This topic lists the frequently asked questions (FAQ) and answers about driver development.

  • What is the function of the device_cb element in the leda_register_and_online_by_device_name(const char *product_key, const char *device_name, leda_device_callback_t *device_cb, void *usr_data) API operation?

    Answer:

    The device_cb element indicates the callback functions. The callback functions receive and process the service requests that are sent from the cloud or edge applications. The callback functions can be used to retrieve device property data, set device properties, and call device services. The details are described as follows:

  • typedef struct leda_device_callback
    {
    
       ...
       int  service_output_max_count; 
    } leda_device_callback_t;

    What does the service_output_max_count parameter specify?

    Answer:

    This parameter specifies the maximum length of the output data for the call_service_cb API operation.

  • What is the function of the worker_thread_nums element in the leda_init(const char *module_name, int worker_thread_nums) API operation?

    Answer:

    This element is used to initialize the thread pool of a driver. You can use the initial thread pool to process the requests that are sent from the cloud or edge applications to the connected devices. The size of the thread pool can be specified based on the number of connected devices.

  • What are the differences between leda_register_and_online_by_device_name and leda_register_and_online_by_local_name?

    Answer:

    • The differences between these two API operations are described as follows. If you call the leda_register_and_online_by_device_name operation to register a device, the registered device name must be the device name that you specify when you create the device in the IoT Platform console.
    • If you call the leda_register_and_online_by_local_name operation to register a device, you can use a custom device name.
      Note You must use either of the two API operations to create all of the devices that belong to a product. A product is uniquely identified by the ProductKey. To be more specific, you cannot use the leda_register_and_online_by_device_name operation to create some devices for a product, and use the leda_register_and_online_by_local_name operation to create the other devices for the product.
  • Why does the reported device data remain unchanged in the IoT Platform console in the following scenario: The device is in the Online state and the operations log of the driver where the device resides shows that the device data is reported as expected?

    Answer:

    The possible reason is that the message route is not configured. To resolve this issue, check whether the message route is configured in the IoT Platform console. For more information, see Configure message routing.