BayEOSArduino Library
|
Public Member Functions | |
BayEOS (void) | |
virtual uint8_t | sendPayload (void)=0 |
virtual uint8_t | readIntoPayload (int timeout=5000) |
virtual int | available (void) |
uint8_t | sendError (const char *s) |
uint8_t | sendMessage (const char *s) |
uint8_t | createMessage (const char *s, uint8_t checksum=0, uint8_t frametype=BayEOS_Message) |
uint8_t | createActionResponse (uint8_t key, uint8_t status) |
void | startFrame (void) |
void | startFrame (uint8_t type) |
void | startOriginFrame (const char *o, uint8_t routed=0) |
void | startDataFrame (uint8_t subtype=BayEOS_Float32le, uint8_t checksum=0) |
void | startDataFrameWithOrigin (uint8_t subtype, const char *o, uint8_t checksum=0, uint8_t routed=0) |
uint8_t | addChannelValue (float v, uint8_t channel_number=0) |
uint8_t | addChannelValue (double v, uint8_t channel_number=0) |
uint8_t | addChannelValue (long v, uint8_t channel_number=0) |
uint8_t | addChannelValue (unsigned long v, uint8_t channel_number=0) |
uint8_t | addChannelValue (int v, uint8_t channel_number=0) |
uint8_t | addChannelValue (unsigned int v, uint8_t channel_number=0) |
uint8_t | addChannelValue (int8_t v, uint8_t channel_number=0) |
uint8_t | addChannelValue (uint8_t v, uint8_t channel_number=0) |
uint8_t | addChannelValue (float v, const char *channel_label) |
uint8_t | addChannelValue (double v, const char *channel_label) |
uint8_t | addChannelValue (long v, const char *channel_label) |
uint8_t | addChannelValue (unsigned long v, const char *channel_label) |
uint8_t | addChannelValue (int v, const char *channel_label) |
uint8_t | addChannelValue (unsigned int v, const char *channel_label) |
uint8_t | addChannelValue (int8_t v, const char *channel_label) |
uint8_t | addChannelValue (uint8_t v, const char *channel_label) |
uint8_t | addChecksum (void) |
uint8_t | validateChecksum (void) |
void | startRoutedFrame (uint16_t sourceMyID, uint16_t sourcePANID, uint8_t rssi=0) |
void | startDelayedFrame (unsigned long delay) |
void | startDelayedSecondFrame (unsigned long delay) |
void | startRF24Frame (uint8_t pipe) |
void | startTimestampFrame (unsigned long timestamp) |
void | startCommand (uint8_t cmd_api) |
void | startCommandResponse (uint8_t cmd_api) |
uint8_t | addToPayload (uint8_t b) |
uint8_t | addToPayload (const void *p, uint8_t length) |
uint8_t | addToPayload (const uint8_t *c) |
uint8_t | addToPayload (const char *s) |
uint8_t | addToPayload (float f) |
uint8_t | addToPayload (unsigned long l) |
uint8_t | addToPayload (long l) |
uint8_t | addToPayload (int w) |
uint8_t | addToPayload (uint16_t w) |
uint8_t | getPayloadBytesLeft (void) const |
uint8_t | getPayloadLength (void) const |
uint8_t | getPacketLength (void) const |
const uint8_t * | getPayload (void) const |
uint8_t | getPayload (uint8_t index) const |
uint8_t | sendOrBuffer (void) |
uint8_t | sendFromBuffer (void) |
uint8_t | writeToBuffer (void) |
uint8_t | readFromBuffer (void) |
uint8_t | readBinaryFromBuffer (unsigned long pos) |
uint8_t | readBinaryFromBuffer (unsigned long pos, unsigned long end, unsigned long vpos) |
void | setBuffer (BayEOSBuffer &buffer, uint16_t max_skip=0) |
Public Attributes | |
uint8_t | _payload [BayEOS_MAX_PAYLOAD] |
uint8_t | _next |
uint8_t | _success |
uint8_t | _failure_counter |
uint16_t | _max_skip |
uint16_t | _skip_counter |
BayEOSBuffer * | _buffer |
|
inline |
Constructor
uint8_t BayEOS::addChannelValue | ( | float | v, |
const char * | channel_label | ||
) |
Adds a channel value to the payload using channel_label type will only take effect on certain subtypes returns 0 on success returns 1 when no space is left in buffer returns 2 when startDataFrame was not called returns 3 when wrong subtype
uint8_t BayEOS::addChannelValue | ( | float | v, |
uint8_t | channel_number = 0 |
||
) |
Adds a channel value to the payload channel_number is optional will only take effect on certain subtypes returns 0 on success returns 1 when no space is left in buffer returns 2 when startDataFrame was not called returns 3 when wrong subtype
uint8_t BayEOS::addToPayload | ( | const char * | s | ) |
Add String to payload buffer
uint8_t BayEOS::addToPayload | ( | const uint8_t * | c | ) |
Add string to payload buffer
uint8_t BayEOS::addToPayload | ( | const void * | p, |
uint8_t | length | ||
) |
copy a buffer to payload buffer
uint8_t BayEOS::addToPayload | ( | float | f | ) |
Add float (4 byte) to payload buffer
uint8_t BayEOS::addToPayload | ( | int | w | ) |
Add int (2 byte) to payload buffer
uint8_t BayEOS::addToPayload | ( | long | l | ) |
Add long (4 byte) to payload buffer
uint8_t BayEOS::addToPayload | ( | uint16_t | w | ) |
Add uint16_t (2 byte) to payload buffer
|
inline |
Add byte to payload buffer returns 1 on success returns 0 when no space is left in buffer
uint8_t BayEOS::addToPayload | ( | unsigned long | l | ) |
Add unsigned long (4 byte) to payload buffer
|
inlinevirtual |
Has RX-data to read Has to be overwritten by implementation
Reimplemented in BayXBeeInterface, BaySoftwareSerial, BaySerialRF24, BaySerial, and BayBluetooth.
uint8_t BayEOS::createActionResponse | ( | uint8_t | key, |
uint8_t | status | ||
) |
Create a Action respons in payload
uint8_t BayEOS::createMessage | ( | const char * | s, |
uint8_t | checksum = 0 , |
||
uint8_t | frametype = BayEOS_Message |
||
) |
Create a Message in payload
uint8_t BayEOS::getPacketLength | ( | void | ) | const |
packet length in payload
const uint8_t * BayEOS::getPayload | ( | void | ) | const |
get read pointer to payload
uint8_t BayEOS::getPayloadBytesLeft | ( | void | ) | const |
returns remaining space in payload buffer
uint8_t BayEOS::getPayloadLength | ( | void | ) | const |
payload buffer length
uint8_t BayEOS::readBinaryFromBuffer | ( | unsigned long | pos | ) |
read binary packet from buffer to payload
uint8_t BayEOS::readBinaryFromBuffer | ( | unsigned long | pos, |
unsigned long | end, | ||
unsigned long | vpos | ||
) |
read binary packet from buffer to payload - but not overrun end
uint8_t BayEOS::readFromBuffer | ( | void | ) |
read packet from buffer to payload
|
inlinevirtual |
Read a rx-Packet Has to be overwritten by implementation
Reimplemented in BayXBeeInterface, and BaySerialInterface.
uint8_t BayEOS::sendError | ( | const char * | s | ) |
Send Error Message
uint8_t BayEOS::sendFromBuffer | ( | void | ) |
Read packet from buffer and try so send
uint8_t BayEOS::sendMessage | ( | const char * | s | ) |
Send Message
uint8_t BayEOS::sendOrBuffer | ( | void | ) |
Send current payload or write to buffer on error
|
pure virtual |
Send current payload buffer Has to be overwritten by implementation
Implemented in BayXBeeInterface, BayTCPInterface, BaySIM800, BaySerialInterface, BayRF24, BayDebugCharbuffer, and BayEOSDebugInterface.
|
inline |
set buffer pointer to a BayEOSBuffer instance max_skip defines the maximum number of packets written directly to buffer without trying to sent...
void BayEOS::startCommand | ( | uint8_t | cmd_api | ) |
Set first two bytes of payload buffer
void BayEOS::startCommandResponse | ( | uint8_t | cmd_api | ) |
Set first two bytes of payload buffer
void BayEOS::startDataFrame | ( | uint8_t | subtype = BayEOS_Float32le , |
uint8_t | checksum = 0 |
||
) |
Set first two bytes of payload buffer and set _next to 2
void BayEOS::startDataFrameWithOrigin | ( | uint8_t | subtype, |
const char * | o, | ||
uint8_t | checksum = 0 , |
||
uint8_t | routed = 0 |
||
) |
Starts a Origin Frame and adds header for data frame
just call addChannelValue() to add values
void BayEOS::startDelayedFrame | ( | unsigned long | delay | ) |
Set first five bytes of payload buffer
void BayEOS::startDelayedSecondFrame | ( | unsigned long | delay | ) |
Set first five bytes of payload buffer
void BayEOS::startFrame | ( | uint8_t | type | ) |
Set first byte of payload buffer and set _next to 1
void BayEOS::startFrame | ( | void | ) |
Start a new Frame (set _next to 0)
void BayEOS::startOriginFrame | ( | const char * | o, |
uint8_t | routed = 0 |
||
) |
Set the start of the payload buffer to be a valid origin or routedOrigin frame
void BayEOS::startRF24Frame | ( | uint8_t | pipe | ) |
Set first two bytes of payload buffer
void BayEOS::startRoutedFrame | ( | uint16_t | sourceMyID, |
uint16_t | sourcePANID, | ||
uint8_t | rssi = 0 |
||
) |
Set first five (six with rssi) bytes of payload buffer and set _next to 5 (6)
void BayEOS::startTimestampFrame | ( | unsigned long | timestamp | ) |
Set first five bytes of payload buffer
uint8_t BayEOS::writeToBuffer | ( | void | ) |
Write current payload to buffer