DJI Cloud API
Catalog
- Function
CloudAPICustomServicesMessageHandler
CloudAPI_RegisterCustomServicesMessageHandler
CloudAPI_SendCustomEventsMessage
Function
function: prototype for receiving custom data from the cloud | product:all |
using CloudAPICustomServicesMessageHandler =
std::function<void(const uint8_t* data, uint32_t len)>;
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.
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);
handler:pointer to the handler for receiving message
Return
Execution result
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);
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