Onboard-SDK-ROS
Public Member Functions | List of all members
DJI::onboardSDK::HardDriver Class Referenceabstract

Public Member Functions

virtual void init ()=0
 After calling this function, HardDriver should be able to read and send correctly, through a correct UART part. More...
 
virtual time_ms getTimeStamp ()=0
 
virtual size_t send (const uint8_t *buf, size_t len)=0
 
virtual size_t readall (uint8_t *buf, size_t maxlen)=0
 
virtual void lockMemory ()=0
 
virtual void freeMemory ()=0
 
virtual void lockMSG ()=0
 
virtual void freeMSG ()=0
 
virtual void displayLog (const char *buf=0)
 

Member Function Documentation

virtual void DJI::onboardSDK::HardDriver::init ( )
pure virtual

After calling this function, HardDriver should be able to read and send correctly, through a correct UART part.

Note
How to use In order to provide platform crossable DJI onboardSDK library, we abstract this class as a hardware level.
function descriptions:

void init(); unsigned int getTimeStamp(); returns a TimeStamp data in unit msec. The difference between the return value of the function call two times is the excat time between them in msec.

size_t send(const uint8_t *buf, size_t len); return sent data length.

size_t readall(uint8_t *buf, size_t maxlen) = 0; return read data length.

void lockMemory();/ void freeMemory(); provide a mutex for multi-thread. when operating memory.

void lockMSG();/ void freeMSG(); provide a mutex for multi-thread. when operating messages.

void displayLog(char *buf); Micro "API_LOG" invoked this function, to pass datalog. In order to pass data through different stream or channel. We abstract this virtual function for user. And different from others, this interface is not a pure virtual funcion. The default data-passing channel is stdout (printf). See also "DJI_HardDriver.cpp".

Attention
when writting and reading data, there might have multi-thread problems. Abstract class HardDriver did not consider these issue. Please be careful when you are going to implement send and readall funtions.
Note
we strongly suggest you to inherit this class in your own file, not just implement it in DJI_HardDriver.cpp or inside this class

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