]> rtime.felk.cvut.cz Git - tiny-bt.git/blobdiff - testf/t4/tiny_bt_hci_core.h
new version of callback functions and new was added
[tiny-bt.git] / testf / t4 / tiny_bt_hci_core.h
diff --git a/testf/t4/tiny_bt_hci_core.h b/testf/t4/tiny_bt_hci_core.h
new file mode 100644 (file)
index 0000000..7203fff
--- /dev/null
@@ -0,0 +1,100 @@
+//
+// C++ Interface: hil2cap
+//
+// Description: 
+//
+//
+// Author: root <root@ubuntu>, (C) 2008
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef __TINI_BT_HCI_CORE
+#define __TINI_BT_HCI_CORE
+
+#include"tiny_bt_hci_cmd.h"
+#include<asm/types.h>
+#include<sys/socket.h>
+#include<errno.h>
+
+
+typedef enum{
+       DISCONNECT = 0,
+       CONNECT= 1
+}connection_state;
+
+typedef enum{
+       FREE = 0,
+       ESTABLISHED = 1,
+       PERMANENT = 2,
+       DONE = 3
+}req_state;
+
+#define MAX_CMD_STATE_REQUEST 0x0F
+#define MAX_EVT_COUNT  128
+
+typedef struct{
+       __u8 actual_status;
+       __u8 id;
+       __u16 req_opcode;
+       __u8 evt_code;//codes of expected ansver event,command status event will be accepted everytime
+       void (*p_serv_rutine)(void); 
+
+} __attribute__((packed)) cmd_state_request;
+
+typedef struct{
+       __u8 actual_status;
+       __u16 id;
+       __u8 evt_type;
+       __u16 req_opcode;
+       void (*p_callback)(void *p_arg, void *p_recbuf);
+       void *p_data;
+} __attribute__((packed)) expect_evt;
+
+typedef struct{
+       __u16 con_id;
+       __u8 con_state;
+       struct hci_dev_info master;
+       struct hci_dev_info slave;
+       uint16_t handle;
+       int socket_fd;
+}connection_hci;
+
+
+typedef struct{
+       bt_address *p_address;
+       void (*callback_app_read_bd_addr)(bt_address *p_address);
+}read_bd_addr_data;
+
+typedef struct{
+       char    *p_name;
+       void (*callback_app_read_local_name)(char *p_name);
+}read_local_name_data;
+
+typedef struct{
+       bt_address *p_address;
+       void (*callback_app_inquiry_RSSI)(bt_address *p_address);
+}inquiry_RSSI_data;
+
+typedef struct{
+       void (*callback_app_inquiry_complete)(void);
+}inquiry_complete_data;
+
+typedef struct{
+       __u16   *p_handle;
+       //bt_address    *p_address; // address of device whoo iniciated this connection
+       void (*callback_app_connection_complete)(__u16 *p_handle);
+}connection_complete_data;
+
+extern void add_evt_toarray(expect_evt *p_evt);
+extern int look_up_inarray(__u8 evt_type, __u16 opcode);
+extern int tiny_bt_init(__u8 dev_id);
+extern int tiny_bt_process();
+extern int tiny_bt_read_bd_addr(bt_address *p_dest, void(*callback_app_read_bd_addr)(bt_address *p_address));
+extern int tiny_bt_read_local_name(char *p_name, void(*callback_app_read_local_name)(char *p_name));
+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));
+extern void tiny_bt_inquiry_register_again(bt_address *p_dest_addr, void(*callback_app_inquiry_RSSI)(bt_address *p_address));
+extern int tiny_bt_connect(bt_address *p_dest_addr, __u16 *p_handle, void( *callback_app_connection_complete)(__u16 *p_handle));
+extern int tiny_bt_wait_for_connection();
+
+#endif