Bluetooth Services

Last Updated on : 2022-11-24 09:20:26download

This topic describes the APIs used to implement Bluetooth services.

API reference

tuya_bt_svc_init

OPERATE_RET tuya_bt_svc_init(IN ty_cJSON *cfg);

Functional description

Initializes Tuya-specific Bluetooth services, such as Bluetooth application management.

Parameter description

Parameter name Description
cfg JSON configuration

Description of JSON configuration

{
    "enable_hb": 1,             //  Enable the heartbeat management.
    "scan_timeout": 60,         //  The scanning timeout period, in seconds.
    "mode": 5,                  //  The Bluetooth mode, with the data type of bitmap. The types of mode: `BT_WORK_MODE_E`
    "sw_ver": "1.0.8"           // This field is deprecated.
}

Return value

Return value Description
OPRT_OK Success
Error code The error code on a failed operation.

tuya_bt_svc_start

OPERATE_RET tuya_bt_svc_start(IN ty_cJSON *cfg);

Functional description

Starts Tuya-specific Bluetooth services to run the Bluetooth application manager.

Parameter description

Parameter name Description
cfg JSON configuration

Description of JSON configuration

{
    "enable_hb": 1,             //  Enable the heartbeat management.
    "scan_timeout": 60,         //  The scanning timeout period, in seconds.
    "mode": 5,                  //  The Bluetooth mode, with the data type of bitmap. The types of mode: `BT_WORK_MODE_E`
    "sw_ver": "1.0.8"           // This field is deprecated.
}

Return value

Return value Description
OPRT_OK Success
Error code The error code on a failed operation.