Skip to main content

Data Subscription

The header file for data subscription-related functions is uav_fc_subscription.h. This document outlines the key information and usage methods for the function prototypes in the uav_fc_subscription.h file. For the messages needed during usage, you can refer to both the uav_fc_subscription.h file and the methods in the example cases.

Function Prototypes

UAV_Subscription_Init

  • Function: Initialize the data subscription module. Users should call this function.

Note:

  • Please call this function after UAV_Core_Init().
T_UAVReturnCode UAV_Subscription_Init(void)

UAV_Subscription_DeInit

  • Function:De-initialize the data subscription module.
T_UAVReturnCode UAV_Subscription_DeInit(void)

UAV_Subscribe_Topic

  • Function: Subscribe to a topic.
T_UAVReturnCode UAV_Subscribe_Topic(E_UAVSubscriptionTopic topicType, uint32_t frequency, UAV_ReceiveDataOfTopicCallback usrCb)
  • Parameters:
    • usrCb: The callback function provided by the user to handle the received subscription messages.
    • frequency: The message frequency. For example, if the frequency is set to 10, it tells the publisher to push messages at a rate of 10 times per second.
    • topicType: The message type. This specifies the topic type to subscribe to, referring to the E_UAVSubscriptionTopic enum defined in the uav_fc_subscription.h file.

UAV_unSubscribeTopic

  • Function: Unsubscribe from the specified topic.
T_UAVReturnCode UAV_unSubscribeTopic(E_UAVSubscriptionTopic topicType)
  • Parameter:
    • topicType: The message type. Specifies the topic type to unsubscribe from.