|
| int | sendCommand (char *buf, size_t nBytes, uint_t timeout=50000) |
| | Send command to Arduino. More...
|
| |
| int | recvResponse (char buf[], size_t count, uint_t timeout=100000) |
| | Receive response from Arduino. More...
|
| |
| byte_t | unpackHex (char buf[]) |
| | Unpack hex characters to byte. More...
|
| |
Definition at line 63 of file hekUno.h.
Close all interfaces to monitoring hardware.
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 103 of file hekUno.cxx.
109 LOGDIAG3(
"Closed Arduino compatible device.");
int m_fd
open arduino file descriptor
virtual int close()
Close all interfaces to monitoring hardware.
uint_t m_uHekHwVer
hekateros hardware version
int m_nFwVer
arduino firmware version
| int HekUno::cmdConfigPin |
( |
int |
id, |
|
|
char |
dir |
|
) |
| |
|
virtual |
Command to configure direction of an I/O pin.
- Parameters
-
| id | Pin identifier. |
| dir | Pin direction 'i' or 'o'. |
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 248 of file hekUno.cxx.
259 else if( dir ==
'o' )
268 sprintf(cmd,
"!c %d %d\r",
id, c);
273 if( (n < 1) || (rsp[0] !=
'@') )
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
static const int HEK_OK
not an error, success
static const int HEK_ECODE_NO_EXEC
cannot execute error
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
static const int HEK_ECODE_BAD_VAL
bad value general error
Null command.
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 405 of file hekUno.cxx.
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
static const int HEK_OK
not an error, success
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
| byte_t HekUno::cmdReadAux |
( |
| ) |
|
|
virtual |
Command to read auxilliary bit state.
Auxillary bits are usually End Effector GPIO, but allows room for additional bits.
- Returns
- Returns auxilliary switches state as a bit packed byte.
Definition at line 188 of file hekUno.cxx.
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
byte_t unpackHex(char buf[])
Unpack hex characters to byte.
| int HekUno::cmdReadFwVersion |
( |
int & |
ver | ) |
|
|
virtual |
Command to read firmware version.
param [out] ver Version number.
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 138 of file hekUno.cxx.
157 LOGERROR(
"Failed to read firmware version.");
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
static const int HEK_OK
not an error, success
static const int HEK_ECODE_NO_EXEC
cannot execute error
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
| byte_t HekUno::cmdReadLimits |
( |
| ) |
|
|
virtual |
Command to read limit bit state.
- Returns
- Returns limit switches state as a bit packed byte.
Definition at line 162 of file hekUno.cxx.
179 LOGERROR(
"Failed to read optical limits.");
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
static const int HEK_ECODE_NO_EXEC
cannot execute error
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
byte_t unpackHex(char buf[])
Unpack hex characters to byte.
| int HekUno::cmdReadPin |
( |
int |
id | ) |
|
|
virtual |
Command to read one I/O pin.
- Parameters
-
- Returns
- Return pin state 0 or 1.
Definition at line 207 of file hekUno.cxx.
214 sprintf(cmd,
"!r %d\r",
id);
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
| int HekUno::cmdSetAlarmLED |
( |
int |
val | ) |
|
|
virtual |
Command to set Alarm LED.
- Parameters
-
| val | LED 0==off or 1==on value. |
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 283 of file hekUno.cxx.
References HEK_VERSION.
294 sprintf(cmd,
"!l 1 %d\r", val? 1: 0);
299 if( (n < 1) || (rsp[0] !=
'@') )
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
static const int HEK_OK
not an error, success
static const int HEK_ECODE_NO_EXEC
cannot execute error
virtual int cmdWritePin(int id, int val)
Command to write value to an I/O pin.
uint_t m_uHekHwVer
hekateros hardware version
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
#define HEK_VERSION(major, minor, revision)
Convert version triplet to integer equivalent.
| int HekUno::cmdSetHaltedState |
( |
| ) |
|
|
virtual |
Command to set monitoring state to halted.
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 335 of file hekUno.cxx.
References HEK_VERSION.
350 if( (n < 1) || (rsp[0] !=
'@') )
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
static const int HEK_OK
not an error, success
static const int HEK_ECODE_NO_EXEC
cannot execute error
uint_t m_uHekHwVer
hekateros hardware version
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
#define HEK_VERSION(major, minor, revision)
Convert version triplet to integer equivalent.
| int HekUno::cmdSetStatusLED |
( |
int |
val | ) |
|
|
virtual |
Command to set Status LED.
- Parameters
-
| val | LED 0==off or 1==on value. |
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 309 of file hekUno.cxx.
References HEK_VERSION.
320 sprintf(cmd,
"!l 2 %d\r", val? 1: 0);
325 if( (n < 1) || (rsp[0] !=
'@') )
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
static const int HEK_OK
not an error, success
static const int HEK_ECODE_NO_EXEC
cannot execute error
uint_t m_uHekHwVer
hekateros hardware version
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
#define HEK_VERSION(major, minor, revision)
Convert version triplet to integer equivalent.
| int HekUno::cmdTestInterface |
( |
| ) |
|
|
virtual |
Test serial interface command.
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 360 of file hekUno.cxx.
374 if( (n < 1) || (rsp[0] !=
'@') )
379 n = sscanf(&rsp[1],
"%d %d", &nOpState, &nSeqNum);
383 LOGERROR(
"Failed test of interface: bad response.");
389 fprintf(stderr,
"ARDUINO TEST: New OpState=%d\n",
m_nFwOpState);
394 fprintf(stderr,
"ARDUINO TEST: Lost sync: Sequence number received=%d, " int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
static const int HEK_OK
not an error, success
static const int HEK_ECODE_NO_EXEC
cannot execute error
int m_nFwSeqNum
expected test sequence number modulo 256
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
int m_nFwOpState
firmware operational state
int m_nFwVer
arduino firmware version
| int HekUno::cmdWritePin |
( |
int |
id, |
|
|
int |
val |
|
) |
| |
|
virtual |
Command to write value to an I/O pin.
- Parameters
-
| id | Pin identifier. |
| val | Pin state 0 or 1. |
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 227 of file hekUno.cxx.
233 sprintf(cmd,
"!w %d %d\r",
id, val? 1: 0);
238 if( (n < 1) || (rsp[0] !=
'@') )
int sendCommand(char *buf, size_t nBytes, uint_t timeout=50000)
Send command to Arduino.
static const int HEK_OK
not an error, success
static const int HEK_ECODE_NO_EXEC
cannot execute error
int recvResponse(char buf[], size_t count, uint_t timeout=100000)
Receive response from Arduino.
Open all interfaces monitoring hardware.
- Parameters
-
Definition at line 81 of file hekUno.cxx.
85 if( (
m_fd = SerDevOpen(dev.c_str(), baud, 8,
'N', 1, 0, 0) ) == -1 )
87 LOGERROR(
"Failed to open Arduino digital I/O board");
91 SerDevFIFOInputFlush(
m_fd);
98 LOGDIAG3(
"Opened Arduino compatible device: %s@%d", dev.c_str(), baud);
int m_fd
open arduino file descriptor
static const int HEK_OK
not an error, success
virtual int cmdNull()
Null command.
static const int HEK_ECODE_SYS
system (errno) error
uint_t m_uHekHwVer
hekateros hardware version
| int HekUno::recvResponse |
( |
char |
buf[], |
|
|
size_t |
count, |
|
|
uint_t |
timeout = 100000 |
|
) |
| |
|
protected |
Receive response from Arduino.
- Parameters
-
| buf | Receiving character buffer. |
| count | Maximum number of bytes to read. |
| timeout | Receive timeout (usec). |
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 425 of file hekUno.cxx.
431 nBytes = SerDevReadLine(
m_fd, buf, count, (
char *)
"\n\r", timeout);
434 fprintf(stderr,
"DBG - received(%zd): ", nBytes);
435 for(ssize_t i=0; i<nBytes; ++i)
437 fprintf(stderr,
"%x ", buf[i]);
439 fprintf(stderr,
"\n");
int m_fd
open arduino file descriptor
Scan and initialize hardware.
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 115 of file hekUno.cxx.
117 LOGDIAG3(
"Scanning Arduino digital I/O board capabilities.");
123 for(
int i=0; i<3; ++i)
133 LOGDIAG3(
"Arduino firmware version %d.",
m_nFwVer);
virtual byte_t cmdReadLimits()
Command to read limit bit state.
static const int HEK_OK
not an error, success
virtual int cmdReadFwVersion(int &ver)
Command to read firmware version.
int m_nFwVer
arduino firmware version
| int HekUno::sendCommand |
( |
char * |
buf, |
|
|
size_t |
nBytes, |
|
|
uint_t |
timeout = 50000 |
|
) |
| |
|
protected |
Send command to Arduino.
- Parameters
-
| buf | Buffer of bytes. |
| nBytes | Number of bytes in buffer to write. |
| timeout | Send timeout (usec). |
- Returns
- On success, HEK_OK is returned.
On error, the appropriate < 0 negated Hekateros Error Code is returned.
Definition at line 418 of file hekUno.cxx.
420 SerDevWrite(
m_fd, (byte_t *)buf, nBytes, timeout);
421 SerDevFIFOOutputDrain(
m_fd);
int m_fd
open arduino file descriptor
static const int HEK_OK
not an error, success
| byte_t HekUno::unpackHex |
( |
char |
buf[] | ) |
|
|
protected |
Unpack hex characters to byte.
Format: hh
- Parameters
-
| buf | Buffer of hex characters |
- Returns
- Returns unpacked byte.
Definition at line 445 of file hekUno.cxx.
452 for(
int i=0; i<2; ++i)
455 if(buf[i] >=
'0' && buf[i] <=
'9')
460 else if (buf[i] >=
'A' && buf[i] <=
'F')
462 val += buf[i] -
'A'+10;
465 else if (buf[i] >=
'a' && buf[i] <=
'f')
467 val += buf[i] -
'a'+10;
The documentation for this class was generated from the following files: