DJI Cloud API

2023-09-11
No Rating

Catalog

Function

function CloudAPICustomServicesMessageHandler

function: prototype for receiving custom data from the cloudproduct:all
using CloudAPICustomServicesMessageHandler =
    std::function<void(const uint8_t* data, uint32_t len)>;
Parameter
data:pointer to the "value" field in the custom protocol sent from the cloud.
len:indicates the length of the "value" field, Note: message length sent from cloud should not exceed 256 bytes.

function CloudAPI_RegisterCustomServicesMessageHandler

To register a handler function for receiving messages from the cloud, format of the message sent from the cloud should follow the example.product:all
Topic: thing/product/${gateway_sn}/services
 {
    "methond": "custom_data_transmission_to_esdk",
    "timestamp": xxxxxxxxxx,
    "bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "data": {
    "value": "xxxx"
    }
}
ErrorCode CloudAPI_RegisterCustomServicesMessageHandler( CloudAPICustomServicesMessageHandler handler);
Parameter
handler:pointer to the handler for receiving message
Return
Execution result

function CloudAPI_SendCustomEventsMessage

Function: The cloud interaction API defines two custom data channels. The events message is sent from Edge to the server, caller only needs to send the content of the "value" field, it will be formatted by the API that can be received by the cloud like the example.product:all
Topic: thing/product/${gateway_sn}/events
{
    "method": "custom_data_transmission_from_esdk",
    "timestamp": xxxxxxxxxx,
    "bid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "tid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "data": {
        "value": "xxxx"
    },
    "gateway":"xxxxxxxxxx"
}
ErrorCode CloudAPI_SendCustomEventsMessage(const uint8_t* data, uint32_t len);
Parameter
data:pointer to the "value" field in the custom protocol
len:indicates the length of the "value", can not exceed 256 bytes
Return
Execution result