2 * BlueZ - Bluetooth protocol stack for Linux
4 * Copyright (C) 2010 Nokia Corporation
5 * Copyright (C) 2010 Marcel Holtmann <marcel@holtmann.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program 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
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #define __packed __attribute__((packed))
28 #define MGMT_INDEX_NONE 0xFFFF
30 #define MGMT_STATUS_SUCCESS 0x00
31 #define MGMT_STATUS_UNKNOWN_COMMAND 0x01
32 #define MGMT_STATUS_NOT_CONNECTED 0x02
33 #define MGMT_STATUS_FAILED 0x03
34 #define MGMT_STATUS_CONNECT_FAILED 0x04
35 #define MGMT_STATUS_AUTH_FAILED 0x05
36 #define MGMT_STATUS_NOT_PAIRED 0x06
37 #define MGMT_STATUS_NO_RESOURCES 0x07
38 #define MGMT_STATUS_TIMEOUT 0x08
39 #define MGMT_STATUS_ALREADY_CONNECTED 0x09
40 #define MGMT_STATUS_BUSY 0x0a
41 #define MGMT_STATUS_REJECTED 0x0b
42 #define MGMT_STATUS_NOT_SUPPORTED 0x0c
43 #define MGMT_STATUS_INVALID_PARAMS 0x0d
44 #define MGMT_STATUS_DISCONNECTED 0x0e
45 #define MGMT_STATUS_NOT_POWERED 0x0f
46 #define MGMT_STATUS_CANCELLED 0x10
47 #define MGMT_STATUS_INVALID_INDEX 0x11
48 #define MGMT_STATUS_RFKILLED 0x12
55 #define MGMT_HDR_SIZE 6
57 struct mgmt_addr_info {
62 #define MGMT_OP_READ_VERSION 0x0001
63 struct mgmt_rp_read_version {
68 #define MGMT_OP_READ_COMMANDS 0x0002
69 struct mgmt_rp_read_commands {
70 uint16_t num_commands;
75 #define MGMT_OP_READ_INDEX_LIST 0x0003
76 struct mgmt_rp_read_index_list {
77 uint16_t num_controllers;
81 /* Reserve one extra byte for names in management messages so that they
82 * are always guaranteed to be nul-terminated */
83 #define MGMT_MAX_NAME_LENGTH (248 + 1)
84 #define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1)
86 #define MGMT_SETTING_POWERED 0x00000001
87 #define MGMT_SETTING_CONNECTABLE 0x00000002
88 #define MGMT_SETTING_FAST_CONNECTABLE 0x00000004
89 #define MGMT_SETTING_DISCOVERABLE 0x00000008
90 #define MGMT_SETTING_BONDABLE 0x00000010
91 #define MGMT_SETTING_LINK_SECURITY 0x00000020
92 #define MGMT_SETTING_SSP 0x00000040
93 #define MGMT_SETTING_BREDR 0x00000080
94 #define MGMT_SETTING_HS 0x00000100
95 #define MGMT_SETTING_LE 0x00000200
96 #define MGMT_SETTING_ADVERTISING 0x00000400
97 #define MGMT_SETTING_SECURE_CONN 0x00000800
98 #define MGMT_SETTING_DEBUG_KEYS 0x00001000
99 #define MGMT_SETTING_PRIVACY 0x00002000
100 #define MGMT_SETTING_CONFIGURATION 0x00004000
101 #define MGMT_SETTING_STATIC_ADDRESS 0x00008000
103 #define MGMT_OP_READ_INFO 0x0004
104 struct mgmt_rp_read_info {
107 uint16_t manufacturer;
108 uint32_t supported_settings;
109 uint32_t current_settings;
110 uint8_t dev_class[3];
111 uint8_t name[MGMT_MAX_NAME_LENGTH];
112 uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH];
123 #define MGMT_OP_SET_POWERED 0x0005
125 #define MGMT_OP_SET_DISCOVERABLE 0x0006
126 struct mgmt_cp_set_discoverable {
131 #define MGMT_OP_SET_CONNECTABLE 0x0007
133 #define MGMT_OP_SET_FAST_CONNECTABLE 0x0008
135 #define MGMT_OP_SET_BONDABLE 0x0009
137 #define MGMT_OP_SET_LINK_SECURITY 0x000A
139 #define MGMT_OP_SET_SSP 0x000B
141 #define MGMT_OP_SET_HS 0x000C
143 #define MGMT_OP_SET_LE 0x000D
145 #define MGMT_OP_SET_DEV_CLASS 0x000E
146 struct mgmt_cp_set_dev_class {
151 #define MGMT_OP_SET_LOCAL_NAME 0x000F
152 struct mgmt_cp_set_local_name {
153 uint8_t name[MGMT_MAX_NAME_LENGTH];
154 uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH];
157 #define MGMT_OP_ADD_UUID 0x0010
158 struct mgmt_cp_add_uuid {
163 #define MGMT_OP_REMOVE_UUID 0x0011
164 struct mgmt_cp_remove_uuid {
168 struct mgmt_link_key_info {
169 struct mgmt_addr_info addr;
175 #define MGMT_OP_LOAD_LINK_KEYS 0x0012
176 struct mgmt_cp_load_link_keys {
179 struct mgmt_link_key_info keys[0];
182 struct mgmt_ltk_info {
183 struct mgmt_addr_info addr;
192 #define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013
193 struct mgmt_cp_load_long_term_keys {
195 struct mgmt_ltk_info keys[0];
198 #define MGMT_OP_DISCONNECT 0x0014
199 struct mgmt_cp_disconnect {
200 struct mgmt_addr_info addr;
202 struct mgmt_rp_disconnect {
203 struct mgmt_addr_info addr;
206 #define MGMT_OP_GET_CONNECTIONS 0x0015
207 struct mgmt_rp_get_connections {
209 struct mgmt_addr_info addr[0];
212 #define MGMT_OP_PIN_CODE_REPLY 0x0016
213 struct mgmt_cp_pin_code_reply {
214 struct mgmt_addr_info addr;
216 uint8_t pin_code[16];
219 #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017
220 struct mgmt_cp_pin_code_neg_reply {
221 struct mgmt_addr_info addr;
224 #define MGMT_OP_SET_IO_CAPABILITY 0x0018
225 struct mgmt_cp_set_io_capability {
226 uint8_t io_capability;
229 #define MGMT_OP_PAIR_DEVICE 0x0019
230 struct mgmt_cp_pair_device {
231 struct mgmt_addr_info addr;
234 struct mgmt_rp_pair_device {
235 struct mgmt_addr_info addr;
238 #define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A
240 #define MGMT_OP_UNPAIR_DEVICE 0x001B
241 struct mgmt_cp_unpair_device {
242 struct mgmt_addr_info addr;
245 struct mgmt_rp_unpair_device {
246 struct mgmt_addr_info addr;
249 #define MGMT_OP_USER_CONFIRM_REPLY 0x001C
250 struct mgmt_cp_user_confirm_reply {
251 struct mgmt_addr_info addr;
253 struct mgmt_rp_user_confirm_reply {
254 struct mgmt_addr_info addr;
257 #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D
259 #define MGMT_OP_USER_PASSKEY_REPLY 0x001E
260 struct mgmt_cp_user_passkey_reply {
261 struct mgmt_addr_info addr;
264 struct mgmt_rp_user_passkey_reply {
265 struct mgmt_addr_info addr;
268 #define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F
269 struct mgmt_cp_user_passkey_neg_reply {
270 struct mgmt_addr_info addr;
273 #define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020
274 struct mgmt_rp_read_local_oob_data {
276 uint8_t randomizer[16];
278 struct mgmt_rp_read_local_oob_ext_data {
280 uint8_t randomizer192[16];
282 uint8_t randomizer256[16];
285 #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
286 struct mgmt_cp_add_remote_oob_data {
287 struct mgmt_addr_info addr;
294 #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
295 struct mgmt_cp_remove_remote_oob_data {
296 struct mgmt_addr_info addr;
299 #define MGMT_OP_START_DISCOVERY 0x0023
300 struct mgmt_cp_start_discovery {
304 #define MGMT_OP_STOP_DISCOVERY 0x0024
305 struct mgmt_cp_stop_discovery {
309 #define MGMT_OP_CONFIRM_NAME 0x0025
310 struct mgmt_cp_confirm_name {
311 struct mgmt_addr_info addr;
314 struct mgmt_rp_confirm_name {
315 struct mgmt_addr_info addr;
318 #define MGMT_OP_BLOCK_DEVICE 0x0026
319 struct mgmt_cp_block_device {
320 struct mgmt_addr_info addr;
323 #define MGMT_OP_UNBLOCK_DEVICE 0x0027
324 struct mgmt_cp_unblock_device {
325 struct mgmt_addr_info addr;
328 #define MGMT_OP_SET_DEVICE_ID 0x0028
329 struct mgmt_cp_set_device_id {
336 #define MGMT_OP_SET_ADVERTISING 0x0029
338 #define MGMT_OP_SET_BREDR 0x002A
340 #define MGMT_OP_SET_STATIC_ADDRESS 0x002B
341 struct mgmt_cp_set_static_address {
345 #define MGMT_OP_SET_SCAN_PARAMS 0x002C
346 struct mgmt_cp_set_scan_params {
351 #define MGMT_OP_SET_SECURE_CONN 0x002D
353 #define MGMT_OP_SET_DEBUG_KEYS 0x002E
355 struct mgmt_irk_info {
356 struct mgmt_addr_info addr;
360 #define MGMT_OP_SET_PRIVACY 0x002F
361 struct mgmt_cp_set_privacy {
366 #define MGMT_OP_LOAD_IRKS 0x0030
367 struct mgmt_cp_load_irks {
369 struct mgmt_irk_info irks[0];
372 #define MGMT_OP_GET_CONN_INFO 0x0031
373 struct mgmt_cp_get_conn_info {
374 struct mgmt_addr_info addr;
376 struct mgmt_rp_get_conn_info {
377 struct mgmt_addr_info addr;
383 #define MGMT_OP_GET_CLOCK_INFO 0x0032
384 struct mgmt_cp_get_clock_info {
385 struct mgmt_addr_info addr;
387 struct mgmt_rp_get_clock_info {
388 struct mgmt_addr_info addr;
389 uint32_t local_clock;
390 uint32_t piconet_clock;
394 #define MGMT_OP_ADD_DEVICE 0x0033
395 struct mgmt_cp_add_device {
396 struct mgmt_addr_info addr;
399 struct mgmt_rp_add_device {
400 struct mgmt_addr_info addr;
403 #define MGMT_OP_REMOVE_DEVICE 0x0034
404 struct mgmt_cp_remove_device {
405 struct mgmt_addr_info addr;
407 struct mgmt_rp_remove_device {
408 struct mgmt_addr_info addr;
411 struct mgmt_conn_param {
412 struct mgmt_addr_info addr;
413 uint16_t min_interval;
414 uint16_t max_interval;
419 #define MGMT_OP_LOAD_CONN_PARAM 0x0035
420 struct mgmt_cp_load_conn_param {
421 uint16_t param_count;
422 struct mgmt_conn_param params[0];
425 #define MGMT_OP_READ_UNCONF_INDEX_LIST 0x0036
426 struct mgmt_rp_read_unconf_index_list {
427 uint16_t num_controllers;
431 #define MGMT_OPTION_EXTERNAL_CONFIG 0x00000001
432 #define MGMT_OPTION_PUBLIC_ADDRESS 0x00000002
434 #define MGMT_OP_READ_CONFIG_INFO 0x0037
435 struct mgmt_rp_read_config_info {
436 uint16_t manufacturer;
437 uint32_t supported_options;
438 uint32_t missing_options;
441 #define MGMT_OP_SET_EXTERNAL_CONFIG 0x0038
442 struct mgmt_cp_set_external_config {
446 #define MGMT_OP_SET_PUBLIC_ADDRESS 0x0039
447 struct mgmt_cp_set_public_address {
451 #define MGMT_OP_START_SERVICE_DISCOVERY 0x003A
452 struct mgmt_cp_start_service_discovery {
456 uint8_t uuids[0][16];
458 #define MGMT_START_SERVICE_DISCOVERY_SIZE 4
460 #define MGMT_EV_CMD_COMPLETE 0x0001
461 struct mgmt_ev_cmd_complete {
467 #define MGMT_EV_CMD_STATUS 0x0002
468 struct mgmt_ev_cmd_status {
473 #define MGMT_EV_CONTROLLER_ERROR 0x0003
474 struct mgmt_ev_controller_error {
478 #define MGMT_EV_INDEX_ADDED 0x0004
480 #define MGMT_EV_INDEX_REMOVED 0x0005
482 #define MGMT_EV_NEW_SETTINGS 0x0006
484 #define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007
485 struct mgmt_ev_class_of_dev_changed {
486 uint8_t class_of_dev[3];
489 #define MGMT_EV_LOCAL_NAME_CHANGED 0x0008
490 struct mgmt_ev_local_name_changed {
491 uint8_t name[MGMT_MAX_NAME_LENGTH];
492 uint8_t short_name[MGMT_MAX_SHORT_NAME_LENGTH];
495 #define MGMT_EV_NEW_LINK_KEY 0x0009
496 struct mgmt_ev_new_link_key {
498 struct mgmt_link_key_info key;
501 #define MGMT_EV_NEW_LONG_TERM_KEY 0x000A
502 struct mgmt_ev_new_long_term_key {
504 struct mgmt_ltk_info key;
507 #define MGMT_EV_DEVICE_CONNECTED 0x000B
508 struct mgmt_ev_device_connected {
509 struct mgmt_addr_info addr;
515 #define MGMT_DEV_DISCONN_UNKNOWN 0x00
516 #define MGMT_DEV_DISCONN_TIMEOUT 0x01
517 #define MGMT_DEV_DISCONN_LOCAL_HOST 0x02
518 #define MGMT_DEV_DISCONN_REMOTE 0x03
520 #define MGMT_EV_DEVICE_DISCONNECTED 0x000C
521 struct mgmt_ev_device_disconnected {
522 struct mgmt_addr_info addr;
526 #define MGMT_EV_CONNECT_FAILED 0x000D
527 struct mgmt_ev_connect_failed {
528 struct mgmt_addr_info addr;
532 #define MGMT_EV_PIN_CODE_REQUEST 0x000E
533 struct mgmt_ev_pin_code_request {
534 struct mgmt_addr_info addr;
538 #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
539 struct mgmt_ev_user_confirm_request {
540 struct mgmt_addr_info addr;
541 uint8_t confirm_hint;
545 #define MGMT_EV_USER_PASSKEY_REQUEST 0x0010
546 struct mgmt_ev_user_passkey_request {
547 struct mgmt_addr_info addr;
550 #define MGMT_EV_AUTH_FAILED 0x0011
551 struct mgmt_ev_auth_failed {
552 struct mgmt_addr_info addr;
556 #define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
557 #define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
558 #define MGMT_DEV_FOUND_NOT_CONNECTABLE 0x04
560 #define MGMT_EV_DEVICE_FOUND 0x0012
561 struct mgmt_ev_device_found {
562 struct mgmt_addr_info addr;
569 #define MGMT_EV_DISCOVERING 0x0013
570 struct mgmt_ev_discovering {
575 #define MGMT_EV_DEVICE_BLOCKED 0x0014
576 struct mgmt_ev_device_blocked {
577 struct mgmt_addr_info addr;
580 #define MGMT_EV_DEVICE_UNBLOCKED 0x0015
581 struct mgmt_ev_device_unblocked {
582 struct mgmt_addr_info addr;
585 #define MGMT_EV_DEVICE_UNPAIRED 0x0016
586 struct mgmt_ev_device_unpaired {
587 struct mgmt_addr_info addr;
590 #define MGMT_EV_PASSKEY_NOTIFY 0x0017
591 struct mgmt_ev_passkey_notify {
592 struct mgmt_addr_info addr;
597 #define MGMT_EV_NEW_IRK 0x0018
598 struct mgmt_ev_new_irk {
601 struct mgmt_irk_info key;
604 struct mgmt_csrk_info {
605 struct mgmt_addr_info addr;
610 #define MGMT_EV_NEW_CSRK 0x0019
611 struct mgmt_ev_new_csrk {
613 struct mgmt_csrk_info key;
616 #define MGMT_EV_DEVICE_ADDED 0x001a
617 struct mgmt_ev_device_added {
618 struct mgmt_addr_info addr;
622 #define MGMT_EV_DEVICE_REMOVED 0x001b
623 struct mgmt_ev_device_removed {
624 struct mgmt_addr_info addr;
627 #define MGMT_EV_NEW_CONN_PARAM 0x001c
628 struct mgmt_ev_new_conn_param {
629 struct mgmt_addr_info addr;
631 uint16_t min_interval;
632 uint16_t max_interval;
637 #define MGMT_EV_UNCONF_INDEX_ADDED 0x001d
639 #define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e
641 #define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f
643 static const char *mgmt_op[] = {
648 "Read Controller Info",
652 "Set Fast Connectable", /* 0x0008 */
655 "Set Secure Simple Pairing",
660 "Add UUID", /* 0x0010 */
663 "Load Long Term Keys",
667 "PIN Code Neg Reply",
668 "Set IO Capability", /* 0x0018 */
670 "Cancel Pair Device",
672 "User Confirm Reply",
673 "User Confirm Neg Reply",
674 "User Passkey Reply",
675 "User Passkey Neg Reply",
676 "Read Local OOB Data", /* 0x0020 */
677 "Add Remote OOB Data",
678 "Remove Remove OOB Data",
687 "Set Static Address",
688 "Set Scan Parameters",
689 "Set Secure Connections",
692 "Load Identity Resolving Keys",
693 "Get Connection Information",
694 "Get Clock Information",
697 "Load Connection Parameters",
698 "Read Unconfigured Index List",
699 "Read Controller Configuration Information",
700 "Set External Configuration",
701 "Set Public Address",
702 "Start Service Discovery",
705 static const char *mgmt_ev[] = {
713 "Class of Device Changed",
714 "Local Name Changed", /* 0x0008 */
718 "Device Disconnected",
721 "User Confirm Request",
722 "User Passkey Request", /* 0x0010 */
723 "Authentication Failed",
730 "New Identity Resolving Key",
731 "New Signature Resolving Key",
734 "New Connection Parameter",
735 "Unconfigured Index Added",
736 "Unconfigured Index Removed",
737 "New Configuration Options",
740 static const char *mgmt_status[] = {
746 "Authentication Failed",
754 "Invalid Parameters",
759 "Blocked through rfkill",
762 #ifdef __TIZEN_PATCH__
764 #define TIZEN_OP_CODE_BASE 0xff00
765 #define TIZEN_EV_BASE 0xff00
767 #define MGMT_MAX_ADVERTISING_LENGTH 31
769 #define MGMT_MAX_MANUFACTURER_DATA_LENGTH 31
771 #define MGMT_IRK_SIZE 16
773 #define MGMT_OP_SET_ADVERTISING_PARAMS (TIZEN_OP_CODE_BASE + 0x01)
774 struct mgmt_cp_set_advertising_params {
775 uint16_t interval_min;
776 uint16_t interval_max;
777 uint8_t filter_policy;
781 #define MGMT_OP_SET_ADVERTISING_DATA (TIZEN_OP_CODE_BASE + 0x02)
782 struct mgmt_cp_set_advertising_data {
783 uint8_t data[MGMT_MAX_ADVERTISING_LENGTH];
786 #define MGMT_OP_SET_SCAN_RSP_DATA (TIZEN_OP_CODE_BASE + 0x03)
787 struct mgmt_cp_set_scan_rsp_data {
788 uint8_t data[MGMT_MAX_ADVERTISING_LENGTH];
791 #define MGMT_OP_ADD_DEV_WHITE_LIST (TIZEN_OP_CODE_BASE + 0x04)
792 struct mgmt_cp_add_dev_white_list {
797 #define MGMT_OP_REMOVE_DEV_FROM_WHITE_LIST (TIZEN_OP_CODE_BASE + 0x05)
798 struct mgmt_cp_remove_dev_white_list {
803 #define MGMT_OP_CLEAR_DEV_WHITE_LIST (TIZEN_OP_CODE_BASE + 0x06)
805 /* BEGIN TIZEN_Bluetooth :: RSSI monitoring */
806 #define MGMT_OP_SET_RSSI_ENABLE (TIZEN_OP_CODE_BASE + 0x07)
807 struct mgmt_cp_set_enable_rssi {
815 struct mgmt_cc_rsp_enable_rssi {
817 uint8_t le_ext_opcode;
822 #define MGMT_OP_GET_RAW_RSSI (TIZEN_OP_CODE_BASE + 0x08)
823 struct mgmt_cp_get_raw_rssi {
827 struct mgmt_cc_rp_get_raw_rssi {
834 #define MGMT_OP_SET_RSSI_DISABLE (TIZEN_OP_CODE_BASE + 0x09)
835 struct mgmt_cp_disable_rssi {
839 struct mgmt_cc_rp_disable_rssi {
841 uint8_t le_ext_opcode;
845 /* END TIZEN_Bluetooth :: RSSI monitoring */
847 #define MGMT_OP_START_LE_DISCOVERY (TIZEN_OP_CODE_BASE + 0x0a)
848 struct mgmt_cp_start_le_discovery {
852 #define MGMT_OP_STOP_LE_DISCOVERY (TIZEN_OP_CODE_BASE + 0x0b)
853 struct mgmt_cp_stop_le_discovery {
857 /* BEGIN TIZEN_Bluetooth :: LE auto connection */
858 #define MGMT_OP_DISABLE_LE_AUTO_CONNECT (TIZEN_OP_CODE_BASE + 0x0c)
859 /* END TIZEN_Bluetooth */
861 #define MGMT_OP_LE_CONN_UPDATE (TIZEN_OP_CODE_BASE + 0x0d)
862 struct mgmt_cp_le_conn_update {
863 uint16_t interval_min;
864 uint16_t interval_max;
866 uint16_t supervision_time_out;
870 #define MGMT_OP_SET_MANUFACTURER_DATA (TIZEN_OP_CODE_BASE + 0x0e)
871 struct mgmt_cp_set_manufacturer_data {
872 uint8_t data[MGMT_MAX_MANUFACTURER_DATA_LENGTH];
875 #define MGMT_OP_LE_SET_SCAN_PARAMS (TIZEN_OP_CODE_BASE + 0x0f)
876 struct mgmt_cp_le_set_scan_params {
877 uint8_t type; /* le scan type */
882 #define MGMT_SCO_ROLE_HANDSFREE 0x00
883 #define MGMT_SCO_ROLE_AUDIO_GATEWAY 0x01
884 #define MGMT_OP_SET_VOICE_SETTING (TIZEN_OP_CODE_BASE + 0x10)
885 struct mgmt_cp_set_voice_setting {
888 uint16_t voice_setting;
891 #define MGMT_OP_GET_ADV_TX_POWER (TIZEN_OP_CODE_BASE + 0x11)
892 struct mgmt_rp_get_adv_tx_power {
896 /* Currently there is no support in kernel for below MGMT cmd opcodes. */
897 #if 0 // Not defined in kernel
898 #define MGMT_OP_READ_RSSI (TIZEN_OP_CODE_BASE + 0x11)
899 struct mgmt_cp_read_rssi {
902 struct mgmt_rp_read_rssi {
908 #define MGMT_OP_L2CAP_CONN_PARAM_UPDATE (TIZEN_OP_CODE_BASE + 0x12)
909 struct mgmt_cp_l2cap_conn_param_update {
911 uint16_t interval_min;
912 uint16_t interval_max;
914 uint16_t supervision_time_out;
917 #define MGMT_OP_WRITE_SEC_CONN_HOST_SUPPORT (TIZEN_OP_CODE_BASE + 0x13)
918 #define MGMT_WRITE_SEC_CONN_HOST_SUPPORT_SIZE 1
919 struct mgmt_cp_write_sec_conn_host_support {
920 uint8_t secure_connection_host_support;
922 struct mgmt_rp_write_sec_conn_host_support {
926 #define MGMT_OP_READ_SEC_CONN_HOST_SUPPORT (TIZEN_OP_CODE_BASE + 0x14)
927 struct mgmt_rp_read_sec_conn_host_support {
929 uint8_t sec_conn_host_support;
932 #define MGMT_OP_WRITE_AUTH_PAYLOAD_TIMEOUT (TIZEN_OP_CODE_BASE + 0x15)
933 struct mgmt_cp_write_auth_payload_timeout {
935 uint16_t auth_payload_timeout;
937 struct mgmt_rp_write_auth_payload_timeout {
941 #define MGMT_OP_READ_AUTH_PAYLOAD_TIMEOUT (TIZEN_OP_CODE_BASE + 0x16)
942 struct mgmt_cp_read_auth_payload_timeout {
945 struct mgmt_rp_read_auth_payload_timeout {
947 uint16_t auth_payload_timeout;
952 /* BEGIN TIZEN_Bluetooth :: name update changes */
953 #define MGMT_EV_DEVICE_NAME_UPDATE (TIZEN_EV_BASE + 0x01)
954 struct mgmt_ev_device_name_update {
955 struct mgmt_addr_info addr;
959 /* END TIZEN_Bluetooth :: name update changes */
961 /* BEGIN TIZEN_Bluetooth :: Add handling of hardware error event */
962 #define MGMT_EV_HARDWARE_ERROR (TIZEN_EV_BASE + 0x02)
963 struct mgmt_ev_hardware_error{
966 /* END TIZEN_Bluetooth */
968 /* BEGIN TIZEN_Bluetooth :: HCI TX Timeout Error */
969 #define MGMT_EV_TX_TIMEOUT_ERROR (TIZEN_EV_BASE + 0x03)
970 /* END TIZEN_Bluetooth */
972 /* BEGIN TIZEN_Bluetooth :: Add handling of RSSI Events */
973 #define MGMT_EV_RSSI_ALERT (TIZEN_EV_BASE + 0x04)
974 struct mgmt_ev_vendor_specific_rssi_alert {
981 #define MGMT_EV_RAW_RSSI (TIZEN_EV_BASE + 0x05)
983 #define MGMT_EV_RSSI_ENABLED (TIZEN_EV_BASE + 0x06)
985 #define MGMT_EV_RSSI_DISABLED (TIZEN_EV_BASE + 0x07)
986 /* END TIZEN_Bluetooth :: Handling of RSSI Events */
988 /* BEGIN TIZEN_Bluetooth :: Add LE connection update Events */
989 #define MGMT_EV_CONN_UPDATED (TIZEN_EV_BASE + 0x08)
990 struct mgmt_ev_conn_updated {
991 struct mgmt_addr_info addr;
992 uint16_t conn_interval;
993 uint16_t conn_latency;
994 uint16_t supervision_timeout;
997 #define MGMT_EV_CONN_UPDATE_FAILED (TIZEN_EV_BASE + 0x09)
998 struct mgmt_ev_conn_update_failed {
999 struct mgmt_addr_info addr;
1002 /* END TIZEN_Bluetooth :: Add LE connection update Events */
1004 #define MGMT_EV_LE_DEVICE_FOUND (TIZEN_EV_BASE + 0x0a)
1005 struct mgmt_ev_le_device_found {
1006 struct mgmt_addr_info addr;
1014 #define MGMT_EV_MULTI_ADV_STATE_CHANGED (TIZEN_EV_BASE + 0x0b)
1015 struct mgmt_ev_vendor_specific_multi_adv_state_changed {
1016 uint8_t adv_instance;
1017 uint8_t state_change_reason;
1018 int16_t connection_handle;
1021 /* Currently there is no support in kernel for below MGMT events. */
1022 #if 0 // Not defined in kernel
1023 #define MGMT_EV_NEW_LOCAL_IRK (TIZEN_EV_BASE + 0x0b)
1024 struct mgmt_ev_new_local_irk {
1029 static const char *mgmt_tizen_op[] = {
1031 "Set Advertising Parameters",
1032 "Set Advertising Data",
1033 "Set Scan Response Data",
1034 "Add Device White List",
1035 "Remove Device White List",
1036 "Clear Device White List",
1040 "Start LE Discovery",
1041 "Stop LE Discovery",
1042 "Disable LE Auto Connect",
1043 "LE Connection Update",
1044 "Set Manufacturer Data",
1045 "LE Set Scan Parameters",
1046 "Set Voice Setting",
1050 static const char *mgmt_tizen_ev[] = {
1052 "Device Name Update",
1059 "LE Connection Updated",
1060 "LE Connection Update Failed",
1062 "Multi Adv State Change",
1064 #endif /* End of __TIZEN_PATCH__ */
1067 #define NELEM(x) (sizeof(x) / sizeof((x)[0]))
1070 static inline const char *mgmt_opstr(uint16_t op)
1072 #ifdef __TIZEN_PATCH__
1073 if (op >= NELEM(mgmt_op)) {
1074 uint16_t tizen_op = op - TIZEN_OP_CODE_BASE;
1077 tizen_op < NELEM(mgmt_tizen_op))
1078 return mgmt_tizen_op[tizen_op];
1080 return "<unknown opcode>";
1083 if (op >= NELEM(mgmt_op))
1084 return "<unknown opcode>";
1090 static inline const char *mgmt_evstr(uint16_t ev)
1092 #ifdef __TIZEN_PATCH__
1093 if (ev >= NELEM(mgmt_ev)) {
1094 uint16_t tizen_ev = ev - TIZEN_EV_BASE;
1097 tizen_ev < NELEM(mgmt_tizen_ev))
1098 return mgmt_tizen_ev[tizen_ev];
1100 return "<unknown event>";
1103 if (ev >= NELEM(mgmt_ev))
1104 return "<unknown event>";
1110 static inline const char *mgmt_errstr(uint8_t status)
1112 if (status >= NELEM(mgmt_status))
1113 return "<unknown status>";
1114 return mgmt_status[status];