初版
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
|
||||
#ifndef _JL_RCSP_LIB_API_H_
|
||||
#define _JL_RCSP_LIB_API_H_
|
||||
|
||||
#include "typedef.h"
|
||||
#include "uart.h"
|
||||
|
||||
#define USE_LITTLE_ENDIAN 0
|
||||
#define USE_BIG_ENDIAN 1
|
||||
|
||||
#define USE_ENDIAN_TYPE USE_LITTLE_ENDIAN
|
||||
|
||||
|
||||
#define AI_LICENCE_LEN 16
|
||||
|
||||
enum {
|
||||
TULING = 0,
|
||||
DEEPBRAIN,
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct _AI_platform {
|
||||
u8 platform;
|
||||
u8 license[AI_LICENCE_LEN];
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _rcsp_auth_hdl {
|
||||
u16 ble_con_handle;
|
||||
u8 spp_remote_addr[6];
|
||||
bool rcsp_auth_flag; // 是否认证成功
|
||||
} JL_rcsp_auth_hdl;
|
||||
#pragma pack()
|
||||
|
||||
u16 app_htons(u16 n);
|
||||
u16 app_ntohs(u16 n);
|
||||
|
||||
u32 app_htonl(u32 n);
|
||||
u32 app_ntohl(u32 n);
|
||||
|
||||
void JL_rcsp_auth_init(int (*send)(u16, u8 *, u8 *, u16, uint16_t, u8), u8 *link_key, u8 *addr);
|
||||
void JL_rcsp_auth_reset(void);
|
||||
|
||||
/**
|
||||
* @brief 判断buf是否是rcsp协议头
|
||||
*
|
||||
* @param buf
|
||||
* @param len
|
||||
*/
|
||||
bool rcsp_protocol_head_check(u8 *buf, u16 len);
|
||||
|
||||
/**
|
||||
* @brief 设备断开ble/spp时调用,重置重置认证情况
|
||||
*
|
||||
* @param ble_con_handle ble的con_handle句柄
|
||||
* @param spp_remote_addr spp:mac_addr
|
||||
*/
|
||||
void JL_rcsp_reset_bthdl_auth(u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
|
||||
/**
|
||||
* @brief 获取设备是否rcsp验证
|
||||
*
|
||||
* @param ble_con_handle ble的con_handle句柄
|
||||
* @param spp_remote_addr spp:mac_addr
|
||||
*/
|
||||
bool JL_rcsp_get_auth_flag_with_bthdl(u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
|
||||
u8 JL_rcsp_get_auth_flag(void);
|
||||
void JL_rcsp_set_auth_flag(u8 auth_flag);
|
||||
|
||||
/**
|
||||
* @brief rcsp验证函数
|
||||
*
|
||||
* @param ble_con_handle ble的con_handle句柄
|
||||
* @param spp_remote_addr spp:mac_addr
|
||||
* @param buffer 手机发过来的验证数据
|
||||
* @param len buffer 's length
|
||||
*/
|
||||
void JL_rcsp_auth_recieve(u16 ble_con_handle, u8 *spp_remote_addr, u8 *buffer, u16 len);
|
||||
|
||||
u8 get_rcsp_version(void);
|
||||
|
||||
/**
|
||||
* @brief 设置设备rcsp验证情况
|
||||
*
|
||||
* @param hdl 第一个连接设备的认证情况
|
||||
* @param hdl1 第二个连接设备的认证情况
|
||||
*/
|
||||
void JL_rcsp_set_auth_hdl(JL_rcsp_auth_hdl *hdl, JL_rcsp_auth_hdl *hdl1);
|
||||
|
||||
/**
|
||||
* @brief 获取设备是否rcsp验证
|
||||
*
|
||||
* @param hdl 第一个连接设备的认证情况
|
||||
* @param hdl1 第二个连接设备的认证情况
|
||||
*/
|
||||
void JL_rcsp_get_auth_hdl(JL_rcsp_auth_hdl *hdl, JL_rcsp_auth_hdl *hdl1);
|
||||
|
||||
/**
|
||||
* @brief 设备连接认证/断开连接后lib会调用这个函数,
|
||||
* 应用层需要调用JL_rcsp_get_auth_hdl获取手机的认证状态,
|
||||
* 并把手机的认证情况同步到tws对端
|
||||
*/
|
||||
void JL_rcsp_auth_flag_tws_sync(void);
|
||||
|
||||
#endif //_JL_RCSP_LIB_H_
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef __JL_RCSP_ATTR_H__
|
||||
#define __JL_RCSP_ATTR_H__
|
||||
#include "typedef.h"
|
||||
|
||||
typedef u32(*attr_get_func)(void *priv, u8 attr, u8 *buf, u16 buf_size, u32 offset);
|
||||
typedef void (*attr_set_func)(void *priv, u8 attr, u8 *data, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
|
||||
u16 add_one_attr_huge(u8 *buf, u16 max_len, u8 offset, u8 type, u8 *data, u16 size);
|
||||
u8 add_one_attr(u8 *buf, u16 max_len, u8 offset, u8 type, u8 *data, u8 size);
|
||||
u8 add_one_attr_ex(u8 *buf, u16 max_len, u8 offset, u8 type, u8 *data, u8 size, u8 att_size);
|
||||
u8 add_one_attr_continue(u8 *buf, u16 max_len, u8 offset, u8 type, u8 *data, u8 size);
|
||||
u32 attr_get(void *priv, u8 *buf, u16 buf_size, const attr_get_func *func_tab, u8 attr_max, u32 mask);
|
||||
void attr_set(void *priv, u8 *data, u16 len, const attr_set_func *func_tab, u8 attr_max, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
|
||||
#endif//__JL_RCSP_ATTR_H__
|
||||
@@ -0,0 +1,122 @@
|
||||
#ifndef __JL_PACKET_H__
|
||||
#define __JL_PACKET_H__
|
||||
|
||||
#include "typedef.h"
|
||||
#include "generic/list.h"
|
||||
|
||||
#define READ_BIG_U16(a) ((*((u8*)(a)) <<8) + *((u8*)(a)+1))
|
||||
#define READ_BIG_U32(a) ((*((u8*)(a)) <<24) + (*((u8*)(a)+1)<<16) + (*((u8*)(a)+2)<<8) + *((u8*)(a)+3))
|
||||
|
||||
#define READ_LIT_U16(a) (*((u8*)(a)) + (*((u8*)(a)+1)<<8))
|
||||
#define READ_LIT_U32(a) (*((u8*)(a)) + (*((u8*)(a)+1)<<8) + (*((u8*)(a)+2)<<16) + (*((u8*)(a)+3)<<24))
|
||||
|
||||
|
||||
#define WRITE_BIG_U16(a,src) {*((u8*)(a)+0) = (u8)(src>>8); *((u8*)(a)+1) = (u8)(src&0xff); }
|
||||
#define WRITE_BIG_U32(a,src) {*((u8*)(a)+0) = (u8)((src)>>24); *((u8*)(a)+1) = (u8)(((src)>>16)&0xff);*((u8*)(a)+2) = (u8)(((src)>>8)&0xff);*((u8*)(a)+3) = (u8)((src)&0xff);}
|
||||
|
||||
#define WRITE_LIT_U16(a,src) {*((u8*)(a)+1) = (u8)(src>>8); *((u8*)(a)+0) = (u8)(src&0xff); }
|
||||
#define WRITE_LIT_U32(a,src) {*((u8*)(a)+3) = (u8)((src)>>24); *((u8*)(a)+2) = (u8)(((src)>>16)&0xff);*((u8*)(a)+1) = (u8)(((src)>>8)&0xff);*((u8*)(a)+0) = (u8)((src)&0xff);}
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
typedef union __HEAD_BIT {
|
||||
struct {
|
||||
u16 _OpCode: 8; //OpCode val
|
||||
u16 _app_type : 3; //app_type
|
||||
u16 _unsed : 3; //unsed
|
||||
u16 _resp : 1; //request for response
|
||||
u16 _type : 1; //command or response
|
||||
} _i;
|
||||
u16 _t;
|
||||
} HEAD_BIT;
|
||||
|
||||
struct __JL_PACKET {
|
||||
u8 tag[3];
|
||||
HEAD_BIT head;
|
||||
u16 length;
|
||||
u8 data[0];
|
||||
};
|
||||
#pragma pack()
|
||||
typedef struct __JL_PACKET JL_PACKET;
|
||||
|
||||
typedef struct __JL_QUEUE {
|
||||
struct list_head head;
|
||||
u32 total_size;
|
||||
u32 max_size;
|
||||
} JL_QUEUE;
|
||||
|
||||
typedef struct __JL_PACKET_ENTRY {
|
||||
struct list_head entry;
|
||||
u16 packet_size;
|
||||
u8 packet[0];
|
||||
} JL_PACKET_ENTRY;
|
||||
|
||||
struct __JL_PACKET_CONTROL {
|
||||
JL_PACKET packet;
|
||||
JL_QUEUE queue;
|
||||
u8 *packet_buf;
|
||||
u32 packet_offset;
|
||||
u32 packet_remain;
|
||||
};
|
||||
typedef struct __JL_PACKET_CONTROL JL_PACKET_CONTROL;
|
||||
|
||||
#define JL_PACK_START_TAG0 (0xfe)
|
||||
#define JL_PACK_START_TAG1 (0xdc)
|
||||
#define JL_PACK_START_TAG2 (0xba)
|
||||
#define JL_PACK_END_TAG (0xef)
|
||||
#define JL_ONE_PACKET_LEN(n) (sizeof(JL_PACKET) + n + 1)
|
||||
|
||||
#ifdef JL_RCSP_UBOOT_LIB
|
||||
#define JL_MTU_RESV (540L)
|
||||
#define JL_MTU_SEND (128L)
|
||||
#define JL_RECIEVE_BUF_SIZE ((JL_MTU_RESV + sizeof(JL_PACKET))*2)
|
||||
#define JL_CMD_POOL_SIZE (JL_MTU_SEND)
|
||||
#define JL_RESP_POOL_SIZE (JL_MTU_SEND*2)
|
||||
#define JL_WAIT_RESP_POOL_SIZE (JL_MTU_SEND)
|
||||
#else
|
||||
#define JL_MTU_RESV (540L)
|
||||
#define JL_MTU_SEND (128L)
|
||||
#define JL_RECIEVE_BUF_SIZE (JL_MTU_RESV + sizeof(JL_PACKET) + 128)
|
||||
#define JL_CMD_POOL_SIZE (JL_MTU_SEND*4)
|
||||
#define JL_RESP_POOL_SIZE (JL_MTU_SEND*2)
|
||||
#define JL_WAIT_RESP_POOL_SIZE (JL_MTU_SEND*2)
|
||||
#endif
|
||||
|
||||
void set_jl_rcsp_recieve_buf_size(u16 size);
|
||||
u16 rcsp_packet_write_alloc_len(void);
|
||||
|
||||
u32 rcsp_packet_need_buf_size(void);
|
||||
u32 rcsp_packet_buf_init(u8 *buf, u32 len, u8 *buf1, u32 len1);
|
||||
|
||||
u16 JL_packet_get_rx_max_mtu(void);
|
||||
u16 JL_packet_get_tx_max_mtu(void);
|
||||
u16 JL_packet_set_mtu(u16 mtu);
|
||||
void JL_packet_recieve(void *buf, u16 len, u8 buf_index);
|
||||
void JL_packet_clear_all_data(void);
|
||||
bool JL_packet_find(u8 **r_buf, JL_PACKET **packet, u8 buf_index);
|
||||
void JL_packet_init(void);
|
||||
void JL_packet_clear(void);
|
||||
|
||||
void JL_packet_packing(
|
||||
JL_PACKET *packet,
|
||||
u8 OpCode,
|
||||
u8 type,
|
||||
u8 request_rsp,
|
||||
u8 *extra_param,
|
||||
u16 extra_len,
|
||||
u8 *data,
|
||||
u16 len);
|
||||
|
||||
void set_jl_mtu_resv(u16 jl_mtu_resv_var);
|
||||
void set_jl_mtu_send(u16 jl_mtu_send_var);
|
||||
|
||||
extern u16 jl_mtu_resv;
|
||||
extern u16 jl_mtu_send;
|
||||
extern u16 jl_recieve_buf_size;
|
||||
extern u16 jl_cmd_pool_size;
|
||||
extern u16 jl_rcsp_pool_size;
|
||||
extern u16 jl_wait_rcsp_pool_size;
|
||||
|
||||
#endif//__JL_PACKET_H__
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
#ifndef __JL_PROTOCOL_H__
|
||||
#define __JL_PROTOCOL_H__
|
||||
|
||||
#include "typedef.h"
|
||||
#include "JL_rcsp_packet.h"
|
||||
|
||||
enum {
|
||||
JL_NOT_NEED_RESPOND = 0,
|
||||
JL_NEED_RESPOND,
|
||||
};
|
||||
|
||||
typedef enum __JL_ERR {
|
||||
JL_ERR_NONE = 0x0,
|
||||
JL_ERR_SEND_DATA_OVER_LIMIT,
|
||||
JL_ERR_SEND_BUSY,
|
||||
JL_ERR_SEND_NOT_READY,
|
||||
JL_ERR_EXIT,
|
||||
JL_ERR_SLAVE_SEND,
|
||||
JL_ERR_MAX,
|
||||
} JL_ERR;
|
||||
|
||||
typedef enum __JL_PRO_STATUS {
|
||||
JL_PRO_STATUS_SUCCESS = 0x0,
|
||||
JL_PRO_STATUS_FAIL,
|
||||
JL_PRO_STATUS_UNKOWN_CMD,
|
||||
JL_PRO_STATUS_BUSY,
|
||||
JL_PRO_STATUS_NO_RESPONSE,
|
||||
JL_PRO_STATUS_CRC_ERR,
|
||||
JL_PRO_STATUS_ALL_DATA_CRC_ERR,
|
||||
JL_PRO_STATUS_PARAM_ERR,
|
||||
JL_PRO_STATUS_RESP_DATA_OVER_LIMIT,
|
||||
|
||||
} JL_PRO_STATUS;
|
||||
|
||||
///*< JL_CMD、JL_CMD_response、JL_DATA、JL_DATA_response packet send functions>*/
|
||||
JL_ERR JL_CMD_send(u8 OpCode, u8 *data, u16 len, u8 request_rsp, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
JL_ERR JL_CMD_response_send(u8 OpCode, u8 status, u8 sn, u8 *data, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
JL_ERR JL_DATA_send(u8 OpCode, u8 CMD_OpCode, u8 *data, u16 len, u8 request_rsp, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
JL_ERR JL_DATA_response_send(u8 OpCode, u8 status, u8 sn, u8 CMD_OpCode, u8 *data, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
|
||||
///*<JL_CMD、JL_CMD_response、JL_DATA、JL_DATA_response recieve>*/
|
||||
typedef struct __JL_PRO_CB {
|
||||
/*send function callback, SPP or ble*/
|
||||
void *priv;
|
||||
// bool (*fw_ready)(void *priv);
|
||||
// s32(*fw_send)(void *priv, void *buf, u16 len);
|
||||
|
||||
/*JL_CMD、JL_CMD_response、JL_DATA、JL_DATA_response packet recieve callback*/
|
||||
void (*CMD_resp)(void *priv, u8 OpCode, u8 OpCode_SN, u8 *data, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
void (*DATA_resp)(void *priv, u8 OpCode_SN, u8 CMD_OpCode, u8 *data, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
void (*CMD_no_resp)(void *priv, u8 OpCode, u8 *data, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
void (*DATA_no_resp)(void *priv, u8 CMD_OpCode, u8 *data, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
void (*CMD_recieve_resp)(void *priv, u8 OpCode, u8 status, u8 *data, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
void (*DATA_recieve_resp)(void *priv, u8 status, u8 CMD_OpCode, u8 *data, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
u8(*wait_resp_timeout)(void *priv, u8 OpCode, u8 counter);
|
||||
// void (*auth_pass_callback)(void *priv);
|
||||
} JL_PRO_CB;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _rcsp_bound_hdl {
|
||||
u16 ble_con_handle;
|
||||
u8 spp_remote_addr[6];
|
||||
} JL_rcsp_bound_hdl;
|
||||
#pragma pack()
|
||||
|
||||
// 一拖二设备标识与底层buf的绑定
|
||||
void rcsp_protocol_bound(u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
// 一拖二设备标识与底层buf的解除绑定
|
||||
void rcsp_protocol_reset_bound(u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
|
||||
/**
|
||||
* @brief 设置协议绑定信息
|
||||
*
|
||||
* @param hdl 第一个连接设备的协议绑定信息
|
||||
* @param hdl1 第二个连接设备的协议绑定信息
|
||||
*/
|
||||
void rcsp_protocol_set_bound_hdl(JL_rcsp_bound_hdl *hdl, JL_rcsp_bound_hdl *hdl1);
|
||||
|
||||
/**
|
||||
* @brief 获取协议绑定信息
|
||||
*
|
||||
* @param hdl 第一个连接设备的协议绑定信息
|
||||
* @param hdl1 第二个连接设备的协议绑定信息
|
||||
*/
|
||||
void rcsp_protocol_get_bound_hdl(JL_rcsp_bound_hdl *hdl, JL_rcsp_bound_hdl *hdl1);
|
||||
|
||||
extern u32 rcsp_protocol_need_buf_size(void);
|
||||
|
||||
extern void JL_protocol_init(u8 *buf, u32 len);
|
||||
extern void JL_protocol_exit(void);
|
||||
|
||||
extern void JL_protocol_dev_switch(const JL_PRO_CB *cb);
|
||||
|
||||
extern void JL_protocol_data_recieve(void *priv, void *buf, u16 len, u16 ble_con_handle, u8 *spp_remote_addr);
|
||||
extern void JL_protocol_resume(void);
|
||||
|
||||
extern bool rcsp_send_list_is_empty(void);
|
||||
|
||||
extern void JL_send_packet_process(void);
|
||||
extern void JL_recieve_packet_parse_process(void);
|
||||
|
||||
|
||||
#endif//__JL_PROTOCOL_H__
|
||||
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
|
||||
#ifndef _BTSTACK_RCSP_USER_H_
|
||||
#define _BTSTACK_RCSP_USER_H_
|
||||
|
||||
#include "typedef.h"
|
||||
#include "JL_rcsp_api.h"
|
||||
#include "JL_rcsp_packet.h"
|
||||
#include "JL_rcsp_protocol.h"
|
||||
#include "btstack/le/att.h"
|
||||
|
||||
extern void *rcsp_server_ble_hdl; // ble连接handle
|
||||
extern void *rcsp_server_ble_hdl1; // ble连接handle,rcsp双连的时候有效
|
||||
|
||||
/**
|
||||
* @brief rcsp ble/spp handle初始化
|
||||
*/
|
||||
void bt_rcsp_interface_init(const uint8_t *rcsp_profile_data);
|
||||
|
||||
/**
|
||||
* @brief rcsp ble/spp handle退出并销毁
|
||||
*/
|
||||
void bt_rcsp_interface_exit(void);
|
||||
|
||||
/**
|
||||
* @brief 获取rcsp已连接设备数目
|
||||
*
|
||||
* @result 返回连接的手机设备数
|
||||
*/
|
||||
u8 bt_rcsp_device_conn_num(void);
|
||||
/**
|
||||
* @brief 获取当前已连接ble数目
|
||||
*
|
||||
* @result 返回连接的ble手机设备数
|
||||
*/
|
||||
u8 bt_rcsp_ble_conn_num(void);
|
||||
/**
|
||||
* @brief 获取当前已连接spp数目
|
||||
*
|
||||
* @result 返回连接的spp手机设备数
|
||||
*/
|
||||
u8 bt_rcsp_spp_conn_num(void);
|
||||
|
||||
/**
|
||||
* @brief 在连接或断开的时候,设置rcsp蓝牙连接信息
|
||||
*
|
||||
* @param con_handle ble连接或断开时输入
|
||||
* @param remote_addr spp连接或断开时输入
|
||||
* @param isconn true:连接;false:断开
|
||||
*/
|
||||
void bt_rcsp_set_conn_info(u16 con_handle, void *remote_addr, bool isconn);
|
||||
|
||||
/**
|
||||
* @brief 用于tws同步,从机接收到主机的tws数据后同步到本地
|
||||
*
|
||||
* @param bt handle数据
|
||||
* @param bt handle数据长度
|
||||
*/
|
||||
void rcsp_interface_set_bt_hdl_with_tws_data(u8 *recieve_buf, u16 recieve_len);
|
||||
|
||||
|
||||
/**
|
||||
* @brief rcsp用户自定义ble广播名字
|
||||
*/
|
||||
// _WEAK_ const char *rcsp_ble_name()
|
||||
|
||||
/**
|
||||
* @brief 用于外部接收ble/spp自定义数据使用
|
||||
*
|
||||
* @param ble_con_hdl ble发送句柄
|
||||
* @param remote_addr spp发送地址
|
||||
* @param buf 接收数据
|
||||
* @param len 接收数据的长度
|
||||
* @param att_handle ble_con_hdl有值时,ble的特征值,一般是用户自定义的特征
|
||||
*/
|
||||
// _WEAK_ void bt_rcsp_custom_recieve_callback(u16 ble_con_hdl, void *remote_addr, u8 *buf, u16 len, uint16_t att_handle)
|
||||
|
||||
/**
|
||||
* @brief 用于发送ble/spp自定义数据使用
|
||||
*
|
||||
* @param ble_con_hdl ble发送句柄
|
||||
* @param remote_addr spp发送地址 注:当ble_con_hdl与remote_addr都不填时,给所有的设备都发数据
|
||||
* @param buf 发送的数据
|
||||
* @param len 发送的数据长度
|
||||
* @param att_handle ble_con_hdl有值时,可填用户自定义的特征, 为0是rcsp的特征值
|
||||
* @param att_op_type 参考att_op_type_e枚举的排序
|
||||
*/
|
||||
void bt_rcsp_custom_data_send(u16 ble_con_hdl, u8 *remote_addr, u8 *buf, u16 len, uint16_t att_handle, att_op_type_e att_op_type);
|
||||
|
||||
/**
|
||||
* @brief 用于rcsp接收ble/spp数据使用
|
||||
*
|
||||
* @param hdl ble/spp发送句柄
|
||||
* @param remote_addr spp发送地址
|
||||
* @param buf 接收数据
|
||||
* @param len 接收数据的长度
|
||||
*/
|
||||
void bt_rcsp_recieve_callback(void *hdl, void *remote_addr, u8 *buf, u16 len);
|
||||
|
||||
/**
|
||||
* @brief 设置rcsp的ble的默认发送特征
|
||||
*
|
||||
* @param att_handle ble_con_hdl有值时,可填用户自定义的特征, 为0是rcsp的特征值
|
||||
* @param att_op_type 参考att_op_type_e枚举的排序,为0是rcsp的特征值
|
||||
*/
|
||||
void bt_rcsp_set_default_send_att_msg(uint16_t att_handle, att_op_type_e att_op_type);
|
||||
|
||||
/**
|
||||
* @brief 用于发送rcsp的数据使用
|
||||
*
|
||||
* @param ble_con_hdl ble发送句柄
|
||||
* @param remote_addr spp发送地址 注:当ble_con_hdl与remote_addr都不填时,给所有的设备都发数据
|
||||
* @param buf 发送的数据
|
||||
* @param len 发送的数据长度
|
||||
* @param att_handle ble_con_hdl有值时,可填用户自定义的特征, 为0是rcsp的特征值,或者是bt_rcsp_set_default_send_att_msg设置的
|
||||
* @param att_op_type 参考att_op_type_e枚举的排序,为0是rcsp默认配置,或者是bt_rcsp_set_default_send_att_msg设置的
|
||||
*/
|
||||
int bt_rcsp_data_send(u16 ble_con_hdl, u8 *remote_addr, u8 *buf, u16 len, uint16_t att_handle, u8 att_op_type);
|
||||
|
||||
/**
|
||||
* @brief 获取当前ble连接设备的mac地址
|
||||
*/
|
||||
u8 *rcsp_get_ble_hdl_remote_mac_addr(u16 ble_con_handle);
|
||||
|
||||
/**
|
||||
* @brief 获取tws同步的bt handle的总buf大小
|
||||
*/
|
||||
u16 rcsp_interface_tws_sync_buf_size();
|
||||
|
||||
/**
|
||||
* @brief rcsp主机同步bt handle数据给从机
|
||||
*
|
||||
* @param send_buf 外部malloc的一个指针,size根据rcsp_interface_tws_sync_buf_size获取
|
||||
*/
|
||||
void rcsp_interface_tws_sync_buf_content(u8 *send_buf);
|
||||
|
||||
/**
|
||||
* @brief tws同步rcsp bt_handle信息,用于tws同步ble句柄信息
|
||||
* 已实现于rcsp_bt_manage.c
|
||||
*/
|
||||
// _WEAK_ void rcsp_interface_bt_handle_tws_sync(void)
|
||||
|
||||
/**
|
||||
* @brief 用于外部自定义att_read_callback的使用
|
||||
*
|
||||
* @param hdl ble的结构体句柄
|
||||
* @param connection_handle ble的连接句柄
|
||||
* @param att_handle ble特征值
|
||||
* @param offset
|
||||
* @param buffer 读特征的数据
|
||||
* @param buffer_size 读特征的数据长度
|
||||
*/
|
||||
// _WEAK_ uint16_t bt_rcsp_custom_att_read_callback(void *hdl, hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t offset, uint8_t *buffer, uint16_t buffer_size)
|
||||
|
||||
/**
|
||||
* @brief 用于外部自定义att_write_callback的使用
|
||||
*
|
||||
* @param hdl ble的结构体句柄
|
||||
* @param connection_handle ble的连接句柄
|
||||
* @param att_handle ble特征值
|
||||
* @param transaction_mode
|
||||
* @param offset
|
||||
* @param buffer 写特征的数据
|
||||
* @param buffer_size 写特征的数据长度
|
||||
*/
|
||||
// _WEAK_ void bt_rcsp_custom_att_write_callback(void *hdl, hci_con_handle_t connection_handle, uint16_t att_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size)
|
||||
|
||||
#endif // _BTSTACK_RCSP_USER_H_
|
||||
Reference in New Issue
Block a user