TuyaOS
tkl_bluetooth.h
1#ifndef __TKL_BLUETOOTH_H__
2#define __TKL_BLUETOOTH_H__
3
4#include "tkl_bluetooth_def.h"
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
18OPERATE_RET tkl_ble_stack_init(UCHAR_T role);
19
28OPERATE_RET tkl_ble_stack_deinit(UCHAR_T role);
29
36OPERATE_RET tkl_ble_stack_gatt_link(USHORT_T *p_link);
37
44OPERATE_RET tkl_ble_gap_callback_register(CONST TKL_BLE_GAP_EVT_FUNC_CB gap_evt);
45
52OPERATE_RET tkl_ble_gatt_callback_register(CONST TKL_BLE_GATT_EVT_FUNC_CB gatt_evt);
53
54/******************************************************************************************************************************/
65OPERATE_RET tkl_ble_gap_addr_set(TKL_BLE_GAP_ADDR_T CONST *p_peer_addr);
66
73OPERATE_RET tkl_ble_gap_address_get(TKL_BLE_GAP_ADDR_T *p_peer_addr);
74
81OPERATE_RET tkl_ble_gap_adv_start(TKL_BLE_GAP_ADV_PARAMS_T CONST *p_adv_params);
82
89OPERATE_RET tkl_ble_gap_adv_stop(VOID);
90
99OPERATE_RET tkl_ble_gap_adv_rsp_data_set(TKL_BLE_DATA_T CONST *p_adv, TKL_BLE_DATA_T CONST *p_scan_rsp);
100
109OPERATE_RET tkl_ble_gap_adv_rsp_data_update(TKL_BLE_DATA_T CONST *p_adv, TKL_BLE_DATA_T CONST *p_scan_rsp);
110
117OPERATE_RET tkl_ble_gap_scan_start(TKL_BLE_GAP_SCAN_PARAMS_T CONST *p_scan_params);
118
125OPERATE_RET tkl_ble_gap_scan_stop(VOID);
126
135OPERATE_RET tkl_ble_gap_connect(TKL_BLE_GAP_ADDR_T CONST *p_peer_addr, TKL_BLE_GAP_SCAN_PARAMS_T CONST *p_scan_params, TKL_BLE_GAP_CONN_PARAMS_T CONST *p_conn_params);
136
144OPERATE_RET tkl_ble_gap_disconnect(USHORT_T conn_handle, UCHAR_T hci_reason);
145
153OPERATE_RET tkl_ble_gap_conn_param_update(USHORT_T conn_handle, TKL_BLE_GAP_CONN_PARAMS_T CONST *p_conn_params);
154
163OPERATE_RET tkl_ble_gap_tx_power_set(UCHAR_T role, INT_T tx_power);
164
171OPERATE_RET tkl_ble_gap_rssi_get(USHORT_T conn_handle);
172
173/******************************************************************************************************************************/
287OPERATE_RET tkl_ble_gatts_service_add(TKL_BLE_GATTS_PARAMS_T *p_service);
288
299OPERATE_RET tkl_ble_gatts_value_set(USHORT_T conn_handle, USHORT_T char_handle, UCHAR_T *p_data, USHORT_T length);
300
308OPERATE_RET tkl_ble_gatts_value_get(USHORT_T conn_handle, USHORT_T char_handle, UCHAR_T *p_data, USHORT_T length);
309
319OPERATE_RET tkl_ble_gatts_value_notify(USHORT_T conn_handle, USHORT_T char_handle, UCHAR_T *p_data, USHORT_T length);
320
330OPERATE_RET tkl_ble_gatts_value_indicate(USHORT_T conn_handle, USHORT_T char_handle, UCHAR_T *p_data, USHORT_T length);
331
339OPERATE_RET tkl_ble_gatts_exchange_mtu_reply(USHORT_T conn_handle, USHORT_T server_rx_mtu);
340
341/******************************************************************************************************************************/
354OPERATE_RET tkl_ble_gattc_all_service_discovery(USHORT_T conn_handle);
355
366OPERATE_RET tkl_ble_gattc_all_char_discovery(USHORT_T conn_handle, USHORT_T start_handle, USHORT_T end_handle);
367
377OPERATE_RET tkl_ble_gattc_char_desc_discovery(USHORT_T conn_handle, USHORT_T start_handle, USHORT_T end_handle);
378
388OPERATE_RET tkl_ble_gattc_write_without_rsp(USHORT_T conn_handle, USHORT_T char_handle, UCHAR_T *p_data, USHORT_T length);
389
399OPERATE_RET tkl_ble_gattc_write(USHORT_T conn_handle, USHORT_T char_handle, UCHAR_T *p_data, USHORT_T length);
400
408OPERATE_RET tkl_ble_gattc_read(USHORT_T conn_handle, USHORT_T char_handle);
409
417OPERATE_RET tkl_ble_gattc_exchange_mtu_request(USHORT_T conn_handle, USHORT_T client_rx_mtu);
418
442OPERATE_RET tkl_ble_vendor_command_control(USHORT_T opcode, VOID_T *user_data, USHORT_T data_len);
443
444#ifdef __cplusplus
445}
446#endif
447
448#endif
449
Definition: tkl_bluetooth_def.h:77
GAP address parameters.
Definition: tkl_bluetooth_def.h:72
GAP advertising parameters.
Definition: tkl_bluetooth_def.h:89
Definition of LE connection request parameter.
Definition: tkl_bluetooth_def.h:124
GAP scanning parameters.
Definition: tkl_bluetooth_def.h:109
Definition: tkl_bluetooth_def.h:201