#include <LongMessageService.h>
|
| virtual void | process () override |
| virtual void | processAction (const Action &action) override |
| | Called when there is an action available.
|
| bool | sendLongMessage (const void *msg, const unsigned int msg_len, const byte stream_id) |
| void | subscribe (byte *stream_ids, const byte num_stream_ids, void *receive_buffer, const unsigned int receive_buffer_len, void(*messagehandler)(void *fragment, const unsigned int fragment_len, const byte stream_id, const byte status)) |
| | subscribe to a range of stream IDs
|
| virtual void | processReceivedMessageFragment (const VlcbMessage *frame) |
| bool | is_sending () |
| void | setDelay (byte delay_in_millis) |
| void | setTimeout (unsigned int timeout_in_millis) |
| virtual VlcbServiceTypes | getServiceID () const override |
| | Return a unique ID for this service.
|
| virtual byte | getServiceVersionID () const override |
| | Return the version of the service specification implemented by this service.
|
| void | setController (Controller *ctrl) |
| | Set a pointer to the controller object for use in implementing class.
|
| virtual void | begin () |
| | This optional method is called at the beginning of the Arduino sketch. Define this method for the service to do any setup required at the beginning.
|
| virtual void | reportDiagnostics (byte serviceIndex, byte diagnosticsCode) |
| | Report a given diagnostic value.
|
| virtual int | getDiagnosticCount () |
| | report how many diagnostics this service supports.
|
| virtual Data | getServiceData () |
| | Return Data bytes specific for the implementing service. The meaning of each data byte is defined in the service specification.
|
a basic class to send and receive Controller long messages per MERG RFC 0005 See https://www.merg.org.uk/merg_wiki/doku.php?id=rfc:longmessageprotocol handles a single message, sending and receiving suitable for small microcontrollers with limited memory
◆ process()
| void VLCB::LongMessageService::process |
( |
| ) |
|
|
overridevirtual |
the process method is called regularly from the user's loop function we use this to send the individual fragments of an outgoing message and check the message receive timeout
Reimplemented from VLCB::Service.
Reimplemented in VLCB::LongMessageServiceEx.
◆ processAction()
| void VLCB::LongMessageService::processAction |
( |
const Action & | action | ) |
|
|
overridevirtual |
Called when there is an action available.
This method does not need to be implemented if the service does react to any actions.
- Parameters
-
| action | The action that the service may have interest in. |
Reimplemented from VLCB::Service.
◆ sendLongMessage()
| bool VLCB::LongMessageService::sendLongMessage |
( |
const void * | msg, |
|
|
const unsigned int | msg_len, |
|
|
const byte | stream_id ) |
initiate sending of a long message this method sends the first message - the header packet the remainder of the message is sent in chunks from the process() method
◆ subscribe()
| void VLCB::LongMessageService::subscribe |
( |
byte * | stream_ids, |
|
|
const byte | num_stream_ids, |
|
|
void * | receive_buffer, |
|
|
const unsigned int | receive_buffer_len, |
|
|
void(* | messagehandler )(void *fragment, const unsigned int fragment_len, const byte stream_id, const byte status) ) |
subscribe to a range of stream IDs
◆ processReceivedMessageFragment()
| void VLCB::LongMessageService::processReceivedMessageFragment |
( |
const VlcbMessage * | frame | ) |
|
|
virtual |
◆ is_sending()
| bool VLCB::LongMessageService::is_sending |
( |
| ) |
|
report progress of sending last long message true = complete, false = in progress, incomplete user code must not start a new message until the previous one has been completely sent
◆ setDelay()
| void VLCB::LongMessageService::setDelay |
( |
byte | delay_in_millis | ) |
|
set the delay between send fragments, to avoid flooding the bus and other modules overrides the default value
◆ setTimeout()
| void VLCB::LongMessageService::setTimeout |
( |
unsigned int | timeout_in_millis | ) |
|
set the receive timeout if an expected next fragment is not received, the user's handler function will be called with the message so far assembled and an error status overrides the default value
◆ getServiceID()
Return a unique ID for this service.
This ID is used by configuration utilities to identify the service type. The service IDs are listed in the VLCB service specifications.
Implements VLCB::Service.
◆ getServiceVersionID()
| virtual byte VLCB::LongMessageService::getServiceVersionID |
( |
| ) |
const |
|
inlineoverridevirtual |
Return the version of the service specification implemented by this service.
This version is used by configuration utilities to identify which features are implemented by this service.
Implements VLCB::Service.
◆ handleMessage()
| void VLCB::LongMessageService::handleMessage |
( |
const VlcbMessage * | msg | ) |
|
|
protected |
◆ sendMessageFragment()
| bool VLCB::LongMessageService::sendMessageFragment |
( |
VlcbMessage * | frame | ) |
|
|
protected |
send next message fragment
◆ _is_receiving
| bool VLCB::LongMessageService::_is_receiving = false |
|
protected |
◆ _send_buffer
| byte* VLCB::LongMessageService::_send_buffer |
|
protected |
◆ _receive_buffer
| byte * VLCB::LongMessageService::_receive_buffer |
|
protected |
◆ _send_stream_id
| byte VLCB::LongMessageService::_send_stream_id = 0 |
|
protected |
◆ _receive_stream_id
| byte VLCB::LongMessageService::_receive_stream_id = 0 |
|
protected |
◆ _stream_ids
| byte * VLCB::LongMessageService::_stream_ids = NULL |
|
protected |
◆ _num_stream_ids
| byte VLCB::LongMessageService::_num_stream_ids = 0 |
|
protected |
◆ _msg_delay
◆ _send_buffer_len
| unsigned int VLCB::LongMessageService::_send_buffer_len = 0 |
|
protected |
◆ _incoming_message_length
| unsigned int VLCB::LongMessageService::_incoming_message_length = 0 |
|
protected |
◆ _receive_buffer_len
| unsigned int VLCB::LongMessageService::_receive_buffer_len = 0 |
|
protected |
◆ _receive_buffer_index
| unsigned int VLCB::LongMessageService::_receive_buffer_index = 0 |
|
protected |
◆ _send_buffer_index
| unsigned int VLCB::LongMessageService::_send_buffer_index = 0 |
|
protected |
◆ _incoming_message_crc
| unsigned int VLCB::LongMessageService::_incoming_message_crc = 0 |
|
protected |
◆ _incoming_bytes_received
| unsigned int VLCB::LongMessageService::_incoming_bytes_received = 0 |
|
protected |
◆ _receive_timeout
◆ _send_sequence_num
| unsigned int VLCB::LongMessageService::_send_sequence_num = 0 |
|
protected |
◆ _expected_next_receive_sequence_num
| unsigned int VLCB::LongMessageService::_expected_next_receive_sequence_num = 0 |
|
protected |
◆ _last_fragment_sent
| unsigned long VLCB::LongMessageService::_last_fragment_sent = 0UL |
|
protected |
◆ _last_fragment_received
| unsigned long VLCB::LongMessageService::_last_fragment_received = 0UL |
|
protected |
◆ _messagehandler
| void(* VLCB::LongMessageService::_messagehandler) (void *fragment, const unsigned int fragment_len, const byte stream_id, const byte status) |
|
protected |
The documentation for this class was generated from the following files: