This class provides a means to write CAN data to an a file descriptor in Grid Connect format.
More...
#include <GridConnect.hxx>
|
| static ssize_t | write (int fd, const void *data, size_t len) |
| | Write a CAN packet to Grid Connect interface in single format.
|
| |
| static ssize_t | write_double (int fd, const void *data, size_t len) |
| | Write a CAN packet to Grid Connect interface in double format.
|
| |
| static ssize_t | read (int fd, void *data, size_t len) |
| | Read a CAN packet to Grid Connect interface in single format.
|
| |
| static ssize_t | read_double (int fd, void *data, size_t len) |
| | Read a CAN packet to Grid Connect interface in double format.
|
| |
|
| static ssize_t | write_generic (int fd, const void *data, size_t len, bool doub) |
| | Write a CAN packet to Grid Connect interface in single or double format.
|
| |
| static ssize_t | read_generic (int fd, void *data, size_t len, bool doub) |
| | Read a CAN packet to Grid Connect interface in single or double format.
|
| |
| static ssize_t | encode (struct can_frame *frame, unsigned char buf[]) |
| |
| static char | nibble_to_ascii (int nibble) |
| | Builds an ASCII character representation of a nibble value.
|
| |
| static int | ascii_pair_to_byte (const char *pair) |
| | Take a pair of ASCII characters and convert them to a byte value.
|
| |
This class provides a means to write CAN data to an a file descriptor in Grid Connect format.
Definition at line 47 of file GridConnect.hxx.
◆ GridConnect()
| GridConnect::GridConnect |
( |
| ) |
|
|
inlineprotected |
◆ ~GridConnect()
| GridConnect::~GridConnect |
( |
| ) |
|
|
inlineprotected |
◆ ascii_pair_to_byte()
| static int GridConnect::ascii_pair_to_byte |
( |
const char * |
pair | ) |
|
|
inlinestaticprivate |
Take a pair of ASCII characters and convert them to a byte value.
pointer to two ASCII characters
- Parameters
-
| pair | points to two hex digits. |
- Returns
- byte value
Definition at line 152 of file GridConnect.hxx.
◆ encode()
| ssize_t GridConnect::encode |
( |
struct can_frame * |
frame, |
|
|
unsigned char |
buf[] |
|
) |
| |
|
staticprivate |
- Parameters
-
| frame | is the binary CAn frame to encode. |
| buf | array of at least 28 bytes to place encoded data into |
- Returns
- number of bytes making up the final encoded packet
Definition at line 40 of file GridConnect.cxx.
◆ nibble_to_ascii()
| static char GridConnect::nibble_to_ascii |
( |
int |
nibble | ) |
|
|
inlinestaticprivate |
Builds an ASCII character representation of a nibble value.
- Parameters
-
- Returns
- converted value
Definition at line 135 of file GridConnect.hxx.
◆ read()
| static ssize_t GridConnect::read |
( |
int |
fd, |
|
|
void * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlinestaticprotected |
Read a CAN packet to Grid Connect interface in single format.
- Parameters
-
| fd | file descriptor for device |
| data | location to read can data into |
| len | length of data, should be a multiple of sizeof(struct can_frame) |
- Returns
- number of bytes read, or -1 with errno set
Definition at line 90 of file GridConnect.hxx.
◆ read_double()
| static ssize_t GridConnect::read_double |
( |
int |
fd, |
|
|
void * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlinestaticprotected |
Read a CAN packet to Grid Connect interface in double format.
- Parameters
-
| fd | file descriptor for device |
| data | location to read can data into |
| len | length of data, should be a multiple of sizeof(struct can_frame) |
- Returns
- number of bytes read, or -1 with errno set
Definition at line 101 of file GridConnect.hxx.
◆ read_generic()
| ssize_t GridConnect::read_generic |
( |
int |
fd, |
|
|
void * |
data, |
|
|
size_t |
len, |
|
|
bool |
doub |
|
) |
| |
|
staticprivate |
Read a CAN packet to Grid Connect interface in single or double format.
- Parameters
-
| fd | file descriptor for device |
| data | location to read can data into |
| len | length of data, should be a multiple of sizeof(struct can_frame) |
| doub | true if this is a double read |
- Returns
- number of bytes read, or -1 with errno set
- Todo:
- this decode method is simple, but could be optimized.
Definition at line 160 of file GridConnect.cxx.
◆ write()
| static ssize_t GridConnect::write |
( |
int |
fd, |
|
|
const void * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlinestaticprotected |
Write a CAN packet to Grid Connect interface in single format.
- Parameters
-
| fd | file descriptor for device |
| data | can data to write |
| len | length of data, should be a multiple of sizeof(struct can_frame) |
- Returns
- number of bytes written, or -1 with errno set
Definition at line 68 of file GridConnect.hxx.
◆ write_double()
| static ssize_t GridConnect::write_double |
( |
int |
fd, |
|
|
const void * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlinestaticprotected |
Write a CAN packet to Grid Connect interface in double format.
- Parameters
-
| fd | file descriptor for device |
| data | can data to write |
| len | length of data, should be a multiple of sizeof(struct can_frame) |
- Returns
- number of bytes written, or -1 with errno set
Definition at line 79 of file GridConnect.hxx.
◆ write_generic()
| ssize_t GridConnect::write_generic |
( |
int |
fd, |
|
|
const void * |
data, |
|
|
size_t |
len, |
|
|
bool |
doub |
|
) |
| |
|
staticprivate |
Write a CAN packet to Grid Connect interface in single or double format.
Write a CAN packet to Grid Connect interface in double format.
- Parameters
-
| fd | file descriptor for device |
| data | can data to write |
| len | length of data, should be a multiple of sizeof(struct can_frame) |
| doub | true if this is a double write |
- Returns
- number of bytes written, or -1 with errno set
Definition at line 103 of file GridConnect.cxx.
The documentation for this class was generated from the following files: