⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bt_api.h

📁 AMLOGIC DPF source code
💻 H
字号:
#ifndef __BT_API_H
#define __BT_API_H

#ifndef __BLUETOOTH_H

#include "bluetooth.h"

/* HCI ioctl defines */
#define HCIIOBASE			0x55AA
#define HCIDEVUP			(HCIIOBASE+1)
#define HCIDEVDOWN			(HCIIOBASE+2)
#define HCIDEVRESET			(HCIIOBASE+3)
#define HCIDEVRESTAT		(HCIIOBASE+4)

#define HCIGETDEVLIST		(HCIIOBASE+5)
#define HCIGETDEVINFO		(HCIIOBASE+6)
#define HCIGETCONNLIST		(HCIIOBASE+7)
#define HCIGETCONNINFO		(HCIIOBASE+8)
#define HCIGETREMOTENAME	(HCIIOBASE+9)

#define HCISETRAW			(HCIIOBASE+10)
#define HCISETSCAN			(HCIIOBASE+11)
#define HCISETAUTH			(HCIIOBASE+12)
#define HCISETENCRYPT		(HCIIOBASE+13)
#define HCISETPTYPE			(HCIIOBASE+14)
#define HCISETLINKPOL		(HCIIOBASE+15)
#define HCISETLINKMODE		(HCIIOBASE+16)
#define HCISETACLMTU		(HCIIOBASE+17)
#define HCISETSCOMTU		(HCIIOBASE+18)

#define HCISETSECMGR		(HCIIOBASE+19)

#define HCIINQUIRY			(HCIIOBASE+20)

#define HCICONNFLUSH		(HCIIOBASE+21)

#pragma Pack(1)

typedef struct hci_inquiry_info
{
	bdaddr_t bdaddr;
	__u8     pscan_rep_mode;
	__u8     pscan_period_mode;
	__u8     pscan_mode;
	__u8     dev_class[3];
	__u16    clock_offset;
} hci_inquiry_info_t;

#pragma Pack()


typedef struct hci_dev_stats
{
	__u32 err_rx;
	__u32 err_tx;
	__u32 cmd_tx;
	__u32 evt_rx;
	__u32 acl_tx;
	__u32 acl_rx;
	__u32 sco_tx;
	__u32 sco_rx;
	__u32 byte_rx;
	__u32 byte_tx;
} hci_dev_stats_t;

typedef struct hci_dev_info
{
	__u16 dev_id;
	char  name[8];

	bdaddr_t bdaddr;

	__u32 flags;
	__u8  type;

	__u8  features[8];

	__u32 pkt_type;
	__u32 link_policy;
	__u32 link_mode;

	__u16 acl_mtu;
	__u16 acl_pkts;
	__u16 sco_mtu;
	__u16 sco_pkts;

	hci_dev_stats_t stat;
} hci_dev_info_t;

typedef struct hci_inquiry_req
{
	__u16 dev_id;
	__u16 flags;
	//__u8  lap[3];
	__u32 lap;
	__u8  length;
	__u8  num_rsp;
	__u8 *buf;
} hci_inquiry_req_t;

typedef struct hci_remote_name_req
{
	__u16 dev_id;
	
	bdaddr_t bdaddr;
	__u8     pscan_rep_mode;
	__u16    clock_offset;
	
	__u8	timeout;
	char    *remote_name;
} hci_remote_name_req_t;

typedef struct hci_conn_flush_req
{
	__u16 dev_id;
	
	bdaddr_t bdaddr;
	__u8 type;
} hci_conn_flush_req_t;

#endif //__BLUETOOTH_H

typedef void* BT_FTP_Handle_t;
typedef void* BT_OPP_Handle_t;

#define BT_FTP_TYPE_NONE				0
#define BT_FTP_TYPE_DIR					1
#define BT_FTP_TYPE_FILE				2

typedef struct _BT_FTP_Dir_List
{
	char *name;
	int type;
	unsigned long size;
	
	struct _BT_FTP_Dir_List *next;
	
	//struct _BT_FTP_Dir_List *down;
	//struct _BT_FTP_Dir_List *up;
} BT_FTP_Dir_List_t;

typedef struct _BT_Local_Device
{
	hci_dev_info_t *hci_info;
	char *ba_str;
	char *user_name;
	
	BT_OPP_Handle_t opp_handle;
	char *opp_name;
	int opp_size;
	int opp_cur_size;
	int opp_abort_flag;
} BT_Local_Device_t;

typedef struct _BT_Remote_Device
{
	struct list_head list;
	spin_lock_t	lock;
	
	hci_inquiry_info_t *ir_info;
	char *ba_str;
	char *user_name;
	
	int ftp_channel;
	BT_FTP_Handle_t ftp_handle;
	BT_FTP_Dir_List_t *ftp_list;
	int ftp_list_nums;
} BT_Remote_Device_t;

typedef struct _BT_Inquiry_Arg
{
	int dev_id;
	int num_rsp;
	int timeout;
} BT_Inquiry_Arg_t;

typedef struct _BT_Device
{
	int fd;
	BT_Remote_Device_t *cur_remote;
	
	BT_Inquiry_Arg_t ir_arg;
	
	BT_Local_Device_t *local_dev;
	
	struct list_head remote_dev_list;
} BT_Device_t;

typedef int (*obex_file_cb_t)(int finish_flag);

int bt_open();
int bt_close(int fd);
void bt_print_enable(int en_flag);
hci_dev_info_t *bt_get_dev_info(int fd, int dev_id);
char *bt_get_remote_name(int fd, int dev_id, hci_inquiry_info_t *ir_info, int timeout);

int bt_get_ftp_channel(bdaddr_t *src, bdaddr_t *dst);
int bt_get_spp_channel(bdaddr_t *src, bdaddr_t *dst);

int bt_inquiry(BT_Device_t *bt_dev);
void bt_dev_free(BT_Device_t *bt_dev);
void bt_local_dev_free(BT_Local_Device_t *local_dev);
void bt_remote_dev_free(BT_Remote_Device_t *remote_dev);
BT_Remote_Device_t *bt_remote_get_next(struct list_head *head, BT_Remote_Device_t *cur_dev);
void bt_set_current_remote(BT_Device_t *bt_dev, BT_Remote_Device_t *remote_dev);
int bt_read_remote_name(BT_Device_t *bt_dev);
BT_Device_t *bt_enable();
int bt_disable(BT_Device_t *bt_dev);
BT_Device_t *bt_get_dev();
char* bt_get_pin_code(void);

int bt_ftp_open(BT_Device_t *bt_dev);
int bt_ftp_close(BT_Device_t *bt_dev);
int bt_ftp_is_open(BT_Device_t *bt_dev);
int bt_ftp_cdroot(BT_Device_t *bt_dev);
int bt_ftp_cdup(BT_Device_t *bt_dev);
int bt_ftp_cddir(BT_Device_t *bt_dev, char *new_dir);
int bt_ftp_cancel(BT_Device_t *bt_dev);
int bt_ftp_enable();

int bt_opp_start(BT_Device_t *bt_dev);
int bt_opp_stop(BT_Device_t *bt_dev);
int bt_opp_abort(BT_Device_t *bt_dev);
int bt_opp_cancel(BT_Device_t *bt_dev);
void bt_opp_enable();
char *bt_opp_get_filename(BT_Device_t *bt_dev);
int bt_opp_get_filesize(BT_Device_t *bt_dev);
int bt_opp_get_curfilesize(BT_Device_t *bt_dev);

#endif //__BT_API_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -