]> rtime.felk.cvut.cz Git - tiny-bt.git/blob - src/hil2cap.h
part of master l2cap functions was implemented. Master initiate connection. Next...
[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 request states*/
25 #define FREE            0
26 #define ESTABLISHED     1
27 #define PENDING         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 DISCONNECT_CMD_OP               0x0604
36 #define REMOTE_NAME_REQUEST_CMD_OP      0x1904
37 #define RESET_CMD_OP                    0x030C
38 #define WRITE_LOCAL_NAME_CMD_OP         0x130C
39 #define READ_LOCAL_NAME_CMD_OP          0x140C
40 #define READ_BD_ADDR_CMD_OP             0x0910
41
42
43 #define MAX_CMD_STATE_REQUEST 0x0F
44 typedef struct{
45         __u8 actual_status;
46         __u8 id;
47         __u16 req_opcode;
48         __u16 evt_code;//codes of expected ansver event,command status event will be accepted everytime
49         void (*p_serv_rutine)(void); 
50
51 } __attribute__((packed)) cmd_state_request;
52
53
54 typedef struct{
55         __u16 con_id;
56         __u8 con_state;
57         struct hci_dev_info master;
58         struct hci_dev_info slave;
59         int handle;
60         int socket_fd;
61 }connection_hci;
62
63
64 extern int create_master_connection(connection_hci *p_connection);
65 extern int show_all_local_dev(struct hci_dev_info *master);
66 extern int show_all_remote_dev(struct hci_dev_info *master, bt_address *p_remadrar,int *p_remd_count);
67
68 extern int l2cap_call_cmd(__u16 ocf_ogf,int dd, void *p_param);
69
70 extern int req_fcn_add(cmd_state_request *p_req);
71 extern void req_fcn_remove(void);
72
73 extern void *rutine_catch_bd_addr(void *arg);
74
75
76
77
78 #endif