BayEOSArduino Library
Public Member Functions | Public Attributes | List of all members
BayEOS Class Referenceabstract
Inheritance diagram for BayEOS:
Inheritance graph
[legend]
Collaboration diagram for BayEOS:
Collaboration graph
[legend]

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
 

Constructor & Destructor Documentation

◆ BayEOS()

BayEOS::BayEOS ( void  )
inline

Constructor

Member Function Documentation

◆ addChannelValue() [1/2]

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

◆ addChannelValue() [2/2]

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

◆ addToPayload() [1/9]

uint8_t BayEOS::addToPayload ( const char *  s)

Add String to payload buffer

◆ addToPayload() [2/9]

uint8_t BayEOS::addToPayload ( const uint8_t *  c)

Add string to payload buffer

◆ addToPayload() [3/9]

uint8_t BayEOS::addToPayload ( const void *  p,
uint8_t  length 
)

copy a buffer to payload buffer

◆ addToPayload() [4/9]

uint8_t BayEOS::addToPayload ( float  f)

Add float (4 byte) to payload buffer

◆ addToPayload() [5/9]

uint8_t BayEOS::addToPayload ( int  w)

Add int (2 byte) to payload buffer

◆ addToPayload() [6/9]

uint8_t BayEOS::addToPayload ( long  l)

Add long (4 byte) to payload buffer

◆ addToPayload() [7/9]

uint8_t BayEOS::addToPayload ( uint16_t  w)

Add uint16_t (2 byte) to payload buffer

◆ addToPayload() [8/9]

uint8_t BayEOS::addToPayload ( uint8_t  b)
inline

Add byte to payload buffer returns 1 on success returns 0 when no space is left in buffer

◆ addToPayload() [9/9]

uint8_t BayEOS::addToPayload ( unsigned long  l)

Add unsigned long (4 byte) to payload buffer

◆ available()

virtual int BayEOS::available ( void  )
inlinevirtual

Has RX-data to read Has to be overwritten by implementation

Reimplemented in BayXBeeInterface, BaySoftwareSerial, BaySerialRF24, BaySerial, and BayBluetooth.

◆ createActionResponse()

uint8_t BayEOS::createActionResponse ( uint8_t  key,
uint8_t  status 
)

Create a Action respons in payload

◆ createMessage()

uint8_t BayEOS::createMessage ( const char *  s,
uint8_t  checksum = 0,
uint8_t  frametype = BayEOS_Message 
)

Create a Message in payload

◆ getPacketLength()

uint8_t BayEOS::getPacketLength ( void  ) const

packet length in payload

◆ getPayload()

const uint8_t * BayEOS::getPayload ( void  ) const

get read pointer to payload

◆ getPayloadBytesLeft()

uint8_t BayEOS::getPayloadBytesLeft ( void  ) const

returns remaining space in payload buffer

◆ getPayloadLength()

uint8_t BayEOS::getPayloadLength ( void  ) const

payload buffer length

◆ readBinaryFromBuffer() [1/2]

uint8_t BayEOS::readBinaryFromBuffer ( unsigned long  pos)

read binary packet from buffer to payload

◆ readBinaryFromBuffer() [2/2]

uint8_t BayEOS::readBinaryFromBuffer ( unsigned long  pos,
unsigned long  end,
unsigned long  vpos 
)

read binary packet from buffer to payload - but not overrun end

◆ readFromBuffer()

uint8_t BayEOS::readFromBuffer ( void  )

read packet from buffer to payload

◆ readIntoPayload()

virtual uint8_t BayEOS::readIntoPayload ( int  timeout = 5000)
inlinevirtual

Read a rx-Packet Has to be overwritten by implementation

Reimplemented in BayXBeeInterface, and BaySerialInterface.

◆ sendError()

uint8_t BayEOS::sendError ( const char *  s)

Send Error Message

◆ sendFromBuffer()

uint8_t BayEOS::sendFromBuffer ( void  )

Read packet from buffer and try so send

◆ sendMessage()

uint8_t BayEOS::sendMessage ( const char *  s)

Send Message

◆ sendOrBuffer()

uint8_t BayEOS::sendOrBuffer ( void  )

Send current payload or write to buffer on error

◆ sendPayload()

virtual uint8_t BayEOS::sendPayload ( void  )
pure virtual

Send current payload buffer Has to be overwritten by implementation

Implemented in BayXBeeInterface, BayTCPInterface, BaySIM800, BaySerialInterface, BayRF24, BayDebugCharbuffer, and BayEOSDebugInterface.

◆ setBuffer()

void BayEOS::setBuffer ( BayEOSBuffer buffer,
uint16_t  max_skip = 0 
)
inline

set buffer pointer to a BayEOSBuffer instance max_skip defines the maximum number of packets written directly to buffer without trying to sent...

◆ startCommand()

void BayEOS::startCommand ( uint8_t  cmd_api)

Set first two bytes of payload buffer

◆ startCommandResponse()

void BayEOS::startCommandResponse ( uint8_t  cmd_api)

Set first two bytes of payload buffer

◆ startDataFrame()

void BayEOS::startDataFrame ( uint8_t  subtype = BayEOS_Float32le,
uint8_t  checksum = 0 
)

Set first two bytes of payload buffer and set _next to 2

◆ startDataFrameWithOrigin()

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

◆ startDelayedFrame()

void BayEOS::startDelayedFrame ( unsigned long  delay)

Set first five bytes of payload buffer

◆ startDelayedSecondFrame()

void BayEOS::startDelayedSecondFrame ( unsigned long  delay)

Set first five bytes of payload buffer

◆ startFrame() [1/2]

void BayEOS::startFrame ( uint8_t  type)

Set first byte of payload buffer and set _next to 1

◆ startFrame() [2/2]

void BayEOS::startFrame ( void  )

Start a new Frame (set _next to 0)

◆ startOriginFrame()

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

◆ startRF24Frame()

void BayEOS::startRF24Frame ( uint8_t  pipe)

Set first two bytes of payload buffer

◆ startRoutedFrame()

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)

◆ startTimestampFrame()

void BayEOS::startTimestampFrame ( unsigned long  timestamp)

Set first five bytes of payload buffer

◆ writeToBuffer()

uint8_t BayEOS::writeToBuffer ( void  )

Write current payload to buffer


The documentation for this class was generated from the following files: