2 // C++ Interface: hil2cap
7 // Author: root <root@ubuntu>, (C) 2008
9 // Copyright: See COPYING file that comes with this distribution
12 #ifndef __TINI_BT_HCI_CORE
13 #define __TINI_BT_HCI_CORE
15 #include"tiny_bt_hci_cmd.h"
17 #include<sys/socket.h>
33 #define MAX_CMD_STATE_REQUEST 0x0F
34 #define MAX_EVT_COUNT 128
40 __u8 evt_code;//codes of expected ansver event,command status event will be accepted everytime
41 void (*p_serv_rutine)(void);
43 } __attribute__((packed)) cmd_state_request;
50 void (*p_callback)(void *p_arg, void *p_recbuf);
52 } __attribute__((packed)) expect_evt;
57 struct hci_dev_info master;
58 struct hci_dev_info slave;
65 bt_address *p_address;
66 void (*callback_app_read_bd_addr)(bt_address *p_address);
71 void (*callback_app_read_local_name)(char *p_name);
72 }read_local_name_data;
75 bt_address *p_address;
76 void (*callback_app_inquiry_RSSI)(bt_address *p_address);
80 void (*callback_app_inquiry_complete)(void);
81 }inquiry_complete_data;
85 //bt_address *p_address; // address of device whoo iniciated this connection
86 void (*callback_app_connection_complete)(__u16 *p_handle);
87 }connection_complete_data;
89 extern void add_evt_toarray(expect_evt *p_evt);
90 extern int look_up_inarray(__u8 evt_type, __u16 opcode);
91 extern int tiny_bt_init(__u8 dev_id);
92 extern int tiny_bt_process();
93 extern int tiny_bt_read_bd_addr(bt_address *p_dest, void(*callback_app_read_bd_addr)(bt_address *p_address));
94 extern int tiny_bt_read_local_name(char *p_name, void(*callback_app_read_local_name)(char *p_name));
95 extern int tiny_bt_inquiry(bt_address *p_dest_addr, void(*callback_app_inquiry_RSSI)(bt_address *p_address), void(*callback_app_inquiry_complete)(void));
96 extern void tiny_bt_inquiry_register_again(bt_address *p_dest_addr, void(*callback_app_inquiry_RSSI)(bt_address *p_address));
97 extern int tiny_bt_connect(bt_address *p_dest_addr, __u16 *p_handle, void( *callback_app_connection_complete)(__u16 *p_handle));
98 extern int tiny_bt_wait_for_connection();