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 <asm/types.h>
16 #include <sys/socket.h>
18 #include "tiny_bt_hci_cmd.h"
20 #define MAX_CMD_STATE_REQUEST 0x0F
21 #define MAX_EVT_COUNT 128
39 __u8 evt_code; /*codes of expected ansver event,command status event will be accepted everytime*/
40 void (*p_serv_rutine)(void);
41 } __attribute__((packed)) cmd_state_request;
48 void (*p_callback)(void *p_arg, void *p_recbuf);
50 } __attribute__((packed)) expect_evt;
55 struct hci_dev_info master;
56 struct hci_dev_info slave;
62 bt_address *p_address;
63 void (*callback_app_read_bd_addr)(bt_address *p_address);
68 void (*callback_app_read_local_name)(char *p_name);
69 } read_local_name_data;
72 bt_address *p_address;
73 void (*callback_app_inquiry_RSSI)(bt_address *p_address);
77 void (*callback_app_inquiry_complete)(void);
78 } inquiry_complete_data;
81 bt_address *p_address;
82 void (*callback_app_connection_request)(bt_address *p_address);
83 } connection_request_data;
87 //bt_address *p_address; // address of device whoo iniciated this connection
88 void (*callback_app_connection_complete)(__u16 *p_handle);
89 } connection_complete_data;
94 void (*callback_app_disconnect)(__u16 *p_handle, __u8 *p_reason);
97 extern void add_evt_toarray(expect_evt *p_evt);
98 extern int look_up_inarray(__u8 evt_type, __u16 opcode);
99 extern int tiny_bt_init(__u8 dev_id);
100 extern int tiny_bt_finish();
101 extern int tiny_bt_process();
102 extern int tiny_bt_read_bd_addr(bt_address *p_dest, void(*callback_app_read_bd_addr)(bt_address *p_address));
103 extern int tiny_bt_read_local_name(char *p_name, void(*callback_app_read_local_name)(char *p_name));
104 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));
105 extern void tiny_bt_inquiry_register_again(bt_address *p_dest_addr, void(*callback_app_inquiry_RSSI)(bt_address *p_address));
106 extern int tiny_bt_connect(bt_address *p_dest_addr, __u16 *p_handle, void( *callback_app_connection_complete)(__u16 *p_handle));
107 extern void tiny_bt_wait_for_connection(bt_address *p_dest_addr, void(*callback_app_conection_request)(bt_address *p_address));
108 extern int tiny_bt_accept_connection(bt_address *p_dest_addr,__u16 *p_handle, void(*callback_app_connection_complete)(__u16 *p_handle));
109 extern void tiny_bt_disconnect_register(void(*callback_app_disconnect)(__u16 *p_handle, __u8 *p_reason));
110 extern int tiny_bt_disconnect(__u16 *p_handle, void(*callback_app_disconnect)(__u16 *p_handle, __u8 *p_reason));
111 extern int tiny_bt_send_data(char *p_data, __u16 lenght, __u16 *p_chandle, __u16 PB_flag, __u16 B_flag);