Public Member Functions | Private Attributes
dji2mav::MsgManager Class Reference

#include <msgManager.h>

List of all members.

Public Member Functions

bool establish (std::string targetIP, uint16_t targetPort, uint16_t srcPort)
 Establish the UDP connection to the target.
uint16_t getCurrSenderListSize ()
 Get current sender list size.
uint16_t getMaxSenderListSize ()
 Get max sender list size.
uint8_t * getRecvBuf ()
 Get the buffer of receiver.
uint16_t getRecvBufSize ()
 Get the buffer size of receiver.
uint8_t * getSendBuf (uint16_t idx)
 Get the buffer of a sender.
uint16_t getSendBufSize (uint16_t idx)
 Get the buffer size of a sender.
bool isValidSenderIdx (uint16_t senderIdx)
 Check if a sender index is valid senderIdx : The index of sender.
 MsgManager (uint16_t senderListSize, uint16_t sendBufSize, uint16_t recvBufSize)
 Constructor for MsgManager.
int recv ()
 Receive mavlink message.
int registerSender (uint16_t bufSize)
 Register a message sender and get its index.
int registerSender ()
 Register a messager sender with default buf size.
int send (uint16_t idx, int len)
 Send mavlink message.
 ~MsgManager ()

Private Attributes

SocketCommm_comm
uint16_t m_currListSize
uint16_t m_defaultSendBufSize
uint16_t m_maxListSize
MsgReceiverm_receiver
std::mutex m_registerMutex
MsgSender ** m_senderList

Detailed Description

Definition at line 23 of file msgManager.h.


Constructor & Destructor Documentation

dji2mav::MsgManager::MsgManager ( uint16_t  senderListSize,
uint16_t  sendBufSize,
uint16_t  recvBufSize 
) [inline]

Constructor for MsgManager.

Parameters:
senderListSize: Used to allocate senders list
sendBufSize: Used to allocate buf for sender
recvBufSize: Used to allocate buf for receiver

Definition at line 31 of file msgManager.h.

Definition at line 57 of file msgManager.h.


Member Function Documentation

bool dji2mav::MsgManager::establish ( std::string  targetIP,
uint16_t  targetPort,
uint16_t  srcPort 
) [inline]

Establish the UDP connection to the target.

Parameters:
targetIP: The IP of target
targetPort: The connection port of target
srcPort: The connection port of source
Returns:
True if succeed or false if fail

Definition at line 208 of file msgManager.h.

Get current sender list size.

Returns:
The size of current sender list

Definition at line 232 of file msgManager.h.

Get max sender list size.

Returns:
The size of max sender list

Definition at line 241 of file msgManager.h.

uint8_t* dji2mav::MsgManager::getRecvBuf ( ) [inline]

Get the buffer of receiver.

Returns:
The pointer to the receiver buffer

Definition at line 178 of file msgManager.h.

uint16_t dji2mav::MsgManager::getRecvBufSize ( ) [inline]

Get the buffer size of receiver.

Returns:
The size of the receiver buffer

Definition at line 187 of file msgManager.h.

uint8_t* dji2mav::MsgManager::getSendBuf ( uint16_t  idx) [inline]

Get the buffer of a sender.

Parameters:
idx: The index of the sender
Returns:
A pointer to send buf. Return NULL for invalid input

Definition at line 132 of file msgManager.h.

uint16_t dji2mav::MsgManager::getSendBufSize ( uint16_t  idx) [inline]

Get the buffer size of a sender.

Parameters:
idx: The index of the sender
Returns:
The size of send buf. Return -1 for invalid input

Definition at line 146 of file msgManager.h.

bool dji2mav::MsgManager::isValidSenderIdx ( uint16_t  senderIdx) [inline]

Check if a sender index is valid senderIdx : The index of sender.

Returns:
True if valid or false if invalid

Definition at line 86 of file msgManager.h.

int dji2mav::MsgManager::recv ( ) [inline]

Receive mavlink message.

Returns:
Bytes received. Return -1 for no datagram or -2 for fail

Definition at line 196 of file msgManager.h.

int dji2mav::MsgManager::registerSender ( uint16_t  bufSize) [inline]

Register a message sender and get its index.

Parameters:
bufSize: Set the buf size of sender. Default 1024
Returns:
Index of the sender. Return -1 if the list is full

Definition at line 96 of file msgManager.h.

Register a messager sender with default buf size.

Returns:
Refer to "int registerSender(uint16_t bufSize)"

Definition at line 122 of file msgManager.h.

int dji2mav::MsgManager::send ( uint16_t  idx,
int  len 
) [inline]

Send mavlink message.

Parameters:
idx: The index of the sender
len: The length that should be sent
Returns:
Bytes sent. Return -2 or -3 for invalid, -1 for fail

Definition at line 161 of file msgManager.h.


Member Data Documentation

Definition at line 252 of file msgManager.h.

Definition at line 249 of file msgManager.h.

Definition at line 250 of file msgManager.h.

Definition at line 248 of file msgManager.h.

Definition at line 251 of file msgManager.h.

Definition at line 254 of file msgManager.h.

Definition at line 247 of file msgManager.h.


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


dji_sdk_dji2mav
Author(s):
autogenerated on Thu Jun 6 2019 17:55:37