|
tinyproto
|
ProtoLight class incapsulates Protocol functionality. More...
#include <TinyLightProtocol.h>
Public Member Functions | |
| void | begin (write_block_cb_t writecb, read_block_cb_t readcb) |
| Initializes protocol internal variables. More... | |
| void | end () |
| Resets protocol state. | |
| int | write (char *buf, int size) |
| Sends data block over communication channel. More... | |
| int | read (char *buf, int size) |
| Reads data block from communication channel. More... | |
| int | write (const IPacket &pkt) |
| Sends packet over communication channel. More... | |
| int | read (IPacket &pkt) |
| Reads packet from communication channel. More... | |
| void | disableCrc () |
| Disable CRC field in the protocol. More... | |
| void | enableCrc (hdlc_crc_t crc) |
| Enables CRC by specified bit-size. More... | |
| bool | enableCheckSum () |
| Enables CRC 8-bit field in the protocol. More... | |
| bool | enableCrc16 () |
| Enables CRC 16-bit field in the protocol. More... | |
| bool | enableCrc32 () |
| Enables CRC 32-bit field in the protocol. More... | |
ProtoLight class incapsulates Protocol functionality.
Remember that you may use always C-style API functions instead C++. Please refer to documentation.
| void tinyproto::Light::begin | ( | write_block_cb_t | writecb, |
| read_block_cb_t | readcb | ||
| ) |
Initializes protocol internal variables.
If you need to switch communication with other destination point, you can call this method one again after calling end().
| writecb | - write function to some physical channel |
| readcb | - read function from some physical channel |
| void tinyproto::Light::disableCrc | ( | ) |
Disable CRC field in the protocol.
If CRC field is OFF, then the frame looks like this: 0x7E databytes 0x7E.
| bool tinyproto::Light::enableCheckSum | ( | ) |
Enables CRC 8-bit field in the protocol.
This field contains sum of all data bytes in the packet. 8-bit field is supported by Nano version of Tiny library.
| void tinyproto::Light::enableCrc | ( | hdlc_crc_t | crc | ) |
Enables CRC by specified bit-size.
8-bit is supported by Nano version of Tiny library.
| crc | crc type |
| bool tinyproto::Light::enableCrc16 | ( | ) |
Enables CRC 16-bit field in the protocol.
This field contains FCS 16-bit CCITT like defined in RFC 1662. 16-bit field is not supported by Nano version of Tiny library.
| bool tinyproto::Light::enableCrc32 | ( | ) |
Enables CRC 32-bit field in the protocol.
This field contains FCS 32-bit CCITT like defined in RFC 1662. 32-bit field is not supported by Nano version of Tiny library.
| int tinyproto::Light::read | ( | char * | buf, |
| int | size | ||
| ) |
Reads data block from communication channel.
| buf | - buffer to place data read from communication channel |
| size | - maximum size of the buffer in bytes. |
| int tinyproto::Light::read | ( | IPacket & | pkt | ) |
Reads packet from communication channel.
| pkt | - Packet object to put data to |
| int tinyproto::Light::write | ( | char * | buf, |
| int | size | ||
| ) |
Sends data block over communication channel.
| buf | - data to send |
| size | - length of the data in bytes |
| int tinyproto::Light::write | ( | const IPacket & | pkt | ) |
Sends packet over communication channel.
| pkt | - Packet to send |
1.8.13