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