Skip to main content

Low-speed Data Channel

The header file for low-speed data channel related functionality is uav_low_speed_data_channel.h. This document describes key information and usage methods for the structures and function prototypes in the uav_low_speed_data_channel.h file.

Table of Contents

  • Macros, Enumerations, and Structures
    UAVLowSpeedDataChannelRecvDataCallback
    E_UAVChannelAddress

  • Function Prototypes
    UAV_LowSpeedDataChannel_Init
    UAV_LowSpeedDataChannel_DeInit
    UAV_LowSpeedDataChannel_SendData
    UAV_LowSpeedDataChannel_GetSendDataState
    UAV_LowSpeedDataChannel_RegRecvDataCallback

  • Macros, Enumerations, and Structures

typedef function UAVLowSpeedDataChannelRecvDataCallback

  • FunctionCallback function prototype for receiving data from a selected channel address.
  • product: all

Note:

  • Users must not perform blocking operations or functions within the callback function as this could block the root thread, resulting in slow system response, disconnecting payloads, or causing infinite loops.
typedef void (*UAVLowSpeedDataChannelRecvDataCallback)(int32_t srcChannelID, int data_type, const uint8_t *data, uint32_t len);
  • ParametersrcChannelID:The data source channel address.data_type:The data type, user-defined, must be greater than 100.data:Pointer to the data.len:Length of the data.
  • Return Value The corresponding return value based on the program execution, for details refer to UAV Error Codes.

typedef enum E_UAVChannelAddress

  • Function: The address of the data source channel.
typedef enum {
UAV_CHANNEL_ADDRESS_UNKNOWN = 0,
UAV_CHANNEL_ADDRESS_MASTER_RC_APP = 1,
UAV_CHANNEL_ADDRESS_CLOUD_API = 2,
UAV_CHANNEL_ADDRESS_SLAVE_RC_APP = 3,
UAV_CHANNEL_ADDRESS_SPEAKER = 4,
UAV_CHANNEL_ADDRESS_GIMBAL = 5,
UAV_CHANNEL_ADDRESS_EVERY = 999
}E_UAVChannelAddress;

Function Prototypes

Low-Speed Channel Initialization

function UAV_LowSpeedDataChannel_Init
- **Function:** Initializes the low-speed data channel module. - **product:** all

Note:

  • This should be used after UAV_Core_Init.
T_UAVReturnCode UAV_LowSpeedDataChannel_Init(void);
  • Parameter

    none
  • Return Value

    Outputs the corresponding return value based on the execution of the program. For details, please refer to UAV Error Codes.

Low-Speed Channel De-initialization

function UAV_LowSpeedDataChannel_DeInit- **Function:** De-initializes the low-speed data channel. - **product:** all

Note:

  • Low-speed channel must be successfully initialized before de-initialization.
T_UAVReturnCode UAV_LowSpeedDataChannel_DeInit(void);
  • Parameternone
  • Return Value Outputs the corresponding return value based on the execution of the program. For details, please refer to UAV Error Codes.

低速通道发送数据

function UAV_LowSpeedDataChannel_SendData- **Function:** Sends data to the selected channel address via the command channel. - **product:** all

Note:

  • The send length must not exceed 256 bytes.
T_UAVReturnCode UAV_LowSpeedDataChannel_SendData(int32_t dstChannelID, int data_type, const uint8_t *data, uint32_t len);
  • ParameterschannelAddress:Low-speed data channel address.type:Data type, user-defined, must be greater than 100.data:Pointer to the data to be sent.len:Length of the data, must be less than or equal to 256 bytes.
  • Return Value Outputs the corresponding return value based on the execution of the program. For details, please refer to UAV Error Codes.。

Send Data Status

function UAV_LowSpeedDataChannel_GetSendDataState- **Function:** Gets the data transfer status of the command transmission channel. This data can serve as a basis for controlling communication between the selected channel address and the onboard computer. - **product:** all

Note:

  • To be implemented.
T_UAVReturnCode UAV_LowSpeedDataChannel_GetSendDataState(E_UAVChannelAddress channelAddress, T_UAVDataChannelState *state);
  • ParameterschannelAddress:Low-speed data channel address.state: Channel status.
  • Return Value Outputs the corresponding return value based on the execution of the program. For details, please refer to UAV Error Codes.

Register Return Data Callback Function

function UAV_LowSpeedDataChannel_RegRecvDataCallback
  • Function: Registers a callback function for receiving data from a specified channel address. After the callback function is registered, the function will be automatically called when data is received from the specified channel address.
  • product: all
T_UAVReturnCode UAV_LowSpeedDataChannel_RegRecvDataCallback(UAVLowSpeedDataChannelRecvDataCallback callback);
  • Parametercallback:Pointer to the callback function.
  • Return Value Outputs the corresponding return value based on the execution of the program. For details, please refer to UAV Error Codes.