Upgrade bluez5_37 :Merge the code from private
[platform/upstream/bluez.git] / android / hal-msg.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2013  Intel Corporation. All rights reserved.
6  *
7  *
8  *  This library is free software; you can redistribute it and/or
9  *  modify it under the terms of the GNU Lesser General Public
10  *  License as published by the Free Software Foundation; either
11  *  version 2.1 of the License, or (at your option) any later version.
12  *
13  *  This library is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  *  Lesser General Public License for more details.
17  *
18  *  You should have received a copy of the GNU Lesser General Public
19  *  License along with this library; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 static const char BLUEZ_HAL_SK_PATH[] = "\0bluez_hal_socket";
25
26 #define HAL_MINIMUM_EVENT               0x81
27
28 #define HAL_SERVICE_ID_CORE             0
29 #define HAL_SERVICE_ID_BLUETOOTH        1
30 #define HAL_SERVICE_ID_SOCKET           2
31 #define HAL_SERVICE_ID_HIDHOST          3
32 #define HAL_SERVICE_ID_PAN              4
33 #define HAL_SERVICE_ID_HANDSFREE        5
34 #define HAL_SERVICE_ID_A2DP             6
35 #define HAL_SERVICE_ID_HEALTH           7
36 #define HAL_SERVICE_ID_AVRCP            8
37 #define HAL_SERVICE_ID_GATT             9
38 #define HAL_SERVICE_ID_HANDSFREE_CLIENT 10
39 #define HAL_SERVICE_ID_MAP_CLIENT       11
40 #define HAL_SERVICE_ID_AVRCP_CTRL       12
41 #define HAL_SERVICE_ID_A2DP_SINK        13
42
43 #define HAL_SERVICE_ID_MAX HAL_SERVICE_ID_A2DP_SINK
44
45 /* Core Service */
46
47 #define HAL_STATUS_SUCCESS              IPC_STATUS_SUCCESS
48 #define HAL_STATUS_FAILED               0x01
49 #define HAL_STATUS_NOT_READY            0x02
50 #define HAL_STATUS_NOMEM                0x03
51 #define HAL_STATUS_BUSY                 0x04
52 #define HAL_STATUS_DONE                 0x05
53 #define HAL_STATUS_UNSUPPORTED          0x06
54 #define HAL_STATUS_INVALID              0x07
55 #define HAL_STATUS_UNHANDLED            0x08
56 #define HAL_STATUS_AUTH_FAILURE         0x09
57 #define HAL_STATUS_REMOTE_DEVICE_DOWN   0x0a
58
59 #define HAL_OP_STATUS                   IPC_OP_STATUS
60
61 #define HAL_MODE_DEFAULT                0x00
62 #define HAL_MODE_BREDR                  0x01
63 #define HAL_MODE_LE                     0x02
64
65 #define HAL_OP_REGISTER_MODULE          0x01
66 struct hal_cmd_register_module {
67         uint8_t service_id;
68         uint8_t mode;
69         int32_t max_clients;
70 } __attribute__((packed));
71
72 #define HAL_OP_UNREGISTER_MODULE        0x02
73 struct hal_cmd_unregister_module {
74         uint8_t service_id;
75 } __attribute__((packed));
76
77 #define HAL_CONFIG_VENDOR               0x00
78 #define HAL_CONFIG_MODEL                0x01
79 #define HAL_CONFIG_NAME                 0x02
80 #define HAL_CONFIG_SERIAL_NUMBER        0x03
81 #define HAL_CONFIG_SYSTEM_ID            0x04
82 #define HAL_CONFIG_PNP_ID               0x05
83 #define HAL_CONFIG_FW_REV               0x06
84 #define HAL_CONFIG_HW_REV               0x07
85
86 struct hal_config_prop {
87         uint8_t type;
88         uint16_t len;
89         uint8_t val[0];
90 } __attribute__((packed));
91
92 #define HAL_OP_CONFIGURATION            0x03
93 struct hal_cmd_configuration {
94         uint8_t num;
95         struct hal_config_prop props[0];
96 } __attribute__((packed));
97
98 /* Bluetooth Core HAL API */
99
100 #define HAL_OP_ENABLE                   0x01
101
102 #define HAL_OP_DISABLE                  0x02
103
104 #define HAL_OP_GET_ADAPTER_PROPS        0x03
105
106 #define HAL_OP_GET_ADAPTER_PROP         0x04
107 struct hal_cmd_get_adapter_prop {
108         uint8_t type;
109 } __attribute__((packed));
110
111 #define HAL_MAX_NAME_LENGTH             249
112
113 #define HAL_PROP_ADAPTER_NAME                   0x01
114 #define HAL_PROP_ADAPTER_ADDR                   0x02
115 #define HAL_PROP_ADAPTER_UUIDS                  0x03
116 #define HAL_PROP_ADAPTER_CLASS                  0x04
117 #define HAL_PROP_ADAPTER_TYPE                   0x05
118 #define HAL_PROP_ADAPTER_SERVICE_REC            0x06
119 #define HAL_PROP_ADAPTER_SCAN_MODE              0x07
120 #define HAL_PROP_ADAPTER_BONDED_DEVICES         0x08
121 #define HAL_PROP_ADAPTER_DISC_TIMEOUT           0x09
122
123 #define HAL_PROP_DEVICE_NAME                    0x01
124 #define HAL_PROP_DEVICE_ADDR                    0x02
125 #define HAL_PROP_DEVICE_UUIDS                   0x03
126 #define HAL_PROP_DEVICE_CLASS                   0x04
127 #define HAL_PROP_DEVICE_TYPE                    0x05
128 #define HAL_PROP_DEVICE_SERVICE_REC             0x06
129 struct hal_prop_device_service_rec {
130         uint8_t uuid[16];
131         uint16_t channel;
132         uint8_t name_len;
133         uint8_t name[];
134 } __attribute__((packed));
135
136 #define HAL_PROP_DEVICE_FRIENDLY_NAME           0x0a
137 #define HAL_PROP_DEVICE_RSSI                    0x0b
138 #define HAL_PROP_DEVICE_VERSION_INFO            0x0c
139 struct hal_prop_device_info {
140         uint8_t version;
141         uint16_t sub_version;
142         uint16_t manufacturer;
143 } __attribute__((packed));
144
145 #define HAL_PROP_ADAPTER_LOCAL_LE_FEAT          0x0d
146 #define HAL_PROP_DEVICE_TIMESTAMP               0xFF
147
148 #define HAL_ADAPTER_SCAN_MODE_NONE              0x00
149 #define HAL_ADAPTER_SCAN_MODE_CONN              0x01
150 #define HAL_ADAPTER_SCAN_MODE_CONN_DISC 0x02
151
152 #define HAL_TYPE_BREDR                          0x01
153 #define HAL_TYPE_LE                             0x02
154 #define HAL_TYPE_DUAL                           0x03
155
156 #define HAL_OP_SET_ADAPTER_PROP         0x05
157 struct hal_cmd_set_adapter_prop {
158         uint8_t  type;
159         uint16_t len;
160         uint8_t  val[0];
161 } __attribute__((packed));
162
163 #define HAL_OP_GET_REMOTE_DEVICE_PROPS  0x06
164 struct hal_cmd_get_remote_device_props {
165         uint8_t bdaddr[6];
166 } __attribute__((packed));
167
168 #define HAL_OP_GET_REMOTE_DEVICE_PROP   0x07
169 struct hal_cmd_get_remote_device_prop {
170         uint8_t bdaddr[6];
171         uint8_t type;
172 } __attribute__((packed));
173
174 #define HAL_OP_SET_REMOTE_DEVICE_PROP   0x08
175 struct hal_cmd_set_remote_device_prop {
176         uint8_t  bdaddr[6];
177         uint8_t  type;
178         uint16_t len;
179         uint8_t  val[0];
180 } __attribute__((packed));
181
182 #define HAL_OP_GET_REMOTE_SERVICE_REC   0x09
183 struct hal_cmd_get_remote_service_rec {
184         uint8_t bdaddr[6];
185         uint8_t uuid[16];
186 } __attribute__((packed));
187
188 #define HAL_OP_GET_REMOTE_SERVICES      0x0a
189 struct hal_cmd_get_remote_services {
190         uint8_t bdaddr[6];
191 } __attribute__((packed));
192
193 #define HAL_OP_START_DISCOVERY          0x0b
194
195 #define HAL_OP_CANCEL_DISCOVERY         0x0c
196
197 #define BT_TRANSPORT_UNKNOWN            0x00
198 #define BT_TRANSPORT_BR_EDR             0x01
199 #define BT_TRANSPORT_LE                 0x02
200
201 #define HAL_OP_CREATE_BOND              0x0d
202 struct hal_cmd_create_bond {
203         uint8_t bdaddr[6];
204         uint8_t transport;
205 } __attribute__((packed));
206
207 #define HAL_OP_REMOVE_BOND              0x0e
208 struct hal_cmd_remove_bond {
209         uint8_t bdaddr[6];
210 } __attribute__((packed));
211
212 #define HAL_OP_CANCEL_BOND              0x0f
213 struct hal_cmd_cancel_bond {
214         uint8_t bdaddr[6];
215 } __attribute__((packed));
216
217 #define HAL_OP_PIN_REPLY                0x10
218 struct hal_cmd_pin_reply {
219         uint8_t bdaddr[6];
220         uint8_t accept;
221         uint8_t pin_len;
222         uint8_t pin_code[16];
223 } __attribute__((packed));
224
225 #define HAL_SSP_VARIANT_CONFIRM         0x00
226 #define HAL_SSP_VARIANT_ENTRY           0x01
227 #define HAL_SSP_VARIANT_CONSENT         0x02
228 #define HAL_SSP_VARIANT_NOTIF           0x03
229
230 #define HAL_OP_SSP_REPLY                0x11
231 struct hal_cmd_ssp_reply {
232         uint8_t  bdaddr[6];
233         uint8_t  ssp_variant;
234         uint8_t  accept;
235         uint32_t passkey;
236 } __attribute__((packed));
237
238 #define HAL_OP_DUT_MODE_CONF            0x12
239 struct hal_cmd_dut_mode_conf {
240         uint8_t enable;
241 } __attribute__((packed));
242
243 #define HAL_OP_DUT_MODE_SEND            0x13
244 struct hal_cmd_dut_mode_send {
245         uint16_t opcode;
246         uint8_t  len;
247         uint8_t  data[0];
248 } __attribute__((packed));
249
250 #define HAL_OP_LE_TEST_MODE             0x14
251 struct hal_cmd_le_test_mode {
252         uint16_t opcode;
253         uint8_t  len;
254         uint8_t  data[0];
255 } __attribute__((packed));
256
257 #define HAL_OP_GET_CONNECTION_STATE     0x15
258 struct hal_cmd_get_connection_state {
259         uint8_t  bdaddr[6];
260 } __attribute__((packed));
261
262 struct hal_rsp_get_connection_state {
263         int32_t connection_state;
264 } __attribute__((packed));
265
266 #define HAL_OP_READ_ENERGY_INFO         0x16
267
268 /* Bluetooth Socket HAL api */
269
270 #define HAL_MODE_SOCKET_DEFAULT         HAL_MODE_DEFAULT
271 #define HAL_MODE_SOCKET_DYNAMIC_MAP     0x01
272
273 #define HAL_SOCK_RFCOMM         0x01
274 #define HAL_SOCK_SCO            0x02
275 #define HAL_SOCK_L2CAP          0x03
276
277 #define HAL_SOCK_FLAG_ENCRYPT   0x01
278 #define HAL_SOCK_FLAG_AUTH      0x02
279
280 #define HAL_OP_SOCKET_LISTEN            0x01
281 struct hal_cmd_socket_listen {
282         uint8_t type;
283         uint8_t name[256];
284         uint8_t uuid[16];
285         int32_t channel;
286         uint8_t flags;
287 } __attribute__((packed));
288
289 #define HAL_OP_SOCKET_CONNECT           0x02
290 struct hal_cmd_socket_connect {
291         uint8_t bdaddr[6];
292         uint8_t type;
293         uint8_t uuid[16];
294         int32_t channel;
295         uint8_t flags;
296 } __attribute__((packed));
297
298 /* Bluetooth HID Host HAL API */
299
300 #define HAL_OP_HIDHOST_CONNECT          0x01
301 struct hal_cmd_hidhost_connect {
302         uint8_t bdaddr[6];
303 } __attribute__((packed));
304
305 #define HAL_OP_HIDHOST_DISCONNECT               0x02
306 struct hal_cmd_hidhost_disconnect {
307         uint8_t bdaddr[6];
308 } __attribute__((packed));
309
310 #define HAL_OP_HIDHOST_VIRTUAL_UNPLUG           0x03
311 struct hal_cmd_hidhost_virtual_unplug {
312         uint8_t bdaddr[6];
313 } __attribute__((packed));
314
315 #define HAL_OP_HIDHOST_SET_INFO         0x04
316 struct hal_cmd_hidhost_set_info {
317         uint8_t  bdaddr[6];
318         uint8_t  attr;
319         uint8_t  subclass;
320         uint8_t  app_id;
321         uint16_t vendor;
322         uint16_t product;
323         uint16_t country;
324         uint16_t descr_len;
325         uint8_t  descr[0];
326 } __attribute__((packed));
327
328 #define HAL_HIDHOST_REPORT_PROTOCOL             0x00
329 #define HAL_HIDHOST_BOOT_PROTOCOL               0x01
330 #define HAL_HIDHOST_UNSUPPORTED_PROTOCOL        0xff
331
332 #define HAL_OP_HIDHOST_GET_PROTOCOL     0x05
333 struct hal_cmd_hidhost_get_protocol {
334         uint8_t bdaddr[6];
335         uint8_t mode;
336 } __attribute__((packed));
337
338 #define HAL_OP_HIDHOST_SET_PROTOCOL     0x06
339 struct hal_cmd_hidhost_set_protocol {
340         uint8_t bdaddr[6];
341         uint8_t mode;
342 } __attribute__((packed));
343
344 #define HAL_HIDHOST_INPUT_REPORT                0x01
345 #define HAL_HIDHOST_OUTPUT_REPORT               0x02
346 #define HAL_HIDHOST_FEATURE_REPORT              0x03
347
348 #define HAL_OP_HIDHOST_GET_REPORT               0x07
349 struct hal_cmd_hidhost_get_report {
350         uint8_t  bdaddr[6];
351         uint8_t  type;
352         uint8_t  id;
353         uint16_t buf_size;
354 } __attribute__((packed));
355
356 #define HAL_OP_HIDHOST_SET_REPORT               0x08
357 struct hal_cmd_hidhost_set_report {
358         uint8_t  bdaddr[6];
359         uint8_t  type;
360         uint16_t len;
361         uint8_t  data[0];
362 } __attribute__((packed));
363
364 #define HAL_OP_HIDHOST_SEND_DATA                0x09
365 struct hal_cmd_hidhost_send_data {
366         uint8_t  bdaddr[6];
367         uint16_t len;
368         uint8_t  data[0];
369 } __attribute__((packed));
370
371 /* a2dp source and sink HAL API */
372
373 #define HAL_OP_A2DP_CONNECT     0x01
374 struct hal_cmd_a2dp_connect {
375         uint8_t bdaddr[6];
376 } __attribute__((packed));
377
378 #define HAL_OP_A2DP_DISCONNECT  0x02
379 struct hal_cmd_a2dp_disconnect {
380         uint8_t bdaddr[6];
381 } __attribute__((packed));
382
383 /* PAN HAL API */
384
385 /* PAN Roles */
386 #define HAL_PAN_ROLE_NONE       0x00
387 #define HAL_PAN_ROLE_NAP        0x01
388 #define HAL_PAN_ROLE_PANU       0x02
389
390 /* PAN Control states */
391 #define HAL_PAN_CTRL_ENABLED    0x00
392 #define HAL_PAN_CTRL_DISABLED   0x01
393
394 /* PAN Connection states */
395 #define HAL_PAN_STATE_CONNECTED         0x00
396 #define HAL_PAN_STATE_CONNECTING        0x01
397 #define HAL_PAN_STATE_DISCONNECTED      0x02
398 #define HAL_PAN_STATE_DISCONNECTING     0x03
399
400 /* PAN status values */
401 #define HAL_PAN_STATUS_FAIL             0x01
402 #define HAL_PAN_STATUS_NOT_READY        0x02
403 #define HAL_PAN_STATUS_NO_MEMORY        0x03
404 #define HAL_PAN_STATUS_BUSY             0x04
405 #define HAL_PAN_STATUS_DONE             0x05
406 #define HAL_PAN_STATUS_UNSUPORTED       0x06
407 #define HAL_PAN_STATUS_INVAL            0x07
408 #define HAL_PAN_STATUS_UNHANDLED        0x08
409 #define HAL_PAN_STATUS_AUTH_FAILED      0x09
410 #define HAL_PAN_STATUS_DEVICE_DOWN      0x0A
411
412 #define HAL_OP_PAN_ENABLE       0x01
413 struct hal_cmd_pan_enable {
414         uint8_t local_role;
415 } __attribute__((packed));
416
417 #define HAL_OP_PAN_GET_ROLE     0x02
418 struct hal_rsp_pan_get_role {
419         uint8_t local_role;
420 } __attribute__((packed));
421
422 #define HAL_OP_PAN_CONNECT      0x03
423 struct hal_cmd_pan_connect {
424         uint8_t bdaddr[6];
425         uint8_t local_role;
426         uint8_t remote_role;
427 } __attribute__((packed));
428
429 #define HAL_OP_PAN_DISCONNECT   0x04
430 struct hal_cmd_pan_disconnect {
431         uint8_t bdaddr[6];
432 } __attribute__((packed));
433
434 #define HAL_HEALTH_MDEP_ROLE_SOURCE     0x00
435 #define HAL_HEALTH_MDEP_ROLE_SINK       0x01
436
437 #define HAL_HEALTH_CHANNEL_TYPE_RELIABLE        0x00
438 #define HAL_HEALTH_CHANNEL_TYPE_STREAMING       0x01
439 #define HAL_HEALTH_CHANNEL_TYPE_ANY             0x02
440
441 #define HAL_OP_HEALTH_REG_APP           0x01
442 struct hal_cmd_health_reg_app {
443         uint8_t  num_of_mdep;
444         uint16_t app_name_off;
445         uint16_t provider_name_off;
446         uint16_t service_name_off;
447         uint16_t service_descr_off;
448         uint16_t len;
449         uint8_t  data[0];
450 } __attribute__((packed));
451
452 struct hal_rsp_health_reg_app {
453         uint16_t app_id;
454 } __attribute__((packed));
455
456 #define HAL_OP_HEALTH_MDEP              0x02
457 struct hal_cmd_health_mdep {
458         uint16_t app_id;
459         uint8_t  role;
460         uint16_t data_type;
461         uint8_t  channel_type;
462         uint16_t descr_len;
463         uint8_t  descr[0];
464 } __attribute__((packed));
465
466 #define HAL_OP_HEALTH_UNREG_APP         0x03
467 struct hal_cmd_health_unreg_app {
468         uint16_t app_id;
469 } __attribute__((packed));
470
471 #define HAL_OP_HEALTH_CONNECT_CHANNEL   0x04
472 struct hal_cmd_health_connect_channel {
473         uint16_t app_id;
474         uint8_t  bdaddr[6];
475         uint8_t  mdep_index;
476 } __attribute__((packed));
477
478 struct hal_rsp_health_connect_channel {
479         uint16_t  channel_id;
480 } __attribute__((packed));
481
482 #define HAL_OP_HEALTH_DESTROY_CHANNEL   0x05
483 struct hal_cmd_health_destroy_channel {
484         uint16_t channel_id;
485 } __attribute__((packed));
486
487 /* Handsfree HAL API */
488
489 #define HAL_MODE_HANDSFREE_HSP_ONLY             HAL_MODE_DEFAULT
490 #define HAL_MODE_HANDSFREE_HFP                  0x01
491 #define HAL_MODE_HANDSFREE_HFP_WBS              0x02
492
493 #define HAL_OP_HANDSFREE_CONNECT                0x01
494 struct hal_cmd_handsfree_connect {
495         uint8_t bdaddr[6];
496 } __attribute__((packed));
497
498 #define HAL_OP_HANDSFREE_DISCONNECT             0x02
499 struct hal_cmd_handsfree_disconnect {
500         uint8_t bdaddr[6];
501 } __attribute__((packed));
502
503 #define HAL_OP_HANDSFREE_CONNECT_AUDIO          0x03
504 struct hal_cmd_handsfree_connect_audio {
505         uint8_t bdaddr[6];
506 } __attribute__((packed));
507
508 #define HAL_OP_HANDSFREE_DISCONNECT_AUDIO       0x04
509 struct hal_cmd_handsfree_disconnect_audio {
510         uint8_t bdaddr[6];
511 } __attribute__((packed));
512
513 #define HAL_OP_HANDSFREE_START_VR               0x05
514 struct hal_cmd_handsfree_start_vr {
515         uint8_t bdaddr[6];
516 } __attribute__((packed));
517
518 #define HAL_OP_HANDSFREE_STOP_VR                0x06
519 struct hal_cmd_handsfree_stop_vr {
520         uint8_t bdaddr[6];
521 } __attribute__((packed));
522
523 #define HAL_HANDSFREE_VOLUME_TYPE_SPEAKER       0x00
524 #define HAL_HANDSFREE_VOLUME_TYPE_MIC           0x01
525
526 #define HAL_OP_HANDSFREE_VOLUME_CONTROL         0x07
527 struct hal_cmd_handsfree_volume_control {
528         uint8_t type;
529         uint8_t volume;
530         uint8_t bdaddr[6];
531 } __attribute__((packed));
532
533 #define HAL_HANDSFREE_NETWORK_STATE_NOT_AVAILABLE       0x00
534 #define HAL_HANDSFREE_NETWORK_STATE_AVAILABLE           0x01
535
536 #define HAL_HANDSFREE_SERVICE_TYPE_HOME         0x00
537 #define HAL_HANDSFREE_SERVICE_TYPE_ROAMING      0x01
538
539 #define HAL_OP_HANDSFREE_DEVICE_STATUS_NOTIF    0x08
540 struct hal_cmd_handsfree_device_status_notif {
541         uint8_t state;
542         uint8_t type;
543         uint8_t signal;
544         uint8_t battery;
545 } __attribute__((packed));
546
547 #define HAL_OP_HANDSFREE_COPS_RESPONSE          0x09
548 struct hal_cmd_handsfree_cops_response {
549         uint16_t len;
550         uint8_t bdaddr[6];
551         uint8_t buf[0];
552 } __attribute__((packed));
553
554 #define HAL_HANDSFREE_CALL_STATE_ACTIVE         0x00
555 #define HAL_HANDSFREE_CALL_STATE_HELD           0x01
556 #define HAL_HANDSFREE_CALL_STATE_DIALING        0x02
557 #define HAL_HANDSFREE_CALL_STATE_ALERTING       0x03
558 #define HAL_HANDSFREE_CALL_STATE_INCOMING       0x04
559 #define HAL_HANDSFREE_CALL_STATE_WAITING        0x05
560 #define HAL_HANDSFREE_CALL_STATE_IDLE           0x06
561
562 #define HAL_OP_HANDSFREE_CIND_RESPONSE          0x0A
563 struct hal_cmd_handsfree_cind_response {
564         uint8_t svc;
565         uint8_t num_active;
566         uint8_t num_held;
567         uint8_t state;
568         uint8_t signal;
569         uint8_t roam;
570         uint8_t batt_chg;
571         uint8_t bdaddr[6];
572 } __attribute__((packed));
573
574 #define HAL_OP_HANDSFREE_FORMATTED_AT_RESPONSE  0x0B
575 struct hal_cmd_handsfree_formatted_at_response {
576         uint16_t len;
577         uint8_t bdaddr[6];
578         uint8_t buf[0];
579 } __attribute__((packed));
580
581 #define HAL_HANDSFREE_AT_RESPONSE_ERROR         0x00
582 #define HAL_HANDSFREE_AT_RESPONSE_OK            0x01
583
584 #define HAL_OP_HANDSFREE_AT_RESPONSE            0x0C
585 struct hal_cmd_handsfree_at_response {
586         uint8_t response;
587         uint8_t error;
588         uint8_t bdaddr[6];
589 } __attribute__((packed));
590
591 #define HAL_HANDSFREE_CALL_DIRECTION_OUTGOING   0x00
592 #define HAL_HANDSFREE_CALL_DIRECTION_INCOMING   0x01
593
594 #define HAL_HANDSFREE_CALL_TYPE_VOICE           0x00
595 #define HAL_HANDSFREE_CALL_TYPE_DATA            0x01
596 #define HAL_HANDSFREE_CALL_TYPE_FAX             0x02
597
598 #define HAL_HANDSFREE_CALL_MPTY_TYPE_SINGLE     0x00
599 #define HAL_HANDSFREE_CALL_MPTY_TYPE_MULTI      0x01
600
601 #define HAL_HANDSFREE_CALL_ADDRTYPE_UNKNOWN     0x81
602 #define HAL_HANDSFREE_CALL_ADDRTYPE_INTERNATIONAL       0x91
603
604 #define HAL_OP_HANDSFREE_CLCC_RESPONSE          0x0D
605 struct hal_cmd_handsfree_clcc_response {
606         uint8_t index;
607         uint8_t dir;
608         uint8_t state;
609         uint8_t mode;
610         uint8_t mpty;
611         uint8_t type;
612         uint8_t bdaddr[6];
613         uint16_t number_len;
614         uint8_t number[0];
615 } __attribute__((packed));
616
617 #define HAL_OP_HANDSFREE_PHONE_STATE_CHANGE     0x0E
618 struct hal_cmd_handsfree_phone_state_change {
619         uint8_t num_active;
620         uint8_t num_held;
621         uint8_t state;
622         uint8_t type;
623         uint16_t number_len;
624         uint8_t number[0];
625 } __attribute__((packed));
626
627 #define HAL_HANDSFREE_WBS_NONE                  0x00
628 #define HAL_HANDSFREE_WBS_NO                    0x01
629 #define HAL_HANDSFREE_WBS_YES                   0x02
630
631 #define HAL_OP_HANDSFREE_CONFIGURE_WBS          0x0F
632 struct hal_cmd_handsfree_configure_wbs {
633         uint8_t bdaddr[6];
634         uint8_t config;
635 } __attribute__((packed));
636
637 /* AVRCP TARGET HAL API */
638
639 #define HAL_AVRCP_PLAY_STATUS_STOPPED   0x00
640 #define HAL_AVRCP_PLAY_STATUS_PLAYING   0x01
641 #define HAL_AVRCP_PLAY_STATUS_PAUSED    0x02
642 #define HAL_AVRCP_PLAY_STATUS_FWD_SEEK  0x03
643 #define HAL_AVRCP_PLAY_STATUS_REV_SEEK  0x04
644 #define HAL_AVRCP_PLAY_STATUS_ERROR     0xff
645
646 #define HAL_OP_AVRCP_GET_PLAY_STATUS    0x01
647 struct hal_cmd_avrcp_get_play_status {
648         uint8_t status;
649         uint32_t duration;
650         uint32_t position;
651 } __attribute__((packed));
652
653 #define HAL_AVRCP_PLAYER_ATTR_EQUALIZER 0x01
654 #define HAL_AVRCP_PLAYER_ATTR_REPEAT    0x02
655 #define HAL_AVRCP_PLAYER_ATTR_SHUFFLE   0x03
656 #define HAL_AVRCP_PLAYER_ATTR_SCAN      0x04
657
658 #define HAL_OP_AVRCP_LIST_PLAYER_ATTRS  0x02
659 struct hal_cmd_avrcp_list_player_attrs {
660         uint8_t number;
661         uint8_t attrs[0];
662 } __attribute__((packed));
663
664 #define HAL_OP_AVRCP_LIST_PLAYER_VALUES 0x03
665 struct hal_cmd_avrcp_list_player_values {
666         uint8_t number;
667         uint8_t values[0];
668 } __attribute__((packed));
669
670 struct hal_avrcp_player_attr_value {
671         uint8_t attr;
672         uint8_t value;
673 } __attribute__((packed));
674
675 #define HAL_OP_AVRCP_GET_PLAYER_ATTRS   0x04
676 struct hal_cmd_avrcp_get_player_attrs {
677         uint8_t number;
678         struct hal_avrcp_player_attr_value attrs[0];
679 } __attribute__((packed));
680
681 struct hal_avrcp_player_setting_text {
682         uint8_t id;
683         uint8_t len;
684         uint8_t text[0];
685 } __attribute__((packed));
686
687 #define HAL_OP_AVRCP_GET_PLAYER_ATTRS_TEXT      0x05
688 struct hal_cmd_avrcp_get_player_attrs_text {
689         uint8_t number;
690         struct hal_avrcp_player_setting_text attrs[0];
691 } __attribute__((packed));
692
693 #define HAL_OP_AVRCP_GET_PLAYER_VALUES_TEXT     0x06
694 struct hal_cmd_avrcp_get_player_values_text {
695         uint8_t number;
696         struct hal_avrcp_player_setting_text values[0];
697 } __attribute__((packed));
698
699 #define HAL_AVRCP_MEDIA_ATTR_TITLE              0x01
700 #define HAL_AVRCP_MEDIA_ATTR_ARTIST             0x02
701 #define HAL_AVRCP_MEDIA_ATTR_ALBUM              0x03
702 #define HAL_AVRCP_MEDIA_ATTR_TRACK_NUM          0x04
703 #define HAL_AVRCP_MEDIA_ATTR_NUM_TRACKS         0x05
704 #define HAL_AVRCP_MEDIA_ATTR_GENRE              0x06
705 #define HAL_AVRCP_MEDIA_ATTR_DURATION           0x07
706
707 #define HAL_OP_AVRCP_GET_ELEMENT_ATTRS_TEXT     0x07
708 struct hal_cmd_avrcp_get_element_attrs_text {
709         uint8_t number;
710         struct hal_avrcp_player_setting_text values[0];
711 } __attribute__((packed));
712
713 #define HAL_OP_AVRCP_SET_PLAYER_ATTRS_VALUE     0x08
714 struct hal_cmd_avrcp_set_player_attrs_value {
715         uint8_t status;
716 } __attribute__((packed));
717
718 #define HAL_AVRCP_EVENT_STATUS_CHANGED          0x01
719 #define HAL_AVRCP_EVENT_TRACK_CHANGED           0x02
720 #define HAL_AVRCP_EVENT_TRACK_REACHED_END       0x03
721 #define HAL_AVRCP_EVENT_TRACK_REACHED_START     0x04
722 #define HAL_AVRCP_EVENT_POSITION_CHANGED        0x05
723 #define HAL_AVRCP_EVENT_SETTING_CHANGED         0x08
724
725 #define HAL_AVRCP_EVENT_TYPE_INTERIM            0x00
726 #define HAL_AVRCP_EVENT_TYPE_CHANGED            0x01
727
728 #define HAL_OP_AVRCP_REGISTER_NOTIFICATION      0x09
729 struct hal_cmd_avrcp_register_notification {
730         uint8_t event;
731         uint8_t type;
732         uint8_t len;
733         uint8_t data[0];
734 } __attribute__((packed));
735
736 #define HAL_OP_AVRCP_SET_VOLUME                 0x0a
737 struct hal_cmd_avrcp_set_volume {
738         uint8_t value;
739 } __attribute__((packed));
740
741 /* AVRCP CTRL HAL API */
742
743 #define HAL_OP_AVRCP_CTRL_SEND_PASSTHROUGH      0x01
744 struct hal_cmd_avrcp_ctrl_send_passthrough {
745         uint8_t bdaddr[6];
746         uint8_t key_code;
747         uint8_t key_state;
748 } __attribute__((packed));
749
750 /* GATT HAL API */
751
752 #define HAL_OP_GATT_CLIENT_REGISTER             0x01
753 struct hal_cmd_gatt_client_register {
754         uint8_t uuid[16];
755 } __attribute__((packed));
756
757 #define HAL_OP_GATT_CLIENT_UNREGISTER           0x02
758 struct hal_cmd_gatt_client_unregister {
759         int32_t client_if;
760 } __attribute__((packed));
761
762 #define HAL_OP_GATT_CLIENT_SCAN                 0x03
763 struct hal_cmd_gatt_client_scan {
764         int32_t client_if;
765         uint8_t start;
766 } __attribute__((packed));
767
768 #define HAL_OP_GATT_CLIENT_CONNECT              0x04
769 struct hal_cmd_gatt_client_connect {
770         int32_t client_if;
771         uint8_t bdaddr[6];
772         uint8_t is_direct;
773         int32_t transport;
774 } __attribute__((packed));
775
776 #define HAL_OP_GATT_CLIENT_DISCONNECT           0x05
777 struct hal_cmd_gatt_client_disconnect {
778         int32_t client_if;
779         uint8_t bdaddr[6];
780         int32_t conn_id;
781 } __attribute__((packed));
782
783 #define HAL_OP_GATT_CLIENT_LISTEN               0x06
784 struct hal_cmd_gatt_client_listen {
785         int32_t client_if;
786         uint8_t start;
787 } __attribute__((packed));
788
789 #define HAL_OP_GATT_CLIENT_REFRESH              0x07
790 struct hal_cmd_gatt_client_refresh {
791         int32_t client_if;
792         uint8_t bdaddr[6];
793 } __attribute__((packed));
794
795 #define HAL_OP_GATT_CLIENT_SEARCH_SERVICE       0x08
796 struct hal_cmd_gatt_client_search_service {
797         int32_t conn_id;
798         uint8_t filtered;
799         uint8_t filter_uuid[0];
800 } __attribute__((packed));
801
802 #define HAL_OP_GATT_CLIENT_GET_INCLUDED_SERVICE 0x09
803 struct hal_gatt_srvc_id {
804         uint8_t uuid[16];
805         uint8_t inst_id;
806         uint8_t is_primary;
807 } __attribute__((packed));
808
809 struct hal_cmd_gatt_client_get_included_service {
810         int32_t conn_id;
811         struct hal_gatt_srvc_id srvc_id;
812         uint8_t continuation;
813         struct hal_gatt_srvc_id incl_srvc_id[0];
814 } __attribute__((packed));
815
816 #define HAL_OP_GATT_CLIENT_GET_CHARACTERISTIC   0x0a
817 struct hal_gatt_gatt_id {
818         uint8_t uuid[16];
819         uint8_t inst_id;
820 } __attribute__((packed));
821
822 struct hal_cmd_gatt_client_get_characteristic {
823         int32_t conn_id;
824         struct hal_gatt_srvc_id srvc_id;
825         uint8_t continuation;
826         struct hal_gatt_gatt_id char_id[0];
827 } __attribute__((packed));
828
829 #define HAL_OP_GATT_CLIENT_GET_DESCRIPTOR       0x0b
830 struct hal_cmd_gatt_client_get_descriptor {
831         int32_t conn_id;
832         struct hal_gatt_srvc_id srvc_id;
833         struct hal_gatt_gatt_id char_id;
834         uint8_t continuation;
835         struct hal_gatt_gatt_id descr_id[0];
836 } __attribute__((packed));
837
838 #define HAL_OP_GATT_CLIENT_READ_CHARACTERISTIC  0x0c
839 struct hal_cmd_gatt_client_read_characteristic {
840         int32_t conn_id;
841         struct hal_gatt_srvc_id srvc_id;
842         struct hal_gatt_gatt_id char_id;
843         int32_t auth_req;
844 } __attribute__((packed));
845
846 #define GATT_WRITE_TYPE_NO_RESPONSE     0x01
847 #define GATT_WRITE_TYPE_DEFAULT         0x02
848 #define GATT_WRITE_TYPE_PREPARE         0x03
849 #define GATT_WRITE_TYPE_SIGNED          0x04
850
851 #define HAL_OP_GATT_CLIENT_WRITE_CHARACTERISTIC 0x0d
852 struct hal_cmd_gatt_client_write_characteristic {
853         int32_t conn_id;
854         struct hal_gatt_srvc_id srvc_id;
855         struct hal_gatt_gatt_id char_id;
856         int32_t write_type;
857         int32_t len;
858         int32_t auth_req;
859         uint8_t value[0];
860 } __attribute__((packed));
861
862 #define HAL_OP_GATT_CLIENT_READ_DESCRIPTOR      0x0e
863 struct hal_cmd_gatt_client_read_descriptor {
864         int32_t conn_id;
865         struct hal_gatt_srvc_id srvc_id;
866         struct hal_gatt_gatt_id char_id;
867         struct hal_gatt_gatt_id descr_id;
868         int32_t auth_req;
869 } __attribute__((packed));
870
871 #define HAL_OP_GATT_CLIENT_WRITE_DESCRIPTOR     0x0f
872 struct hal_cmd_gatt_client_write_descriptor {
873         int32_t conn_id;
874         struct hal_gatt_srvc_id srvc_id;
875         struct hal_gatt_gatt_id char_id;
876         struct hal_gatt_gatt_id descr_id;
877         int32_t write_type;
878         int32_t len;
879         int32_t auth_req;
880         uint8_t value[0];
881 } __attribute__((packed));
882
883 #define HAL_OP_GATT_CLIENT_EXECUTE_WRITE        0x10
884 struct hal_cmd_gatt_client_execute_write {
885         int32_t conn_id;
886         int32_t execute;
887 } __attribute__((packed));
888
889 #define HAL_OP_GATT_CLIENT_REGISTER_FOR_NOTIFICATION    0x11
890 struct hal_cmd_gatt_client_register_for_notification {
891         int32_t client_if;
892         uint8_t bdaddr[6];
893         struct hal_gatt_srvc_id srvc_id;
894         struct hal_gatt_gatt_id char_id;
895 } __attribute__((packed));
896
897 #define HAL_OP_GATT_CLIENT_DEREGISTER_FOR_NOTIFICATION  0x12
898 struct hal_cmd_gatt_client_deregister_for_notification {
899         int32_t client_if;
900         uint8_t bdaddr[6];
901         struct hal_gatt_srvc_id srvc_id;
902         struct hal_gatt_gatt_id char_id;
903 } __attribute__((packed));
904
905 #define HAL_OP_GATT_CLIENT_READ_REMOTE_RSSI     0x13
906 struct hal_cmd_gatt_client_read_remote_rssi {
907         int32_t client_if;
908         uint8_t bdaddr[6];
909 } __attribute__((packed));
910
911 #define HAL_OP_GATT_CLIENT_GET_DEVICE_TYPE      0x14
912 struct hal_cmd_gatt_client_get_device_type {
913         uint8_t bdaddr[6];
914 } __attribute__((packed));
915
916 struct hal_rsp_gatt_client_get_device_type {
917         uint8_t type;
918 } __attribute__((packed));
919
920 #define HAL_OP_GATT_CLIENT_SET_ADV_DATA         0x015
921 struct hal_cmd_gatt_client_set_adv_data {
922         int32_t  server_if;
923         uint8_t  set_scan_rsp;
924         uint8_t  include_name;
925         uint8_t  include_txpower;
926         int32_t  min_interval;
927         int32_t  max_interval;
928         int32_t  appearance;
929         uint16_t manufacturer_len;
930         uint16_t service_data_len;
931         uint16_t service_uuid_len;
932         uint8_t  data[0];
933 } __attribute__((packed));
934
935 #define GATT_CLIENT_TEST_CMD_ENABLE             0x01
936 #define GATT_CLIENT_TEST_CMD_CONNECT            0x02
937 #define GATT_CLIENT_TEST_CMD_DISCONNECT         0x03
938 #define GATT_CLIENT_TEST_CMD_DISCOVER           0x04
939 #define GATT_CLIENT_TEST_CMD_READ               0xe0
940 #define GATT_CLIENT_TEST_CMD_WRITE              0xe1
941 #define GATT_CLIENT_TEST_CMD_INCREASE_SECURITY  0xe2
942 #define GATT_CLIENT_TEST_CMD_PAIRING_CONFIG     0xf0
943
944 #define HAL_OP_GATT_CLIENT_TEST_COMMAND         0x16
945 struct hal_cmd_gatt_client_test_command {
946         int32_t command;
947         uint8_t  bda1[6];
948         uint8_t  uuid1[16];
949         uint16_t u1;
950         uint16_t u2;
951         uint16_t u3;
952         uint16_t u4;
953         uint16_t u5;
954 } __attribute__((packed));
955
956 #define HAL_OP_GATT_SERVER_REGISTER             0x17
957 struct hal_cmd_gatt_server_register {
958         uint8_t uuid[16];
959 } __attribute__((packed));
960
961 #define HAL_OP_GATT_SERVER_UNREGISTER           0x18
962 struct hal_cmd_gatt_server_unregister {
963         int32_t server_if;
964 } __attribute__((packed));
965
966 #define HAL_OP_GATT_SERVER_CONNECT              0x19
967 struct hal_cmd_gatt_server_connect {
968         int32_t server_if;
969         uint8_t bdaddr[6];
970         uint8_t is_direct;
971         int32_t transport;
972 } __attribute__((packed));
973
974 #define HAL_OP_GATT_SERVER_DISCONNECT           0x1a
975 struct hal_cmd_gatt_server_disconnect {
976         int32_t server_if;
977         uint8_t bdaddr[6];
978         int32_t conn_id;
979 } __attribute__((packed));
980
981 #define HAL_OP_GATT_SERVER_ADD_SERVICE          0x1b
982 struct hal_cmd_gatt_server_add_service {
983         int32_t server_if;
984         struct hal_gatt_srvc_id srvc_id;
985         int32_t num_handles;
986 } __attribute__((packed));
987
988 #define HAL_OP_GATT_SERVER_ADD_INC_SERVICE      0x1c
989 struct hal_cmd_gatt_server_add_inc_service {
990         int32_t server_if;
991         int32_t service_handle;
992         int32_t included_handle;
993 } __attribute__((packed));
994
995 #define HAL_OP_GATT_SERVER_ADD_CHARACTERISTIC   0x1d
996 struct hal_cmd_gatt_server_add_characteristic {
997         int32_t server_if;
998         int32_t service_handle;
999         uint8_t uuid[16];
1000         int32_t properties;
1001         int32_t permissions;
1002 } __attribute__((packed));
1003
1004 #define HAL_OP_GATT_SERVER_ADD_DESCRIPTOR       0x1e
1005 struct hal_cmd_gatt_server_add_descriptor {
1006         int32_t server_if;
1007         int32_t service_handle;
1008         uint8_t uuid[16];
1009         int32_t permissions;
1010 } __attribute__((packed));
1011
1012 #define GATT_SERVER_TRANSPORT_LE_BIT            0x01
1013 #define GATT_SERVER_TRANSPORT_BREDR_BIT         0x02
1014
1015 #define HAL_OP_GATT_SERVER_START_SERVICE        0x1f
1016 struct hal_cmd_gatt_server_start_service {
1017         int32_t server_if;
1018         int32_t service_handle;
1019         int32_t transport;
1020 } __attribute__((packed));
1021
1022 #define HAL_OP_GATT_SERVER_STOP_SERVICE         0x20
1023 struct hal_cmd_gatt_server_stop_service {
1024         int32_t server_if;
1025         int32_t service_handle;
1026 } __attribute__((packed));
1027
1028 #define HAL_OP_GATT_SERVER_DELETE_SERVICE       0x21
1029 struct hal_cmd_gatt_server_delete_service {
1030         int32_t server_if;
1031         int32_t service_handle;
1032 } __attribute__((packed));
1033
1034 #define HAL_OP_GATT_SERVER_SEND_INDICATION      0x22
1035 struct hal_cmd_gatt_server_send_indication {
1036         int32_t server_if;
1037         int32_t attribute_handle;
1038         int32_t conn_id;
1039         int32_t len;
1040         int32_t confirm;
1041         uint8_t value[0];
1042 } __attribute__((packed));
1043
1044 #define HAL_OP_GATT_SERVER_SEND_RESPONSE        0x23
1045 struct hal_cmd_gatt_server_send_response {
1046         int32_t conn_id;
1047         int32_t trans_id;
1048         uint16_t handle;
1049         uint16_t offset;
1050         uint8_t auth_req;
1051         int32_t status;
1052         uint16_t len;
1053         uint8_t data[0];
1054 } __attribute__((packed));
1055
1056 #define HAL_OP_GATT_CLIENT_SCAN_FILTER_SETUP    0x024
1057 struct hal_cmd_gatt_client_scan_filter_setup {
1058         int32_t client_if;
1059         int32_t action;
1060         int32_t filter_index;
1061         int32_t features;
1062         int32_t list_type;
1063         int32_t filter_type;
1064         int32_t rssi_hi;
1065         int32_t rssi_lo;
1066         int32_t delivery_mode;
1067         int32_t found_timeout;
1068         int32_t lost_timeout;
1069         int32_t found_timeout_cnt;
1070 } __attribute__((packed));
1071
1072 #define HAL_OP_GATT_CLIENT_SCAN_FILTER_ADD_REMOVE       0x025
1073 struct hal_cmd_gatt_client_scan_filter_add_remove {
1074         int32_t client_if;
1075         int32_t action;
1076         int32_t filter_type;
1077         int32_t filter_index;
1078         int32_t company_id;
1079         int32_t company_id_mask;
1080         uint8_t uuid[16];
1081         uint8_t uuid_mask[16];
1082         uint8_t address[6];
1083         uint8_t address_type;
1084         int32_t data_len;
1085         int32_t mask_len;
1086         uint8_t data_mask[0]; /* common buffer for data and mask */
1087 } __attribute__((packed));
1088
1089 #define HAL_OP_GATT_CLIENT_SCAN_FILTER_CLEAR            0x26
1090 struct hal_cmd_gatt_client_scan_filter_clear {
1091         int32_t client_if;
1092         int32_t index;
1093 } __attribute__((packed));
1094
1095 #define HAL_OP_GATT_CLIENT_SCAN_FILTER_ENABLE           0x27
1096 struct hal_cmd_gatt_client_scan_filter_enable {
1097         int32_t client_if;
1098         uint8_t enable;
1099 } __attribute__((packed));
1100
1101 #define HAL_OP_GATT_CLIENT_CONFIGURE_MTU                0x28
1102 struct hal_cmd_gatt_client_configure_mtu {
1103         int32_t conn_id;
1104         int32_t mtu;
1105 } __attribute__((packed));
1106
1107 #define HAL_OP_GATT_CLIENT_CONN_PARAM_UPDATE            0x29
1108 struct hal_cmd_gatt_client_conn_param_update {
1109         uint8_t address[6];
1110         int32_t min_interval;
1111         int32_t max_interval;
1112         int32_t latency;
1113         int32_t timeout;
1114 } __attribute__((packed));
1115
1116 #define HAL_OP_GATT_CLIENT_SET_SCAN_PARAM               0x2a
1117 struct hal_cmd_gatt_client_set_scan_param {
1118         int32_t interval;
1119         int32_t window;
1120 } __attribute__((packed));
1121
1122 #define HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV              0x2b
1123 struct hal_cmd_gatt_client_setup_multi_adv {
1124         int32_t client_if;
1125         int32_t min_interval;
1126         int32_t max_interval;
1127         int32_t type;
1128         int32_t channel_map;
1129         int32_t tx_power;
1130         int32_t timeout;
1131 } __attribute__((packed));
1132
1133 #define HAL_OP_GATT_CLIENT_UPDATE_MULTI_ADV             0x2c
1134 struct hal_cmd_gatt_client_update_multi_adv {
1135         int32_t client_if;
1136         int32_t min_interval;
1137         int32_t max_interval;
1138         int32_t type;
1139         int32_t channel_map;
1140         int32_t tx_power;
1141         int32_t timeout;
1142 } __attribute__((packed));
1143
1144 #define HAL_OP_GATT_CLIENT_SETUP_MULTI_ADV_INST         0x2d
1145 struct hal_cmd_gatt_client_setup_multi_adv_inst {
1146         int32_t client_if;
1147         uint8_t set_scan_rsp;
1148         uint8_t include_name;
1149         uint8_t include_tx_power;
1150         int32_t appearance;
1151         int32_t manufacturer_data_len;
1152         int32_t service_data_len;
1153         int32_t service_uuid_len;
1154         uint8_t data_service_uuid[0];
1155 } __attribute__((packed));
1156
1157 #define HAL_OP_GATT_CLIENT_DISABLE_MULTI_ADV_INST       0x2e
1158 struct hal_cmd_gatt_client_disable_multi_adv_inst {
1159         int32_t client_if;
1160 } __attribute__((packed));
1161
1162 #define HAL_OP_GATT_CLIENT_CONFIGURE_BATCHSCAN          0x2f
1163 struct hal_cmd_gatt_client_configure_batchscan {
1164         int32_t client_if;
1165         int32_t full_max;
1166         int32_t trunc_max;
1167         int32_t notify_threshold;
1168 } __attribute__((packed));
1169
1170 #define HAL_OP_GATT_CLIENT_ENABLE_BATCHSCAN             0x30
1171 struct hal_cmd_gatt_client_enable_batchscan {
1172         int32_t client_if;
1173         int32_t mode;
1174         int32_t interval;
1175         int32_t window;
1176         int32_t address_type;
1177         int32_t discard_rule;
1178 } __attribute__((packed));
1179
1180 #define HAL_OP_GATT_CLIENT_DISABLE_BATCHSCAN            0x31
1181 struct hal_cmd_gatt_client_disable_batchscan {
1182         int32_t client_if;
1183 } __attribute__((packed));
1184
1185 #define HAL_OP_GATT_CLIENT_READ_BATCHSCAN_REPORTS       0x32
1186 struct hal_cmd_gatt_client_read_batchscan_reports {
1187         int32_t client_if;
1188         int32_t scan_mode;
1189 } __attribute__((packed));
1190
1191 /* Handsfree client HAL API */
1192
1193 #define HAL_OP_HF_CLIENT_CONNECT                0x01
1194 struct hal_cmd_hf_client_connect {
1195         uint8_t bdaddr[6];
1196 } __attribute__((packed));
1197
1198 #define HAL_OP_HF_CLIENT_DISCONNECT             0x02
1199 struct hal_cmd_hf_client_disconnect {
1200         uint8_t bdaddr[6];
1201 } __attribute__((packed));
1202
1203 #define HAL_OP_HF_CLIENT_CONNECT_AUDIO          0x03
1204 struct hal_cmd_hf_client_connect_audio {
1205         uint8_t bdaddr[6];
1206 } __attribute__((packed));
1207
1208 #define HAL_OP_HF_CLIENT_DISCONNECT_AUDIO       0x04
1209 struct hal_cmd_hf_client_disconnect_audio {
1210         uint8_t bdaddr[6];
1211 } __attribute__((packed));
1212
1213 #define HAL_OP_HF_CLIENT_START_VR               0x05
1214 #define HAL_OP_HF_CLIENT_STOP_VR                0x06
1215
1216 #define HF_CLIENT_VOLUME_TYPE_SPEAKER   0x00
1217 #define HF_CLIENT_VOLUME_TYPE_MIC       0x01
1218
1219 #define HAL_OP_HF_CLIENT_VOLUME_CONTROL         0x07
1220 struct hal_cmd_hf_client_volume_control {
1221         uint8_t type;
1222         uint8_t volume;
1223 } __attribute__((packed));
1224
1225 #define HAL_OP_HF_CLIENT_DIAL                   0x08
1226 struct hal_cmd_hf_client_dial {
1227         uint16_t number_len;
1228         uint8_t number[0];
1229 } __attribute__((packed));
1230
1231 #define HAL_OP_HF_CLIENT_DIAL_MEMORY            0x09
1232 struct hal_cmd_hf_client_dial_memory {
1233         int32_t location;
1234 } __attribute__((packed));
1235
1236 #define HAL_HF_CLIENT_ACTION_CHLD_0             0x00
1237 #define HAL_HF_CLIENT_ACTION_CHLD_1             0x01
1238 #define HAL_HF_CLIENT_ACTION_CHLD_2             0x02
1239 #define HAL_HF_CLIENT_ACTION_CHLD_3             0x03
1240 #define HAL_HF_CLIENT_ACTION_CHLD_4             0x04
1241 #define HAL_HF_CLIENT_ACTION_CHLD_1x            0x05
1242 #define HAL_HF_CLIENT_ACTION_CHLD_2x            0x06
1243 #define HAL_HF_CLIENT_ACTION_ATA                0x07
1244 #define HAL_HF_CLIENT_ACTION_CHUP               0x08
1245 #define HAL_HF_CLIENT_ACTION_BRTH_0             0x09
1246 #define HAL_HF_CLIENT_ACTION_BRTH_1             0x0a
1247 #define HAL_HF_CLIENT_ACTION_BRTH_2             0x0b
1248
1249 #define HAL_OP_HF_CLIENT_CALL_ACTION            0x0a
1250 struct hal_cmd_hf_client_call_action {
1251         uint8_t action;
1252         int32_t index;
1253 } __attribute__((packed));
1254
1255 #define HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS    0x0b
1256 #define HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME    0x0c
1257 #define HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO   0x0d
1258
1259 #define HAL_OP_HF_CLIENT_SEND_DTMF              0x0e
1260 struct hal_cmd_hf_client_send_dtmf {
1261         uint8_t tone;
1262 } __attribute__((packed));
1263
1264 #define HAL_OP_HF_CLIENT_GET_LAST_VOICE_TAG_NUM 0x0f
1265
1266 /* MAP CLIENT HAL API */
1267
1268 #define HAL_OP_MAP_CLIENT_GET_INSTANCES 0x01
1269 struct hal_cmd_map_client_get_instances {
1270         uint8_t bdaddr[6];
1271 } __attribute__((packed));
1272
1273 /* Notifications and confirmations */
1274
1275 #define HAL_POWER_OFF                   0x00
1276 #define HAL_POWER_ON                    0x01
1277
1278 #define HAL_EV_ADAPTER_STATE_CHANGED    0x81
1279 struct hal_ev_adapter_state_changed {
1280         uint8_t state;
1281 } __attribute__((packed));
1282
1283 #define HAL_EV_ADAPTER_PROPS_CHANGED    0x82
1284 struct hal_property {
1285         uint8_t  type;
1286         uint16_t len;
1287         uint8_t  val[0];
1288 } __attribute__((packed));
1289 struct hal_ev_adapter_props_changed {
1290         uint8_t              status;
1291         uint8_t              num_props;
1292         struct  hal_property props[0];
1293 } __attribute__((packed));
1294
1295 #define HAL_EV_REMOTE_DEVICE_PROPS      0x83
1296 struct hal_ev_remote_device_props {
1297         uint8_t             status;
1298         uint8_t             bdaddr[6];
1299         uint8_t             num_props;
1300         struct hal_property props[0];
1301 } __attribute__((packed));
1302
1303 #define HAL_EV_DEVICE_FOUND             0x84
1304 struct hal_ev_device_found {
1305         uint8_t             num_props;
1306         struct hal_property props[0];
1307 } __attribute__((packed));
1308
1309 #define HAL_DISCOVERY_STATE_STOPPED     0x00
1310 #define HAL_DISCOVERY_STATE_STARTED     0x01
1311
1312 #define HAL_EV_DISCOVERY_STATE_CHANGED  0x85
1313 struct hal_ev_discovery_state_changed {
1314         uint8_t state;
1315 } __attribute__((packed));
1316
1317 #define HAL_EV_PIN_REQUEST              0x86
1318 struct hal_ev_pin_request {
1319         uint8_t  bdaddr[6];
1320         uint8_t  name[249];
1321         uint32_t class_of_dev;
1322 } __attribute__((packed));
1323
1324 #define HAL_EV_SSP_REQUEST              0x87
1325 struct hal_ev_ssp_request {
1326         uint8_t  bdaddr[6];
1327         uint8_t  name[249];
1328         uint32_t class_of_dev;
1329         uint8_t  pairing_variant;
1330         uint32_t passkey;
1331 } __attribute__((packed));
1332
1333 #define HAL_BOND_STATE_NONE 0
1334 #define HAL_BOND_STATE_BONDING 1
1335 #define HAL_BOND_STATE_BONDED 2
1336
1337 #define HAL_EV_BOND_STATE_CHANGED       0x88
1338 struct hal_ev_bond_state_changed {
1339         uint8_t status;
1340         uint8_t bdaddr[6];
1341         uint8_t state;
1342 } __attribute__((packed));
1343
1344 #define HAL_ACL_STATE_CONNECTED         0x00
1345 #define HAL_ACL_STATE_DISCONNECTED      0x01
1346
1347 #define HAL_EV_ACL_STATE_CHANGED        0x89
1348 struct hal_ev_acl_state_changed {
1349         uint8_t status;
1350         uint8_t bdaddr[6];
1351         uint8_t state;
1352 } __attribute__((packed));
1353
1354 #define HAL_EV_DUT_MODE_RECEIVE         0x8a
1355 struct hal_ev_dut_mode_receive {
1356         uint16_t opcode;
1357         uint8_t  len;
1358         uint8_t  data[0];
1359 } __attribute__((packed));
1360
1361 #define HAL_EV_LE_TEST_MODE             0x8b
1362 struct hal_ev_le_test_mode {
1363         uint8_t  status;
1364         uint16_t num_packets;
1365 } __attribute__((packed));
1366
1367 #define HAL_EV_ENERGY_INFO              0x8c
1368 struct hal_ev_energy_info {
1369         uint8_t status;
1370         uint8_t ctrl_state;
1371         uint64_t tx_time;
1372         uint64_t rx_time;
1373         uint64_t idle_time;
1374         uint64_t energy_used;
1375 } __attribute__((packed));
1376
1377 #define HAL_HIDHOST_STATE_CONNECTED             0x00
1378 #define HAL_HIDHOST_STATE_CONNECTING    0x01
1379 #define HAL_HIDHOST_STATE_DISCONNECTED  0x02
1380 #define HAL_HIDHOST_STATE_DISCONNECTING 0x03
1381 #define HAL_HIDHOST_STATE_NO_HID                0x07
1382 #define HAL_HIDHOST_STATE_FAILED                0x08
1383 #define HAL_HIDHOST_STATE_UNKNOWN               0x09
1384
1385 #define HAL_EV_HIDHOST_CONN_STATE               0x81
1386 struct hal_ev_hidhost_conn_state {
1387         uint8_t bdaddr[6];
1388         uint8_t state;
1389 } __attribute__((packed));
1390
1391 #define HAL_HIDHOST_STATUS_OK                   0x00
1392
1393 #define HAL_HIDHOST_HS_NOT_READY                0x01
1394 #define HAL_HIDHOST_HS_INVALID_RAPORT_ID        0x02
1395 #define HAL_HIDHOST_HS_TRANS_NOT_SUPPORTED      0x03
1396 #define HAL_HIDHOST_HS_INVALID_PARAM            0x04
1397 #define HAL_HIDHOST_HS_ERROR                    0x05
1398
1399 #define HAL_HIDHOST_GENERAL_ERROR               0x06
1400 #define HAL_HIDHOST_SDP_ERROR                   0x07
1401 #define HAL_HIDHOST_PROTOCOL_ERROR              0x08
1402 #define HAL_HIDHOST_DB_ERROR                    0x09
1403 #define HAL_HIDHOST_TOD_UNSUPPORTED_ERROR       0x0a
1404 #define HAL_HIDHOST_NO_RESOURCES_ERROR          0x0b
1405 #define HAL_HIDHOST_AUTH_FAILED_ERROR           0x0c
1406 #define HAL_HIDHOST_HDL_ERROR                   0x0d
1407
1408 #define HAL_EV_HIDHOST_INFO                     0x82
1409 struct hal_ev_hidhost_info {
1410         uint8_t  bdaddr[6];
1411         uint8_t  attr;
1412         uint8_t  subclass;
1413         uint8_t  app_id;
1414         uint16_t vendor;
1415         uint16_t product;
1416         uint16_t version;
1417         uint8_t  country;
1418         uint16_t descr_len;
1419         uint8_t  descr[884];
1420 } __attribute__((packed));
1421
1422 #define HAL_EV_HIDHOST_PROTO_MODE               0x83
1423 struct hal_ev_hidhost_proto_mode {
1424         uint8_t bdaddr[6];
1425         uint8_t status;
1426         uint8_t mode;
1427 } __attribute__((packed));
1428
1429 #define HAL_EV_HIDHOST_IDLE_TIME                0x84
1430 struct hal_ev_hidhost_idle_time {
1431         uint8_t bdaddr[6];
1432         uint8_t status;
1433         uint32_t idle_rate;
1434 } __attribute__((packed));
1435
1436 #define HAL_EV_HIDHOST_GET_REPORT               0x85
1437 struct hal_ev_hidhost_get_report {
1438         uint8_t  bdaddr[6];
1439         uint8_t  status;
1440         uint16_t len;
1441         uint8_t  data[0];
1442 } __attribute__((packed));
1443
1444 #define HAL_EV_HIDHOST_VIRTUAL_UNPLUG           0x86
1445 struct hal_ev_hidhost_virtual_unplug {
1446         uint8_t  bdaddr[6];
1447         uint8_t  status;
1448 } __attribute__((packed));
1449
1450 #define HAL_EV_HIDHOST_HANDSHAKE                0x87
1451 struct hal_ev_hidhost_handshake {
1452         uint8_t  bdaddr[6];
1453         uint8_t  status;
1454 } __attribute__((packed));
1455
1456 #define HAL_EV_PAN_CTRL_STATE                   0x81
1457 struct hal_ev_pan_ctrl_state {
1458         uint8_t  state;
1459         uint8_t  status;
1460         uint8_t  local_role;
1461         uint8_t  name[17];
1462 } __attribute__((packed));
1463
1464 #define HAL_EV_PAN_CONN_STATE                   0x82
1465 struct hal_ev_pan_conn_state {
1466         uint8_t  state;
1467         uint8_t  status;
1468         uint8_t  bdaddr[6];
1469         uint8_t  local_role;
1470         uint8_t  remote_role;
1471 } __attribute__((packed));
1472
1473 #define HAL_HEALTH_APP_REG_SUCCESS              0x00
1474 #define HAL_HEALTH_APP_REG_FAILED               0x01
1475 #define HAL_HEALTH_APP_DEREG_SUCCESS            0x02
1476 #define HAL_HEALTH_APP_DEREG_FAILED             0x03
1477
1478 #define HAL_HEALTH_CHANNEL_CONNECTING           0x00
1479 #define HAL_HEALTH_CHANNEL_CONNECTED            0x01
1480 #define HAL_HEALTH_CHANNEL_DISCONNECTING        0x02
1481 #define HAL_HEALTH_CHANNEL_DISCONNECTED         0x03
1482 #define HAL_HEALTH_CHANNEL_DESTROYED            0x04
1483
1484 #define HAL_EV_HEALTH_APP_REG_STATE             0x81
1485 struct hal_ev_health_app_reg_state {
1486         uint16_t id;
1487         uint8_t  state;
1488 } __attribute__((packed));
1489
1490 #define HAL_EV_HEALTH_CHANNEL_STATE             0x82
1491 struct hal_ev_health_channel_state {
1492         uint16_t app_id;
1493         uint8_t  bdaddr[6];
1494         uint8_t  mdep_index;
1495         uint16_t channel_id;
1496         uint8_t  channel_state;
1497 } __attribute__((packed));
1498
1499 #define HAL_A2DP_STATE_DISCONNECTED             0x00
1500 #define HAL_A2DP_STATE_CONNECTING               0x01
1501 #define HAL_A2DP_STATE_CONNECTED                0x02
1502 #define HAL_A2DP_STATE_DISCONNECTING            0x03
1503
1504 #define HAL_EV_A2DP_CONN_STATE                  0x81
1505 struct hal_ev_a2dp_conn_state {
1506         uint8_t state;
1507         uint8_t bdaddr[6];
1508 } __attribute__((packed));
1509
1510 #define HAL_AUDIO_SUSPEND                       0x00
1511 #define HAL_AUDIO_STOPPED                       0x01
1512 #define HAL_AUDIO_STARTED                       0x02
1513
1514 #define HAL_EV_A2DP_AUDIO_STATE                 0x82
1515 struct hal_ev_a2dp_audio_state {
1516         uint8_t state;
1517         uint8_t bdaddr[6];
1518 } __attribute__((packed));
1519
1520 #define HAL_EV_A2DP_AUDIO_CONFIG                0x83
1521 struct hal_ev_a2dp_audio_config {
1522         uint8_t  bdaddr[6];
1523         uint32_t sample_rate;
1524         uint8_t  channel_count;
1525 } __attribute__((packed));
1526
1527 #define HAL_EV_HANDSFREE_CONN_STATE_DISCONNECTED        0x00
1528 #define HAL_EV_HANDSFREE_CONN_STATE_CONNECTING          0x01
1529 #define HAL_EV_HANDSFREE_CONN_STATE_CONNECTED           0x02
1530 #define HAL_EV_HANDSFREE_CONN_STATE_SLC_CONNECTED       0x03
1531 #define HAL_EV_HANDSFREE_CONN_STATE_DISCONNECTING       0x04
1532
1533 #define HAL_EV_HANDSFREE_CONN_STATE             0x81
1534 struct hal_ev_handsfree_conn_state {
1535         uint8_t state;
1536         uint8_t bdaddr[6];
1537 } __attribute__((packed));
1538
1539 #define HAL_EV_HANDSFREE_AUDIO_STATE_DISCONNECTED       0x00
1540 #define HAL_EV_HANDSFREE_AUDIO_STATE_CONNECTING         0x01
1541 #define HAL_EV_HANDSFREE_AUDIO_STATE_CONNECTED          0x02
1542 #define HAL_EV_HANDSFREE_AUDIO_STATE_DISCONNECTING      0x03
1543
1544 #define HAL_EV_HANDSFREE_AUDIO_STATE            0x82
1545 struct hal_ev_handsfree_audio_state {
1546         uint8_t state;
1547         uint8_t bdaddr[6];
1548 } __attribute__((packed));
1549
1550 #define HAL_HANDSFREE_VR_STOPPED        0x00
1551 #define HAL_HANDSFREE_VR_STARTED        0x01
1552
1553 #define HAL_EV_HANDSFREE_VR             0x83
1554 struct hal_ev_handsfree_vr_state {
1555         uint8_t state;
1556         uint8_t bdaddr[6];
1557 } __attribute__((packed));
1558
1559 #define HAL_EV_HANDSFREE_ANSWER         0x84
1560 struct hal_ev_handsfree_answer {
1561         uint8_t bdaddr[6];
1562 } __attribute__((packed));
1563
1564 #define HAL_EV_HANDSFREE_HANGUP         0x85
1565 struct hal_ev_handsfree_hangup {
1566         uint8_t bdaddr[6];
1567 } __attribute__((packed));
1568
1569 #define HAL_EV_HANDSFREE_VOLUME         0x86
1570 struct hal_ev_handsfree_volume {
1571         uint8_t type;
1572         uint8_t volume;
1573         uint8_t bdaddr[6];
1574 } __attribute__((packed));
1575
1576 #define HAL_EV_HANDSFREE_DIAL           0x87
1577 struct hal_ev_handsfree_dial {
1578         uint8_t bdaddr[6];
1579         uint16_t number_len;
1580         uint8_t number[0];
1581 } __attribute__((packed));
1582
1583 #define HAL_EV_HANDSFREE_DTMF           0x88
1584 struct hal_ev_handsfree_dtmf {
1585         uint8_t tone;
1586         uint8_t bdaddr[6];
1587 } __attribute__((packed));
1588
1589 #define HAL_HANDSFREE_NREC_STOP         0x00
1590 #define HAL_HANDSFREE_NREC_START        0x01
1591
1592 #define HAL_EV_HANDSFREE_NREC           0x89
1593 struct hal_ev_handsfree_nrec {
1594         uint8_t nrec;
1595         uint8_t bdaddr[6];
1596 } __attribute__((packed));
1597
1598 #define HAL_HANDSFREE_CHLD_TYPE_RELEASEHELD                     0x00
1599 #define HAL_HANDSFREE_CHLD_TYPE_RELEASEACTIVE_ACCEPTHELD        0x01
1600 #define HAL_HANDSFREE_CHLD_TYPE_HOLDACTIVE_ACCEPTHELD           0x02
1601 #define HAL_HANDSFREE_CHLD_TYPE_ADDHELDTOCONF                   0x03
1602
1603 #define HAL_EV_HANDSFREE_CHLD           0x8A
1604 struct hal_ev_handsfree_chld {
1605         uint8_t chld;
1606         uint8_t bdaddr[6];
1607 } __attribute__((packed));
1608
1609 #define HAL_EV_HANDSFREE_CNUM           0x8B
1610 struct hal_ev_handsfree_cnum {
1611         uint8_t bdaddr[6];
1612 } __attribute__((packed));
1613
1614 #define HAL_EV_HANDSFREE_CIND           0x8C
1615 struct hal_ev_handsfree_cind {
1616         uint8_t bdaddr[6];
1617 } __attribute__((packed));
1618
1619 #define HAL_EV_HANDSFREE_COPS           0x8D
1620 struct hal_ev_handsfree_cops {
1621         uint8_t bdaddr[6];
1622 } __attribute__((packed));
1623
1624 #define HAL_EV_HANDSFREE_CLCC           0x8E
1625 struct hal_ev_handsfree_clcc {
1626         uint8_t bdaddr[6];
1627 } __attribute__((packed));
1628
1629 #define HAL_EV_HANDSFREE_UNKNOWN_AT     0x8F
1630 struct hal_ev_handsfree_unknown_at {
1631         uint8_t bdaddr[6];
1632         uint16_t len;
1633         uint8_t buf[0];
1634 } __attribute__((packed));
1635
1636 #define HAL_EV_HANDSFREE_HSP_KEY_PRESS  0x90
1637 struct hal_ev_handsfree_hsp_key_press {
1638         uint8_t bdaddr[6];
1639 } __attribute__((packed));
1640
1641 #define HAL_EV_HANDSFREE_WBS            0x91
1642 struct hal_ev_handsfree_wbs {
1643         uint8_t wbs;
1644         uint8_t bdaddr[6];
1645 } __attribute__((packed));
1646
1647 #define HAL_AVRCP_FEATURE_NONE                  0x00
1648 #define HAL_AVRCP_FEATURE_METADATA              0x01
1649 #define HAL_AVRCP_FEATURE_ABSOLUTE_VOLUME       0x02
1650 #define HAL_AVRCP_FEATURE_BROWSE                0x04
1651
1652 #define HAL_EV_AVRCP_REMOTE_FEATURES            0x81
1653 struct hal_ev_avrcp_remote_features {
1654         uint8_t bdaddr[6];
1655         uint8_t features;
1656 } __attribute__((packed));
1657
1658 #define HAL_EV_AVRCP_GET_PLAY_STATUS            0x82
1659 #define HAL_EV_AVRCP_LIST_PLAYER_ATTRS          0x83
1660
1661 #define HAL_EV_AVRCP_LIST_PLAYER_VALUES         0x84
1662 struct hal_ev_avrcp_list_player_values {
1663         uint8_t attr;
1664 } __attribute__((packed));
1665
1666 #define HAL_EV_AVRCP_GET_PLAYER_VALUES          0x85
1667 struct hal_ev_avrcp_get_player_values {
1668         uint8_t number;
1669         uint8_t attrs[0];
1670 } __attribute__((packed));
1671
1672 #define HAL_EV_AVRCP_GET_PLAYER_ATTRS_TEXT      0x86
1673 struct hal_ev_avrcp_get_player_attrs_text {
1674         uint8_t number;
1675         uint8_t attrs[0];
1676 } __attribute__((packed));
1677
1678 #define HAL_EV_AVRCP_GET_PLAYER_VALUES_TEXT     0x87
1679 struct hal_ev_avrcp_get_player_values_text {
1680         uint8_t attr;
1681         uint8_t number;
1682         uint8_t values[0];
1683 } __attribute__((packed));
1684
1685 #define HAL_EV_AVRCP_SET_PLAYER_VALUES          0x88
1686 struct hal_ev_avrcp_set_player_values {
1687         uint8_t number;
1688         struct hal_avrcp_player_attr_value attrs[0];
1689 } __attribute__((packed));
1690
1691 #define HAL_EV_AVRCP_GET_ELEMENT_ATTRS          0x89
1692 struct hal_ev_avrcp_get_element_attrs {
1693         uint8_t number;
1694         uint8_t attrs[0];
1695 } __attribute__((packed));
1696
1697 #define HAL_EV_AVRCP_REGISTER_NOTIFICATION      0x8a
1698 struct hal_ev_avrcp_register_notification {
1699         uint8_t event;
1700         uint32_t param;
1701 } __attribute__((packed));
1702
1703 #define HAL_EV_AVRCP_VOLUME_CHANGED             0x8b
1704 struct hal_ev_avrcp_volume_changed {
1705         uint8_t volume;
1706         uint8_t type;
1707 } __attribute__((packed));
1708
1709 #define HAL_EV_AVRCP_PASSTHROUGH_CMD            0x8c
1710 struct hal_ev_avrcp_passthrough_cmd {
1711         uint8_t id;
1712         uint8_t state;
1713 } __attribute__((packed));
1714
1715 #define HAL_EV_AVRCP_CTRL_CONN_STATE            0x81
1716 struct hal_ev_avrcp_ctrl_conn_state {
1717         uint8_t state;
1718         uint8_t bdaddr[6];
1719 } __attribute__((packed));
1720
1721 #define HAL_EV_AVRCP_CTRL_PASSTHROUGH_RSP       0x82
1722 struct hal_ev_avrcp_ctrl_passthrough_rsp {
1723         uint8_t id;
1724         uint8_t key_state;
1725 } __attribute__((packed));
1726
1727 #define HAL_EV_GATT_CLIENT_REGISTER_CLIENT      0x81
1728 struct hal_ev_gatt_client_register_client {
1729         int32_t status;
1730         int32_t client_if;
1731         uint8_t app_uuid[16];
1732 } __attribute__((packed));
1733
1734 #define HAL_EV_GATT_CLIENT_SCAN_RESULT  0x82
1735 struct hal_ev_gatt_client_scan_result {
1736         uint8_t  bda[6];
1737         int32_t  rssi;
1738         uint16_t len;
1739         uint8_t  adv_data[0];
1740 } __attribute__((packed));
1741
1742 #define HAL_EV_GATT_CLIENT_CONNECT      0x83
1743 struct hal_ev_gatt_client_connect {
1744         int32_t conn_id;
1745         int32_t status;
1746         int32_t client_if;
1747         uint8_t bda[6];
1748 } __attribute__((packed));
1749
1750 #define HAL_EV_GATT_CLIENT_DISCONNECT   0x84
1751 struct hal_ev_gatt_client_disconnect {
1752         int32_t conn_id;
1753         int32_t status;
1754         int32_t client_if;
1755         uint8_t bda[6];
1756 } __attribute__((packed));
1757
1758 #define HAL_EV_GATT_CLIENT_SEARCH_COMPLETE      0x85
1759 struct hal_ev_gatt_client_search_complete {
1760         int32_t conn_id;
1761         int32_t status;
1762 } __attribute__((packed));
1763
1764 #define HAL_EV_GATT_CLIENT_SEARCH_RESULT        0x86
1765 struct hal_ev_gatt_client_search_result {
1766         int32_t conn_id;
1767         struct hal_gatt_srvc_id srvc_id;
1768 } __attribute__((packed));
1769
1770 #define HAL_EV_GATT_CLIENT_GET_CHARACTERISTIC   0x87
1771 struct hal_ev_gatt_client_get_characteristic {
1772         int32_t conn_id;
1773         int32_t status;
1774         struct hal_gatt_srvc_id srvc_id;
1775         struct hal_gatt_gatt_id char_id;
1776         int32_t char_prop;
1777 } __attribute__((packed));
1778
1779 #define HAL_EV_GATT_CLIENT_GET_DESCRIPTOR       0x88
1780 struct hal_ev_gatt_client_get_descriptor {
1781         int32_t conn_id;
1782         int32_t status;
1783         struct hal_gatt_srvc_id srvc_id;
1784         struct hal_gatt_gatt_id char_id;
1785         struct hal_gatt_gatt_id descr_id;
1786 } __attribute__((packed));
1787
1788 #define HAL_EV_GATT_CLIENT_GET_INC_SERVICE      0X89
1789 struct hal_ev_gatt_client_get_inc_service {
1790         int32_t conn_id;
1791         int32_t status;
1792         struct hal_gatt_srvc_id srvc_id;
1793         struct hal_gatt_srvc_id incl_srvc_id;
1794 } __attribute__((packed));
1795
1796 #define HAL_EV_GATT_CLIENT_REGISTER_FOR_NOTIF   0x8a
1797 struct hal_ev_gatt_client_reg_for_notif {
1798         int32_t conn_id;
1799         int32_t registered;
1800         int32_t status;
1801         struct hal_gatt_srvc_id srvc_id;
1802         struct hal_gatt_gatt_id char_id;
1803 } __attribute__((packed));
1804
1805 #define HAL_EV_GATT_CLIENT_NOTIFY               0x8b
1806 struct hal_ev_gatt_client_notify {
1807         int32_t conn_id;
1808         uint8_t bda[6];
1809         struct hal_gatt_srvc_id srvc_id;
1810         struct hal_gatt_gatt_id char_id;
1811         uint8_t  is_notify;
1812         uint16_t len;
1813         uint8_t  value[0];
1814 } __attribute__((packed));
1815
1816 #define HAL_EV_GATT_CLIENT_READ_CHARACTERISTIC  0x8c
1817 struct hal_gatt_read_params {
1818         struct hal_gatt_srvc_id srvc_id;
1819         struct hal_gatt_gatt_id char_id;
1820         struct hal_gatt_gatt_id descr_id;
1821         uint8_t  status;
1822         uint16_t value_type;
1823         uint16_t len;
1824         uint8_t  value[0];
1825 } __attribute__((packed));
1826
1827 struct hal_ev_gatt_client_read_characteristic {
1828         int32_t conn_id;
1829         int32_t status;
1830         struct hal_gatt_read_params data;
1831 } __attribute__((packed));
1832
1833 #define HAL_EV_GATT_CLIENT_WRITE_CHARACTERISTIC 0x8d
1834 struct hal_gatt_write_params {
1835         struct hal_gatt_srvc_id srvc_id;
1836         struct hal_gatt_gatt_id char_id;
1837         struct hal_gatt_gatt_id descr_id;
1838         uint8_t status;
1839 } __attribute__((packed));
1840
1841 struct hal_ev_gatt_client_write_characteristic {
1842         int32_t conn_id;
1843         int32_t status;
1844         struct hal_gatt_write_params data;
1845 } __attribute__((packed));
1846
1847 #define HAL_EV_GATT_CLIENT_READ_DESCRIPTOR      0x8e
1848 struct hal_ev_gatt_client_read_descriptor {
1849         int32_t conn_id;
1850         int32_t status;
1851         struct hal_gatt_read_params data;
1852 } __attribute__((packed));
1853
1854 #define HAL_EV_GATT_CLIENT_WRITE_DESCRIPTOR     0x8f
1855 struct hal_ev_gatt_client_write_descriptor {
1856         int32_t conn_id;
1857         int32_t status;
1858         struct hal_gatt_write_params data;
1859 } __attribute__((packed));
1860
1861 #define HAL_EV_GATT_CLIENT_EXEC_WRITE           0x90
1862 struct hal_ev_gatt_client_exec_write {
1863         int32_t conn_id;
1864         int32_t status;
1865 } __attribute__((packed));
1866
1867 #define HAL_EV_GATT_CLIENT_READ_REMOTE_RSSI     0x91
1868 struct hal_ev_gatt_client_read_remote_rssi {
1869         int32_t client_if;
1870         uint8_t address[6];
1871         int32_t rssi;
1872         int32_t status;
1873 } __attribute__((packed));
1874
1875 #define HAL_EV_GATT_CLIENT_LISTEN               0x92
1876 struct hal_ev_gatt_client_listen {
1877         int32_t status;
1878         int32_t server_if;
1879 } __attribute__((packed));
1880
1881 #define HAL_EV_GATT_SERVER_REGISTER             0x93
1882 struct hal_ev_gatt_server_register {
1883         int32_t status;
1884         int32_t server_if;
1885         uint8_t uuid[16];
1886 } __attribute__((packed));
1887
1888 #define HAL_EV_GATT_SERVER_CONNECTION           0x94
1889 struct hal_ev_gatt_server_connection {
1890         int32_t conn_id;
1891         int32_t server_if;
1892         int32_t connected;
1893         uint8_t bdaddr[6];
1894 } __attribute__((packed));
1895
1896 #define HAL_EV_GATT_SERVER_SERVICE_ADDED        0x95
1897 struct hal_ev_gatt_server_service_added {
1898         int32_t status;
1899         int32_t server_if;
1900         struct hal_gatt_srvc_id srvc_id;
1901         int32_t srvc_handle;
1902 } __attribute__((packed));
1903
1904 #define HAL_EV_GATT_SERVER_INC_SRVC_ADDED       0x96
1905 struct hal_ev_gatt_server_inc_srvc_added {
1906         int32_t status;
1907         int32_t server_if;
1908         int32_t srvc_handle;
1909         int32_t incl_srvc_handle;
1910 } __attribute__((packed));
1911
1912 #define HAL_EV_GATT_SERVER_CHAR_ADDED           0x97
1913 struct hal_ev_gatt_server_characteristic_added {
1914         int32_t status;
1915         int32_t server_if;
1916         uint8_t uuid[16];
1917         int32_t srvc_handle;
1918         int32_t char_handle;
1919 } __attribute__((packed));
1920
1921 #define HAL_EV_GATT_SERVER_DESCRIPTOR_ADDED     0x98
1922 struct hal_ev_gatt_server_descriptor_added {
1923         int32_t status;
1924         int32_t server_if;
1925         uint8_t uuid[16];
1926         int32_t srvc_handle;
1927         int32_t descr_handle;
1928 } __attribute__((packed));
1929
1930 #define HAL_EV_GATT_SERVER_SERVICE_STARTED      0x99
1931 struct hal_ev_gatt_server_service_started {
1932         int32_t status;
1933         int32_t server_if;
1934         int32_t srvc_handle;
1935 } __attribute__((packed));
1936
1937 #define HAL_EV_GATT_SERVER_SERVICE_STOPPED      0x9a
1938 struct hal_ev_gatt_server_service_stopped {
1939         int32_t status;
1940         int32_t server_if;
1941         int32_t srvc_handle;
1942 } __attribute__((packed));
1943
1944 #define HAL_EV_GATT_SERVER_SERVICE_DELETED      0x9b
1945 struct hal_ev_gatt_server_service_deleted {
1946         int32_t status;
1947         int32_t server_if;
1948         int32_t srvc_handle;
1949 } __attribute__((packed));
1950
1951 #define HAL_EV_GATT_SERVER_REQUEST_READ         0x9c
1952 struct hal_ev_gatt_server_request_read {
1953         int32_t conn_id;
1954         int32_t trans_id;
1955         uint8_t bdaddr[6];
1956         int32_t attr_handle;
1957         int32_t offset;
1958         uint8_t is_long;
1959 } __attribute__((packed));
1960
1961 #define HAL_EV_GATT_SERVER_REQUEST_WRITE        0x9d
1962 struct hal_ev_gatt_server_request_write {
1963         int32_t conn_id;
1964         int32_t trans_id;
1965         uint8_t bdaddr[6];
1966         int32_t attr_handle;
1967         int32_t offset;
1968         int32_t length;
1969         uint8_t need_rsp;
1970         uint8_t is_prep;
1971         uint8_t value[0];
1972 } __attribute__((packed));
1973
1974 #define HAL_EV_GATT_SERVER_REQUEST_EXEC_WRITE   0x9e
1975 struct hal_ev_gatt_server_request_exec_write {
1976         int32_t conn_id;
1977         int32_t trans_id;
1978         uint8_t bdaddr[6];
1979         int32_t exec_write;
1980 } __attribute__((packed));
1981
1982 #define HAL_EV_GATT_SERVER_RSP_CONFIRMATION     0x9f
1983 struct hal_ev_gatt_server_rsp_confirmation {
1984         int32_t status;
1985         int32_t handle;
1986 } __attribute__((packed));
1987
1988 #define HAL_EV_GATT_CLIENT_CONFIGURE_MTU        0xa0
1989 struct hal_ev_gatt_client_configure_mtu {
1990         int32_t conn_id;
1991         int32_t status;
1992         int32_t mtu;
1993 } __attribute__((packed));
1994
1995 #define HAL_EV_GATT_CLIENT_FILTER_CONFIG        0xa1
1996 struct hal_ev_gatt_client_filter_config {
1997         int32_t action;
1998         int32_t client_if;
1999         int32_t status;
2000         int32_t type;
2001         int32_t space;
2002 }  __attribute__((packed));
2003
2004 #define HAL_EV_GATT_CLIENT_FILTER_PARAMS        0xa2
2005 struct hal_ev_gatt_client_filter_params {
2006         int32_t action;
2007         int32_t client_if;
2008         int32_t status;
2009         int32_t space;
2010 }  __attribute__((packed));
2011
2012 #define HAL_EV_GATT_CLIENT_FILTER_STATUS        0xa3
2013 struct hal_ev_gatt_client_filter_status {
2014         int32_t enable;
2015         int32_t client_if;
2016         int32_t status;
2017 }  __attribute__((packed));
2018
2019 #define HAL_EV_GATT_CLIENT_MULTI_ADV_ENABLE     0xa4
2020 struct hal_ev_gatt_client_multi_adv_enable {
2021         int32_t client_if;
2022         int32_t status;
2023 } __attribute__((packed));
2024
2025
2026 #define HAL_EV_GATT_CLIENT_MULTI_ADV_UPDATE     0xa5
2027 struct hal_ev_gatt_client_multi_adv_update {
2028         int32_t client_if;
2029         int32_t status;
2030 } __attribute__((packed));
2031
2032
2033 #define HAL_EV_GATT_CLIENT_MULTI_ADV_DATA       0xa6
2034 struct hal_ev_gatt_client_multi_adv_data {
2035         int32_t client_if;
2036         int32_t status;
2037 } __attribute__((packed));
2038
2039
2040 #define HAL_EV_GATT_CLIENT_MULTI_ADV_DISABLE    0xa7
2041 struct hal_ev_gatt_client_multi_adv_disable {
2042         int32_t client_if;
2043         int32_t status;
2044 } __attribute__((packed));
2045
2046 #define HAL_EV_GATT_CLIENT_CONGESTION           0xa8
2047 struct hal_ev_gatt_client_congestion {
2048         int32_t conn_id;
2049         uint8_t congested;
2050 } __attribute__((packed));
2051
2052 #define HAL_EV_GATT_CLIENT_CONFIG_BATCHSCAN     0xa9
2053 struct hal_ev_gatt_client_config_batchscan {
2054         int32_t client_if;
2055         int32_t status;
2056 } __attribute__((packed));
2057
2058 #define HAL_EV_GATT_CLIENT_ENABLE_BATCHSCAN     0xaa
2059 struct hal_ev_gatt_client_enable_batchscan {
2060         int32_t action;
2061         int32_t client_if;
2062         int32_t status;
2063 } __attribute__((packed));
2064
2065 #define HAL_EV_GATT_CLIENT_BATCHSCAN_REPORTS    0xab
2066 struct hal_ev_gatt_client_batchscan_reports {
2067         int32_t client_if;
2068         int32_t status;
2069         int32_t format;
2070         int32_t num;
2071         int32_t data_len;
2072         uint8_t data[0];
2073 } __attribute__((packed));
2074
2075 #define HAL_EV_GATT_CLIENT_BATCHSCAN_THRESHOLD  0xac
2076 struct hal_ev_gatt_client_batchscan_threshold {
2077         int32_t client_if;
2078 } __attribute__((packed));
2079
2080 #define HAL_EV_GATT_CLIENT_TRACK_ADV            0xad
2081 struct hal_ev_gatt_client_track_adv {
2082         int32_t client_if;
2083         int32_t filetr_index;
2084         int32_t address_type;
2085         uint8_t address[6];
2086         int32_t state;
2087 } __attribute__((packed));
2088
2089 #define HAL_EV_GATT_SERVER_INDICATION_SENT      0xae
2090 struct hal_ev_gatt_server_indication_sent {
2091         int32_t conn_id;
2092         int32_t status;
2093 } __attribute__((packed));
2094
2095 #define HAL_EV_GATT_SERVER_CONGESTION           0xaf
2096 struct hal_ev_gatt_server_congestion {
2097         int32_t conn_id;
2098         uint8_t congested;
2099 } __attribute__((packed));
2100
2101 #define HAL_EV_GATT_SERVER_MTU_CHANGED          0xb0
2102 struct hal_ev_gatt_server_mtu_changed {
2103         int32_t conn_id;
2104         int32_t mtu;
2105 } __attribute__((packed));
2106
2107 #define HAL_GATT_PERMISSION_READ                        0x0001
2108 #define HAL_GATT_PERMISSION_READ_ENCRYPTED              0x0002
2109 #define HAL_GATT_PERMISSION_READ_ENCRYPTED_MITM         0x0004
2110 #define HAL_GATT_PERMISSION_WRITE                       0x0010
2111 #define HAL_GATT_PERMISSION_WRITE_ENCRYPTED             0x0020
2112 #define HAL_GATT_PERMISSION_WRITE_ENCRYPTED_MITM        0x0040
2113 #define HAL_GATT_PERMISSION_WRITE_SIGNED                0x0080
2114 #define HAL_GATT_PERMISSION_WRITE_SIGNED_MITM           0x0100
2115
2116 #define HAL_GATT_AUTHENTICATION_NONE            0
2117 #define HAL_GATT_AUTHENTICATION_NO_MITM         1
2118 #define HAL_GATT_AUTHENTICATION_MITM            2
2119
2120 #define HAL_HF_CLIENT_CONN_STATE_DISCONNECTED           0x00
2121 #define HAL_HF_CLIENT_CONN_STATE_CONNECTING             0x01
2122 #define HAL_HF_CLIENT_CONN_STATE_CONNECTED              0x02
2123 #define HAL_HF_CLIENT_CONN_STATE_SLC_CONNECTED          0x03
2124 #define HAL_HF_CLIENT_CONN_STATE_DISCONNECTING          0x04
2125
2126 #define HAL_HF_CLIENT_PEER_FEAT_3WAY            0x00000001
2127 #define HAL_HF_CLIENT_PEER_FEAT_ECNR            0x00000002
2128 #define HAL_HF_CLIENT_PEER_FEAT_VREC            0x00000004
2129 #define HAL_HF_CLIENT_PEER_FEAT_INBAND          0x00000008
2130 #define HAL_HF_CLIENT_PEER_FEAT_VTAG            0x00000010
2131 #define HAL_HF_CLIENT_PEER_FEAT_REJECT          0x00000020
2132 #define HAL_HF_CLIENT_PEER_FEAT_ECS             0x00000040
2133 #define HAL_HF_CLIENT_PEER_FEAT_ECC             0x00000080
2134 #define HAL_HF_CLIENT_PEER_FEAT_EXTERR          0x00000100
2135 #define HAL_HF_CLIENT_PEER_FEAT_CODEC           0x00000200
2136
2137 #define HAL_HF_CLIENT_CHLD_FEAT_REL             0x00000001
2138 #define HAL_HF_CLIENT_CHLD_FEAT_REL_ACC         0x00000002
2139 #define HAL_HF_CLIENT_CHLD_FEAT_REL_X           0x00000004
2140 #define HAL_HF_CLIENT_CHLD_FEAT_HOLD_ACC        0x00000008
2141 #define HAL_HF_CLIENT_CHLD_FEAT_PRIV_X          0x00000010
2142 #define HAL_HF_CLIENT_CHLD_FEAT_MERGE           0x00000020
2143 #define HAL_HF_CLIENT_CHLD_FEAT_MERGE_DETACH    0x00000040
2144
2145 #define HAL_EV_HF_CLIENT_CONN_STATE                     0x81
2146 struct hal_ev_hf_client_conn_state {
2147         uint8_t state;
2148         uint32_t peer_feat;
2149         uint32_t chld_feat;
2150         uint8_t bdaddr[6];
2151 } __attribute__((packed));
2152
2153 #define HAL_HF_CLIENT_AUDIO_STATE_DISCONNECTED          0x00
2154 #define HAL_HF_CLIENT_AUDIO_STATE_CONNECTING            0x01
2155 #define HAL_HF_CLIENT_AUDIO_STATE_CONNECTED             0x02
2156 #define HAL_HF_CLIENT_AUDIO_STATE_CONNECTED_MSBC        0x03
2157
2158 #define HAL_EV_HF_CLIENT_AUDIO_STATE                    0x82
2159 struct hal_ev_hf_client_audio_state {
2160         uint8_t state;
2161         uint8_t bdaddr[6];
2162 } __attribute__((packed));
2163
2164 #define HAL_HF_CLIENT_VR_STOPPED        0x00
2165 #define HAL_HF_CLIENT_VR_STARTED        0x01
2166
2167 #define HAL_EV_HF_CLIENT_VR_STATE                       0x83
2168 struct hal_ev_hf_client_vr_state {
2169         uint8_t state;
2170 } __attribute__((packed));
2171
2172 #define HAL_HF_CLIENT_NET_NOT_AVAILABLE         0x00
2173 #define HAL_HF_CLIENT_NET_AVAILABLE             0x01
2174
2175 #define HAL_EV_HF_CLIENT_NET_STATE                      0x84
2176 struct hal_ev_hf_client_net_state {
2177         uint8_t state;
2178 } __attribute__((packed));
2179
2180 #define HAL_HF_CLIENT_NET_ROAMING_TYPE_HOME             0x00
2181 #define HAL_HF_CLIENT_NET_ROAMING_TYPE_ROAMING          0x01
2182
2183 #define HAL_EV_HF_CLIENT_NET_ROAMING_TYPE               0x85
2184 struct hal_ev_hf_client_net_roaming_type {
2185         uint8_t state;
2186 } __attribute__((packed));
2187
2188 #define HAL_EV_HF_CLIENT_NET_SIGNAL_STRENGTH            0x86
2189 struct hal_ev_hf_client_net_signal_strength {
2190         uint8_t signal_strength;
2191 } __attribute__((packed));
2192
2193 #define HAL_EV_HF_CLIENT_BATTERY_LEVEL                  0x87
2194 struct hal_ev_hf_client_battery_level {
2195         uint8_t battery_level;
2196 } __attribute__((packed));
2197
2198 #define HAL_EV_HF_CLIENT_OPERATOR_NAME                  0x88
2199 struct hal_ev_hf_client_operator_name {
2200         uint16_t name_len;
2201         uint8_t name[0];
2202 } __attribute__((packed));
2203
2204 #define HAL_HF_CLIENT_CALL_IND_NO_CALL_IN_PROGERSS      0x00
2205 #define HAL_HF_CLIENT_CALL_IND_CALL_IN_PROGERSS         0x01
2206
2207 #define HAL_EV_HF_CLIENT_CALL_INDICATOR                 0x89
2208 struct hal_ev_hf_client_call_indicator {
2209         uint8_t call;
2210 } __attribute__((packed));
2211
2212 #define HAL_HF_CLIENT_CALL_SETUP_NONE                   0x00
2213 #define HAL_HF_CLIENT_CALL_SETUP_INCOMING               0x01
2214 #define HAL_HF_CLIENT_CALL_SETUP_OUTGOING               0x02
2215 #define HAL_HF_CLIENT_CALL_SETUP_ALERTING               0x03
2216
2217 #define HAL_EV_HF_CLIENT_CALL_SETUP_INDICATOR           0x8a
2218 struct hal_ev_hf_client_call_setup_indicator {
2219         uint8_t call_setup;
2220 } __attribute__((packed));
2221
2222 #define HAL_HF_CLIENT_CALL_HELD_IND_NONE                0x00
2223 #define HAL_HF_CLIENT_CALL_HELD_IND_HOLD_AND_ACTIVE     0x01
2224 #define HAL_HF_CLIENT_CALL_SETUP_IND_HOLD               0x02
2225
2226 #define HAL_EV_HF_CLIENT_CALL_HELD_INDICATOR            0x8b
2227 struct hal_ev_hf_client_call_held_indicator {
2228         uint8_t call_held;
2229 } __attribute__((packed));
2230
2231 #define HAL_HF_CLIENT_RESP_AND_HOLD_STATUS_HELD         0x00
2232 #define HAL_HF_CLIENT_RESP_AND_HOLD_STATUS_ACCEPT       0x01
2233 #define HAL_HF_CLIENT_RESP_AND_HOLD_STATUS_REJECT       0x02
2234
2235 #define HAL_EV_HF_CLIENT_RESPONSE_AND_HOLD_STATUS       0x8c
2236 struct hal_ev_hf_client_response_and_hold_status {
2237         uint8_t status;
2238 } __attribute__((packed));
2239
2240 #define HAL_EV_HF_CLIENT_CALLING_LINE_IDENT             0x8d
2241 struct hal_ev_hf_client_calling_line_ident {
2242         uint16_t number_len;
2243         uint8_t number[0];
2244 } __attribute__((packed));
2245
2246 #define HAL_EV_HF_CLIENT_CALL_WAITING                   0x8e
2247 struct hal_ev_hf_client_call_waiting {
2248         uint16_t number_len;
2249         uint8_t number[0];
2250 } __attribute__((packed));
2251
2252 #define HAL_HF_CLIENT_DIRECTION_OUTGOING        0x00
2253 #define HAL_HF_CLIENT_DIRECTION_INCOMING        0x01
2254
2255 #define HAL_HF_CLIENT_CALL_STATE_ACTIVE                 0x00
2256 #define HAL_HF_CLIENT_CALL_STATE_HELD                   0x01
2257 #define HAL_HF_CLIENT_CALL_STATE_DIALING                0x02
2258 #define HAL_HF_CLIENT_CALL_STATE_ALERTING               0x03
2259 #define HAL_HF_CLIENT_CALL_STATE_INCOMING               0x04
2260 #define HAL_HF_CLIENT_CALL_STATE_WAITING                0x05
2261 #define HAL_HF_CLIENT_CALL_STATE_HELD_BY_RESP_AND_HOLD  0x06
2262
2263 #define HAL_EV_HF_CLIENT_CURRENT_CALL                   0x8f
2264 struct hal_ev_hf_client_current_call {
2265         uint8_t index;
2266         uint8_t direction;
2267         uint8_t call_state;
2268         uint8_t multiparty;
2269         uint16_t number_len;
2270         uint8_t number[0];
2271 } __attribute__((packed));
2272
2273 #define HAL_EV_CLIENT_VOLUME_CHANGED                    0x90
2274 struct hal_ev_hf_client_volume_changed {
2275         uint8_t type;
2276         uint8_t volume;
2277 } __attribute__((packed));
2278
2279 #define HAL_HF_CLIENT_CMD_COMP_OK                       0x00
2280 #define HAL_HF_CLIENT_CMD_COMP_ERR                      0x01
2281 #define HAL_HF_CLIENT_CMD_COMP_ERR_NO_CARRIER           0x02
2282 #define HAL_HF_CLIENT_CMD_COMP_ERR_BUSY                 0x03
2283 #define HAL_HF_CLIENT_CMD_COMP_ERR_NO_ANSWER            0x04
2284 #define HAL_HF_CLIENT_CMD_COMP_ERR_DELAYED              0x05
2285 #define HAL_HF_CLIENT_CMD_COMP_ERR_BACKLISTED           0x06
2286 #define HAL_HF_CLIENT_CMD_COMP_ERR_CME                  0x07
2287
2288 #define HAL_EV_CLIENT_COMMAND_COMPLETE                  0x91
2289 struct hal_ev_hf_client_command_complete {
2290         uint8_t type;
2291         uint8_t cme;
2292 } __attribute__((packed));
2293
2294 #define HAL_HF_CLIENT_SUBSCR_TYPE_UNKNOWN       0x00
2295 #define HAL_HF_CLIENT_SUBSCR_TYPE_VOICE         0x01
2296 #define HAL_HF_CLIENT_SUBSCR_TYPE_FAX           0x02
2297
2298 #define HAL_EV_CLIENT_SUBSCRIBER_SERVICE_INFO           0x92
2299 struct hal_ev_hf_client_subscriber_service_info {
2300         uint8_t type;
2301         uint16_t name_len;
2302         uint8_t name[0];
2303 } __attribute__((packed));
2304
2305 #define HAL_HF_CLIENT_INBAND_RINGTONE_NOT_PROVIDED      0x00
2306 #define HAL_HF_CLIENT_INBAND_RINGTONE_PROVIDED          0x01
2307
2308 #define HAL_EV_CLIENT_INBAND_SETTINGS                   0x93
2309 struct hal_ev_hf_client_inband_settings {
2310         uint8_t state;
2311 } __attribute__((packed));
2312
2313 #define HAL_EV_CLIENT_LAST_VOICE_CALL_TAG_NUM           0x94
2314 struct hal_ev_hf_client_last_void_call_tag_num {
2315         uint16_t number_len;
2316         uint8_t number[0];
2317 } __attribute__((packed));
2318
2319 #define HAL_EV_CLIENT_RING_INDICATION                   0x95
2320
2321 #define HAL_EV_MAP_CLIENT_REMOTE_MAS_INSTANCES  0x81
2322 struct hal_map_client_mas_instance {
2323         int32_t id;
2324         int32_t scn;
2325         int32_t msg_types;
2326         int32_t name_len;
2327         uint8_t name[0];
2328 } __attribute__((packed));
2329
2330 struct hal_ev_map_client_remote_mas_instances {
2331         int8_t status;
2332         uint8_t bdaddr[6];
2333         int32_t num_instances;
2334         struct hal_map_client_mas_instance instances[0];
2335 } __attribute__((packed));