TuyaOS
类型定义 | 函数
tkl_hci.h 文件参考

Host-Controller Interface, Sync with Tuya Host Stack 更多...

#include "tuya_cloud_types.h"
#include "tuya_error_code.h"
tkl_hci.h 的引用(Include)关系图:

浏览源代码.

类型定义

typedef OPERATE_RET(* TKL_HCI_FUNC_CB) (UCHAR_T *p_buf, USHORT_T buf_len)
 

函数

OPERATE_RET tkl_hci_acl_packet_send (CONST UCHAR_T *p_buf, USHORT_T buf_len)
 Send HCI-Command Packet to controller from host. HCI ACL Data packets are used to exchange data between the Host and Controller. Hosts and Controllers shall be able to accept HCI ACL Data packets with up to 27 bytes of data excluding the HCI ACL Data packet header on Connection_Handles associated with an LE-U logical link.The HCI ACL Data packet header is the first 4 octets of the packet. 更多...
 
OPERATE_RET tkl_hci_callback_register (CONST TKL_HCI_FUNC_CB hci_evt_cb, CONST TKL_HCI_FUNC_CB acl_pkt_cb)
 Register the hci callback, while receiving "hci-event" or "acl-packet" data from controller, we will post these data into host stack. hci_evt_cb: The Host shall be able to accept HCI Event packets with up to 255 octets of data excluding the HCI Event packet header acl_pkt_cb: Refer to @tkl_hci_acl_packet_send 更多...
 
OPERATE_RET tkl_hci_cmd_packet_send (CONST UCHAR_T *p_buf, USHORT_T buf_len)
 Send HCI-Command Packet to controller from host. The HCI Command packet is used to send commands to the Controller from the Host. The format of the HCI Command packet is shown @Rule Controllers shall be able to accept HCI Command packets with up to 255 bytes of data excluding the HCI Command packet header. The HCI Command packet header is the first 3 octets of the packet. 更多...
 
OPERATE_RET tkl_hci_deinit (VOID)
 Function for de-initializing the bluetooth host-controller interface 更多...
 
OPERATE_RET tkl_hci_init (VOID)
 Function for initializing the bluetooth host-controller interface 更多...
 
OPERATE_RET tkl_hci_reset (VOID)
 [Linux/Android] Function for reseting the bluetooth host-controller interface Try to recover socket or reopen uart/usb interface. 更多...
 

详细描述

Host-Controller Interface, Sync with Tuya Host Stack

版本

日期
2021-10-11

类型定义说明

◆ TKL_HCI_FUNC_CB

typedef OPERATE_RET(* TKL_HCI_FUNC_CB) (UCHAR_T *p_buf, USHORT_T buf_len)

< HCI Callback Register function definition

函数说明

◆ tkl_hci_acl_packet_send()

OPERATE_RET tkl_hci_acl_packet_send ( CONST UCHAR_T *  p_buf,
USHORT_T  buf_len 
)

Send HCI-Command Packet to controller from host. HCI ACL Data packets are used to exchange data between the Host and Controller. Hosts and Controllers shall be able to accept HCI ACL Data packets with up to 27 bytes of data excluding the HCI ACL Data packet header on Connection_Handles associated with an LE-U logical link.The HCI ACL Data packet header is the first 4 octets of the packet.

参数
p_bufFollow Core Spec. Refer to @Rule length Indicate the length of the buffer. it can be "Handle + PB Flag + PC Flag + Data Total Length";
返回
SUCCESS Initialized successfully. ERROR

@Spec BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 4, Part E, 5-4.2 @Rule 2 bytes 2 bytes N bytes (Connection Handle + PB Flag(12-14bit) + PC Flag(14-16bit)) + Data Total Length + Data @Note PB Flag: Packet_Boundary_Flag; PB Flag: Broadcast_Flag;

◆ tkl_hci_callback_register()

OPERATE_RET tkl_hci_callback_register ( CONST TKL_HCI_FUNC_CB  hci_evt_cb,
CONST TKL_HCI_FUNC_CB  acl_pkt_cb 
)

Register the hci callback, while receiving "hci-event" or "acl-packet" data from controller, we will post these data into host stack. hci_evt_cb: The Host shall be able to accept HCI Event packets with up to 255 octets of data excluding the HCI Event packet header acl_pkt_cb: Refer to @tkl_hci_acl_packet_send

参数
hci_evt_cbIndicate the HCI Event callback. acl_pkt_cb Indicate the ACL packet callback.
返回
SUCCESS Initialized successfully. ERROR

@Spec BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 4, Part E, 5-4.4 For More Event And Commnad Details: BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 4, Part E, 7-x

@Rule hci_evt_cb: 1 byte 1 byte 1 byte N bytes Event Code + Parameter Total Length+ Event Parameter 0 + ... + Event Parameter N

◆ tkl_hci_cmd_packet_send()

OPERATE_RET tkl_hci_cmd_packet_send ( CONST UCHAR_T *  p_buf,
USHORT_T  buf_len 
)

Send HCI-Command Packet to controller from host. The HCI Command packet is used to send commands to the Controller from the Host. The format of the HCI Command packet is shown @Rule Controllers shall be able to accept HCI Command packets with up to 255 bytes of data excluding the HCI Command packet header. The HCI Command packet header is the first 3 octets of the packet.

参数
p_bufFollow Core Spec. Refer to @Rule length Indicate the length of the buffer. it can be "opcode + 1(len) + Parameter len";
返回
SUCCESS Initialized successfully. ERROR

@Spec BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 4, Part E, 5-4.1 @Rule 2 bytes 1 byte 1 byte N bytes OpCode(OCF+OGF) + Parameter Total Length + Parameter 0 ... + Parameter N @Note The OpCode Group Field (OGF), OpCode Command Field (OCF).

◆ tkl_hci_deinit()

OPERATE_RET tkl_hci_deinit ( VOID  )

Function for de-initializing the bluetooth host-controller interface

参数
VOID
返回
SUCCESS De-initialized successfully. ERROR

◆ tkl_hci_init()

OPERATE_RET tkl_hci_init ( VOID  )

Function for initializing the bluetooth host-controller interface

参数
VOID
返回
SUCCESS Initialized successfully. ERROR

◆ tkl_hci_reset()

OPERATE_RET tkl_hci_reset ( VOID  )

[Linux/Android] Function for reseting the bluetooth host-controller interface Try to recover socket or reopen uart/usb interface.

参数
VOID
返回
SUCCESS Reset successfully. ERROR
注解
[Special Interface] If running in RTOS, we may not support this feature. And you can report OPRT_NOT_SUPPORT if you dont need it.