2 * Copyright (c) 2015 -2016 Samsung Electronics Co., Ltd All Rights Reserved.
4 * Contact: Anupam Roy <anupam.r@samsung.com>
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #ifndef _BT_HAL_MSG_H_
22 #define _BT_HAL_MSG_H_
24 #define HAL_MINIMUM_EVENT 0x81
25 /*TODO: More events to be added in subsequent patches */
27 /* HAL Global Macros */
28 #define HAL_POWER_OFF 0x00
29 #define HAL_POWER_ON 0x01
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
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
49 /* Tizen specific HAL Adapter and Device property types.
50 These properties have to added to HAL bt_property_type_t enums */
52 struct hal_prop_device_service_rec {
57 } __attribute__((packed));
59 #define HAL_PROP_DEVICE_FRIENDLY_NAME 0x0a
60 #define HAL_PROP_DEVICE_RSSI 0x0b
61 #define HAL_PROP_DEVICE_VERSION_INFO 0x0c
63 * Tizen specific HAL Adapter and Device property types.
64 * These properties have to added to HAL bt_property_type_t enums
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
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
81 struct hal_prop_device_info {
84 uint16_t manufacturer;
85 } __attribute__((packed));
87 #define HAL_PROP_DEVICE_TIMESTAMP 0xFF
89 #define HAL_EV_ADAPTER_STATE_CHANGED 0x00
90 struct hal_ev_adapter_state_changed {
92 } __attribute__((packed));
99 } __attribute__((packed));
101 #define HAL_EV_ADAPTER_PROPS_CHANGED 0x01
102 struct hal_ev_adapter_props_changed {
105 struct hal_property props[0];
106 } __attribute__((packed));
109 #define HAL_DISCOVERY_STATE_STOPPED 0x00
110 #define HAL_DISCOVERY_STATE_STARTED 0x01
112 #define HAL_EV_DISCOVERY_STATE_CHANGED 0x85
113 struct hal_ev_discovery_state_changed {
115 } __attribute__((packed));
117 #define HAL_EV_REMOTE_DEVICE_PROPS 0x83
118 struct hal_ev_remote_device_props {
122 struct hal_property props[0];
123 } __attribute__((packed));
125 #define HAL_EV_DEVICE_FOUND 0x84
126 struct hal_ev_device_found {
128 struct hal_property props[0];
129 } __attribute__((packed));
132 /* Device callbacks */
133 #define HAL_EV_PIN_REQUEST 0x86
134 struct hal_ev_pin_request {
137 uint32_t class_of_dev;
138 } __attribute__((packed));
140 #define HAL_EV_SSP_REQUEST 0x87
141 struct hal_ev_ssp_request {
144 uint32_t class_of_dev;
145 uint8_t pairing_variant;
147 } __attribute__((packed));
149 #define HAL_BOND_STATE_NONE 0
150 #define HAL_BOND_STATE_BONDING 1
151 #define HAL_BOND_STATE_BONDED 2
153 #define HAL_EV_BOND_STATE_CHANGED 0x88
154 struct hal_ev_bond_state_changed {
158 } __attribute__((packed));
160 #define HAL_EV_AUTHORIZE_REQUEST 0x89
161 struct hal_ev_authorize_request {
164 } __attribute__((packed));
167 #define HAL_EV_SOCK_AUTHORIZE_REQUEST 0x90
168 struct hal_ev_sock_conn_auth {
171 } __attribute__((packed));
172 #endif //TIZEN_BT_HAL
174 #define HAL_ACL_STATE_CONNECTED 0x00
175 #define HAL_ACL_STATE_DISCONNECTED 0x01
177 #define HAL_EV_ACL_STATE_CHANGED 0x8A
178 struct hal_ev_acl_state_changed {
182 } __attribute__((packed));
184 #define HAL_DEVICE_TRUSTED 0x00
185 #define HAL_DEVICE_UNTRUSTED 0x01
187 #define HAL_EV_DEVICE_TRUST_CHANGED 0x8B
188 struct hal_ev_device_trust_state_changed {
191 } __attribute__((packed));
193 #define BT_TRANSPORT_UNKNOWN 0x00
194 #define BT_TRANSPORT_BR_EDR 0x01
195 #define BT_TRANSPORT_LE 0x02
197 /* HID host events */
198 #define HAL_HIDHOST_STATE_CONNECTED 0x00
199 #define HAL_HIDHOST_STATE_CONNECTING 0x01
200 #define HAL_HIDHOST_STATE_DISCONNECTED 0x02
201 #define HAL_HIDHOST_STATE_DISCONNECTING 0x03
202 #define HAL_HIDHOST_STATE_NO_HID 0x07
203 #define HAL_HIDHOST_STATE_FAILED 0x08
204 #define HAL_HIDHOST_STATE_UNKNOWN 0x09
206 #define HAL_EV_HIDHOST_CONN_STATE 0x81
207 struct hal_ev_hidhost_conn_state {
210 } __attribute__((packed));
212 #define HAL_EV_HIDHOST_INFO 0x82
213 struct hal_ev_hidhost_info {
224 } __attribute__((packed));
226 #define HAL_EV_HIDHOST_PROTO_MODE 0x83
227 struct hal_ev_hidhost_proto_mode {
231 } __attribute__((packed));
233 #define HAL_EV_HIDHOST_IDLE_TIME 0x84
234 struct hal_ev_hidhost_idle_time {
238 } __attribute__((packed));
240 #define HAL_EV_HIDHOST_GET_REPORT 0x85
241 struct hal_ev_hidhost_get_report {
246 } __attribute__((packed));
248 #define HAL_EV_HIDHOST_VIRTUAL_UNPLUG 0x86
249 struct hal_ev_hidhost_virtual_unplug {
252 } __attribute__((packed));
254 #define HAL_EV_HIDHOST_HANDSHAKE 0x87
255 struct hal_ev_hidhost_handshake {
258 } __attribute__((packed));
260 /* Bluetooth Socket HAL events */
261 struct hal_ev_sock_connect {
266 } __attribute__((packed));
268 /* A2DP (AV) Headers */
269 #define HAL_EV_A2DP_STATE_DISCONNECTED 0x00
270 #define HAL_EV_A2DP_STATE_CONNECTING 0x01
271 #define HAL_EV_A2DP_STATE_CONNECTED 0x02
272 #define HAL_EV_A2DP_STATE_DISCONNECTING 0x03
274 #define HAL_EV_A2DP_CONN_STATE 0x8C
275 struct hal_ev_a2dp_conn_state {
278 } __attribute__((packed));
280 #define HAL_AUDIO_SUSPEND 0x00
281 #define HAL_AUDIO_STOPPED 0x01
282 #define HAL_AUDIO_STARTED 0x02
284 #define HAL_EV_A2DP_AUDIO_STATE 0x8D
285 struct hal_ev_a2dp_audio_state {
288 } __attribute__((packed));
290 #define HAL_EV_A2DP_AUDIO_CONFIG 0x8E
291 struct hal_ev_a2dp_audio_config {
293 uint32_t sample_rate;
294 uint8_t channel_count;
295 } __attribute__((packed));
297 /* A2DP Sink Role connection*/
298 #define HAL_EV_A2DP_SOURCE_CONN_STATE 0x8F
300 /* HandsFree Headers */
301 #define HAL_EV_HANDSFREE_CONN_STATE_DISCONNECTED 0x00
302 #define HAL_EV_HANDSFREE_CONN_STATE_CONNECTING 0x01
303 #define HAL_EV_HANDSFREE_CONN_STATE_CONNECTED 0x02
304 #define HAL_EV_HANDSFREE_CONN_STATE_SLC_CONNECTED 0x03
305 #define HAL_EV_HANDSFREE_CONN_STATE_DISCONNECTING 0x04
307 #define HAL_EV_HANDSFREE_CONN_STATE 0x91
308 struct hal_ev_handsfree_conn_state {
311 } __attribute__((packed));
313 #define HAL_EV_HANDSFREE_AUDIO_STATE_DISCONNECTED 0x00
314 #define HAL_EV_HANDSFREE_AUDIO_STATE_CONNECTING 0x01
315 #define HAL_EV_HANDSFREE_AUDIO_STATE_CONNECTED 0x02
316 #define HAL_EV_HANDSFREE_AUDIO_STATE_DISCONNECTING 0x04
318 #define HAL_EV_HANDSFREE_AUDIO_STATE 0x92
319 struct hal_ev_handsfree_audio_state {
322 } __attribute__((packed));
325 #define HAL_EV_HDP_APP_REG_STATE 0x93
326 struct hal_ev_hdp_app_reg_state {
329 } __attribute__((packed));
331 #define HAL_EV_HDP_CONN_STATE 0x94
332 struct hal_ev_hdp_conn_state {
337 uint8_t channel_state;
339 } __attribute__((packed));
341 /* AVRCP Controller Role HAL Events */
342 #define HAL_EV_AVRCP_CTRL_CONN_STATE 0x95
343 #define HAL_AVRCP_CTRL_STATE_DISCONNECTED 0x00
344 #define HAL_AVRCP_CTRL_STATE_CONNECTED 0x01
345 struct hal_ev_avrcp_ctrl_conn_state {
348 } __attribute__((packed));
350 #define HAL_EV_AVRCP_CTRL_PASS_THROUGH_RSP 0x96
351 struct hal_ev_pass_cmd_rsp {
355 } __attribute__((packed));
357 #define HAL_EV_AVRCP_CTRL_SET_PLAYER_APP_SETTING_RSP 0x97
358 #define HAL_AVRCP_PLAYER_APP_SETTING_REJECTED 0x00
359 #define HAL_AVRCP_PLAYER_APP_SETTING_ACCEPTED 0x01
360 struct hal_ev_set_player_app_setting_rsp {
363 } __attribute__((packed));
365 #define HAL_EV_AVRCP_CTRL_PLAYER_APP_SETTING_CHANGED 0x98
366 #define HAL_MAX_APP_SETTINGS 8
367 #define HAL_PLAYER_ATTR_EQUALIZER 0x01
368 #define HAL_PLAYER_ATTR_REPEAT 0x02
369 #define HAL_PLAYER_ATTR_SHUFFLE 0x03
370 #define HAL_PLAYER_ATTR_SCAN 0x04
371 struct hal_ev_player_setting {
374 uint8_t attr_ids[HAL_MAX_APP_SETTINGS];
375 uint8_t attr_values[HAL_MAX_APP_SETTINGS];
376 } __attribute__((packed));
378 #define HAL_EV_AVRCP_CTRL_TRACK_CHANGED 0x99
379 #define HAL_MAX_ATTR_STR_LEN 100
380 #define HAL_MAX_ATTR_NUM 10
381 #define HAL_MEDIA_ATTR_ID_INVALID -1
382 #define HAL_MEDIA_ATTR_ID_TITLE 0x00000001
383 #define HAL_MEDIA_ATTR_ID_ARTIST 0x00000002
384 #define HAL_MEDIA_ATTR_ID_ALBUM 0x00000003
385 #define HAL_MEDIA_ATTR_ID_TRACK_NUM 0x00000004
386 #define HAL_MEDIA_ATTR_ID_NUM_TRACKS 0x00000005
387 #define HAL_MEDIA_ATTR_ID_GENRE 0x00000006
388 #define HAL_MEDIA_ATTR_ID_PLAYING_TIME 0x00000007
389 struct hal_attr_val {
391 uint8_t text[HAL_MAX_ATTR_STR_LEN];
392 } __attribute__((packed));
394 struct hal_ev_track_changed {
397 struct hal_attr_val attr[HAL_MAX_ATTR_NUM];
398 } __attribute__((packed));
400 #define HAL_EV_AVRCP_CTRL_PLAY_POSITION_CHANGED 0xA0
401 struct hal_ev_play_position {
405 } __attribute__((packed));
407 #define HAL_EV_AVRCP_CTRL_PLAY_STATUS_CHANGED 0xA1
408 #define HAL_PLAYSTATE_STOPPED 0x00 /* Stopped */
409 #define HAL_PLAYSTATE_PLAYING 0x01 /* Playing */
410 #define HAL_PLAYSTATE_PAUSED 0x02 /* Paused */
411 #define HAL_PLAYSTATE_FWD_SEEK 0x03 /* Fwd Seek*/
412 #define HAL_PLAYSTATE_REV_SEEK 0x04 /* Rev Seek*/
413 #define HAL_PLAYSTATE_ERROR 0xFF /* Error */
414 struct hal_ev_play_status_changed {
417 } __attribute__((packed));
419 /* AVRCP TG events */
421 #define HAL_EV_AVRCP_TG_CONN_STATE 0xA2
422 #define HAL_EV_AVRCP_TG_DELAY_CHANGE 0xF1
424 #define HAL_AVRCP_TG_STATE_DISCONNECTED 0x00
425 #define HAL_AVRCP_TG_STATE_CONNECTED 0x01
426 struct hal_ev_avrcp_tg_conn_state{
429 } __attribute__((packed));
431 struct hal_ev_avrcp_tg_delay_changed{
434 } __attribute__((packed));
436 #endif /* TIZEN_BT_HAL */
438 #define HAL_EV_AVRCP_TG_SET_PLAYER_PROPERTY 0xA3
440 #define HAL_AVRCP_TG_PLAYER_PROP_EQUALIZER 0x00
441 #define HAL_AVRCP_TG_PLAYER_PROP_REPEAT 0x01
442 #define HAL_AVRCP_TG_PLAYER_PROP_SHUFFLE 0x02
443 #define HAL_AVRCP_TG_PLAYER_PROP_SCAN 0x03
444 struct hal_ev_avrcp_tg_player_property {
447 } __attribute__((packed));
450 #define HAL_EV_SERVER_INSTANCE_INITIALIZED 0xA4
451 struct hal_ev_server_instance_registered {
453 uint32_t server_instance;
454 uint8_t app_uuid[16];
455 } __attribute__((packed));
457 #define HAL_EV_MULTI_ADV_DATA_SET 0xA5
458 struct hal_ev_multi_adv_data_set {
460 uint8_t server_instance;
461 } __attribute__((packed));
463 #define HAL_EV_MULTI_ADV_ENABLE 0xA6
464 struct hal_ev_multi_adv_enable {
466 uint32_t server_instance;
467 } __attribute__((packed));
469 #define HAL_EV_MULTI_ADV_DISABLE 0xA7
470 struct hal_ev_multi_adv_disable {
472 uint32_t server_instance;
473 } __attribute__((packed));
475 #define HAL_EV_MULTI_ADV_UPDATE 0xA8
476 struct hal_ev_multi_adv_update {
478 uint32_t server_instance;
479 } __attribute__((packed));
481 #define HAL_EV_LEGACY_ADV_ENABLE 0xA9
482 struct hal_ev_legacy_adv_status {
484 uint32_t server_instance;
485 } __attribute__((packed));
487 #define HAL_EV_GATT_CLIENT_REGISTERED 0xAA
488 struct hal_ev_gatt_client_registered {
491 uint8_t app_uuid[16];
492 } __attribute__((packed));
494 #define HAL_EV_GATT_CLIENT_SCAN_RESULT 0xAC
495 struct hal_ev_gatt_client_scan_result {
502 } __attribute__((packed));
504 #define HAL_EV_GATT_SERVICE_ADDED 0xAD
505 struct hal_ev_gatt_service_added {
507 uint32_t server_instance;
509 uint8_t svc_uuid[16];
510 uint32_t service_handle;
511 } __attribute__((packed));
513 #define HAL_EV_GATT_CHAR_ADDED 0xAE
514 struct hal_ev_gatt_char_added {
516 uint32_t server_instance;
517 uint32_t service_handle;
518 uint32_t char_handle;
519 uint8_t char_uuid[16];
520 } __attribute__((packed));
522 #define HAL_EV_GATT_DESC_ADDED 0xAF
523 struct hal_ev_gatt_desc_added {
525 uint32_t server_instance;
526 uint32_t service_handle;
527 uint32_t desc_handle;
528 uint8_t desc_uuid[16];
529 } __attribute__((packed));
531 #define HAL_EV_GATT_SERVICE_STARTED 0xB0
532 struct hal_ev_gatt_service_started {
534 uint32_t server_instance;
535 uint32_t service_handle;
536 } __attribute__((packed));
538 #define HAL_EV_GATT_SERVICE_DELETED 0xB1
539 struct hal_ev_gatt_service_deleted {
541 uint32_t server_instance;
542 uint32_t service_handle;
543 } __attribute__((packed));
545 #define HAL_EV_GATT_SERVER_CONNECTED 0xB2
546 struct hal_ev_gatt_server_connected {
548 uint32_t server_instance;
551 } __attribute__((packed));
553 #define HAL_EV_GATT_READ_REQUESTED 0xB3
554 struct hal_ev_gatt_server_read_req {
561 } __attribute__((packed));
563 #define HAL_EV_GATT_WRITE_REQUESTED 0xB4
564 struct hal_ev_gatt_server_write_req {
574 } __attribute__((packed));
576 #define HAL_EV_GATT_INDICATE_CFM 0xB5
577 struct hal_ev_gatt_server_indicate_cfm {
582 } __attribute__((packed));
585 #define HAL_EV_GATT_NOTIFICATION_CHANGE 0xB6
586 struct hal_ev_gatt_server_notifcation_change {
592 } __attribute__((packed));
594 #define HAL_EV_LE_STATE_CHANGED 0xB7
595 struct hal_ev_le_state_changed {
597 } __attribute__((packed));
598 #endif /* TIZEN_BT_HAL */
600 #define HAL_LE_STATE_CONNECTED 0x00
601 #define HAL_LE_STATE_DISCONNECTED 0x01
603 #define HAL_EV_LE_CONN_STATE_CHANGED 0xB8
604 struct hal_ev_le_conn_state_changed {
608 } __attribute__((packed));
610 #define HAL_EV_DEVICE_TRUSTED_PROFILES_CHANGED 0xB9
611 struct hal_ev_device_trusted_profiles_changed {
614 } __attribute__((packed));
616 #define HAL_RSSI_MONITORING_ENABLED 0x00
617 #define HAL_RSSI_MONITORING_DISABLED 0x01
619 #define HAL_EV_RSSI_MONITOR_STATE_CHANGED 0xBA
620 struct hal_ev_rssi_monitor_state_changed {
624 } __attribute__((packed));
626 #define HAL_EV_RSSI_ALERT_RECIEVED 0xBB
627 struct hal_ev_rssi_alert_recieved {
632 } __attribute__((packed));
634 #define HAL_EV_RAW_RSSI_RECIEVED 0xBC
635 struct hal_ev_raw_rssi_recieved {
639 } __attribute__((packed));
641 #define HAL_EV_GATT_CLIENT_CONNECTED 0xBD
642 #define HAL_EV_GATT_CLIENT_DISCONNECTED 0xBE
643 struct hal_ev_gatt_client_connected {
648 } __attribute__((packed));
650 #define HAL_EV_GATT_CLIENT_SEARCH_RESULT 0xBF
651 struct hal_ev_gatt_client_search_result {
656 } __attribute__((packed));
658 #define HAL_EV_GATT_CLIENT_SEARCH_COMPLETE 0xC0
659 struct hal_ev_gatt_client_search_complete {
662 } __attribute__((packed));
664 #define HAL_EV_GATT_CLIENT_CHARAC_SEARCH_RESULT 0xC1
665 struct hal_ev_gatt_client_char_search_result {
670 uint8_t svc_uuid[16];
671 uint8_t char_uuid[16];
673 } __attribute__((packed));
675 #define HAL_EV_GATT_CLIENT_DESC_SEARCH_RESULT 0XC2
676 struct hal_ev_gatt_client_desc_search_result {
681 uint8_t svc_uuid[16];
682 uint8_t char_uuid[16];
683 uint8_t desc_uuid[16];
684 } __attribute__((packed));
686 #define HAL_EV_GATT_CLIENT_READ_CHARAC 0XC3
687 #define HAL_EV_GATT_CLIENT_READ_DESC 0XC4
688 struct hal_ev_gatt_client_read_data {
693 uint8_t svc_uuid[16];
694 uint8_t char_uuid[16];
695 uint8_t desc_uuid[16];
698 } __attribute__((packed));
700 #define HAL_EV_GATT_CLIENT_WRITE_CHARAC 0XC5
701 #define HAL_EV_GATT_CLIENT_WRITE_DESC 0XC6
702 struct hal_ev_gatt_client_write_result {
707 uint8_t svc_uuid[16];
708 uint8_t char_uuid[16];
709 uint8_t desc_uuid[16];
710 } __attribute__((packed));
712 #define HAL_EV_GATT_CLIENT_WATCH_NOTIFICATION 0XC7
713 struct hal_ev_gatt_client_watch_notification {
719 uint8_t svc_uuid[16];
720 uint8_t char_uuid[16];
721 } __attribute__((packed));
723 #define HAL_EV_GATT_ACQUIRE_WRITE 0XC8
724 struct hal_ev_gatt_acquire_write {
728 uint8_t svc_uuid[16];
729 uint8_t char_uuid[16];
730 } __attribute__((packed));
732 #define HAL_EV_GATT_SERVER_ACQUIRE_WRITE_RES 0XC9
733 struct hal_ev_gatt_server_acquire_write_res {
739 } __attribute__((packed));
741 #define HAL_EV_GATT_SERVER_ACQUIRE_NOTIFY_RES 0XC10
742 struct hal_ev_gatt_server_acquire_notify {
748 } __attribute__((packed));
752 #endif //_BT_HAL_MSG_H_