Telemetry API through asynchronous "Subscribe"-style messages. More...

#include <dji_subscription.hpp>

Public Member Functions

 DataSubscription (Vehicle *vehicle)
 
Vehicle * getVehicle ()
 
bool initPackageFromTopicList (int packageID, int numberOfTopics, Telemetry::TopicName *topicList, bool sendTimeStamp, uint16_t freq)
 This is the interface for the end user to generate a package for subscription. More...
 
void verify ()
 Non-blocking call for version match. More...
 
ACK::ErrorCode verify (int timeout)
 Blocking call for version match. More...
 
void startPackage (int packageID)
 Non-blocking call for starting a package. More...
 
ACK::ErrorCode startPackage (int packageID, int timeout)
 Blocking call for start package. More...
 
void removePackage (int packageID)
 Non-blocking call for start package. More...
 
ACK::ErrorCode removePackage (int packageID, int timeout)
 Non-blocking call for start package. More...
 
void removeLeftOverPackages ()
 Remove leftover incoming telemetry data due to unclean quit. More...
 
void removeAllExistingPackages ()
 Remove all occupied packages. More...
 
void reset ()
 Non-blocking call for resetting all packages. More...
 
ACK::ErrorCode reset (int timeout)
 Blocking call for resetting all packages. More...
 
void registerUserPackageUnpackCallback (int packageID, VehicleCallBack userFunctionAfterPackageExtraction, UserData userData=NULL)
 Register a callback function after package[packageID] is received. More...
 
template<Telemetry::TopicName topic>
Telemetry::TypeMap< topic >::type getValue ()
 

Static Public Member Functions

static void verifyCallback (Vehicle *vehiclePtr, RecvContainer rcvContainer, UserData userData)
 Callback function for non-blocking verify() More...
 
static void addPackageCallback (Vehicle *vehiclePtr, RecvContainer rcvContainer, UserData pkgHandle)
 
static void removePackageCallback (Vehicle *vehiclePtr, RecvContainer rcvContainer, UserData pkgHandle)
 
static void resetCallback (Vehicle *vehiclePtr, RecvContainer rcvContainer, UserData pkgHandle)
 
static void decodeCallback (Vehicle *vehiclePtr, RecvContainer rcvContainer, UserData subscriptionPtr)
 This callback function is called by recvReqData, case CMD_ID_SUBSCRIBE. More...
 

Public Attributes

VehicleCallBackHandler subscriptionDataDecodeHandler
 

Static Public Attributes

static const uint8_t MAX_NUMBER_OF_PACKAGE = 7
 

Detailed Description

Telemetry API through asynchronous "Subscribe"-style messages.

The subscribe API allows fine-grained control over requesting various topics at various frequencies.

All topics at a certain frequency should be put into a single "package".

Note
Subscribe-style telemetry is a new feature, available since OSDK 3.3

Constructor & Destructor Documentation

◆ DataSubscription()

DataSubscription::DataSubscription ( Vehicle *  vehiclePtr)
  1. Initialize the api member
    1. Set each package[i] entry with packageID = i
    2. Set the decodeCallback function

Member Function Documentation

◆ decodeCallback()

void DataSubscription::decodeCallback ( Vehicle *  vehiclePtr,
RecvContainer  rcvContainer,
UserData  subPtr 
)
static

This callback function is called by recvReqData, case CMD_ID_SUBSCRIBE.

Parameters
API
header
subHandleThe pointer to the subscription object.

: decodeCallback is a static function and cannot access object member. In order to access members, it needs a pointer to the subscription.

◆ initPackageFromTopicList()

bool DataSubscription::initPackageFromTopicList ( int  packageID,
int  numberOfTopics,
Telemetry::TopicName topicList,
bool  sendTimeStamp,
uint16_t  freq 
)

This is the interface for the end user to generate a package for subscription.

Supported Platforms : M210V2, M300
Parameters
packageIDThe ID of package it'll generate
numberOfTopics
topicListList of Topic Names to subscribe in the package
sendTimeStampNote that timestamp is the time of package transmission, not data acquisition from sensor.
freq
Returns

Setup members of package[packageID] Do basic gate keeping. No api->send call involved

◆ registerUserPackageUnpackCallback()

void DataSubscription::registerUserPackageUnpackCallback ( int  packageID,
VehicleCallBack  userFunctionAfterPackageExtraction,
UserData  userData = NULL 
)

Register a callback function after package[packageID] is received.

Supported Platforms : M210V2, M300
Parameters
packageID
userFunctionAfterPackageExtraction

◆ removeAllExistingPackages()

void DataSubscription::removeAllExistingPackages ( )

Remove all occupied packages.

Supported Platforms : M210V2, M300
Returns

◆ removeLeftOverPackages()

void DataSubscription::removeLeftOverPackages ( )

Remove leftover incoming telemetry data due to unclean quit.

Supported Platforms : M210V2, M300
Returns

◆ removePackage() [1/2]

void DataSubscription::removePackage ( int  packageID)

Non-blocking call for start package.

Supported Platforms : M210V2, M300
Parameters
packageID
Returns

◆ removePackage() [2/2]

ACK::ErrorCode DataSubscription::removePackage ( int  packageID,
int  timeout 
)

Non-blocking call for start package.

Supported Platforms : M210V2, M300
Parameters
packageID
timeout
Returns

◆ reset() [1/2]

void DataSubscription::reset ( )

Non-blocking call for resetting all packages.

Supported Platforms : M210V2, M300
Returns

◆ reset() [2/2]

ACK::ErrorCode DataSubscription::reset ( int  timeout)

Blocking call for resetting all packages.

Supported Platforms : M210V2, M300
Parameters
timeout

◆ startPackage() [1/2]

void DataSubscription::startPackage ( int  packageID)

Non-blocking call for starting a package.

Supported Platforms : M210V2, M300
Parameters
packageID

◆ startPackage() [2/2]

ACK::ErrorCode DataSubscription::startPackage ( int  packageID,
int  timeout 
)

Blocking call for start package.

Supported Platforms : M210V2, M300
Parameters
packageID
timeout
Returns

◆ verify() [1/2]

void DataSubscription::verify ( )

Non-blocking call for version match.

Supported Platforms : M210V2, M300

◆ verify() [2/2]

ACK::ErrorCode DataSubscription::verify ( int  timeout)

Blocking call for version match.

Supported Platforms : M210V2, M300
Parameters
timeout
Returns

◆ verifyCallback()

void DataSubscription::verifyCallback ( Vehicle *  vehiclePtr,
RecvContainer  rcvContainer,
UserData  userData 
)
static

Callback function for non-blocking verify()

Parameters
API
header
userData

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