DJI::OSDK::HardwareSync Class Reference

APIs for controlling Hardware Sync. More...

#include <dji_hardware_sync.hpp>

Public Types

enum  SatelliteIndex {
  GPS,
  GLONASS,
  GALILEO,
  BEIDOU,
  MAX_INDEX_CNT
}
 
enum  NMEAType {
  GNGSA,
  GNRMC,
  TYPENUM
}
 
enum  PPSSource {
  INTERNAL_GPS,
  EXTERNAL_GPS,
  RTK
}
 
typedef enum DJI::OSDK::HardwareSync::SatelliteIndex SatelliteIndex
 
typedef struct DJI::OSDK::HardwareSync::SyncSettings SyncSettings
 
typedef enum DJI::OSDK::HardwareSync::NMEAType NMEAType
 
typedef enum DJI::OSDK::HardwareSync::PPSSource PPSSource
 
typedef timespec RecvTimeMsg
 
typedef struct DJI::OSDK::HardwareSync::NMEAData NMEAData
 
typedef struct DJI::OSDK::HardwareSync::GNGSAPackage GNGSAPackage
 

Public Member Functions

 HardwareSync (Vehicle *vehiclePtr=0)
 
void setSyncFreq (uint32_t freqInHz, uint16_t tag=0)
 Call this API to start sending a hardware pulse and set up a software packet to accompany it. More...
 
void startSync (SyncSettings &data)
 Internal setter function that is called by setSyncFreq function. More...
 
void subscribeNMEAMsgs (VehicleCallBack cb, void *userData)
 Subscribe to NMEA messages with a callback function. More...
 
void unsubscribeNMEAMsgs ()
 Unsubscribe to NMEA messages. More...
 
bool getGNRMCMsg (NMEAData &nmea)
 Poll NMEA messages. More...
 
bool getGNGSAMsg (GNGSAPackage &GNGSA)
 Poll NMEA messages. More...
 
void subscribeUTCTime (VehicleCallBack cb, void *userData)
 Subscribe to UTC Time tag with a callback function. More...
 
void unsubscribeUTCTime ()
 Unsubscribe to UTC time tag. More...
 
bool getUTCTime (NMEAData &utc)
 Poll UTC time tag. More...
 
void subscribeFCTimeInUTCRef (VehicleCallBack cb, void *userData)
 Subscribe to FC Time in UTC referece with a callback function. More...
 
void unsubscribeFCTimeInUTCRef ()
 Unsubscribe to FC Time in UTC referece.
 
bool getFCTimeInUTCRef (DJI::OSDK::ACK::FCTimeInUTC &fcTimeInUTC)
 Poll FC Time in UTC referece. More...
 
void subscribePPSSource (VehicleCallBack cb, void *userData)
 Subscribe to PPS source info with a callback function. More...
 
void unsubscribePPSSource ()
 Unsubscribe to PPS source info. More...
 
bool getPPSSource (PPSSource &source)
 Poll PPS source info. More...
 
void writeData (const uint8_t cmdID, const RecvContainer *recvContainer)
 Write data when received from UART. More...
 

Public Attributes

VehicleCallBackHandler ppsNMEAHandler
 
VehicleCallBackHandler ppsUTCTimeHandler
 
VehicleCallBackHandler ppsUTCFCTimeHandler
 
VehicleCallBackHandler ppsSourceHandler
 

Detailed Description

APIs for controlling Hardware Sync.

These APIs enable you to output a pulse/pulse train along with a software packet with synchronized timestamps and sensor data.

Note
You must use this in conjunction with TOPIC_HARD_SYNC subscription.
You need to set a F-channel to Sync through DJI Assistant 2.

Member Function Documentation

◆ getFCTimeInUTCRef()

bool HardwareSync::getFCTimeInUTCRef ( DJI::OSDK::ACK::FCTimeInUTC fcTimeInUTC)

Poll FC Time in UTC referece.

Supported Platforms : M210V2, M300
Parameters
datastruct to fill

◆ getGNGSAMsg()

bool HardwareSync::getGNGSAMsg ( GNGSAPackage &  GNGSA)

Poll NMEA messages.

Supported Platforms : M210V2, M300
Parameters
whichNMEA message to poll
datastruct to fill

◆ getGNRMCMsg()

bool HardwareSync::getGNRMCMsg ( NMEAData &  nmea)

Poll NMEA messages.

Supported Platforms : M210V2, M300
Parameters
whichNMEA message to poll
datastruct to fill

◆ getPPSSource()

bool HardwareSync::getPPSSource ( PPSSource &  source)

Poll PPS source info.

Supported Platforms : M210V2, M300
Parameters
datastruct to fill

◆ getUTCTime()

bool HardwareSync::getUTCTime ( NMEAData &  utc)

Poll UTC time tag.

Supported Platforms : M210V2, M300
Parameters
datastruct to fill

◆ setSyncFreq()

void HardwareSync::setSyncFreq ( uint32_t  freqInHz,
uint16_t  tag = 0 
)

Call this API to start sending a hardware pulse and set up a software packet to accompany it.

You need to select a pin on DJI Assistant 2 that will output this hardware pulse. To receive the software packet that accompanies this pulse, you will need to subscribe to TOPIC_HARD_SYNC.

Supported Platforms : M210V2, M300
Parameters
freqInHzThe frequency at which you want this pulse to be output.
tagIdentification to match pulse with the corresponding software packet

◆ startSync()

void HardwareSync::startSync ( SyncSettings &  data)

Internal setter function that is called by setSyncFreq function.

Use setSyncFreq instead of this direct interface.

Supported Platforms : M210V2, M300
Parameters
dataStruct of type SyncCmdData.

◆ subscribeFCTimeInUTCRef()

void HardwareSync::subscribeFCTimeInUTCRef ( VehicleCallBack  cb,
void *  userData 
)

Subscribe to FC Time in UTC referece with a callback function.

Supported Platforms : M210V2, M300
Parameters
callbackcallback function
userDatauser data (void ptr)

◆ subscribeNMEAMsgs()

void HardwareSync::subscribeNMEAMsgs ( VehicleCallBack  cb,
void *  userData 
)

Subscribe to NMEA messages with a callback function.

Supported Platforms : M210V2, M300
Parameters
callbackcallback function
userDatauser data (void ptr)

◆ subscribePPSSource()

void HardwareSync::subscribePPSSource ( VehicleCallBack  cb,
void *  userData 
)

Subscribe to PPS source info with a callback function.

Supported Platforms : M210V2, M300
Parameters
callbackcallback function
userDatauser data (void ptr)

◆ subscribeUTCTime()

void HardwareSync::subscribeUTCTime ( VehicleCallBack  cb,
void *  userData 
)

Subscribe to UTC Time tag with a callback function.

Supported Platforms : M210V2, M300
Parameters
callbackcallback function
userDatauser data (void ptr)

◆ unsubscribeNMEAMsgs()

void HardwareSync::unsubscribeNMEAMsgs ( )

Unsubscribe to NMEA messages.

Supported Platforms : M210V2, M300

◆ unsubscribePPSSource()

void HardwareSync::unsubscribePPSSource ( )

Unsubscribe to PPS source info.

Supported Platforms : M210V2, M300

◆ unsubscribeUTCTime()

void HardwareSync::unsubscribeUTCTime ( )

Unsubscribe to UTC time tag.

Supported Platforms : M210V2, M300

◆ writeData()

void HardwareSync::writeData ( const uint8_t  cmdID,
const RecvContainer recvContainer 
)

Write data when received from UART.

Supported Platforms : M210V2, M300
Parameters
cmdid
receiveddata

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