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

#include <mavHandler.h>

List of all members.

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

Detailed Description

Definition at line 34 of file mavHandler.h.


Constructor & Destructor Documentation

dji2mav::MavHandler::MavHandler ( uint8_t  mySysid,
uint16_t  maxMngNum 
) [inline]

Constructor for MavHandler.

Parameters:
mySysid: The mavlink sysid of the device
maxMngNum: The max number of Manager

Definition at line 41 of file mavHandler.h.

Definition at line 63 of file mavHandler.h.


Member Function Documentation

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.

Parameters:
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
Returns:
True if succeed or false if fail

Definition at line 233 of file mavHandler.h.

int dji2mav::MavHandler::findMngIdx ( uint8_t  sysid) [inline]

Get the index of Manager by its sysid.

Parameters:
sysid: The sysid that is used to match
Returns:
Idx of Manager, -1 for not found or -2 for invalid input

Definition at line 159 of file mavHandler.h.

uint8_t dji2mav::MavHandler::findMngSysid ( uint16_t  mngIdx) [inline]

Find the sysid of specific Manager.

Parameters:
mngIdx: The index of Manager
Returns:
The sysid of mng. Return 0 if invalid input or no record

Definition at line 119 of file mavHandler.h.

uint16_t dji2mav::MavHandler::getMaxListSize ( ) [inline]

Get the max size of mngList(aka, GCS number)

Returns:
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.

Returns:
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.

Parameters:
mngIdx: The index of manager that is to be checked
Returns:
True if valid or false if invalid

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.

Parameters:
recvMsgList: The pointer to a recv msg list
recvStatusList: The pointer to a recv status list
listSize: The size of list
Returns:
Num of msg received, -1 for error

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.

Parameters:
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
Returns:
Num of msg received, -2 for invalid input or -1 for error

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.

Parameters:
mngIdx: The index the Manager
bufSize: The size of sender buf that is to be allocated
Returns:
Idx of the sender. -1 for full list, -2 for invalid input

Definition at line 195 of file mavHandler.h.

int dji2mav::MavHandler::registerSender ( uint16_t  mngIdx) [inline]

Register a messager sender with default buf size.

Parameters:
mngIdx: The index the Manager
Returns:
Idx of the sender. -1 for full list, -2 for invalid input

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.

Parameters:
mngIdx: The index of Manager
senderIdx: The index of sender
msg: The reference of msg that is to be sent
Returns:
True if succeed and false if fail

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.

Parameters:
sysid: The target sysid
senderIdx: The index of sender
msg: The reference of msg that is to be sent
Returns:
True if succeed or false if fail

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.

Parameters:
mngIdx: The index of Manager
sysid: The sysid that is to be set
Returns:
True if succeed or false if fail

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.

Parameters:
mngIdx: The index of Manager
sysid: The sysid that is going to be update

Definition at line 180 of file mavHandler.h.


Member Data Documentation

Definition at line 461 of file mavHandler.h.

Definition at line 460 of file mavHandler.h.

uint8_t dji2mav::MavHandler::m_mySysid [private]

Definition at line 464 of file mavHandler.h.

Definition at line 462 of file mavHandler.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