在逗猫棒的基础上实现蓝牙转USB功能,目前功能已经实现,还需裁剪掉之前逗猫棒的业务程序
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#ifndef __ADAPTER_ODEV_BLE_H__
|
||||
#define __ADAPTER_ODEV_BLE_H__
|
||||
|
||||
#include "generic/typedef.h"
|
||||
#include "le_client_demo.h"
|
||||
#include "app_config.h"
|
||||
|
||||
#define DEVICE_RSSI_LEVEL (-50)
|
||||
#define POWER_ON_PAIR_TIME (3500)//unit ms,切换搜索回连周期
|
||||
|
||||
struct _odev_ble_parm {
|
||||
client_conn_cfg_t *cfg_t;
|
||||
};
|
||||
|
||||
enum {
|
||||
ODEV_BLE_CLOSE,
|
||||
ODEV_BLE_OPEN,
|
||||
ODEV_BLE_START,
|
||||
ODEV_BLE_STOP,
|
||||
};
|
||||
|
||||
enum {
|
||||
MATCH_KEYBOARD,
|
||||
MATCH_MOUSE,
|
||||
MATCH_NULL,
|
||||
};
|
||||
|
||||
struct _odev_ble {
|
||||
u16 ble_connected;
|
||||
u16 ble_timer_id;
|
||||
u8 status;
|
||||
u8 match_type;
|
||||
struct ble_client_operation_t *ble_client_api;
|
||||
struct _odev_ble_parm *parm;
|
||||
};
|
||||
|
||||
int adapter_odev_ble_open(void *priv);
|
||||
int adapter_odev_ble_start(void *priv);
|
||||
int adapter_odev_ble_stop(void *priv);
|
||||
int adapter_odev_ble_close(void *priv);
|
||||
int adapter_odev_ble_config(int cmd, void *parm);
|
||||
int adapter_odev_ble_send(void *priv, u8 *buf, u16 len);
|
||||
|
||||
void adapter_odev_ble_search_device(void);
|
||||
|
||||
//dongle
|
||||
void dongle_ble_report_data_deal(att_data_report_t *report_data, target_uuid_t *search_uuid);
|
||||
void dongle_adapter_event_callback(le_client_event_e event, u8 *packet, int size);
|
||||
int dongle_ble_send(void *priv, u8 *buf, u16 len);
|
||||
|
||||
//wireless_mic
|
||||
void wireless_mic_ble_report_data_deal(att_data_report_t *report_data, target_uuid_t *search_uuid);
|
||||
void wireless_adapter_event_callback(le_client_event_e event, u8 *packet, int size);
|
||||
int wireless_mic_ble_send(void *priv, u8 *buf, u16 len);
|
||||
|
||||
#define BLE_REPORT_DATA_DEAL(a,b) wireless_mic_ble_report_data_deal(a,b)
|
||||
#define ADAPTER_EVENT_CALLBACK(a,b,c) wireless_adapter_event_callback(a,b,c)
|
||||
#define ADAPTER_ODEV_BLE_SEND(a,b,c) wireless_mic_ble_send(a,b,c)
|
||||
|
||||
extern struct _odev_ble odev_ble;
|
||||
extern client_conn_cfg_t odev_ble_conn_config;
|
||||
|
||||
#endif//__ADAPTER_ODEV_BLE_H__
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef __ADAPTER_ODEV_BT_H__
|
||||
#define __ADAPTER_ODEV_BT_H__
|
||||
|
||||
#include "generic/typedef.h"
|
||||
|
||||
#include "adapter_odev_edr.h"
|
||||
#include "adapter_odev_ble.h"
|
||||
|
||||
enum {
|
||||
ODEV_EDR = 0x0,
|
||||
ODEV_BLE,
|
||||
};
|
||||
|
||||
struct _odev_bt_parm {
|
||||
u8 mode;
|
||||
struct _odev_edr_parm edr_parm;
|
||||
struct _odev_ble_parm ble_parm;
|
||||
};
|
||||
|
||||
struct _odev_bt {
|
||||
struct _odev_bt_parm *parm;
|
||||
struct _odev_edr *edr;
|
||||
struct _odev_ble *ble;
|
||||
};
|
||||
#endif//__ADAPTER_ODEV_BT_H__
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
#ifndef __ADAPTER_ODEV_EDR_H__
|
||||
#define __ADAPTER_ODEV_EDR_H__
|
||||
|
||||
#include "generic/typedef.h"
|
||||
#include "user_cfg.h"
|
||||
#include "event.h"
|
||||
#include "sbc_enc.h"
|
||||
|
||||
|
||||
#define SEARCH_BD_ADDR_LIMITED 0
|
||||
#define SEARCH_BD_NAME_LIMITED 1
|
||||
#define SEARCH_CUSTOM_LIMITED 2
|
||||
#define SEARCH_NULL_LIMITED 3
|
||||
|
||||
#define SEARCH_LIMITED_MODE SEARCH_BD_NAME_LIMITED
|
||||
|
||||
enum {
|
||||
ODEV_EDR_CLOSE,
|
||||
ODEV_EDR_OPEN,
|
||||
ODEV_EDR_START,
|
||||
ODEV_EDR_STOP,
|
||||
};
|
||||
|
||||
struct _odev_edr {
|
||||
struct list_head inquiry_noname_head;
|
||||
u8 edr_search_busy;
|
||||
u8 edr_read_name_start;
|
||||
u8 edr_search_spp;
|
||||
u8 status;
|
||||
|
||||
int (*fun)(void *, u8, u8, void *);
|
||||
void *priv;
|
||||
u8 mode;
|
||||
|
||||
u16 call_timeout;
|
||||
volatile u16 start_a2dp_flag;
|
||||
struct _odev_edr_parm *parm;
|
||||
};
|
||||
|
||||
struct _odev_edr_parm {
|
||||
u8 poweron_start_search : 1;
|
||||
u8 disable_filt : 1;
|
||||
u8 discon_always_search : 1;
|
||||
u8 inquiry_len;
|
||||
u8 search_type;
|
||||
u8 bt_name_filt_num;
|
||||
u8(*bt_name_filt)[LOCAL_NAME_LEN];
|
||||
u8 spp_name_filt_num;
|
||||
u8(*spp_name_filt)[LOCAL_NAME_LEN];
|
||||
u8 bd_addr_filt_num;
|
||||
u8(*bd_addr_filt)[6];
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
AVCTP_OPID_VOLUME_UP = 0x41,
|
||||
AVCTP_OPID_VOLUME_DOWN = 0x42,
|
||||
AVCTP_OPID_MUTE = 0x43,
|
||||
AVCTP_OPID_PLAY = 0x44,
|
||||
AVCTP_OPID_STOP = 0x45,
|
||||
AVCTP_OPID_PAUSE = 0x46,
|
||||
AVCTP_OPID_NEXT = 0x4B,
|
||||
AVCTP_OPID_PREV = 0x4C,
|
||||
} AVCTP_CMD_TYPE;
|
||||
|
||||
|
||||
int adapter_odev_edr_open(void *priv);
|
||||
int adapter_odev_edr_start(void *priv);
|
||||
int adapter_odev_edr_stop(void *priv);
|
||||
int adapter_odev_edr_close(void *priv);
|
||||
int adapter_odev_edr_get_status(void *priv);
|
||||
int adapter_odev_edr_config(int cmd, void *parm);
|
||||
int adapter_odev_edr_pp(u8 pp);
|
||||
int adapter_odev_edr_media_prepare(u8 mode, int (*fun)(void *, u8, u8, void *), void *priv);
|
||||
|
||||
void adapter_odev_edr_search_device(void);
|
||||
void adapter_odev_edr_search_stop();
|
||||
|
||||
extern struct _odev_edr odev_edr;
|
||||
#endif//__ADAPTER_ODEV_BT_H__
|
||||
|
||||
Reference in New Issue
Block a user