Skyward boardcore
|
The MavlinkDriver object offers an interface to send and receive from a Transceiver object using an implementation of the Mavlink protocol. More...
#include <MavlinkDriver.h>
Public Member Functions | |
MavlinkDriver (Transceiver *device, MavHandler onReceive=nullptr, uint16_t sleepAfterSend=0, size_t outBufferMaxAge=1000) | |
Initializes all data structures. | |
bool | start () |
Start the receiving and sending threads. | |
bool | isStarted () |
Tells whether the driver was started. | |
void | stop () |
Stops sender and receiver threads. | |
bool | enqueueMsg (const mavlink_message_t &msg) |
Non-blocking send function, puts the message in a queue. Message is discarded if the queue is full. | |
bool | enqueueRaw (uint8_t *msg, size_t size) |
Enqueue a raw packet message into the sync packet queue. | |
MavlinkStatus | getStatus () |
Synchronized status getter. | |
void | setSleepAfterSend (uint16_t newSleepTime) |
Setter for the sleep after send value. | |
The MavlinkDriver object offers an interface to send and receive from a Transceiver object using an implementation of the Mavlink protocol.
See src/tests/drivers/test-mavlink.cpp
for an example.
PktLength | Maximum length in bytes of each transceiver packet. |
OutQueueSize | Max number of transceiver packets in the output queue. |
MavMsgLength | Max length of a mavlink message. By default is 255 the maximum possible but can be replaces with MAVLINK_MAX_DIALECT_PAYLOAD_SIZE for a specific protocol. |
Definition at line 66 of file MavlinkDriver.h.
Boardcore::MavlinkDriver< PktLength, OutQueueSize, MavMsgLength >::MavlinkDriver | ( | Transceiver * | device, |
MavHandler | onReceive = nullptr, | ||
uint16_t | sleepAfterSend = 0, | ||
size_t | outBufferMaxAge = 1000 ) |
Initializes all data structures.
device | Transceiver used to send and receive messages. |
onReceive | Function to be executed on message rcv. |
sleepAfterSend | Guaranteed sleep time after each send [ms]. |
outBufferMaxAge | Max residence time for messages in the queue: after this time the message will be automatically sent [ms]. |
Definition at line 205 of file MavlinkDriver.h.
bool Boardcore::MavlinkDriver< PktLength, OutQueueSize, MavMsgLength >::enqueueMsg | ( | const mavlink_message_t & | msg | ) |
Non-blocking send function, puts the message in a queue. Message is discarded if the queue is full.
msg | Message to send (mavlink struct). |
Definition at line 271 of file MavlinkDriver.h.
bool Boardcore::MavlinkDriver< PktLength, OutQueueSize, MavMsgLength >::enqueueRaw | ( | uint8_t * | msg, |
size_t | size ) |
Enqueue a raw packet message into the sync packet queue.
msg | Message to send. |
size | Length in bytes. |
Definition at line 290 of file MavlinkDriver.h.
MavlinkStatus Boardcore::MavlinkDriver< PktLength, OutQueueSize, MavMsgLength >::getStatus | ( | ) |
Synchronized status getter.
Definition at line 433 of file MavlinkDriver.h.
bool Boardcore::MavlinkDriver< PktLength, OutQueueSize, MavMsgLength >::isStarted | ( | ) |
Tells whether the driver was started.
Definition at line 254 of file MavlinkDriver.h.
void Boardcore::MavlinkDriver< PktLength, OutQueueSize, MavMsgLength >::setSleepAfterSend | ( | uint16_t | newSleepTime | ) |
Setter for the sleep after send value.
Definition at line 442 of file MavlinkDriver.h.
bool Boardcore::MavlinkDriver< PktLength, OutQueueSize, MavMsgLength >::start | ( | ) |
Start the receiving and sending threads.
Definition at line 216 of file MavlinkDriver.h.
void Boardcore::MavlinkDriver< PktLength, OutQueueSize, MavMsgLength >::stop | ( | ) |
Stops sender and receiver threads.
Definition at line 261 of file MavlinkDriver.h.