Arduino C++ Library for VLCB
Loading...
Searching...
No Matches
VLCB::LongMessageServiceEx Class Reference

a derived class to extend the base long message class to handle multiple concurrent messages, sending and receiving More...

#include <LongMessageService.h>

Inheritance diagram for VLCB::LongMessageServiceEx:
VLCB::LongMessageService VLCB::Service

Public Member Functions

bool allocateContexts (byte num_receive_contexts=NUM_EX_CONTEXTS, unsigned int receive_buffer_len=EX_BUFFER_LEN, byte num_send_contexts=NUM_EX_CONTEXTS)
 allocate memory for receive and send contexts
bool sendLongMessage (const void *msg, const unsigned int msg_len, const byte stream_id)
bool process ()
void subscribe (byte *stream_ids, const byte num_stream_ids, void(*messagehandler)(void *msg, unsigned int msg_len, byte stream_id, byte status))
 subscribe to a range of stream IDs
virtual void processReceivedMessageFragment (const VlcbMessage *frame)
 handle an incoming long message Controller message fragment
byte is_sending ()
void use_crc (bool use_crc)
 set whether to calculate and compare a CRC of the message
Public Member Functions inherited from VLCB::LongMessageService
virtual void process (const Action *action) override
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
bool process ()
bool is_sending ()
void setDelay (byte delay_in_millis)
void setTimeout (unsigned int timeout_in_millis)
virtual VlcbServiceTypes getServiceID () const override
virtual byte getServiceVersionID () const override

Additional Inherited Members

Protected Member Functions inherited from VLCB::LongMessageService
void handleMessage (const VlcbMessage *msg)
bool sendMessageFragment (VlcbMessage *frame)
 send next message fragment
Protected Attributes inherited from VLCB::LongMessageService
bool _is_receiving = false
byte * _send_buffer
byte * _receive_buffer
byte _send_stream_id = 0
byte _receive_stream_id = 0
byte * _stream_ids = NULL
byte _num_stream_ids = 0
byte _msg_delay = LONG_MESSAGE_DEFAULT_DELAY
unsigned int _send_buffer_len = 0
unsigned int _incoming_message_length = 0
unsigned int _receive_buffer_len = 0
unsigned int _receive_buffer_index = 0
unsigned int _send_buffer_index = 0
unsigned int _incoming_message_crc = 0
unsigned int _incoming_bytes_received = 0
unsigned int _receive_timeout = LONG_MESSAGE_RECEIVE_TIMEOUT
unsigned int _send_sequence_num = 0
unsigned int _expected_next_receive_sequence_num = 0
unsigned long _last_fragment_sent = 0UL
unsigned long _last_fragment_received = 0UL
void(* _messagehandler )(void *fragment, const unsigned int fragment_len, const byte stream_id, const byte status)

Detailed Description

a derived class to extend the base long message class to handle multiple concurrent messages, sending and receiving

Member Function Documentation

◆ allocateContexts()

bool VLCB::LongMessageServiceEx::allocateContexts ( byte num_receive_contexts = NUM_EX_CONTEXTS,
unsigned int receive_buffer_len = EX_BUFFER_LEN,
byte num_send_contexts = NUM_EX_CONTEXTS )

allocate memory for receive and send contexts

◆ sendLongMessage()

bool VLCB::LongMessageServiceEx::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 fragments from the process() method

◆ process()

bool VLCB::LongMessageServiceEx::process ( )

the process method is called regularly from the user's loop function we use this to send the individual fragments of any outgoing messages and check the message receive timeouts

◆ subscribe()

void VLCB::LongMessageServiceEx::subscribe ( byte * stream_ids,
const byte num_stream_ids,
void(* messagehandler )(void *msg, unsigned int msg_len, byte stream_id, byte status) )

subscribe to a range of stream IDs

◆ processReceivedMessageFragment()

void VLCB::LongMessageServiceEx::processReceivedMessageFragment ( const VlcbMessage * frame)
virtual

handle an incoming long message Controller message fragment

Reimplemented from VLCB::LongMessageService.

◆ is_sending()

byte VLCB::LongMessageServiceEx::is_sending ( )

report state of long message sending returns number of streams currently in progress

◆ use_crc()

void VLCB::LongMessageServiceEx::use_crc ( bool use_crc)

set whether to calculate and compare a CRC of the message


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