BayEOS-Arduino
1.8.0_0.0.4
|
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 String &s) |
uint8_t | sendMessage (const String &s) |
void | startFrame (uint8_t type) |
void | startOriginFrame (const String &o, uint8_t routed=0) |
void | startDataFrame (uint8_t subtype=BayEOS_Float32le, uint8_t checksum=0) |
void | startDataFrameWithOrigin (uint8_t subtype, const String &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 | 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 String &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 |
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
Definition at line 57 of file BayEOS.cpp.
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
Definition at line 119 of file BayEOS.cpp.
|
inline |
uint8_t BayEOS::addToPayload | ( | const void * | p, |
uint8_t | length | ||
) |
copy a buffer to payload buffer
Definition at line 231 of file BayEOS.cpp.
uint8_t BayEOS::addToPayload | ( | const uint8_t * | c | ) |
Add string to payload buffer
Definition at line 239 of file BayEOS.cpp.
uint8_t BayEOS::addToPayload | ( | const String & | s | ) |
Add String to payload buffer
Definition at line 246 of file BayEOS.cpp.
uint8_t BayEOS::addToPayload | ( | float | f | ) |
Add float (4 byte) to payload buffer
Definition at line 261 of file BayEOS.cpp.
uint8_t BayEOS::addToPayload | ( | unsigned long | l | ) |
Add unsigned long (4 byte) to payload buffer
Definition at line 265 of file BayEOS.cpp.
uint8_t BayEOS::addToPayload | ( | long | l | ) |
Add long (4 byte) to payload buffer
Definition at line 269 of file BayEOS.cpp.
uint8_t BayEOS::addToPayload | ( | int | w | ) |
Add int (2 byte) to payload buffer
Definition at line 253 of file BayEOS.cpp.
uint8_t BayEOS::addToPayload | ( | uint16_t | w | ) |
Add uint16_t (2 byte) to payload buffer
Definition at line 257 of file BayEOS.cpp.
|
inlinevirtual |
Has RX-data to read Has to be overwritten by implementation
Reimplemented in BayDebugPlus, BaySerialPlus, BaySerial, BayBluetooth, BayXBeeInterface, and BaySoftwareSerial.
uint8_t BayEOS::getPacketLength | ( | void | ) | const |
packet length in payload
Definition at line 395 of file BayEOS.cpp.
const uint8_t * BayEOS::getPayload | ( | void | ) | const |
get read pointer to payload
Definition at line 399 of file BayEOS.cpp.
uint8_t BayEOS::getPayloadBytesLeft | ( | void | ) | const |
returns remaining space in payload buffer
Definition at line 387 of file BayEOS.cpp.
uint8_t BayEOS::getPayloadLength | ( | void | ) | const |
payload buffer length
Definition at line 391 of file BayEOS.cpp.
uint8_t BayEOS::readBinaryFromBuffer | ( | unsigned long | pos | ) |
read binary packet from buffer to payload
Definition at line 293 of file BayEOS.cpp.
uint8_t BayEOS::readBinaryFromBuffer | ( | unsigned long | pos, |
unsigned long | end, | ||
unsigned long | vpos | ||
) |
read binary packet from buffer to payload - but not overrun end
Definition at line 299 of file BayEOS.cpp.
uint8_t BayEOS::readFromBuffer | ( | void | ) |
read packet from buffer to payload
Definition at line 308 of file BayEOS.cpp.
|
inlinevirtual |
Read a rx-Packet Has to be overwritten by implementation
Reimplemented in BaySerialInterface, and BayXBeeInterface.
uint8_t BayEOS::sendError | ( | const String & | s | ) |
Send Error Message
Definition at line 273 of file BayEOS.cpp.
uint8_t BayEOS::sendFromBuffer | ( | void | ) |
Read packet from buffer and try so send
Definition at line 360 of file BayEOS.cpp.
uint8_t BayEOS::sendMessage | ( | const String & | s | ) |
Send Message
Definition at line 279 of file BayEOS.cpp.
uint8_t BayEOS::sendOrBuffer | ( | void | ) |
Send current payload or write to buffer on error
Definition at line 335 of file BayEOS.cpp.
|
pure virtual |
Send current payload buffer Has to be overwritten by implementation
Implemented in BayTCPInterface, BayXBeeInterface, BaySerialInterface, BayEOSDebugInterface, and BayRF24.
|
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
Definition at line 221 of file BayEOS.cpp.
void BayEOS::startCommandResponse | ( | uint8_t | cmd_api | ) |
Set first two bytes of payload buffer
Definition at line 226 of file BayEOS.cpp.
void BayEOS::startDataFrame | ( | uint8_t | subtype = BayEOS_Float32le , |
uint8_t | checksum = 0 |
||
) |
Set first two bytes of payload buffer and set _next to 2
Definition at line 8 of file BayEOS.cpp.
void BayEOS::startDataFrameWithOrigin | ( | uint8_t | subtype, |
const String & | 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
Definition at line 23 of file BayEOS.cpp.
void BayEOS::startDelayedFrame | ( | unsigned long | delay | ) |
Set first five bytes of payload buffer
Definition at line 211 of file BayEOS.cpp.
void BayEOS::startFrame | ( | uint8_t | type | ) |
Set first byte of payload buffer and set _next to 1
Definition at line 3 of file BayEOS.cpp.
void BayEOS::startOriginFrame | ( | const String & | o, |
uint8_t | routed = 0 |
||
) |
Set the start of the payload buffer to be a valid origin or routedOrigin frame
Definition at line 16 of file BayEOS.cpp.
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)
Definition at line 199 of file BayEOS.cpp.
void BayEOS::startTimestampFrame | ( | unsigned long | timestamp | ) |
Set first five bytes of payload buffer
Definition at line 216 of file BayEOS.cpp.
uint8_t BayEOS::writeToBuffer | ( | void | ) |
Write current payload to buffer
Definition at line 285 of file BayEOS.cpp.