#include <mavHandler.h>
Public Member Functions | |
bool | establish (uint16_t mngIdx, std::string targetIP, uint16_t targetPort, uint16_t srcPort, uint16_t senderListSize=DEFAULT_SENDER_LIST_SIZE, uint16_t sendBufSize=DEFAULT_SEND_BUF_SIZE, uint16_t recvBufSize=DEFAULT_RECV_BUF_SIZE) |
Establish UDP connection of the mng. | |
int | findMngIdx (uint8_t sysid) |
Get the index of Manager by its sysid. | |
uint8_t | findMngSysid (uint16_t mngIdx) |
Find the sysid of specific Manager. | |
uint16_t | getMaxListSize () |
Get the max size of mngList(aka, GCS number) | |
uint8_t | getMySysid () |
Get the sysid of the device. | |
bool | isValidMngIdx (uint16_t mngIdx) |
Check whether the manager index is valid. | |
MavHandler (uint8_t mySysid, uint16_t maxMngNum) | |
Constructor for MavHandler. | |
int | recvFromAll (mavlink_message_t *recvMsgList, mavlink_status_t *recvStatusList, uint16_t listSize) |
Receive data from all Manager and parse it. | |
int | recvFromMng (uint16_t mngIdx, mavlink_message_t *recvMsgList, mavlink_status_t *recvStatusList, uint16_t listSize) |
Receive data and parse it from buffer to mavlink message. | |
int | registerSender (uint16_t mngIdx, uint16_t bufSize) |
Register a messager sender with specifc buf size. | |
int | registerSender (uint16_t mngIdx) |
Register a messager sender with default buf size. | |
bool | sendEncodedMsgToMng (uint16_t mngIdx, uint16_t senderIdx, const mavlink_message_t &msg) |
Send msg to specific mng using specific sender. | |
bool | sendEncodedMsgToSys (uint8_t sysid, uint16_t senderIdx, const mavlink_message_t &msg) |
Send msg with specific sysid using specific sender. | |
bool | setMngSysid (uint16_t mngIdx, uint8_t sysid) |
Set the sysid of specific Manager. | |
void | updateSysid (uint16_t mngIdx, uint8_t sysid) |
Implement update sysid strategy. Currently it is simple. | |
~MavHandler () | |
Private Attributes | |
uint16_t | m_maxListSize |
MsgManager ** | m_mngList |
uint8_t | m_mySysid |
uint8_t * | m_sysidRecord |
Definition at line 34 of file mavHandler.h.
dji2mav::MavHandler::MavHandler | ( | uint8_t | mySysid, |
uint16_t | maxMngNum | ||
) | [inline] |
Constructor for MavHandler.
mySysid | : The mavlink sysid of the device |
maxMngNum | : The max number of Manager |
Definition at line 41 of file mavHandler.h.
dji2mav::MavHandler::~MavHandler | ( | ) | [inline] |
Definition at line 63 of file mavHandler.h.
bool dji2mav::MavHandler::establish | ( | uint16_t | mngIdx, |
std::string | targetIP, | ||
uint16_t | targetPort, | ||
uint16_t | srcPort, | ||
uint16_t | senderListSize = DEFAULT_SENDER_LIST_SIZE , |
||
uint16_t | sendBufSize = DEFAULT_SEND_BUF_SIZE , |
||
uint16_t | recvBufSize = DEFAULT_RECV_BUF_SIZE |
||
) | [inline] |
Establish UDP connection of the mng.
mngIdx | : The index of Manager |
targetIP | : The IP of target |
targetPort | : The connection port of target |
srcPort | : The connection port of source |
senderListSize | : The size of sender list |
sendBufSize | : The default value of send buf size |
recvBufSize | : The recv buf size |
Definition at line 233 of file mavHandler.h.
int dji2mav::MavHandler::findMngIdx | ( | uint8_t | sysid | ) | [inline] |
Get the index of Manager by its sysid.
sysid | : The sysid that is used to match |
Definition at line 159 of file mavHandler.h.
uint8_t dji2mav::MavHandler::findMngSysid | ( | uint16_t | mngIdx | ) | [inline] |
Find the sysid of specific Manager.
mngIdx | : The index of Manager |
Definition at line 119 of file mavHandler.h.
uint16_t dji2mav::MavHandler::getMaxListSize | ( | ) | [inline] |
Get the max size of mngList(aka, GCS number)
Definition at line 109 of file mavHandler.h.
uint8_t dji2mav::MavHandler::getMySysid | ( | ) | [inline] |
Get the sysid of the device.
Definition at line 100 of file mavHandler.h.
bool dji2mav::MavHandler::isValidMngIdx | ( | uint16_t | mngIdx | ) | [inline] |
Check whether the manager index is valid.
mngIdx | : The index of manager that is to be checked |
Definition at line 91 of file mavHandler.h.
int dji2mav::MavHandler::recvFromAll | ( | mavlink_message_t * | recvMsgList, |
mavlink_status_t * | recvStatusList, | ||
uint16_t | listSize | ||
) | [inline] |
Receive data from all Manager and parse it.
recvMsgList | : The pointer to a recv msg list |
recvStatusList | : The pointer to a recv status list |
listSize | : The size of list |
Definition at line 425 of file mavHandler.h.
int dji2mav::MavHandler::recvFromMng | ( | uint16_t | mngIdx, |
mavlink_message_t * | recvMsgList, | ||
mavlink_status_t * | recvStatusList, | ||
uint16_t | listSize | ||
) | [inline] |
Receive data and parse it from buffer to mavlink message.
mngIdx | : The index of manager |
recvMsgList | : The pointer to a recv msg array |
recvStatusList | : The pointer to a recv status array |
listSize | : The size of list |
Definition at line 356 of file mavHandler.h.
int dji2mav::MavHandler::registerSender | ( | uint16_t | mngIdx, |
uint16_t | bufSize | ||
) | [inline] |
Register a messager sender with specifc buf size.
mngIdx | : The index the Manager |
bufSize | : The size of sender buf that is to be allocated |
Definition at line 195 of file mavHandler.h.
int dji2mav::MavHandler::registerSender | ( | uint16_t | mngIdx | ) | [inline] |
Register a messager sender with default buf size.
mngIdx | : The index the Manager |
Definition at line 211 of file mavHandler.h.
bool dji2mav::MavHandler::sendEncodedMsgToMng | ( | uint16_t | mngIdx, |
uint16_t | senderIdx, | ||
const mavlink_message_t & | msg | ||
) | [inline] |
Send msg to specific mng using specific sender.
mngIdx | : The index of Manager |
senderIdx | : The index of sender |
msg | : The reference of msg that is to be sent |
Definition at line 287 of file mavHandler.h.
bool dji2mav::MavHandler::sendEncodedMsgToSys | ( | uint8_t | sysid, |
uint16_t | senderIdx, | ||
const mavlink_message_t & | msg | ||
) | [inline] |
Send msg with specific sysid using specific sender.
sysid | : The target sysid |
senderIdx | : The index of sender |
msg | : The reference of msg that is to be sent |
Definition at line 330 of file mavHandler.h.
bool dji2mav::MavHandler::setMngSysid | ( | uint16_t | mngIdx, |
uint8_t | sysid | ||
) | [inline] |
Set the sysid of specific Manager.
mngIdx | : The index of Manager |
sysid | : The sysid that is to be set |
Definition at line 136 of file mavHandler.h.
void dji2mav::MavHandler::updateSysid | ( | uint16_t | mngIdx, |
uint8_t | sysid | ||
) | [inline] |
Implement update sysid strategy. Currently it is simple.
mngIdx | : The index of Manager |
sysid | : The sysid that is going to be update |
Definition at line 180 of file mavHandler.h.
uint16_t dji2mav::MavHandler::m_maxListSize [private] |
Definition at line 461 of file mavHandler.h.
MsgManager** dji2mav::MavHandler::m_mngList [private] |
Definition at line 460 of file mavHandler.h.
uint8_t dji2mav::MavHandler::m_mySysid [private] |
Definition at line 464 of file mavHandler.h.
uint8_t* dji2mav::MavHandler::m_sysidRecord [private] |
Definition at line 462 of file mavHandler.h.