[Adapt: HAL] Implement rfcomm socket connect
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / bluez_hal / inc / bt-hal-msg.h
1 /*
2  * Copyright (c) 2015 -2016 Samsung Electronics Co., Ltd All Rights Reserved.
3  *
4  * Contact: Anupam Roy <anupam.r@samsung.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20
21 #ifndef _BT_HAL_MSG_H_
22 #define _BT_HAL_MSG_H_
23
24 #define HAL_MINIMUM_EVENT               0x81
25 /*TODO: More events to be added in subsequent patches */
26
27 /* HAL Global Macros */
28 #define HAL_POWER_OFF                   0x00
29 #define HAL_POWER_ON                    0x01
30
31 #define HAL_PROP_ADAPTER_NAME                   0x01
32 #define HAL_PROP_ADAPTER_ADDR                   0x02
33 #define HAL_PROP_ADAPTER_UUIDS                  0x03
34 #define HAL_PROP_ADAPTER_CLASS                  0x04
35 #define HAL_PROP_ADAPTER_TYPE                   0x05
36 #define HAL_PROP_ADAPTER_SERVICE_REC            0x06
37 #define HAL_PROP_ADAPTER_SCAN_MODE              0x07
38 #define HAL_PROP_ADAPTER_BONDED_DEVICES         0x08
39 #define HAL_PROP_ADAPTER_DISC_TIMEOUT           0x09
40
41
42 #define HAL_PROP_DEVICE_NAME                    0x01
43 #define HAL_PROP_DEVICE_ADDR                    0x02
44 #define HAL_PROP_DEVICE_UUIDS                   0x03
45 #define HAL_PROP_DEVICE_CLASS                   0x04
46 #define HAL_PROP_DEVICE_TYPE                    0x05
47 #define HAL_PROP_DEVICE_SERVICE_REC             0x06
48
49 /* Tizen specific HAL Adapter and Device property types.
50    These properties have to added to HAL bt_property_type_t enums */
51
52 struct hal_prop_device_service_rec {
53         uint8_t uuid[16];
54         uint16_t channel;
55         uint8_t name_len;
56         uint8_t name[];
57 } __attribute__((packed));
58
59 #define HAL_PROP_DEVICE_FRIENDLY_NAME            0x0a
60 #define HAL_PROP_DEVICE_RSSI                     0x0b
61 #define HAL_PROP_DEVICE_VERSION_INFO             0x0c
62 /*
63  * Tizen specific HAL Adapter and Device property types.
64  * These properties have to added to HAL bt_property_type_t enums
65  */
66 #define HAL_PROP_DEVICE_PAIRED                  0x0d
67 #define HAL_PROP_DEVICE_CONNECTED               0x0e
68 #define HAL_PROP_DEVICE_TRUSTED                 0x0f
69 #define HAL_PROP_ADAPTER_PAIRABLE               0x10
70 #define HAL_PROP_ADAPTER_PAIRABLE_TIMEOUT       0x11
71 #define HAL_PROP_ADAPTER_VERSION                0x12
72 #define HAL_PROP_ADAPTER_IPSP_INITIALIZED       0x13
73 #define HAL_PROP_ADAPTER_MODALIAS               0x14
74
75 #define HAL_PROP_DEVICE_MANUFACTURER_DATA_LEN   0x15
76 #define HAL_PROP_DEVICE_MANUFACTURER_DATA       0x16
77 #define HAL_PROP_DEVICE_BLE_ADV_DATA            0x18
78 #define HAL_PROP_ADAPTER_LOCAL_LE_FEAT          0x19
79
80 struct hal_prop_device_info {
81         uint8_t version;
82         uint16_t sub_version;
83         uint16_t manufacturer;
84 } __attribute__((packed));
85
86 #define HAL_PROP_DEVICE_TIMESTAMP               0xFF
87
88 #define HAL_EV_ADAPTER_STATE_CHANGED    0x00
89 struct hal_ev_adapter_state_changed {
90         uint8_t state;
91 } __attribute__((packed));
92
93
94 struct hal_property {
95         uint8_t  type;
96         uint16_t len;
97         uint8_t  val[0];
98 } __attribute__((packed));
99
100 #define HAL_EV_ADAPTER_PROPS_CHANGED    0x01
101 struct hal_ev_adapter_props_changed {
102         uint8_t              status;
103         uint8_t              num_props;
104         struct  hal_property props[0];
105 } __attribute__((packed));
106
107
108 #define HAL_DISCOVERY_STATE_STOPPED     0x00
109 #define HAL_DISCOVERY_STATE_STARTED     0x01
110
111 #define HAL_EV_DISCOVERY_STATE_CHANGED  0x85
112 struct hal_ev_discovery_state_changed {
113         uint8_t state;
114 } __attribute__((packed));
115
116 #define HAL_EV_REMOTE_DEVICE_PROPS      0x83
117 struct hal_ev_remote_device_props {
118         uint8_t             status;
119         uint8_t             bdaddr[6];
120         uint8_t             num_props;
121         struct hal_property props[0];
122 } __attribute__((packed));
123
124 #define HAL_EV_DEVICE_FOUND             0x84
125 struct hal_ev_device_found {
126         uint8_t             num_props;
127         struct hal_property props[0];
128 } __attribute__((packed));
129
130
131 /* Device callbacks */
132 #define HAL_EV_PIN_REQUEST              0x86
133 struct hal_ev_pin_request {
134         uint8_t  bdaddr[6];
135         uint8_t  name[249];
136         uint32_t class_of_dev;
137 } __attribute__((packed));
138
139 #define HAL_EV_SSP_REQUEST              0x87
140 struct hal_ev_ssp_request {
141         uint8_t  bdaddr[6];
142         uint8_t  name[249];
143         uint32_t class_of_dev;
144         uint8_t  pairing_variant;
145         uint32_t passkey;
146 } __attribute__((packed));
147
148 #define HAL_BOND_STATE_NONE 0
149 #define HAL_BOND_STATE_BONDING 1
150 #define HAL_BOND_STATE_BONDED 2
151
152 #define HAL_EV_BOND_STATE_CHANGED       0x88
153 struct hal_ev_bond_state_changed {
154         uint8_t status;
155         uint8_t bdaddr[6];
156         uint8_t state;
157 } __attribute__((packed));
158
159 #define HAL_ACL_STATE_CONNECTED         0x00
160 #define HAL_ACL_STATE_DISCONNECTED      0x01
161
162 #define HAL_EV_ACL_STATE_CHANGED        0x8A
163 struct hal_ev_acl_state_changed {
164         uint8_t status;
165         uint8_t bdaddr[6];
166         uint8_t state;
167 } __attribute__((packed));
168
169 #define BT_TRANSPORT_UNKNOWN            0x00
170 #define BT_TRANSPORT_BR_EDR             0x01
171 #define BT_TRANSPORT_LE                 0x02
172
173 /* HID host events */
174 #define HAL_HIDHOST_STATE_CONNECTED     0x00
175 #define HAL_HIDHOST_STATE_CONNECTING    0x01
176 #define HAL_HIDHOST_STATE_DISCONNECTED  0x02
177 #define HAL_HIDHOST_STATE_DISCONNECTING 0x03
178 #define HAL_HIDHOST_STATE_NO_HID        0x07
179 #define HAL_HIDHOST_STATE_FAILED        0x08
180 #define HAL_HIDHOST_STATE_UNKNOWN       0x09
181
182 #define HAL_EV_HIDHOST_CONN_STATE               0x81
183 struct hal_ev_hidhost_conn_state {
184                 uint8_t bdaddr[6];
185                         uint8_t state;
186 } __attribute__((packed));
187
188 #define HAL_EV_HIDHOST_INFO     0x82
189 struct hal_ev_hidhost_info {
190         uint8_t  bdaddr[6];
191         uint8_t  attr;
192         uint8_t  subclass;
193         uint8_t  app_id;
194         uint16_t vendor;
195         uint16_t product;
196         uint16_t version;
197         uint8_t  country;
198         uint16_t descr_len;
199         uint8_t  descr[884];
200 } __attribute__((packed));
201
202 #define HAL_EV_HIDHOST_PROTO_MODE       0x83
203 struct hal_ev_hidhost_proto_mode {
204         uint8_t bdaddr[6];
205         uint8_t status;
206         uint8_t mode;
207 } __attribute__((packed));
208
209 #define HAL_EV_HIDHOST_IDLE_TIME        0x84
210 struct hal_ev_hidhost_idle_time {
211         uint8_t bdaddr[6];
212         uint8_t status;
213         uint32_t idle_rate;
214 } __attribute__((packed));
215
216 #define HAL_EV_HIDHOST_GET_REPORT       0x85
217 struct hal_ev_hidhost_get_report {
218         uint8_t  bdaddr[6];
219         uint8_t  status;
220         uint16_t len;
221         uint8_t  data[0];
222 } __attribute__((packed));
223
224 #define HAL_EV_HIDHOST_VIRTUAL_UNPLUG   0x86
225 struct hal_ev_hidhost_virtual_unplug {
226         uint8_t  bdaddr[6];
227         uint8_t  status;
228 } __attribute__((packed));
229
230 #define HAL_EV_HIDHOST_HANDSHAKE        0x87
231 struct hal_ev_hidhost_handshake {
232         uint8_t  bdaddr[6];
233         uint8_t  status;
234 } __attribute__((packed));
235
236 /* Bluetooth Socket HAL events */
237 struct hal_ev_sock_connect {
238         short   size;
239         uint8_t bdaddr[6];
240         int     channel;
241         int     status;
242 } __attribute__((packed));
243 #endif //_BT_HAL_MSG_H_
244