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
423 #define HAL_AVRCP_TG_STATE_DISCONNECTED 0x00
424 #define HAL_AVRCP_TG_STATE_CONNECTED 0x01
425 struct hal_ev_avrcp_tg_conn_state {
428 } __attribute__((packed));
429 #endif /* TIZEN_BT_HAL */
431 #define HAL_EV_AVRCP_TG_SET_PLAYER_PROPERTY 0xA3
433 #define HAL_AVRCP_TG_PLAYER_PROP_EQUALIZER 0x00
434 #define HAL_AVRCP_TG_PLAYER_PROP_REPEAT 0x01
435 #define HAL_AVRCP_TG_PLAYER_PROP_SHUFFLE 0x02
436 #define HAL_AVRCP_TG_PLAYER_PROP_SCAN 0x03
437 struct hal_ev_avrcp_tg_player_property {
440 } __attribute__((packed));
443 #define HAL_EV_SERVER_INSTANCE_INITIALIZED 0xA4
444 struct hal_ev_server_instance_registered {
446 uint32_t server_instance;
447 uint8_t app_uuid[16];
448 } __attribute__((packed));
450 #define HAL_EV_MULTI_ADV_DATA_SET 0xA5
451 struct hal_ev_multi_adv_data_set {
453 uint8_t server_instance;
454 } __attribute__((packed));
456 #define HAL_EV_MULTI_ADV_ENABLE 0xA6
457 struct hal_ev_multi_adv_enable {
459 uint32_t server_instance;
460 } __attribute__((packed));
462 #define HAL_EV_MULTI_ADV_DISABLE 0xA7
463 struct hal_ev_multi_adv_disable {
465 uint32_t server_instance;
466 } __attribute__((packed));
468 #define HAL_EV_MULTI_ADV_UPDATE 0xA8
469 struct hal_ev_multi_adv_update {
471 uint32_t server_instance;
472 } __attribute__((packed));
474 #define HAL_EV_LEGACY_ADV_ENABLE 0xA9
475 struct hal_ev_legacy_adv_status {
477 uint32_t server_instance;
478 } __attribute__((packed));
480 #define HAL_EV_GATT_CLIENT_REGISTERED 0xAA
481 struct hal_ev_gatt_client_registered {
484 uint8_t app_uuid[16];
485 } __attribute__((packed));
487 #define HAL_EV_GATT_CLIENT_SCAN_RESULT 0xAC
488 struct hal_ev_gatt_client_scan_result {
495 } __attribute__((packed));
497 #define HAL_EV_GATT_SERVICE_ADDED 0xAD
498 struct hal_ev_gatt_service_added {
500 uint32_t server_instance;
502 uint8_t svc_uuid[16];
503 uint32_t service_handle;
504 } __attribute__((packed));
506 #define HAL_EV_GATT_CHAR_ADDED 0xAE
507 struct hal_ev_gatt_char_added {
509 uint32_t server_instance;
510 uint32_t service_handle;
511 uint32_t char_handle;
512 uint8_t char_uuid[16];
513 } __attribute__((packed));
515 #define HAL_EV_GATT_DESC_ADDED 0xAF
516 struct hal_ev_gatt_desc_added {
518 uint32_t server_instance;
519 uint32_t service_handle;
520 uint32_t desc_handle;
521 uint8_t desc_uuid[16];
522 } __attribute__((packed));
524 #define HAL_EV_GATT_SERVICE_STARTED 0xB0
525 struct hal_ev_gatt_service_started {
527 uint32_t server_instance;
528 uint32_t service_handle;
529 } __attribute__((packed));
531 #define HAL_EV_GATT_SERVICE_DELETED 0xB1
532 struct hal_ev_gatt_service_deleted {
534 uint32_t server_instance;
535 uint32_t service_handle;
536 } __attribute__((packed));
538 #define HAL_EV_GATT_SERVER_CONNECTED 0xB2
539 struct hal_ev_gatt_server_connected {
541 uint32_t server_instance;
544 } __attribute__((packed));
546 #define HAL_EV_GATT_READ_REQUESTED 0xB3
547 struct hal_ev_gatt_server_read_req {
554 } __attribute__((packed));
556 #define HAL_EV_GATT_WRITE_REQUESTED 0xB4
557 struct hal_ev_gatt_server_write_req {
567 } __attribute__((packed));
569 #define HAL_EV_GATT_INDICATE_CFM 0xB5
570 struct hal_ev_gatt_server_indicate_cfm {
575 } __attribute__((packed));
578 #define HAL_EV_GATT_NOTIFICATION_CHANGE 0xB6
579 struct hal_ev_gatt_server_notifcation_change {
585 } __attribute__((packed));
587 #define HAL_EV_LE_STATE_CHANGED 0xB7
588 struct hal_ev_le_state_changed {
590 } __attribute__((packed));
591 #endif /* TIZEN_BT_HAL */
593 #define HAL_LE_STATE_CONNECTED 0x00
594 #define HAL_LE_STATE_DISCONNECTED 0x01
596 #define HAL_EV_LE_CONN_STATE_CHANGED 0xB8
597 struct hal_ev_le_conn_state_changed {
601 } __attribute__((packed));
603 #define HAL_EV_DEVICE_TRUSTED_PROFILES_CHANGED 0xB9
604 struct hal_ev_device_trusted_profiles_changed {
607 } __attribute__((packed));
609 #define HAL_RSSI_MONITORING_ENABLED 0x00
610 #define HAL_RSSI_MONITORING_DISABLED 0x01
612 #define HAL_EV_RSSI_MONITOR_STATE_CHANGED 0xBA
613 struct hal_ev_rssi_monitor_state_changed {
617 } __attribute__((packed));
619 #define HAL_EV_RSSI_ALERT_RECIEVED 0xBB
620 struct hal_ev_rssi_alert_recieved {
625 } __attribute__((packed));
627 #define HAL_EV_RAW_RSSI_RECIEVED 0xBC
628 struct hal_ev_raw_rssi_recieved {
632 } __attribute__((packed));
633 #endif //_BT_HAL_MSG_H_