]> rtime.felk.cvut.cz Git - tiny-bt.git/blobdiff - src2/hil2cap.h
new version
[tiny-bt.git] / src2 / hil2cap.h
diff --git a/src2/hil2cap.h b/src2/hil2cap.h
new file mode 100644 (file)
index 0000000..1394760
--- /dev/null
@@ -0,0 +1,111 @@
+//
+// C++ Interface: hil2cap
+//
+// Description: 
+//
+//
+// Author: root <root@ubuntu>, (C) 2008
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef __HIL2CAP
+#define __HIL2CAP
+
+#include"hcidriver.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;
+
+typedef enum{
+       LINUX = 0,
+       UART = 1
+}hw_connection_type;
+
+#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;
+       int (*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{
+       hw_connection_type type;
+       __u16 dev_identif; // like a device descriptor
+       hci_dev_info dev;
+}bt_device;
+
+
+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{
+       __u16   *p_handle;
+       //bt_address    *p_address; // address of device whoo iniciated this connection
+       void (*callback_app_connection_complete)(__u16 *p_handle, bt_address *p_address);
+}connection_complete_data;
+
+
+extern int create_master_connection(connection_hci *p_connection);
+extern int show_all_local_dev(struct hci_dev_info *master);
+extern int show_all_remote_dev(struct hci_dev_info *master, bt_address *p_remadrar,int *p_remd_count);
+
+extern int l2cap_call_cmd(__u16 ocf_ogf,int dd, void *p_param);
+
+extern int req_fcn_add(cmd_state_request *p_req);
+extern void req_fcn_remove(void);
+
+extern void *rutine_catch_bd_addr(void *arg);
+
+
+
+
+#endif