BT 5.0 : Support for extended Scanning
[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            0x17
78 #define HAL_PROP_ADAPTER_LOCAL_LE_FEAT          0x18
79 #define HAL_PROP_DEVICE_IS_ALIAS_SET            0x19
80 #define HAL_PROP_ADAPTER_LE_DISCOVERY_STARTED   0x1a
81 #define HAL_PROP_ADAPTER_LE_DISCOVERY_STOPPED  0x1b
82 #define HAL_PROP_ADAPTER_A2DP_ROLE              0x1c
83
84 struct hal_prop_device_info {
85         uint8_t version;
86         uint16_t sub_version;
87         uint16_t manufacturer;
88 } __attribute__((packed));
89
90 #define HAL_PROP_DEVICE_TIMESTAMP               0xFF
91
92 #define HAL_EV_ADAPTER_STATE_CHANGED    0x00
93 struct hal_ev_adapter_state_changed {
94         uint8_t state;
95 } __attribute__((packed));
96
97
98 struct hal_property {
99         uint8_t  type;
100         uint16_t len;
101         uint8_t  val[0];
102 } __attribute__((packed));
103
104 #define HAL_EV_ADAPTER_PROPS_CHANGED    0x01
105 struct hal_ev_adapter_props_changed {
106         uint8_t              status;
107         uint8_t              num_props;
108         struct  hal_property props[0];
109 } __attribute__((packed));
110
111 #define HAL_EV_ADAPTER_PROFILE_CONNECTED_DEVICES    0x02
112 struct hal_ev_adapter_profile_connected_devices {
113         uint8_t count;
114         uint8_t bdaddr_list[10][6];
115 } __attribute__((packed));
116
117 #define HAL_DISCOVERY_STATE_STOPPED     0x00
118 #define HAL_DISCOVERY_STATE_STARTED     0x01
119
120 #define HAL_EV_DISCOVERY_STATE_CHANGED  0x85
121 struct hal_ev_discovery_state_changed {
122         uint8_t state;
123 } __attribute__((packed));
124
125 #define HAL_EV_REMOTE_DEVICE_PROPS      0x83
126 struct hal_ev_remote_device_props {
127         uint8_t             status;
128         uint8_t             bdaddr[6];
129         uint8_t             num_props;
130         struct hal_property props[0];
131 } __attribute__((packed));
132
133 #define HAL_EV_DEVICE_FOUND             0x84
134 struct hal_ev_device_found {
135         uint8_t             num_props;
136         struct hal_property props[0];
137 } __attribute__((packed));
138
139
140 /* Device callbacks */
141 #define HAL_EV_PIN_REQUEST              0x86
142 struct hal_ev_pin_request {
143         uint8_t  bdaddr[6];
144         uint8_t  name[249];
145         uint32_t class_of_dev;
146 } __attribute__((packed));
147
148 #define HAL_EV_SSP_REQUEST              0x87
149 struct hal_ev_ssp_request {
150         uint8_t  bdaddr[6];
151         uint8_t  name[249];
152         uint32_t class_of_dev;
153         uint8_t  pairing_variant;
154         uint32_t passkey;
155 } __attribute__((packed));
156
157 #define HAL_BOND_STATE_NONE 0
158 #define HAL_BOND_STATE_BONDING 1
159 #define HAL_BOND_STATE_BONDED 2
160
161 #define HAL_EV_BOND_STATE_CHANGED       0x88
162 struct hal_ev_bond_state_changed {
163         uint8_t status;
164         uint8_t bdaddr[6];
165         uint8_t state;
166 } __attribute__((packed));
167
168 #define HAL_EV_AUTHORIZE_REQUEST        0x89
169 struct hal_ev_authorize_request {
170         uint8_t  bdaddr[6];
171         uint32_t service_id;
172 } __attribute__((packed));
173
174 #ifdef TIZEN_BT_HAL
175 #define HAL_EV_SOCK_AUTHORIZE_REQUEST        0x90
176 struct hal_ev_sock_conn_auth {
177         uint8_t uuid[16];
178         uint8_t bdaddr[6];
179         uint8_t name[249];
180         uint8_t path[249];
181         uint32_t fd;
182 } __attribute__((packed));
183 #endif //TIZEN_BT_HAL
184
185 #define HAL_ACL_STATE_CONNECTED         0x00
186 #define HAL_ACL_STATE_DISCONNECTED      0x01
187
188 #define HAL_EV_ACL_STATE_CHANGED        0x8A
189 struct hal_ev_acl_state_changed {
190         uint8_t status;  /* Error code */
191         uint8_t bdaddr[6];
192         uint8_t state; /* Link state */
193 } __attribute__((packed));
194
195 #define HAL_DEVICE_TRUSTED         0x00
196 #define HAL_DEVICE_UNTRUSTED       0x01
197
198 #define HAL_EV_DEVICE_TRUST_CHANGED     0x8B
199 struct hal_ev_device_trust_state_changed {
200         uint8_t bdaddr[6];
201         uint8_t trust;
202 } __attribute__((packed));
203
204 #define BT_TRANSPORT_UNKNOWN            0x00
205 #define BT_TRANSPORT_BR_EDR             0x01
206 #define BT_TRANSPORT_LE                 0x02
207
208 /* HID host events */
209 #define HAL_HIDHOST_STATE_CONNECTED     0x00
210 #define HAL_HIDHOST_STATE_CONNECTING    0x01
211 #define HAL_HIDHOST_STATE_DISCONNECTED  0x02
212 #define HAL_HIDHOST_STATE_DISCONNECTING 0x03
213 #define HAL_HIDHOST_STATE_NO_HID        0x07
214 #define HAL_HIDHOST_STATE_FAILED        0x08
215 #define HAL_HIDHOST_STATE_UNKNOWN       0x09
216
217 /* HID device events */
218 #define HAL_HIDDEVICE_STATE_CONNECTED 0x00
219 #define HAL_HIDDEVICE_STATE_DISCONNECTED 0x01
220
221 #define HAL_EV_HIDHOST_CONN_STATE               0x81
222 struct hal_ev_hidhost_conn_state {
223         uint8_t bdaddr[6];
224         uint8_t state;
225 } __attribute__((packed));
226
227 #define HAL_EV_HIDHOST_INFO     0x82
228 struct hal_ev_hidhost_info {
229         uint8_t  bdaddr[6];
230         uint8_t  attr;
231         uint8_t  subclass;
232         uint8_t  app_id;
233         uint16_t vendor;
234         uint16_t product;
235         uint16_t version;
236         uint8_t  country;
237         uint16_t descr_len;
238         uint8_t  descr[884];
239 } __attribute__((packed));
240
241 #define HAL_EV_HIDHOST_PROTO_MODE       0x83
242 struct hal_ev_hidhost_proto_mode {
243         uint8_t bdaddr[6];
244         uint8_t status;
245         uint8_t mode;
246 } __attribute__((packed));
247
248 #define HAL_EV_HIDHOST_IDLE_TIME        0x84
249 struct hal_ev_hidhost_idle_time {
250         uint8_t bdaddr[6];
251         uint8_t status;
252         uint32_t idle_rate;
253 } __attribute__((packed));
254
255 #define HAL_EV_HIDHOST_GET_REPORT       0x85
256 struct hal_ev_hidhost_get_report {
257         uint8_t  bdaddr[6];
258         uint8_t  status;
259         uint16_t len;
260         uint8_t  data[0];
261 } __attribute__((packed));
262
263 #define HAL_EV_HIDHOST_VIRTUAL_UNPLUG   0x86
264 struct hal_ev_hidhost_virtual_unplug {
265         uint8_t  bdaddr[6];
266         uint8_t  status;
267 } __attribute__((packed));
268
269 #define HAL_EV_HIDHOST_HANDSHAKE        0x87
270 struct hal_ev_hidhost_handshake {
271         uint8_t  bdaddr[6];
272         uint8_t  status;
273 } __attribute__((packed));
274
275 #define HAL_EV_HIDDEVICE_CONN_STATE             0x88
276 struct hal_ev_hiddevice_conn_state {
277         uint8_t bdaddr[6];
278         uint8_t state;
279 } __attribute__((packed));
280
281 /* Bluetooth Socket HAL events */
282 struct hal_ev_sock_connect {
283         short   size;
284         uint8_t bdaddr[6];
285         int     channel;
286         int     status;
287 } __attribute__((packed));
288
289 /* A2DP (AV) Headers */
290 #define HAL_EV_A2DP_STATE_DISCONNECTED             0x00
291 #define HAL_EV_A2DP_STATE_CONNECTING               0x01
292 #define HAL_EV_A2DP_STATE_CONNECTED                0x02
293 #define HAL_EV_A2DP_STATE_DISCONNECTING            0x03
294
295 #define HAL_EV_A2DP_CONN_STATE                  0x8C
296 struct hal_ev_a2dp_conn_state {
297         uint8_t state;
298         uint8_t bdaddr[6];
299 } __attribute__((packed));
300
301 #define HAL_AUDIO_SUSPEND                       0x00
302 #define HAL_AUDIO_STOPPED                       0x01
303 #define HAL_AUDIO_STARTED                       0x02
304
305 #define HAL_EV_A2DP_AUDIO_STATE                 0x8D
306 struct hal_ev_a2dp_audio_state {
307         uint8_t state;
308         uint8_t bdaddr[6];
309 } __attribute__((packed));
310
311 #define HAL_EV_A2DP_AUDIO_CONFIG                0x8E
312 struct hal_ev_a2dp_audio_config {
313         uint8_t  bdaddr[6];
314         uint32_t sample_rate;
315         uint8_t  channel_count;
316 } __attribute__((packed));
317
318 /* A2DP Sink Role connection*/
319 #define HAL_EV_A2DP_SOURCE_CONN_STATE                   0x8F
320
321 /* HandsFree Headers */
322 #define HAL_EV_HANDSFREE_CONN_STATE_DISCONNECTED        0x00
323 #define HAL_EV_HANDSFREE_CONN_STATE_CONNECTING          0x01
324 #define HAL_EV_HANDSFREE_CONN_STATE_CONNECTED           0x02
325 #define HAL_EV_HANDSFREE_CONN_STATE_SLC_CONNECTED       0x03
326 #define HAL_EV_HANDSFREE_CONN_STATE_DISCONNECTING       0x04
327
328 #define HAL_EV_HANDSFREE_CONN_STATE             0x91
329 struct hal_ev_handsfree_conn_state {
330         uint8_t state;
331         uint8_t bdaddr[6];
332 } __attribute__((packed));
333
334 #define HAL_EV_HANDSFREE_AUDIO_STATE_DISCONNECTED       0x00
335 #define HAL_EV_HANDSFREE_AUDIO_STATE_CONNECTING         0x01
336 #define HAL_EV_HANDSFREE_AUDIO_STATE_CONNECTED          0x02
337 #define HAL_EV_HANDSFREE_AUDIO_STATE_DISCONNECTING      0x04
338
339 #define HAL_EV_HANDSFREE_AUDIO_STATE            0x92
340 struct hal_ev_handsfree_audio_state {
341         uint8_t state;
342         uint8_t bdaddr[6];
343 } __attribute__((packed));
344
345 /* HDP HAL Events */
346 #define HAL_EV_HDP_APP_REG_STATE            0x93
347 struct hal_ev_hdp_app_reg_state {
348         uint16_t app_id;
349         uint8_t state;
350 } __attribute__((packed));
351
352 #define HAL_EV_HDP_CONN_STATE            0x94
353 struct hal_ev_hdp_conn_state {
354         uint16_t app_id;
355         uint8_t bdaddr[6];
356         uint8_t mdep_index;
357         uint16_t channel_id;
358         uint8_t channel_state;
359         int32_t data_fd;
360 } __attribute__((packed));
361
362 /* AVRCP Controller Role HAL Events */
363 #define HAL_EV_AVRCP_CTRL_CONN_STATE            0x95
364 #define HAL_AVRCP_CTRL_STATE_DISCONNECTED 0x00
365 #define HAL_AVRCP_CTRL_STATE_CONNECTED 0x01
366 struct hal_ev_avrcp_ctrl_conn_state {
367         uint8_t state;
368         uint8_t bdaddr[6];
369 } __attribute__((packed));
370
371 #define HAL_EV_AVRCP_CTRL_PASS_THROUGH_RSP      0x96
372 struct hal_ev_pass_cmd_rsp {
373         uint8_t bdaddr[6];
374         int key_code;
375         int key_state;
376 } __attribute__((packed));
377
378 #define HAL_EV_AVRCP_CTRL_SET_PLAYER_APP_SETTING_RSP    0x97
379 #define HAL_AVRCP_PLAYER_APP_SETTING_REJECTED 0x00
380 #define HAL_AVRCP_PLAYER_APP_SETTING_ACCEPTED 0x01
381 struct hal_ev_set_player_app_setting_rsp {
382         uint8_t bdaddr[6];
383         uint8_t resp;
384 } __attribute__((packed));
385
386 #define HAL_EV_AVRCP_CTRL_PLAYER_APP_SETTING_CHANGED    0x98
387 #define HAL_MAX_APP_SETTINGS 8
388 #define HAL_PLAYER_ATTR_EQUALIZER 0x01
389 #define HAL_PLAYER_ATTR_REPEAT 0x02
390 #define HAL_PLAYER_ATTR_SHUFFLE 0x03
391 #define HAL_PLAYER_ATTR_SCAN 0x04
392 struct hal_ev_player_setting {
393         uint8_t bdaddr[6];
394         uint8_t num_attr;
395         uint8_t attr_ids[HAL_MAX_APP_SETTINGS];
396         uint8_t attr_values[HAL_MAX_APP_SETTINGS];
397 } __attribute__((packed));
398
399 #define HAL_EV_AVRCP_CTRL_TRACK_CHANGED         0x99
400 #define HAL_MAX_ATTR_STR_LEN 100
401 #define HAL_MAX_ATTR_NUM 10
402 #define HAL_MEDIA_ATTR_ID_INVALID -1
403 #define HAL_MEDIA_ATTR_ID_TITLE 0x00000001
404 #define HAL_MEDIA_ATTR_ID_ARTIST 0x00000002
405 #define HAL_MEDIA_ATTR_ID_ALBUM 0x00000003
406 #define HAL_MEDIA_ATTR_ID_TRACK_NUM 0x00000004
407 #define HAL_MEDIA_ATTR_ID_NUM_TRACKS 0x00000005
408 #define HAL_MEDIA_ATTR_ID_GENRE 0x00000006
409 #define HAL_MEDIA_ATTR_ID_PLAYING_TIME 0x00000007
410 struct hal_attr_val {
411         uint32_t attr_id;
412         uint8_t text[HAL_MAX_ATTR_STR_LEN];
413 } __attribute__((packed));
414
415 struct hal_ev_track_changed {
416         uint8_t bdaddr[6];
417         uint8_t num_attr;
418         struct hal_attr_val attr[HAL_MAX_ATTR_NUM];
419 } __attribute__((packed));
420
421 #define HAL_EV_AVRCP_CTRL_PLAY_POSITION_CHANGED         0xA0
422 struct hal_ev_play_position {
423         uint8_t bdaddr[6];
424         uint32_t len;
425         uint32_t pos;
426 } __attribute__((packed));
427
428 #define HAL_EV_AVRCP_CTRL_PLAY_STATUS_CHANGED           0xA1
429 #define HAL_PLAYSTATE_STOPPED 0x00    /* Stopped */
430 #define HAL_PLAYSTATE_PLAYING 0x01    /* Playing */
431 #define HAL_PLAYSTATE_PAUSED 0x02    /* Paused  */
432 #define HAL_PLAYSTATE_FWD_SEEK 0x03    /* Fwd Seek*/
433 #define HAL_PLAYSTATE_REV_SEEK 0x04    /* Rev Seek*/
434 #define HAL_PLAYSTATE_ERROR 0xFF    /* Error   */
435 struct hal_ev_play_status_changed {
436         uint8_t bdaddr[6];
437         uint8_t status;
438 } __attribute__((packed));
439
440 /* AVRCP TG events */
441 #ifdef TIZEN_BT_HAL
442 #define HAL_EV_AVRCP_TG_CONN_STATE              0xA2
443 #define HAL_EV_AVRCP_TG_DELAY_CHANGE    0xF1
444 #define HAL_EV_AVRCP_TG_VOLUME_CHANGE   0xF2
445
446 #define HAL_AVRCP_TG_STATE_DISCONNECTED 0x00
447 #define HAL_AVRCP_TG_STATE_CONNECTED    0x01
448 struct hal_ev_avrcp_tg_conn_state{
449         uint8_t bdaddr[6];
450         uint8_t state;
451 } __attribute__((packed));
452
453 struct hal_ev_avrcp_tg_delay_changed{
454         uint8_t bdaddr[6];
455         uint16_t value;
456 } __attribute__((packed));
457
458 struct hal_ev_avrcp_tg_volume_changed{
459         uint8_t bdaddr[6];
460         uint16_t volume;
461 } __attribute__((packed));
462
463 #endif /* TIZEN_BT_HAL */
464
465 #define HAL_EV_AVRCP_TG_SET_PLAYER_PROPERTY              0xA3
466
467 #define HAL_AVRCP_TG_PLAYER_PROP_EQUALIZER      0x00
468 #define HAL_AVRCP_TG_PLAYER_PROP_REPEAT         0x01
469 #define HAL_AVRCP_TG_PLAYER_PROP_SHUFFLE        0x02
470 #define HAL_AVRCP_TG_PLAYER_PROP_SCAN           0x03
471 struct hal_ev_avrcp_tg_player_property {
472         uint8_t prop_type;
473         uint8_t value;
474 } __attribute__((packed));
475
476 /* LE-GATT */
477 #define HAL_EV_SERVER_INSTANCE_INITIALIZED      0xA4
478 struct hal_ev_server_instance_registered {
479         uint32_t status;
480         uint32_t server_instance;
481         uint8_t app_uuid[16];
482 } __attribute__((packed));
483
484 #define HAL_EV_MULTI_ADV_DATA_SET               0xA5
485 struct hal_ev_multi_adv_data_set {
486         uint8_t status;
487         uint8_t server_instance;
488 } __attribute__((packed));
489
490 #define HAL_EV_MULTI_ADV_ENABLE                 0xA6
491 struct hal_ev_multi_adv_enable {
492         uint32_t status;
493         uint32_t server_instance;
494 } __attribute__((packed));
495
496 #define HAL_EV_MULTI_ADV_DISABLE                0xA7
497 struct hal_ev_multi_adv_disable {
498         uint32_t status;
499         uint32_t server_instance;
500 } __attribute__((packed));
501
502 #define HAL_EV_MULTI_ADV_UPDATE                 0xA8
503 struct hal_ev_multi_adv_update {
504         uint32_t status;
505         uint32_t server_instance;
506 } __attribute__((packed));
507
508 #define HAL_EV_LEGACY_ADV_ENABLE                0xA9
509 struct hal_ev_legacy_adv_status {
510         uint32_t status;
511         uint32_t server_instance;
512 } __attribute__((packed));
513
514 #define HAL_EV_GATT_CLIENT_REGISTERED   0xAA
515 struct hal_ev_gatt_client_registered {
516         uint32_t status;
517         uint32_t client_if;
518         uint8_t app_uuid[16];
519 } __attribute__((packed));
520
521 #define HAL_EV_GATT_CLIENT_SCAN_RESULT  0xAC
522 struct hal_ev_gatt_client_scan_result {
523         uint8_t  bd_addr[6];
524         uint8_t  addr_type;
525         uint8_t  adv_type;
526         int32_t  rssi;
527         bool is_extended;
528         uint16_t event_type;
529         uint8_t primary_phy;
530         uint8_t secondary_phy;
531         uint8_t advertising_sid;
532         int8_t tx_power;
533         uint16_t periodic_adv_int;
534         uint16_t len;
535         uint8_t  adv_data[0];
536 } __attribute__((packed));
537
538 #define HAL_EV_GATT_SERVICE_ADDED               0xAD
539 struct hal_ev_gatt_service_added {
540         uint32_t status;
541         uint32_t server_instance;
542         uint8_t  is_primary;
543         uint8_t svc_uuid[16];
544         uint32_t service_handle;
545 } __attribute__((packed));
546
547 #define HAL_EV_GATT_CHAR_ADDED                  0xAE
548 struct hal_ev_gatt_char_added {
549         uint32_t status;
550         uint32_t server_instance;
551         uint32_t service_handle;
552         uint32_t char_handle;
553         uint8_t char_uuid[16];
554 } __attribute__((packed));
555
556 #define HAL_EV_GATT_DESC_ADDED                  0xAF
557 struct hal_ev_gatt_desc_added {
558         uint32_t status;
559         uint32_t server_instance;
560         uint32_t service_handle;
561         uint32_t desc_handle;
562         uint8_t desc_uuid[16];
563 } __attribute__((packed));
564
565 #define HAL_EV_GATT_SERVICE_STARTED             0xB0
566 struct hal_ev_gatt_service_started {
567         uint32_t status;
568         uint32_t server_instance;
569         uint32_t service_handle;
570 } __attribute__((packed));
571
572 #define HAL_EV_GATT_SERVICE_DELETED             0xB1
573 struct hal_ev_gatt_service_deleted {
574         uint32_t status;
575         uint32_t server_instance;
576         uint32_t service_handle;
577 } __attribute__((packed));
578
579 #define HAL_EV_GATT_SERVER_CONNECTED            0xB2
580 struct hal_ev_gatt_server_connected {
581         uint32_t conn_id;
582         uint32_t server_instance;
583         uint8_t connected;
584         uint8_t bdaddr[6];
585 } __attribute__((packed));
586
587 #define HAL_EV_GATT_READ_REQUESTED              0xB3
588 struct hal_ev_gatt_server_read_req {
589         uint32_t conn_id;
590         uint32_t trans_id;
591         uint8_t bdaddr[6];
592         uint32_t att_handle;
593         uint32_t offset;
594         uint8_t is_long;
595 } __attribute__((packed));
596
597 #define HAL_EV_GATT_WRITE_REQUESTED             0xB4
598 struct hal_ev_gatt_server_write_req {
599         uint32_t conn_id;
600         uint32_t trans_id;
601         uint8_t bdaddr[6];
602         uint32_t att_handle;
603         uint32_t offset;
604         uint32_t length;
605         uint8_t need_rsp;
606         uint8_t is_prep;
607         uint8_t value[600];
608 } __attribute__((packed));
609
610 #define HAL_EV_GATT_INDICATE_CFM                0xB5
611 struct hal_ev_gatt_server_indicate_cfm {
612         uint32_t conn_id;
613         uint32_t trans_id;
614         uint32_t att_handle;
615         uint8_t bdaddr[6];
616 } __attribute__((packed));
617
618 #ifdef TIZEN_BT_HAL
619 #define HAL_EV_GATT_NOTIFICATION_CHANGE         0xB6
620 struct hal_ev_gatt_server_notifcation_change {
621         uint32_t conn_id;
622         uint32_t trans_id;
623         uint32_t att_handle;
624         uint8_t notify;
625         uint8_t bdaddr[6];
626 } __attribute__((packed));
627
628 #define HAL_EV_LE_STATE_CHANGED    0xB7
629 struct hal_ev_le_state_changed {
630         uint8_t state;
631 } __attribute__((packed));
632 #endif /* TIZEN_BT_HAL */
633
634 #define HAL_LE_STATE_CONNECTED         0x00
635 #define HAL_LE_STATE_DISCONNECTED      0x01
636
637 #define HAL_EV_LE_CONN_STATE_CHANGED        0xB8
638 struct hal_ev_le_conn_state_changed {
639         uint8_t status;
640         uint8_t bdaddr[6];
641         uint8_t state;
642 } __attribute__((packed));
643
644 #define HAL_EV_DEVICE_TRUSTED_PROFILES_CHANGED  0xB9
645 struct hal_ev_device_trusted_profiles_changed {
646         uint8_t bdaddr[6];
647         uint32_t trust_val;
648 } __attribute__((packed));
649
650 #define HAL_RSSI_MONITORING_ENABLED     0x00
651 #define HAL_RSSI_MONITORING_DISABLED    0x01
652
653 #define HAL_EV_RSSI_MONITOR_STATE_CHANGED       0xBA
654 struct hal_ev_rssi_monitor_state_changed {
655         uint8_t bdaddr[6];
656         int32_t link_type;
657         uint8_t state;
658 } __attribute__((packed));
659
660 #define HAL_EV_RSSI_ALERT_RECIEVED      0xBB
661 struct hal_ev_rssi_alert_recieved {
662         uint8_t bdaddr[6];
663         int32_t link_type;
664         int32_t alert_type;
665         int32_t rssi;
666 } __attribute__((packed));
667
668 #define HAL_EV_RAW_RSSI_RECIEVED        0xBC
669 struct hal_ev_raw_rssi_recieved {
670         uint8_t bdaddr[6];
671         int32_t link_type;
672         int32_t rssi;
673 } __attribute__((packed));
674
675 #define HAL_EV_GATT_CLIENT_CONNECTED    0xBD
676 #define HAL_EV_GATT_CLIENT_DISCONNECTED  0xBE
677 struct hal_ev_gatt_client_connected {
678         int32_t conn_id;
679         int32_t status;
680         int32_t client_if;
681         uint8_t bdaddr[6];
682 } __attribute__((packed));
683
684 #define HAL_EV_GATT_CLIENT_SEARCH_RESULT        0xBF
685 struct hal_ev_gatt_client_search_result {
686         int32_t conn_id;
687         int32_t inst_id;
688         uint8_t uuid[16];
689         int32_t is_primary;
690         int32_t svc_handle;
691 } __attribute__((packed));
692
693 #define HAL_EV_GATT_CLIENT_SEARCH_COMPLETE      0xC0
694 struct hal_ev_gatt_client_search_complete {
695         int32_t conn_id;
696         int32_t status;
697 } __attribute__((packed));
698
699 #define HAL_EV_GATT_CLIENT_CHARAC_SEARCH_RESULT 0xC1
700 struct hal_ev_gatt_client_char_search_result {
701         int32_t conn_id;
702         int32_t status;
703         int32_t is_primary;
704         int32_t inst_id;
705         uint8_t svc_uuid[16];
706         uint8_t char_uuid[16];
707         int32_t char_prop;
708         int32_t char_handle;
709         int32_t svc_handle;
710 } __attribute__((packed));
711
712 #define HAL_EV_GATT_CLIENT_DESC_SEARCH_RESULT 0XC2
713 struct hal_ev_gatt_client_desc_search_result {
714         int32_t conn_id;
715         int32_t status;
716         int32_t is_primary;
717         int32_t inst_id;
718         uint8_t svc_uuid[16];
719         uint8_t char_uuid[16];
720         uint8_t desc_uuid[16];
721         uint32_t char_handle;
722         uint32_t svc_handle;
723         uint32_t desc_handle;
724 } __attribute__((packed));
725
726 #define HAL_EV_GATT_CLIENT_READ_CHARAC  0XC3
727 #define HAL_EV_GATT_CLIENT_READ_DESC    0XC4
728 struct hal_ev_gatt_client_read_data {
729         int32_t conn_id;
730         int32_t status;
731         int32_t is_primary;
732         int32_t inst_id;
733         uint8_t svc_uuid[16];
734         uint8_t char_uuid[16];
735         uint8_t desc_uuid[16];
736         uint8_t value[600];
737         int32_t len;
738         uint32_t char_handle;
739         uint32_t svc_handle;
740         uint32_t desc_handle;
741 } __attribute__((packed));
742
743 #define HAL_EV_GATT_CLIENT_WRITE_CHARAC 0XC5
744 #define HAL_EV_GATT_CLIENT_WRITE_DESC   0XC6
745 struct hal_ev_gatt_client_write_result {
746         int32_t conn_id;
747         int32_t status;
748         int32_t is_primary;
749         int32_t inst_id;
750         uint8_t svc_uuid[16];
751         uint8_t char_uuid[16];
752         uint8_t desc_uuid[16];
753         uint32_t char_handle;
754         uint32_t svc_handle;
755         uint32_t desc_handle;
756 } __attribute__((packed));
757
758 #define HAL_EV_GATT_CLIENT_WATCH_NOTIFICATION  0XC7
759 struct hal_ev_gatt_client_watch_notification {
760         int32_t conn_id;
761         int32_t registered;
762         int32_t status;
763         int32_t is_primary;
764         int32_t inst_id;
765         uint8_t svc_uuid[16];
766         uint8_t char_uuid[16];
767         uint32_t char_handle;
768         uint32_t svc_handle;
769 } __attribute__((packed));
770
771 #define HAL_EV_GATT_ACQUIRE_WRITE  0XC8
772 struct hal_ev_gatt_acquire_write {
773         int32_t fd;
774         int32_t conn_id;
775         int32_t status;
776         uint8_t svc_uuid[16];
777         uint8_t char_uuid[16];
778 } __attribute__((packed));
779
780 #define HAL_EV_GATT_SERVER_ACQUIRE_WRITE_RES  0XC9
781 struct hal_ev_gatt_server_acquire_write_res {
782         int32_t mtu;
783         int32_t trans_id;
784         int32_t conn_id;
785         int32_t char_handl;
786         uint8_t bdaddr[6];
787 } __attribute__((packed));
788
789 #define HAL_EV_GATT_SERVER_ACQUIRE_NOTIFY_RES  0XCA
790 struct hal_ev_gatt_server_acquire_notify {
791         int32_t mtu;
792         int32_t trans_id;
793         int32_t conn_id;
794         int32_t char_handl;
795         char *path;
796         uint8_t bdaddr[6];
797 } __attribute__((packed));
798
799 #define HAL_EV_GATT_CLIENT_NOTIFY_CHANGED_VALUE 0XCB
800 struct hal_ev_gatt_client_notify_changed_value {
801         int32_t conn_id;
802         uint8_t value[600];
803         int32_t len;
804         uint8_t bdaddr[6];
805         int32_t is_primary;
806         int32_t inst_id;
807         uint8_t svc_uuid[16];
808         uint8_t char_uuid[16];
809         uint8_t is_notify;
810         uint32_t char_handle;
811         uint32_t svc_handle;
812 } __attribute__((packed));
813
814 #define HAL_EV_GATT_SERVER_MTU_CHANGED 0XCC
815 struct hal_ev_gatt_server_mtu_changed {
816         int32_t conn_id;
817         int32_t mtu;
818 } __attribute__((packed));
819
820 /* HF Client Headers */
821 #define HAL_EV_HF_CLIENT_CONN_STATE_DISCONNECTED        0x00
822 #define HAL_EV_HF_CLIENT_CONN_STATE_CONNECTING          0x01
823 #define HAL_EV_HF_CLIENT_CONN_STATE_CONNECTED           0x02
824 #define HAL_EV_HF_CLIENT_CONN_STATE_SLC_CONNECTED       0x03
825 #define HAL_EV_HF_CLIENT_CONN_STATE_DISCONNECTING       0x04
826
827 #define HAL_EV_HF_CLIENT_CONN_STATE             0xCD
828 struct hal_ev_hf_client_conn_state {
829         uint8_t state;
830         uint8_t bdaddr[6];
831 } __attribute__((packed));
832
833 #define HAL_EV_DBFW_PLUS_INFO_RECIEVED  0xCE
834 struct hal_ev_dbfw_plus_info_recieved {
835         uint8_t event_code;
836         unsigned char *data;
837         uint32_t data_len;
838 } __attribute__((packed));
839
840 #define HAL_EV_GATT_CLIENT_SERVICE_CHANGED 0xCF
841 struct hal_ev_gatt_client_service_changed {
842         int32_t conn_id;
843         int32_t inst_id;
844         uint8_t bdaddr[6];
845         uint8_t change_type;
846         uint8_t uuid[16];
847 } __attribute__((packed));
848
849 #define HAL_EV_GATT_CLIENT_MTU_EXCHANGE_COMPLETED  0xD0
850 struct hal_ev_gatt_client_mtu_exchange_completed {
851         int32_t conn_id;
852         int32_t mtu;
853         int32_t status;
854 } __attribute__((packed));
855
856 #define HAL_CONTROLLER_ERROR_HW_ERROR   0x00
857 #define HAL_CONTROLLER_ERROR_TX_TIMEOUT 0x01
858
859 #define HAL_EV_CONTROLLER_ERROR_RECIEVED        0xD1
860 struct hal_ev_controller_error_recieved {
861         uint8_t code;
862 } __attribute__((packed));
863
864
865 /* MESH HAL events */
866 #define HAL_EV_MESH_NETWORK_ATTACHED    0xD2
867 struct hal_ev_mesh_network_attached {
868         uint8_t status;
869         bool is_prov;
870         uint8_t uuid[16];
871         uint8_t token[8];
872 } __attribute__((packed));
873
874 #define HAL_MESH_SCAN_STATE_STOPPED     0x00
875 #define HAL_MESH_SCAN_STATE_STARTED     0x01
876
877 #define HAL_EV_MESH_SCAN_STATE_CHANGED   0xD3
878 struct hal_ev_mesh_scan_state_changed {
879         uint8_t status;
880         uint8_t state;
881         uint8_t net_uuid[16];
882 } __attribute__((packed));
883
884 /*
885 #define HAL_EV_MESH_SCAN_FINISHED       0xD4
886 struct hal_ev_mesh_scan_finished {
887         uint8_t status;
888         uint8_t net_uuid[16];
889 } __attribute__((packed));
890 */
891
892 #define HAL_EV_MESH_SCAN_RESULT         0xD5
893 struct hal_ev_mesh_scan_result {
894         uint8_t status;
895         int rssi;
896         uint8_t net_uuid[16];
897         uint8_t dev_uuid[16];
898         uint8_t oob_info[2];
899         uint8_t uri_hash[4];
900 } __attribute__((packed));
901
902 #define HAL_EV_MESH_PROVISIONING_STATUS 0xD6
903 struct hal_ev_mesh_provision_status {
904         uint8_t status;
905         uint8_t net_uuid[16];
906         uint8_t dev_uuid[16];
907 } __attribute__((packed));
908
909 #define HAL_EV_MESH_PROVISIONING_FINISHED 0xD7
910 struct hal_ev_mesh_provision_finished {
911         uint8_t status;
912         int reason;
913         uint8_t net_uuid[16];
914         uint16_t unicast;
915         uint8_t count;
916         uint8_t dev_uuid[16];
917 } __attribute__((packed));
918
919 #define HAL_EV_MESH_PROVISIONING_DATA_REQUEST 0xD8
920 struct hal_ev_mesh_provision_data_request {
921         uint8_t net_uuid[16];
922         uint8_t count;
923 } __attribute__((packed));
924
925 #define HAL_EV_MESH_AUTHENTICATION_REQUEST 0xD9
926 struct hal_ev_mesh_authentication_request {
927         uint8_t net_uuid[16];
928         char auth_value[50];
929         int auth_type;
930 } __attribute__((packed));
931
932
933 #define HAL_MESH_KEY_ADD     0x00
934 #define HAL_MESH_KEY_UPDATE  0x01
935 #define HAL_MESH_KEY_DELETE  0x02
936
937 #define HAL_EV_MESH_NETKEY_EXECUTE_EVENT 0xDA
938 struct hal_ev_mesh_netkey_execute_event {
939         uint8_t status;
940         uint8_t key_event;
941         uint8_t net_uuid[16];
942         uint16_t key_idx;
943 } __attribute__((packed));
944
945 #define HAL_EV_MESH_APPKEY_EXECUTE_EVENT 0xDB
946 struct hal_ev_mesh_appkey_execute_event {
947         uint8_t status;
948         uint8_t key_event;
949         uint8_t net_uuid[16];
950         uint16_t net_idx;
951         uint16_t app_idx;
952 } __attribute__((packed));
953
954 #define HAL_EV_MESH_DEVKEY_MESSAGE_EVENT        0xDC
955 struct hal_ev_mesh_devkey_message_event {
956         uint8_t net_uuid[16];
957         uint16_t source_addr;
958         uint8_t is_remote_devkey;
959         uint16_t netkey_idx;
960         int data_len;
961         uint8_t data[0];
962 } __attribute__((packed));
963
964 #define HAL_EV_MESH_MESSAGE_EVENT       0xDD
965 struct hal_ev_mesh_message_event {
966         uint8_t net_uuid[16];
967         bool is_prov;
968         uint16_t source_addr;
969         uint16_t dest_addr;
970         uint16_t key_idx;
971         int data_len;
972         uint8_t data[0];
973 } __attribute__((packed));
974
975 #define HAL_EV_MESH_NETWORK_DESTROYED   0xDE
976 struct hal_ev_mesh_network_destroyed {
977         uint8_t status;
978         uint8_t uuid[16];
979         uint8_t token[8];
980 } __attribute__((packed));
981
982 #define HAL_EV_MESH_NETWORK_PROXY_ADDED 0xDF
983 struct hal_ev_mesh_network_proxy_added {
984         uint8_t status;
985         uint8_t uuid[16];
986         uint8_t token[8];
987 } __attribute__((packed));
988
989
990 #endif //_BT_HAL_MSG_H_