]> rtime.felk.cvut.cz Git - tiny-bt.git/blob - src/hil2cap.h
b3375fd55cdbc88bc86d066618cf557385b92c0a
[tiny-bt.git] / src / hil2cap.h
1 //
2 // C++ Interface: hil2cap
3 //
4 // Description: 
5 //
6 //
7 // Author: root <root@ubuntu>, (C) 2008
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12 #ifndef __HIL2CAP
13 #define __HIL2CAP
14
15 #include"hcidriver.h"
16 #include<asm/types.h>
17 #include<sys/socket.h>
18 #include<errno.h>
19
20 /* Connection states */
21 #define DISCONNECTED    0
22 #define CONNECTED       1
23
24 /* CMD\EVT states*/
25 #define FREE            0
26 #define ESTABLISHED     1
27 #define PERMANENT       2
28 #define DONE            3
29
30 /* CMD ocf and ogf */
31
32 #define INQUIRY_CMD_OP                  0x0104
33 #define INQUIRY_CANCEL_CMD_OP           0x0204
34 #define CREATE_CONNECTION_CMD_OP        0x0504
35 #define ACCEPT_CONNECTION_REQ           0x0904
36 #define DISCONNECT_CMD_OP               0x0604
37 #define REMOTE_NAME_REQUEST_CMD_OP      0x1904
38 #define RESET_CMD_OP                    0x030C
39 #define WRITE_LOCAL_NAME_CMD_OP         0x130C
40 #define READ_LOCAL_NAME_CMD_OP          0x140C
41 #define READ_BD_ADDR_CMD_OP             0x0910
42
43
44 #define MAX_CMD_STATE_REQUEST 0x0F
45 #define MAX_EVT_COUNT   128
46 typedef struct{
47         __u8 actual_status;
48         __u8 id;
49         __u16 req_opcode;
50         __u8 evt_code;//codes of expected ansver event,command status event will be accepted everytime
51         void (*p_serv_rutine)(void); 
52
53 } __attribute__((packed)) cmd_state_request;
54
55 typedef struct{
56         __u8 actual_status;
57         __u16 id;
58         __u8 evt_code;
59         int (*p_serv_rutine)(void *p_recbuf, int dd, struct hci_filter *p_pf, int *p_fchanged);
60 } __attribute__((packed)) incoming_evt;
61
62 typedef struct{
63         __u16 con_id;
64         __u8 con_state;
65         struct hci_dev_info master;
66         struct hci_dev_info slave;
67         uint16_t handle;
68         int socket_fd;
69 }connection_hci;
70
71
72 extern int create_master_connection(connection_hci *p_connection);
73 extern int show_all_local_dev(struct hci_dev_info *master);
74 extern int show_all_remote_dev(struct hci_dev_info *master, bt_address *p_remadrar,int *p_remd_count);
75
76 extern int l2cap_call_cmd(__u16 ocf_ogf,int dd, void *p_param);
77
78 extern int req_fcn_add(cmd_state_request *p_req);
79 extern void req_fcn_remove(void);
80
81 extern void *rutine_catch_bd_addr(void *arg);
82
83
84
85
86 #endif