147f4e325SMatthias Ringwald /* 247f4e325SMatthias Ringwald * Copyright (C) 2015 BlueKitchen GmbH 347f4e325SMatthias Ringwald * 447f4e325SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 547f4e325SMatthias Ringwald * modification, are permitted provided that the following conditions 647f4e325SMatthias Ringwald * are met: 747f4e325SMatthias Ringwald * 847f4e325SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 947f4e325SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 1047f4e325SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 1147f4e325SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 1247f4e325SMatthias Ringwald * documentation and/or other materials provided with the distribution. 1347f4e325SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 1447f4e325SMatthias Ringwald * contributors may be used to endorse or promote products derived 1547f4e325SMatthias Ringwald * from this software without specific prior written permission. 1647f4e325SMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 1747f4e325SMatthias Ringwald * personal benefit and not for any commercial purpose or for 1847f4e325SMatthias Ringwald * monetary gain. 1947f4e325SMatthias Ringwald * 2047f4e325SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 2147f4e325SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2247f4e325SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 2347f4e325SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 2447f4e325SMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 2547f4e325SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 2647f4e325SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 2747f4e325SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 2847f4e325SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2947f4e325SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 3047f4e325SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3147f4e325SMatthias Ringwald * SUCH DAMAGE. 3247f4e325SMatthias Ringwald * 3347f4e325SMatthias Ringwald * Please inquire about commercial licensing options at 3447f4e325SMatthias Ringwald * [email protected] 3547f4e325SMatthias Ringwald * 3647f4e325SMatthias Ringwald */ 3747f4e325SMatthias Ringwald 3847f4e325SMatthias Ringwald /* 3947f4e325SMatthias Ringwald * bluetooth.h 4047f4e325SMatthias Ringwald * 4147f4e325SMatthias Ringwald * Numbers defined or derived from the official Bluetooth specification 4247f4e325SMatthias Ringwald */ 4347f4e325SMatthias Ringwald 4447f4e325SMatthias Ringwald #ifndef __BLUETOOTH_H 4547f4e325SMatthias Ringwald #define __BLUETOOTH_H 4647f4e325SMatthias Ringwald 4747f4e325SMatthias Ringwald #include <stdint.h> 4847f4e325SMatthias Ringwald 4947f4e325SMatthias Ringwald /** 5047f4e325SMatthias Ringwald * HCI Transport 5147f4e325SMatthias Ringwald */ 5247f4e325SMatthias Ringwald 5347f4e325SMatthias Ringwald /** 5447f4e325SMatthias Ringwald * packet types - used in BTstack and over the H4 UART interface 5547f4e325SMatthias Ringwald */ 5647f4e325SMatthias Ringwald #define HCI_COMMAND_DATA_PACKET 0x01 5747f4e325SMatthias Ringwald #define HCI_ACL_DATA_PACKET 0x02 5847f4e325SMatthias Ringwald #define HCI_SCO_DATA_PACKET 0x03 5947f4e325SMatthias Ringwald #define HCI_EVENT_PACKET 0x04 6047f4e325SMatthias Ringwald 618799c043SMatthias Ringwald // packet header sizes 628799c043SMatthias Ringwald #define HCI_CMD_HEADER_SIZE 3 638799c043SMatthias Ringwald #define HCI_ACL_HEADER_SIZE 4 648799c043SMatthias Ringwald #define HCI_SCO_HEADER_SIZE 3 658799c043SMatthias Ringwald #define HCI_EVENT_HEADER_SIZE 2 668799c043SMatthias Ringwald 6747f4e325SMatthias Ringwald /** 6847f4e325SMatthias Ringwald * HCI Layer 6947f4e325SMatthias Ringwald */ 7047f4e325SMatthias Ringwald 7147f4e325SMatthias Ringwald // 7247f4e325SMatthias Ringwald // Error Codes 7347f4e325SMatthias Ringwald // 7447f4e325SMatthias Ringwald 7547f4e325SMatthias Ringwald // from Bluetooth Core Specification 7647f4e325SMatthias Ringwald #define ERROR_CODE_UNKNOWN_HCI_COMMAND 0x01 7747f4e325SMatthias Ringwald #define ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER 0x02 7847f4e325SMatthias Ringwald #define ERROR_CODE_HARDWARE_FAILURE 0x03 7947f4e325SMatthias Ringwald #define ERROR_CODE_PAGE_TIMEOUT 0x04 8047f4e325SMatthias Ringwald #define ERROR_CODE_AUTHENTICATION_FAILURE 0x05 8147f4e325SMatthias Ringwald #define ERROR_CODE_PIN_OR_KEY_MISSING 0x06 8247f4e325SMatthias Ringwald #define ERROR_CODE_MEMORY_CAPACITY_EXCEEDED 0x07 8347f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_TIMEOUT 0x08 8447f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_LIMIT_EXCEEDED 0x09 8547f4e325SMatthias Ringwald #define ERROR_CODE_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED 0x0A 8647f4e325SMatthias Ringwald #define ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS 0x0B 8747f4e325SMatthias Ringwald #define ERROR_CODE_COMMAND_DISALLOWED 0x0C 8847f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES 0x0D 8947f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS 0x0E 9047f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR 0x0F 9147f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED 0x10 9247f4e325SMatthias Ringwald #define ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE 0x11 9347f4e325SMatthias Ringwald #define ERROR_CODE_INVALID_HCI_COMMAND_PARAMETERS 0x12 9447f4e325SMatthias Ringwald #define ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION 0x13 9547f4e325SMatthias Ringwald #define ERROR_CODE_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES 0x14 9647f4e325SMatthias Ringwald #define ERROR_CODE_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF 0x15 9747f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST 0x16 9847f4e325SMatthias Ringwald #define ERROR_CODE_REPEATED_ATTEMPTS 0x17 9947f4e325SMatthias Ringwald #define ERROR_CODE_PAIRING_NOT_ALLOWED 0x18 10047f4e325SMatthias Ringwald #define ERROR_CODE_UNKNOWN_LMP_PDU 0x19 10147f4e325SMatthias Ringwald #define ERROR_CODE_UNSUPPORTED_REMOTE_FEATURE_UNSUPPORTED_LMP_FEATURE 0x1A 10247f4e325SMatthias Ringwald #define ERROR_CODE_SCO_OFFSET_REJECTED 0x1B 10347f4e325SMatthias Ringwald #define ERROR_CODE_SCO_INTERVAL_REJECTED 0x1C 10447f4e325SMatthias Ringwald #define ERROR_CODE_SCO_AIR_MODE_REJECTED 0x1D 10547f4e325SMatthias Ringwald #define ERROR_CODE_INVALID_LMP_PARAMETERS_INVALID_LL_PARAMETERS 0x1E 10647f4e325SMatthias Ringwald #define ERROR_CODE_UNSPECIFIED_ERROR 0x1F 10747f4e325SMatthias Ringwald #define ERROR_CODE_UNSUPPORTED_LMP_PARAMETER_VALUE_UNSUPPORTED_LL_PARAMETER_VALUE 0x20 10847f4e325SMatthias Ringwald #define ERROR_CODE_ROLE_CHANGE_NOT_ALLOWED 0x21 10947f4e325SMatthias Ringwald #define ERROR_CODE_LMP_RESPONSE_TIMEOUT_LL_RESPONSE_TIMEOUT 0x22 11047f4e325SMatthias Ringwald #define ERROR_CODE_LMP_ERROR_TRANSACTION_COLLISION 0x23 11147f4e325SMatthias Ringwald #define ERROR_CODE_LMP_PDU_NOT_ALLOWED 0x24 11247f4e325SMatthias Ringwald #define ERROR_CODE_ENCRYPTION_MODE_NOT_ACCEPTABLE 0x25 11347f4e325SMatthias Ringwald #define ERROR_CODE_LINK_KEY_CANNOT_BE_CHANGED 0x26 11447f4e325SMatthias Ringwald #define ERROR_CODE_REQUESTED_QOS_NOT_SUPPORTED 0x27 11547f4e325SMatthias Ringwald #define ERROR_CODE_INSTANT_PASSED 0x28 11647f4e325SMatthias Ringwald #define ERROR_CODE_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29 11747f4e325SMatthias Ringwald #define ERROR_CODE_DIFFERENT_TRANSACTION_COLLISION 0x2A 11847f4e325SMatthias Ringwald #define ERROR_CODE_RESERVED 0x2B 11947f4e325SMatthias Ringwald #define ERROR_CODE_QOS_UNACCEPTABLE_PARAMETER 0x2C 12047f4e325SMatthias Ringwald #define ERROR_CODE_QOS_REJECTED 0x2D 12147f4e325SMatthias Ringwald #define ERROR_CODE_CHANNEL_CLASSIFICATION_NOT_SUPPORTED 0x2E 12247f4e325SMatthias Ringwald #define ERROR_CODE_INSUFFICIENT_SECURITY 0x2F 12347f4e325SMatthias Ringwald #define ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE 0x30 12447f4e325SMatthias Ringwald // #define ERROR_CODE_RESERVED 12547f4e325SMatthias Ringwald #define ERROR_CODE_ROLE_SWITCH_PENDING 0x32 12647f4e325SMatthias Ringwald // #define ERROR_CODE_RESERVED 12747f4e325SMatthias Ringwald #define ERROR_CODE_RESERVED_SLOT_VIOLATION 0x34 12847f4e325SMatthias Ringwald #define ERROR_CODE_ROLE_SWITCH_FAILED 0x35 12947f4e325SMatthias Ringwald #define ERROR_CODE_EXTENDED_INQUIRY_RESPONSE_TOO_LARGE 0x36 13047f4e325SMatthias Ringwald #define ERROR_CODE_SECURE_SIMPLE_PAIRING_NOT_SUPPORTED_BY_HOST 0x37 13147f4e325SMatthias Ringwald #define ERROR_CODE_HOST_BUSY_PAIRING 0x38 13247f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND 0x39 13347f4e325SMatthias Ringwald #define ERROR_CODE_CONTROLLER_BUSY 0x3A 13447f4e325SMatthias Ringwald #define ERROR_CODE_UNACCEPTABLE_CONNECTION_PARAMETERS 0x3B 13547f4e325SMatthias Ringwald #define ERROR_CODE_DIRECTED_ADVERTISING_TIMEOUT 0x3C 13647f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3D 13747f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3E 13847f4e325SMatthias Ringwald #define ERROR_CODE_MAC_CONNECTION_FAILED 0x3F 13947f4e325SMatthias Ringwald #define ERROR_CODE_COARSE_CLOCK_ADJUSTMENT_REJECTED_BUT_WILL_TRY_TO_ADJUST_USING_CLOCK_DRAGGING 0x40 14047f4e325SMatthias Ringwald 1418799c043SMatthias Ringwald // HCI roles 1428799c043SMatthias Ringwald #define HCI_ROLE_MASTER 0 1438799c043SMatthias Ringwald #define HCI_ROLE_SLAVE 1 1448799c043SMatthias Ringwald 1458799c043SMatthias Ringwald // packet sizes (max payload) 1468799c043SMatthias Ringwald #define HCI_ACL_DM1_SIZE 17 1478799c043SMatthias Ringwald #define HCI_ACL_DH1_SIZE 27 1488799c043SMatthias Ringwald #define HCI_ACL_2DH1_SIZE 54 1498799c043SMatthias Ringwald #define HCI_ACL_3DH1_SIZE 83 1508799c043SMatthias Ringwald #define HCI_ACL_DM3_SIZE 121 1518799c043SMatthias Ringwald #define HCI_ACL_DH3_SIZE 183 1528799c043SMatthias Ringwald #define HCI_ACL_DM5_SIZE 224 1538799c043SMatthias Ringwald #define HCI_ACL_DH5_SIZE 339 1548799c043SMatthias Ringwald #define HCI_ACL_2DH3_SIZE 367 1558799c043SMatthias Ringwald #define HCI_ACL_3DH3_SIZE 552 1568799c043SMatthias Ringwald #define HCI_ACL_2DH5_SIZE 679 1578799c043SMatthias Ringwald #define HCI_ACL_3DH5_SIZE 1021 1588799c043SMatthias Ringwald 1598799c043SMatthias Ringwald #define HCI_EVENT_PAYLOAD_SIZE 255 1608799c043SMatthias Ringwald #define HCI_CMD_PAYLOAD_SIZE 255 1618799c043SMatthias Ringwald 1628799c043SMatthias Ringwald #define LE_ADVERTISING_DATA_SIZE 31 16347f4e325SMatthias Ringwald 16447f4e325SMatthias Ringwald /** 16547f4e325SMatthias Ringwald * Default INQ Mode 16647f4e325SMatthias Ringwald */ 16747f4e325SMatthias Ringwald #define HCI_INQUIRY_LAP 0x9E8B33L // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC) 16847f4e325SMatthias Ringwald 16947f4e325SMatthias Ringwald /** 17047f4e325SMatthias Ringwald * SSP IO Capabilities 17147f4e325SMatthias Ringwald */ 17247f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_DISPLAY_ONLY 0 17347f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_DISPLAY_YES_NO 1 17447f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_KEYBOARD_ONLY 2 17547f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_NO_INPUT_NO_OUTPUT 3 17647f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_UNKNOWN 0xff 17747f4e325SMatthias Ringwald 17847f4e325SMatthias Ringwald 17947f4e325SMatthias Ringwald /** 18047f4e325SMatthias Ringwald * SSP Authentication Requirements, see IO Capability Request Reply Commmand 18147f4e325SMatthias Ringwald */ 18247f4e325SMatthias Ringwald 18347f4e325SMatthias Ringwald // Numeric comparison with automatic accept allowed. 18447f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_NO_BONDING 0x00 18547f4e325SMatthias Ringwald 18647f4e325SMatthias Ringwald // Use IO Capabilities to deter- mine authentication procedure 18747f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_NO_BONDING 0x01 18847f4e325SMatthias Ringwald 18947f4e325SMatthias Ringwald // Numeric compar- ison with automatic accept allowed. 19047f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING 0x02 19147f4e325SMatthias Ringwald 19247f4e325SMatthias Ringwald // Use IO Capabilities to determine authentication procedure 19347f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_DEDICATED_BONDING 0x03 19447f4e325SMatthias Ringwald 19547f4e325SMatthias Ringwald // Numeric Compari- son with automatic accept allowed. 19647f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_GENERAL_BONDING 0x04 19747f4e325SMatthias Ringwald 1988799c043SMatthias Ringwald // Use IO capabilities to determine authentication procedure. 19947f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_GENERAL_BONDING 0x05 20047f4e325SMatthias Ringwald 20147f4e325SMatthias Ringwald 2028799c043SMatthias Ringwald // OGFs 2038799c043SMatthias Ringwald #define OGF_LINK_CONTROL 0x01 2048799c043SMatthias Ringwald #define OGF_LINK_POLICY 0x02 2058799c043SMatthias Ringwald #define OGF_CONTROLLER_BASEBAND 0x03 2068799c043SMatthias Ringwald #define OGF_INFORMATIONAL_PARAMETERS 0x04 2078799c043SMatthias Ringwald #define OGF_STATUS_PARAMETERS 0x05 2088799c043SMatthias Ringwald #define OGF_TESTING 0x06 2098799c043SMatthias Ringwald #define OGF_LE_CONTROLLER 0x08 2108799c043SMatthias Ringwald #define OGF_VENDOR 0x3f 2118799c043SMatthias Ringwald 2128799c043SMatthias Ringwald 21347f4e325SMatthias Ringwald // Events from host controller to host 21447f4e325SMatthias Ringwald 21547f4e325SMatthias Ringwald /** 21647f4e325SMatthias Ringwald * @format 1 21747f4e325SMatthias Ringwald * @param status 21847f4e325SMatthias Ringwald */ 21947f4e325SMatthias Ringwald #define HCI_EVENT_INQUIRY_COMPLETE 0x01 22047f4e325SMatthias Ringwald // no format yet, can contain multiple results 22147f4e325SMatthias Ringwald 22247f4e325SMatthias Ringwald /** 22347f4e325SMatthias Ringwald * @format 1B11132 22447f4e325SMatthias Ringwald * @param num_responses 22547f4e325SMatthias Ringwald * @param bd_addr 22647f4e325SMatthias Ringwald * @param page_scan_repetition_mode 22747f4e325SMatthias Ringwald * @param reserved1 22847f4e325SMatthias Ringwald * @param reserved2 22947f4e325SMatthias Ringwald * @param class_of_device 23047f4e325SMatthias Ringwald * @param clock_offset 23147f4e325SMatthias Ringwald */ 23247f4e325SMatthias Ringwald #define HCI_EVENT_INQUIRY_RESULT 0x02 23347f4e325SMatthias Ringwald 23447f4e325SMatthias Ringwald /** 23547f4e325SMatthias Ringwald * @format 12B11 23647f4e325SMatthias Ringwald * @param status 23747f4e325SMatthias Ringwald * @param connection_handle 23847f4e325SMatthias Ringwald * @param bd_addr 23947f4e325SMatthias Ringwald * @param link_type 24047f4e325SMatthias Ringwald * @param encryption_enabled 24147f4e325SMatthias Ringwald */ 24247f4e325SMatthias Ringwald #define HCI_EVENT_CONNECTION_COMPLETE 0x03 24347f4e325SMatthias Ringwald /** 24447f4e325SMatthias Ringwald * @format B31 24547f4e325SMatthias Ringwald * @param bd_addr 24647f4e325SMatthias Ringwald * @param class_of_device 24747f4e325SMatthias Ringwald * @param link_type 24847f4e325SMatthias Ringwald */ 24947f4e325SMatthias Ringwald #define HCI_EVENT_CONNECTION_REQUEST 0x04 25047f4e325SMatthias Ringwald /** 25147f4e325SMatthias Ringwald * @format 121 25247f4e325SMatthias Ringwald * @param status 25347f4e325SMatthias Ringwald * @param connection_handle 25447f4e325SMatthias Ringwald * @param reason 25547f4e325SMatthias Ringwald */ 25647f4e325SMatthias Ringwald #define HCI_EVENT_DISCONNECTION_COMPLETE 0x05 25747f4e325SMatthias Ringwald /** 25847f4e325SMatthias Ringwald * @format 12 25947f4e325SMatthias Ringwald * @param status 26047f4e325SMatthias Ringwald * @param connection_handle 26147f4e325SMatthias Ringwald */ 26247f4e325SMatthias Ringwald #define HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT 0x06 26347f4e325SMatthias Ringwald /** 26447f4e325SMatthias Ringwald * @format 1BN 26547f4e325SMatthias Ringwald * @param status 26647f4e325SMatthias Ringwald * @param bd_addr 26747f4e325SMatthias Ringwald * @param remote_name 26847f4e325SMatthias Ringwald */ 26947f4e325SMatthias Ringwald #define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07 27047f4e325SMatthias Ringwald /** 27147f4e325SMatthias Ringwald * @format 121 27247f4e325SMatthias Ringwald * @param status 27347f4e325SMatthias Ringwald * @param connection_handle 27447f4e325SMatthias Ringwald * @param encryption_enabled 27547f4e325SMatthias Ringwald */ 27647f4e325SMatthias Ringwald #define HCI_EVENT_ENCRYPTION_CHANGE 0x08 27747f4e325SMatthias Ringwald /** 27847f4e325SMatthias Ringwald * @format 12 27947f4e325SMatthias Ringwald * @param status 28047f4e325SMatthias Ringwald * @param connection_handle 28147f4e325SMatthias Ringwald */ 28247f4e325SMatthias Ringwald #define HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE 0x09 28347f4e325SMatthias Ringwald /** 28447f4e325SMatthias Ringwald * @format 121 28547f4e325SMatthias Ringwald * @param status 28647f4e325SMatthias Ringwald * @param connection_handle 28747f4e325SMatthias Ringwald * @param key_flag 28847f4e325SMatthias Ringwald */ 28947f4e325SMatthias Ringwald #define HCI_EVENT_MASTER_LINK_KEY_COMPLETE 0x0A 29047f4e325SMatthias Ringwald #define HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE 0x0B 29147f4e325SMatthias Ringwald #define HCI_EVENT_READ_REMOTE_VERSION_INFORMATION_COMPLETE 0x0C 29247f4e325SMatthias Ringwald #define HCI_EVENT_QOS_SETUP_COMPLETE 0x0D 29347f4e325SMatthias Ringwald 29447f4e325SMatthias Ringwald /** 29547f4e325SMatthias Ringwald * @format 12R 29647f4e325SMatthias Ringwald * @param num_hci_command_packets 29747f4e325SMatthias Ringwald * @param command_opcode 29847f4e325SMatthias Ringwald * @param return_parameters 29947f4e325SMatthias Ringwald */ 30047f4e325SMatthias Ringwald #define HCI_EVENT_COMMAND_COMPLETE 0x0E 30147f4e325SMatthias Ringwald /** 30247f4e325SMatthias Ringwald * @format 112 30347f4e325SMatthias Ringwald * @param status 30447f4e325SMatthias Ringwald * @param num_hci_command_packets 30547f4e325SMatthias Ringwald * @param command_opcode 30647f4e325SMatthias Ringwald */ 30747f4e325SMatthias Ringwald #define HCI_EVENT_COMMAND_STATUS 0x0F 30847f4e325SMatthias Ringwald 30947f4e325SMatthias Ringwald /** 31047f4e325SMatthias Ringwald * @format 121 31147f4e325SMatthias Ringwald * @param hardware_code 31247f4e325SMatthias Ringwald */ 31347f4e325SMatthias Ringwald #define HCI_EVENT_HARDWARE_ERROR 0x10 31447f4e325SMatthias Ringwald 31547f4e325SMatthias Ringwald #define HCI_EVENT_FLUSH_OCCURED 0x11 31647f4e325SMatthias Ringwald 31747f4e325SMatthias Ringwald /** 31847f4e325SMatthias Ringwald * @format 1B1 31947f4e325SMatthias Ringwald * @param status 32047f4e325SMatthias Ringwald * @param bd_addr 32147f4e325SMatthias Ringwald * @param role 32247f4e325SMatthias Ringwald */ 32347f4e325SMatthias Ringwald #define HCI_EVENT_ROLE_CHANGE 0x12 32447f4e325SMatthias Ringwald 32547f4e325SMatthias Ringwald #define HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS 0x13 32647f4e325SMatthias Ringwald #define HCI_EVENT_MODE_CHANGE_EVENT 0x14 32747f4e325SMatthias Ringwald #define HCI_EVENT_RETURN_LINK_KEYS 0x15 32847f4e325SMatthias Ringwald #define HCI_EVENT_PIN_CODE_REQUEST 0x16 32947f4e325SMatthias Ringwald #define HCI_EVENT_LINK_KEY_REQUEST 0x17 33047f4e325SMatthias Ringwald #define HCI_EVENT_LINK_KEY_NOTIFICATION 0x18 33147f4e325SMatthias Ringwald #define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1A 33247f4e325SMatthias Ringwald #define HCI_EVENT_MAX_SLOTS_CHANGED 0x1B 33347f4e325SMatthias Ringwald #define HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE 0x1C 33447f4e325SMatthias Ringwald #define HCI_EVENT_PACKET_TYPE_CHANGED 0x1D 33547f4e325SMatthias Ringwald 33647f4e325SMatthias Ringwald /** 33747f4e325SMatthias Ringwald * @format 1B11321 33847f4e325SMatthias Ringwald * @param num_responses 33947f4e325SMatthias Ringwald * @param bd_addr 34047f4e325SMatthias Ringwald * @param page_scan_repetition_mode 34147f4e325SMatthias Ringwald * @param reserved 34247f4e325SMatthias Ringwald * @param class_of_device 34347f4e325SMatthias Ringwald * @param clock_offset 34447f4e325SMatthias Ringwald * @param rssi 34547f4e325SMatthias Ringwald */ 34647f4e325SMatthias Ringwald #define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 0x22 34747f4e325SMatthias Ringwald 34847f4e325SMatthias Ringwald /** 34947f4e325SMatthias Ringwald * @format 1HB111221 35047f4e325SMatthias Ringwald * @param status 35147f4e325SMatthias Ringwald * @param handle 35247f4e325SMatthias Ringwald * @param bd_addr 35347f4e325SMatthias Ringwald * @param link_type 35447f4e325SMatthias Ringwald * @param transmission_interval 35547f4e325SMatthias Ringwald * @param retransmission_interval 35647f4e325SMatthias Ringwald * @param rx_packet_length 35747f4e325SMatthias Ringwald * @param tx_packet_length 35847f4e325SMatthias Ringwald * @param air_mode 35947f4e325SMatthias Ringwald */ 36047f4e325SMatthias Ringwald #define HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 0x2C 36147f4e325SMatthias Ringwald 36247f4e325SMatthias Ringwald // TODO: serialize extended_inquiry_response and provide parser 36347f4e325SMatthias Ringwald /** 36447f4e325SMatthias Ringwald * @format 1B11321 36547f4e325SMatthias Ringwald * @param num_responses 36647f4e325SMatthias Ringwald * @param bd_addr 36747f4e325SMatthias Ringwald * @param page_scan_repetition_mode 36847f4e325SMatthias Ringwald * @param reserved 36947f4e325SMatthias Ringwald * @param class_of_device 37047f4e325SMatthias Ringwald * @param clock_offset 37147f4e325SMatthias Ringwald * @param rssi 37247f4e325SMatthias Ringwald */ 37347f4e325SMatthias Ringwald #define HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 0x2F 37447f4e325SMatthias Ringwald 37547f4e325SMatthias Ringwald /** 37647f4e325SMatthias Ringwald * @format 1H 37747f4e325SMatthias Ringwald * @param status 37847f4e325SMatthias Ringwald * @param handle 37947f4e325SMatthias Ringwald */ 38047f4e325SMatthias Ringwald #define HCI_EVENT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30 38147f4e325SMatthias Ringwald 38247f4e325SMatthias Ringwald #define HCI_EVENT_IO_CAPABILITY_REQUEST 0x31 38347f4e325SMatthias Ringwald #define HCI_EVENT_IO_CAPABILITY_RESPONSE 0x32 38447f4e325SMatthias Ringwald #define HCI_EVENT_USER_CONFIRMATION_REQUEST 0x33 38547f4e325SMatthias Ringwald #define HCI_EVENT_USER_PASSKEY_REQUEST 0x34 38647f4e325SMatthias Ringwald #define HCI_EVENT_REMOTE_OOB_DATA_REQUEST 0x35 38747f4e325SMatthias Ringwald #define HCI_EVENT_SIMPLE_PAIRING_COMPLETE 0x36 38847f4e325SMatthias Ringwald 38947f4e325SMatthias Ringwald #define HCI_EVENT_LE_META 0x3E 39047f4e325SMatthias Ringwald 39147f4e325SMatthias Ringwald /** 39247f4e325SMatthias Ringwald * @format 11211B2221 39347f4e325SMatthias Ringwald * @param subevent_code 39447f4e325SMatthias Ringwald * @param status 39547f4e325SMatthias Ringwald * @param connection_handle 39647f4e325SMatthias Ringwald * @param role 39747f4e325SMatthias Ringwald * @param peer_address_type 39847f4e325SMatthias Ringwald * @param peer_address 39947f4e325SMatthias Ringwald * @param conn_interval 40047f4e325SMatthias Ringwald * @param conn_latency 40147f4e325SMatthias Ringwald * @param supervision_timeout 40247f4e325SMatthias Ringwald * @param master_clock_accuracy 40347f4e325SMatthias Ringwald */ 40447f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_CONNECTION_COMPLETE 0x01 40547f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_ADVERTISING_REPORT 0x02 40647f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE 0x03 40747f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04 40847f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST 0x05 40947f4e325SMatthias Ringwald 41047f4e325SMatthias Ringwald // last used HCI_EVENT in 2.1 is 0x3d 41147f4e325SMatthias Ringwald // last used HCI_EVENT in 4.1 is 0x57 41247f4e325SMatthias Ringwald 41347f4e325SMatthias Ringwald /** 41447f4e325SMatthias Ringwald * L2CAP Layer 41547f4e325SMatthias Ringwald */ 41647f4e325SMatthias Ringwald 417a8373a41SMatthias Ringwald #define L2CAP_HEADER_SIZE 4 418a8373a41SMatthias Ringwald 419a8373a41SMatthias Ringwald #define L2CAP_SIG_ID_INVALID 0 420a8373a41SMatthias Ringwald 421a8373a41SMatthias Ringwald // size of HCI ACL + L2CAP Header for regular data packets (8) 422a8373a41SMatthias Ringwald #define COMPLETE_L2CAP_HEADER (HCI_ACL_HEADER_SIZE + L2CAP_HEADER_SIZE) 423a8373a41SMatthias Ringwald 424a8373a41SMatthias Ringwald // minimum signaling MTU 425a8373a41SMatthias Ringwald #define L2CAP_MINIMAL_MTU 48 426a8373a41SMatthias Ringwald #define L2CAP_DEFAULT_MTU 672 427a8373a41SMatthias Ringwald 428a8373a41SMatthias Ringwald // Minimum/default MTU 429a8373a41SMatthias Ringwald #define L2CAP_LE_DEFAULT_MTU 23 430a8373a41SMatthias Ringwald 431a8373a41SMatthias Ringwald // L2CAP Fixed Channel IDs 432a8373a41SMatthias Ringwald #define L2CAP_CID_SIGNALING 0x0001 433a8373a41SMatthias Ringwald #define L2CAP_CID_CONNECTIONLESS_CHANNEL 0x0002 434a8373a41SMatthias Ringwald #define L2CAP_CID_ATTRIBUTE_PROTOCOL 0x0004 435a8373a41SMatthias Ringwald #define L2CAP_CID_SIGNALING_LE 0x0005 436a8373a41SMatthias Ringwald #define L2CAP_CID_SECURITY_MANAGER_PROTOCOL 0x0006 437a8373a41SMatthias Ringwald 438a8373a41SMatthias Ringwald // L2CAP Configuration Result Codes 439a8373a41SMatthias Ringwald #define L2CAP_CONF_RESULT_UNKNOWN_OPTIONS 0x0003 440a8373a41SMatthias Ringwald 441a8373a41SMatthias Ringwald // L2CAP Reject Result Codes 442a8373a41SMatthias Ringwald #define L2CAP_REJ_CMD_UNKNOWN 0x0000 443a8373a41SMatthias Ringwald 444a8373a41SMatthias Ringwald // Response Timeout eXpired 445a8373a41SMatthias Ringwald #define L2CAP_RTX_TIMEOUT_MS 10000 446a8373a41SMatthias Ringwald 447a8373a41SMatthias Ringwald // Extended Response Timeout eXpired 448a8373a41SMatthias Ringwald #define L2CAP_ERTX_TIMEOUT_MS 120000 449a8373a41SMatthias Ringwald 45047f4e325SMatthias Ringwald // Fixed PSM numbers 45147f4e325SMatthias Ringwald #define PSM_SDP 0x01 45247f4e325SMatthias Ringwald #define PSM_RFCOMM 0x03 45347f4e325SMatthias Ringwald #define PSM_BNEP 0x0F 45447f4e325SMatthias Ringwald #define PSM_HID_CONTROL 0x11 45547f4e325SMatthias Ringwald #define PSM_HID_INTERRUPT 0x13 45647f4e325SMatthias Ringwald 45766b1fcb3SMatthias Ringwald /** 458ef907034SMatthias Ringwald * SDP Protocl 459ef907034SMatthias Ringwald */ 460ef907034SMatthias Ringwald 461ef907034SMatthias Ringwald // PDU Types 462ef907034SMatthias Ringwald typedef enum { 463ef907034SMatthias Ringwald SDP_Invalid = 0, 464ef907034SMatthias Ringwald SDP_ErrorResponse = 1, 465ef907034SMatthias Ringwald SDP_ServiceSearchRequest, 466ef907034SMatthias Ringwald SDP_ServiceSearchResponse, 467ef907034SMatthias Ringwald SDP_ServiceAttributeRequest, 468ef907034SMatthias Ringwald SDP_ServiceAttributeResponse, 469ef907034SMatthias Ringwald SDP_ServiceSearchAttributeRequest, 470ef907034SMatthias Ringwald SDP_ServiceSearchAttributeResponse 471ef907034SMatthias Ringwald } SDP_PDU_ID_t; 472ef907034SMatthias Ringwald 473ef907034SMatthias Ringwald // UNIVERSAL ATTRIBUTE DEFINITIONS 474ef907034SMatthias Ringwald #define SDP_ServiceRecordHandle 0x0000 475ef907034SMatthias Ringwald #define SDP_ServiceClassIDList 0x0001 476ef907034SMatthias Ringwald #define SDP_ServiceRecordState 0x0002 477ef907034SMatthias Ringwald #define SDP_ServiceID 0x0003 478ef907034SMatthias Ringwald #define SDP_ProtocolDescriptorList 0x0004 479ef907034SMatthias Ringwald #define SDP_BrowseGroupList 0x0005 480ef907034SMatthias Ringwald #define SDP_LanguageBaseAttributeIDList 0x0006 481ef907034SMatthias Ringwald #define SDP_ServiceInfoTimeToLive 0x0007 482ef907034SMatthias Ringwald #define SDP_ServiceAvailability 0x0008 483ef907034SMatthias Ringwald #define SDP_BluetoothProfileDescriptorList 0x0009 484ef907034SMatthias Ringwald #define SDP_DocumentationURL 0x000a 485ef907034SMatthias Ringwald #define SDP_ClientExecutableURL 0x000b 486ef907034SMatthias Ringwald #define SDP_IconURL 0x000c 487ef907034SMatthias Ringwald #define SDP_AdditionalProtocolDescriptorList 0x000d 488ef907034SMatthias Ringwald #define SDP_SupportedFormatsList 0x0303 489ef907034SMatthias Ringwald 490ef907034SMatthias Ringwald // SERVICE CLASSES 491ef907034SMatthias Ringwald #define SDP_OBEXObjectPush 0x1105 492ef907034SMatthias Ringwald #define SDP_OBEXFileTransfer 0x1106 493ef907034SMatthias Ringwald #define SDP_PublicBrowseGroup 0x1002 494ef907034SMatthias Ringwald #define SDP_HSP 0x1108 495ef907034SMatthias Ringwald #define SDP_Headset_AG 0x1112 496ef907034SMatthias Ringwald #define SDP_PANU 0x1115 497ef907034SMatthias Ringwald #define SDP_NAP 0x1116 498ef907034SMatthias Ringwald #define SDP_GN 0x1117 499ef907034SMatthias Ringwald #define SDP_Handsfree 0x111E 500ef907034SMatthias Ringwald #define SDP_HandsfreeAudioGateway 0x111F 501ef907034SMatthias Ringwald #define SDP_Headset_HS 0x1131 502ef907034SMatthias Ringwald #define SDP_GenericAudio 0x1203 503ef907034SMatthias Ringwald 504ef907034SMatthias Ringwald 505ef907034SMatthias Ringwald // PROTOCOLS 506ef907034SMatthias Ringwald #define SDP_SDPProtocol 0x0001 507ef907034SMatthias Ringwald #define SDP_UDPProtocol 0x0002 508ef907034SMatthias Ringwald #define SDP_RFCOMMProtocol 0x0003 509ef907034SMatthias Ringwald #define SDP_OBEXProtocol 0x0008 510ef907034SMatthias Ringwald #define SDP_L2CAPProtocol 0x0100 511ef907034SMatthias Ringwald #define SDP_BNEPProtocol 0x000F 512ef907034SMatthias Ringwald #define SDP_AVDTPProtocol 0x0019 513ef907034SMatthias Ringwald 514ef907034SMatthias Ringwald // OFFSETS FOR LOCALIZED ATTRIBUTES - SDP_LanguageBaseAttributeIDList 515ef907034SMatthias Ringwald #define SDP_Offest_ServiceName 0x0000 516ef907034SMatthias Ringwald #define SDP_Offest_ServiceDescription 0x0001 517ef907034SMatthias Ringwald #define SDP_Offest_ProviderName 0x0002 518ef907034SMatthias Ringwald 519ef907034SMatthias Ringwald // OBEX 520ef907034SMatthias Ringwald #define SDP_vCard_2_1 0x01 521ef907034SMatthias Ringwald #define SDP_vCard_3_0 0x02 522ef907034SMatthias Ringwald #define SDP_vCal_1_0 0x03 523ef907034SMatthias Ringwald #define SDP_iCal_2_0 0x04 524ef907034SMatthias Ringwald #define SDP_vNote 0x05 525ef907034SMatthias Ringwald #define SDP_vMessage 0x06 526ef907034SMatthias Ringwald #define SDP_OBEXFileTypeAny 0xFF 527ef907034SMatthias Ringwald 528ef907034SMatthias Ringwald /** 529e2577bd7SMatthias Ringwald * RFCOMM Protocol 530e2577bd7SMatthias Ringwald */ 531e2577bd7SMatthias Ringwald 532e2577bd7SMatthias Ringwald // Control field values bit no. 1 2 3 4 PF 6 7 8 533e2577bd7SMatthias Ringwald #define BT_RFCOMM_SABM 0x3F // 1 1 1 1 1 1 0 0 534e2577bd7SMatthias Ringwald #define BT_RFCOMM_UA 0x73 // 1 1 0 0 1 1 1 0 535e2577bd7SMatthias Ringwald #define BT_RFCOMM_DM 0x0F // 1 1 1 1 0 0 0 0 536e2577bd7SMatthias Ringwald #define BT_RFCOMM_DM_PF 0x1F // 1 1 1 1 1 0 0 0 537e2577bd7SMatthias Ringwald #define BT_RFCOMM_DISC 0x53 // 1 1 0 0 1 0 1 0 538e2577bd7SMatthias Ringwald #define BT_RFCOMM_UIH 0xEF // 1 1 1 1 0 1 1 1 539e2577bd7SMatthias Ringwald #define BT_RFCOMM_UIH_PF 0xFF // 1 1 1 1 0 1 1 1 540e2577bd7SMatthias Ringwald 541e2577bd7SMatthias Ringwald // Multiplexer message types 542e2577bd7SMatthias Ringwald #define BT_RFCOMM_CLD_CMD 0xC3 543e2577bd7SMatthias Ringwald #define BT_RFCOMM_FCON_CMD 0xA3 544e2577bd7SMatthias Ringwald #define BT_RFCOMM_FCON_RSP 0xA1 545e2577bd7SMatthias Ringwald #define BT_RFCOMM_FCOFF_CMD 0x63 546e2577bd7SMatthias Ringwald #define BT_RFCOMM_FCOFF_RSP 0x61 547e2577bd7SMatthias Ringwald #define BT_RFCOMM_MSC_CMD 0xE3 548e2577bd7SMatthias Ringwald #define BT_RFCOMM_MSC_RSP 0xE1 549e2577bd7SMatthias Ringwald #define BT_RFCOMM_NSC_RSP 0x11 550e2577bd7SMatthias Ringwald #define BT_RFCOMM_PN_CMD 0x83 551e2577bd7SMatthias Ringwald #define BT_RFCOMM_PN_RSP 0x81 552e2577bd7SMatthias Ringwald #define BT_RFCOMM_RLS_CMD 0x53 553e2577bd7SMatthias Ringwald #define BT_RFCOMM_RLS_RSP 0x51 554e2577bd7SMatthias Ringwald #define BT_RFCOMM_RPN_CMD 0x93 555e2577bd7SMatthias Ringwald #define BT_RFCOMM_RPN_RSP 0x91 556e2577bd7SMatthias Ringwald #define BT_RFCOMM_TEST_CMD 0x23 557e2577bd7SMatthias Ringwald #define BT_RFCOMM_TEST_RSP 0x21 558e2577bd7SMatthias Ringwald 559e2577bd7SMatthias Ringwald // Line Status 560e2577bd7SMatthias Ringwald #define LINE_STATUS_NO_ERROR 0x00 561e2577bd7SMatthias Ringwald #define LINE_STATUS_OVERRUN_ERROR 0x03 562e2577bd7SMatthias Ringwald #define LINE_STATUS_PARITY_ERORR 0x05 563e2577bd7SMatthias Ringwald #define LINE_STATUS_FRAMING_ERROR 0x09 564e2577bd7SMatthias Ringwald 565e2577bd7SMatthias Ringwald // Modem Status Flags 566e2577bd7SMatthias Ringwald #define MODEM_STATUS_FC 0x02 567e2577bd7SMatthias Ringwald #define MODEM_STATUS_RTC 0x04 568e2577bd7SMatthias Ringwald #define MODEM_STATUS_RTR 0x08 569e2577bd7SMatthias Ringwald #define MODEM_STATUS_IC 0x40 570e2577bd7SMatthias Ringwald #define MODEM_STATUS_DV 0x80 571e2577bd7SMatthias Ringwald 572e2577bd7SMatthias Ringwald typedef enum rpn_baud { 573e2577bd7SMatthias Ringwald RPN_BAUD_2400 = 0, 574e2577bd7SMatthias Ringwald RPN_BAUD_4800, 575e2577bd7SMatthias Ringwald RPN_BAUD_7200, 576e2577bd7SMatthias Ringwald RPN_BAUD_9600, 577e2577bd7SMatthias Ringwald RPN_BAUD_19200, 578e2577bd7SMatthias Ringwald RPN_BAUD_38400, 579e2577bd7SMatthias Ringwald RPN_BAUD_57600, 580e2577bd7SMatthias Ringwald RPN_BAUD_115200, 581e2577bd7SMatthias Ringwald RPN_BAUD_230400 582e2577bd7SMatthias Ringwald } rpn_baud_t; 583e2577bd7SMatthias Ringwald 584e2577bd7SMatthias Ringwald typedef enum rpn_data_bits { 585e2577bd7SMatthias Ringwald RPN_DATA_BITS_5 = 0, 586e2577bd7SMatthias Ringwald RPN_DATA_BITS_6 = 0, 587e2577bd7SMatthias Ringwald RPN_DATA_BITS_7 = 0, 588e2577bd7SMatthias Ringwald RPN_DATA_BITS_8 = 0 589e2577bd7SMatthias Ringwald } rpn_data_bits_t; 590e2577bd7SMatthias Ringwald 591e2577bd7SMatthias Ringwald typedef enum rpn_stop_bits { 592e2577bd7SMatthias Ringwald RPN_STOP_BITS_1_0 = 0, 593e2577bd7SMatthias Ringwald RPN_STOP_BITS_1_5 594e2577bd7SMatthias Ringwald } rpn_stop_bits_t; 595e2577bd7SMatthias Ringwald 596e2577bd7SMatthias Ringwald typedef enum rpn_parity { 597e2577bd7SMatthias Ringwald RPN_PARITY_NONE = 0, 598e2577bd7SMatthias Ringwald RPN_PARITY_ODD = 1, 599e2577bd7SMatthias Ringwald RPN_PARITY_EVEN = 3, 600e2577bd7SMatthias Ringwald RPN_PARITY_MARK = 5, 601e2577bd7SMatthias Ringwald RPN_PARITY_SPACE = 7, 602e2577bd7SMatthias Ringwald } rpn_parity_t; 603e2577bd7SMatthias Ringwald 604e2577bd7SMatthias Ringwald typedef enum rpn_flow_control { 605e2577bd7SMatthias Ringwald RPN_FLOW_CONTROL_XONXOFF_ON_INPUT = 1 << 0, 606e2577bd7SMatthias Ringwald RPN_FLOW_CONTROL_XONXOFF_ON_OUTPUT = 1 << 1, 607e2577bd7SMatthias Ringwald RPN_FLOW_CONTROL_RTR_ON_INPUT = 1 << 2, 608e2577bd7SMatthias Ringwald RPN_FLOW_CONTROL_RTR_ON_OUTPUT = 1 << 3, 609e2577bd7SMatthias Ringwald RPN_FLOW_CONTROL_RTC_ON_INPUT = 1 << 4, 610e2577bd7SMatthias Ringwald RPN_FLOW_CONTROL_RTC_ON_OUTPUT = 1 << 5, 611e2577bd7SMatthias Ringwald } rpn_flow_control_t; 612e2577bd7SMatthias Ringwald 613e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_BAUD 0x01 614e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_DATA_BITS 0x02 615e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_STOP_BITS 0x04 616e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_PARITY 0x08 617e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_PARITY_TYPE 0x10 618e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_XON_CHAR 0x20 619e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_XOFF_CHAR 0x40 620e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_RESERVED 0x80 621e2577bd7SMatthias Ringwald 622e2577bd7SMatthias Ringwald // @note: values are identical to rpn_flow_control_t 623e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_XONOFF_ON_INPUT 0x01 624e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_XONOFF_ON_OUTPUT 0x02 625e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTR_ON_INPUT 0x04 626e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTR_ON_OUTPUT 0x08 627e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTC_ON_INPUT 0x10 628e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTC_ON_OUTPUT 0x20 629e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RESERVED_0 0x40 630e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RESERVED_1 0x80 631e2577bd7SMatthias Ringwald 632e2577bd7SMatthias Ringwald /** 63366b1fcb3SMatthias Ringwald * BNEP Protocol 63466b1fcb3SMatthias Ringwald */ 63547f4e325SMatthias Ringwald 63666b1fcb3SMatthias Ringwald #ifndef ETHER_ADDR_LEN 63766b1fcb3SMatthias Ringwald #define ETHER_ADDR_LEN sizeof(bd_addr_t) 63866b1fcb3SMatthias Ringwald #endif 63947f4e325SMatthias Ringwald 64066b1fcb3SMatthias Ringwald #ifndef ETHERTYPE_VLAN 64166b1fcb3SMatthias Ringwald #define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tag */ 64266b1fcb3SMatthias Ringwald #endif 64366b1fcb3SMatthias Ringwald 64466b1fcb3SMatthias Ringwald #define BNEP_MTU_MIN 1691 64566b1fcb3SMatthias Ringwald 64666b1fcb3SMatthias Ringwald #define BNEP_EXT_FLAG 0x80 64766b1fcb3SMatthias Ringwald #define BNEP_TYPE_MASK 0x7F 64866b1fcb3SMatthias Ringwald #define BNEP_TYPE(header) ((header) & BNEP_TYPE_MASK) 64966b1fcb3SMatthias Ringwald #define BNEP_HEADER_HAS_EXT(x) (((x) & BNEP_EXT_FLAG) == BNEP_EXT_FLAG) 65066b1fcb3SMatthias Ringwald 65166b1fcb3SMatthias Ringwald /* BNEP packet types */ 65266b1fcb3SMatthias Ringwald #define BNEP_PKT_TYPE_GENERAL_ETHERNET 0x00 65366b1fcb3SMatthias Ringwald #define BNEP_PKT_TYPE_CONTROL 0x01 65466b1fcb3SMatthias Ringwald #define BNEP_PKT_TYPE_COMPRESSED_ETHERNET 0x02 65566b1fcb3SMatthias Ringwald #define BNEP_PKT_TYPE_COMPRESSED_ETHERNET_SOURCE_ONLY 0x03 65666b1fcb3SMatthias Ringwald #define BNEP_PKT_TYPE_COMPRESSED_ETHERNET_DEST_ONLY 0x04 65766b1fcb3SMatthias Ringwald 65866b1fcb3SMatthias Ringwald /* BNEP control types */ 65966b1fcb3SMatthias Ringwald #define BNEP_CONTROL_TYPE_COMMAND_NOT_UNDERSTOOD 0x00 66066b1fcb3SMatthias Ringwald #define BNEP_CONTROL_TYPE_SETUP_CONNECTION_REQUEST 0x01 66166b1fcb3SMatthias Ringwald #define BNEP_CONTROL_TYPE_SETUP_CONNECTION_RESPONSE 0x02 66266b1fcb3SMatthias Ringwald #define BNEP_CONTROL_TYPE_FILTER_NET_TYPE_SET 0x03 66366b1fcb3SMatthias Ringwald #define BNEP_CONTROL_TYPE_FILTER_NET_TYPE_RESPONSE 0x04 66466b1fcb3SMatthias Ringwald #define BNEP_CONTROL_TYPE_FILTER_MULTI_ADDR_SET 0x05 66566b1fcb3SMatthias Ringwald #define BNEP_CONTROL_TYPE_FILTER_MULTI_ADDR_RESPONSE 0x06 66666b1fcb3SMatthias Ringwald 66766b1fcb3SMatthias Ringwald /* BNEP extension header types */ 66866b1fcb3SMatthias Ringwald #define BNEP_EXT_HEADER_TYPE_EXTENSION_CONTROL 0x00 66966b1fcb3SMatthias Ringwald 67066b1fcb3SMatthias Ringwald /* BNEP setup response codes */ 67166b1fcb3SMatthias Ringwald #define BNEP_RESP_SETUP_SUCCESS 0x0000 67266b1fcb3SMatthias Ringwald #define BNEP_RESP_SETUP_INVALID_DEST_UUID 0x0001 67366b1fcb3SMatthias Ringwald #define BNEP_RESP_SETUP_INVALID_SOURCE_UUID 0x0002 67466b1fcb3SMatthias Ringwald #define BNEP_RESP_SETUP_INVALID_SERVICE_UUID_SIZE 0x0003 67566b1fcb3SMatthias Ringwald #define BNEP_RESP_SETUP_CONNECTION_NOT_ALLOWED 0x0004 67666b1fcb3SMatthias Ringwald 67766b1fcb3SMatthias Ringwald /* BNEP filter response codes */ 67866b1fcb3SMatthias Ringwald #define BNEP_RESP_FILTER_SUCCESS 0x0000 67966b1fcb3SMatthias Ringwald #define BNEP_RESP_FILTER_UNSUPPORTED_REQUEST 0x0001 68066b1fcb3SMatthias Ringwald #define BNEP_RESP_FILTER_ERR_INVALID_RANGE 0x0002 68166b1fcb3SMatthias Ringwald #define BNEP_RESP_FILTER_ERR_TOO_MANY_FILTERS 0x0003 68266b1fcb3SMatthias Ringwald #define BNEP_RESP_FILTER_ERR_SECURITY 0x0004 68366b1fcb3SMatthias Ringwald 68466b1fcb3SMatthias Ringwald /** 68566b1fcb3SMatthias Ringwald * PAN Profile 68666b1fcb3SMatthias Ringwald */ 68766b1fcb3SMatthias Ringwald 68866b1fcb3SMatthias Ringwald typedef enum { 68966b1fcb3SMatthias Ringwald PANU_UUID = 0x1115, 69066b1fcb3SMatthias Ringwald NAP_UUID = 0x1116, 69166b1fcb3SMatthias Ringwald GN_UUID = 0x1117 69266b1fcb3SMatthias Ringwald } bnep_service_uuid_t; 69366b1fcb3SMatthias Ringwald 69466b1fcb3SMatthias Ringwald typedef enum { 69566b1fcb3SMatthias Ringwald BNEP_SECURITY_NONE = 0x0000, 69666b1fcb3SMatthias Ringwald BNEP_SECURITY_SERVICE_LEVEL_ENFORCED, 69766b1fcb3SMatthias Ringwald BNEP_SECURITY_802_1X 69866b1fcb3SMatthias Ringwald } security_description_t; 69966b1fcb3SMatthias Ringwald 70066b1fcb3SMatthias Ringwald typedef enum { 70166b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_PSTN = 0x0000, 70266b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_ISDN, 70366b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_DSL, 70466b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_CABLE_MODEM, 70566b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_10MB_ETHERNET, 70666b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_100MB_ETHERNET, 70766b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_4MB_TOKEN_RING, 70866b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_16MB_TOKEN_RING, 70966b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_100MB_TOKEN_RING, 71066b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_FDDI, 71166b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_GSM, 71266b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_CDMA, 71366b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_GPRS, 71466b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_3G, 71566b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_CELULAR, 71666b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_OTHER = 0xFFFE, 71766b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_NONE 71866b1fcb3SMatthias Ringwald } net_access_type_t; 71947f4e325SMatthias Ringwald 720*4c1900e6SMatthias Ringwald /** 721*4c1900e6SMatthias Ringwald * ATT 722*4c1900e6SMatthias Ringwald */ 723*4c1900e6SMatthias Ringwald 724*4c1900e6SMatthias Ringwald // Minimum/default MTU 725*4c1900e6SMatthias Ringwald #define ATT_DEFAULT_MTU 23 726*4c1900e6SMatthias Ringwald 727*4c1900e6SMatthias Ringwald // MARK: Attribute PDU Opcodes 728*4c1900e6SMatthias Ringwald #define ATT_ERROR_RESPONSE 0x01 729*4c1900e6SMatthias Ringwald 730*4c1900e6SMatthias Ringwald #define ATT_EXCHANGE_MTU_REQUEST 0x02 731*4c1900e6SMatthias Ringwald #define ATT_EXCHANGE_MTU_RESPONSE 0x03 732*4c1900e6SMatthias Ringwald 733*4c1900e6SMatthias Ringwald #define ATT_FIND_INFORMATION_REQUEST 0x04 734*4c1900e6SMatthias Ringwald #define ATT_FIND_INFORMATION_REPLY 0x05 735*4c1900e6SMatthias Ringwald #define ATT_FIND_BY_TYPE_VALUE_REQUEST 0x06 736*4c1900e6SMatthias Ringwald #define ATT_FIND_BY_TYPE_VALUE_RESPONSE 0x07 737*4c1900e6SMatthias Ringwald 738*4c1900e6SMatthias Ringwald #define ATT_READ_BY_TYPE_REQUEST 0x08 739*4c1900e6SMatthias Ringwald #define ATT_READ_BY_TYPE_RESPONSE 0x09 740*4c1900e6SMatthias Ringwald #define ATT_READ_REQUEST 0x0a 741*4c1900e6SMatthias Ringwald #define ATT_READ_RESPONSE 0x0b 742*4c1900e6SMatthias Ringwald #define ATT_READ_BLOB_REQUEST 0x0c 743*4c1900e6SMatthias Ringwald #define ATT_READ_BLOB_RESPONSE 0x0d 744*4c1900e6SMatthias Ringwald #define ATT_READ_MULTIPLE_REQUEST 0x0e 745*4c1900e6SMatthias Ringwald #define ATT_READ_MULTIPLE_RESPONSE 0x0f 746*4c1900e6SMatthias Ringwald #define ATT_READ_BY_GROUP_TYPE_REQUEST 0x10 747*4c1900e6SMatthias Ringwald #define ATT_READ_BY_GROUP_TYPE_RESPONSE 0x11 748*4c1900e6SMatthias Ringwald 749*4c1900e6SMatthias Ringwald #define ATT_WRITE_REQUEST 0x12 750*4c1900e6SMatthias Ringwald #define ATT_WRITE_RESPONSE 0x13 751*4c1900e6SMatthias Ringwald 752*4c1900e6SMatthias Ringwald #define ATT_PREPARE_WRITE_REQUEST 0x16 753*4c1900e6SMatthias Ringwald #define ATT_PREPARE_WRITE_RESPONSE 0x17 754*4c1900e6SMatthias Ringwald #define ATT_EXECUTE_WRITE_REQUEST 0x18 755*4c1900e6SMatthias Ringwald #define ATT_EXECUTE_WRITE_RESPONSE 0x19 756*4c1900e6SMatthias Ringwald 757*4c1900e6SMatthias Ringwald #define ATT_HANDLE_VALUE_NOTIFICATION 0x1b 758*4c1900e6SMatthias Ringwald #define ATT_HANDLE_VALUE_INDICATION 0x1d 759*4c1900e6SMatthias Ringwald #define ATT_HANDLE_VALUE_CONFIRMATION 0x1e 760*4c1900e6SMatthias Ringwald 761*4c1900e6SMatthias Ringwald 762*4c1900e6SMatthias Ringwald #define ATT_WRITE_COMMAND 0x52 763*4c1900e6SMatthias Ringwald #define ATT_SIGNED_WRITE_COMMAND 0xD2 764*4c1900e6SMatthias Ringwald 765*4c1900e6SMatthias Ringwald // MARK: ATT Error Codes 766*4c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_HANDLE 0x01 767*4c1900e6SMatthias Ringwald #define ATT_ERROR_READ_NOT_PERMITTED 0x02 768*4c1900e6SMatthias Ringwald #define ATT_ERROR_WRITE_NOT_PERMITTED 0x03 769*4c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_PDU 0x04 770*4c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_AUTHENTICATION 0x05 771*4c1900e6SMatthias Ringwald #define ATT_ERROR_REQUEST_NOT_SUPPORTED 0x06 772*4c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_OFFSET 0x07 773*4c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_AUTHORIZATION 0x08 774*4c1900e6SMatthias Ringwald #define ATT_ERROR_PREPARE_QUEUE_FULL 0x09 775*4c1900e6SMatthias Ringwald #define ATT_ERROR_ATTRIBUTE_NOT_FOUND 0x0a 776*4c1900e6SMatthias Ringwald #define ATT_ERROR_ATTRIBUTE_NOT_LONG 0x0b 777*4c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE 0x0c 778*4c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LENGTH 0x0d 779*4c1900e6SMatthias Ringwald #define ATT_ERROR_UNLIKELY_ERROR 0x0e 780*4c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_ENCRYPTION 0x0f 781*4c1900e6SMatthias Ringwald #define ATT_ERROR_UNSUPPORTED_GROUP_TYPE 0x10 782*4c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_RESOURCES 0x11 783*4c1900e6SMatthias Ringwald 784*4c1900e6SMatthias Ringwald // MARK: Attribute Property Flags 785*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_BROADCAST 0x01 786*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_READ 0x02 787*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_WRITE_WITHOUT_RESPONSE 0x04 788*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_WRITE 0x08 789*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_NOTIFY 0x10 790*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_INDICATE 0x20 791*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_AUTHENTICATED_SIGNED_WRITE 0x40 792*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_EXTENDED_PROPERTIES 0x80 793*4c1900e6SMatthias Ringwald 794*4c1900e6SMatthias Ringwald // MARK: Attribute Property Flag, BTstack extension 795*4c1900e6SMatthias Ringwald // value is asked from client 796*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_DYNAMIC 0x100 797*4c1900e6SMatthias Ringwald // 128 bit UUID used 798*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_UUID128 0x200 799*4c1900e6SMatthias Ringwald // Authentication required 800*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_AUTHENTICATION_REQUIRED 0x400 801*4c1900e6SMatthias Ringwald // Authorization from user required 802*4c1900e6SMatthias Ringwald #define ATT_PROPERTY_AUTHORIZATION_REQUIRED 0x800 803*4c1900e6SMatthias Ringwald // Encryption key size stored in upper 4 bits, 0 == no encryption, encryption key size - 1 otherwise 804*4c1900e6SMatthias Ringwald 805*4c1900e6SMatthias Ringwald // ATT Transaction Timeout of 30 seconds for Command/Response or Incidationc/Confirmation 806*4c1900e6SMatthias Ringwald #define ATT_TRANSACTION_TIMEOUT_MS 30000 807*4c1900e6SMatthias Ringwald 808*4c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_NONE 0x0 809*4c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_ACTIVE 0x1 810*4c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_EXECUTE 0x2 811*4c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_CANCEL 0x3 812*4c1900e6SMatthias Ringwald 813*4c1900e6SMatthias Ringwald // MARK: GATT UUIDs 814*4c1900e6SMatthias Ringwald #define GATT_PRIMARY_SERVICE_UUID 0x2800 815*4c1900e6SMatthias Ringwald #define GATT_SECONDARY_SERVICE_UUID 0x2801 816*4c1900e6SMatthias Ringwald #define GATT_INCLUDE_SERVICE_UUID 0x2802 817*4c1900e6SMatthias Ringwald #define GATT_CHARACTERISTICS_UUID 0x2803 818*4c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_EXTENDED_PROPERTIES 0x2900 819*4c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_USER_DESCRIPTION 0x2901 820*4c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION 0x2902 821*4c1900e6SMatthias Ringwald #define GATT_SERVER_CHARACTERISTICS_CONFIGURATION 0x2903 822*4c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_PRESENTATION_FORMAT 0x2904 823*4c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_AGGREGATE_FORMAT 0x2905 824*4c1900e6SMatthias Ringwald 825*4c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NONE 0 826*4c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION 1 827*4c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION 2 828*4c1900e6SMatthias Ringwald 829*4c1900e6SMatthias Ringwald // GAP Service and Characteristics 830*4c1900e6SMatthias Ringwald #define GAP_SERVICE_UUID 0x1800 831*4c1900e6SMatthias Ringwald #define GAP_DEVICE_NAME_UUID 0x2a00 832*4c1900e6SMatthias Ringwald #define GAP_APPEARANCE_UUID 0x2a01 833*4c1900e6SMatthias Ringwald #define GAP_PERIPHERAL_PRIVACY_FLAG 0x2a02 834*4c1900e6SMatthias Ringwald #define GAP_RECONNECTION_ADDRESS_UUID 0x2a03 835*4c1900e6SMatthias Ringwald #define GAP_PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS_UUID 0x2a04 836*4c1900e6SMatthias Ringwald 837*4c1900e6SMatthias Ringwald /** 838*4c1900e6SMatthias Ringwald * SM - LE Security Manager 839*4c1900e6SMatthias Ringwald */ 840*4c1900e6SMatthias Ringwald // Bluetooth Spec definitions 841*4c1900e6SMatthias Ringwald typedef enum { 842*4c1900e6SMatthias Ringwald SM_CODE_PAIRING_REQUEST = 0X01, 843*4c1900e6SMatthias Ringwald SM_CODE_PAIRING_RESPONSE, 844*4c1900e6SMatthias Ringwald SM_CODE_PAIRING_CONFIRM, 845*4c1900e6SMatthias Ringwald SM_CODE_PAIRING_RANDOM, 846*4c1900e6SMatthias Ringwald SM_CODE_PAIRING_FAILED, 847*4c1900e6SMatthias Ringwald SM_CODE_ENCRYPTION_INFORMATION, 848*4c1900e6SMatthias Ringwald SM_CODE_MASTER_IDENTIFICATION, 849*4c1900e6SMatthias Ringwald SM_CODE_IDENTITY_INFORMATION, 850*4c1900e6SMatthias Ringwald SM_CODE_IDENTITY_ADDRESS_INFORMATION, 851*4c1900e6SMatthias Ringwald SM_CODE_SIGNING_INFORMATION, 852*4c1900e6SMatthias Ringwald SM_CODE_SECURITY_REQUEST 853*4c1900e6SMatthias Ringwald } SECURITY_MANAGER_COMMANDS; 854*4c1900e6SMatthias Ringwald 855*4c1900e6SMatthias Ringwald // IO Capability Values 856*4c1900e6SMatthias Ringwald typedef enum { 857*4c1900e6SMatthias Ringwald IO_CAPABILITY_DISPLAY_ONLY = 0, 858*4c1900e6SMatthias Ringwald IO_CAPABILITY_DISPLAY_YES_NO, 859*4c1900e6SMatthias Ringwald IO_CAPABILITY_KEYBOARD_ONLY, 860*4c1900e6SMatthias Ringwald IO_CAPABILITY_NO_INPUT_NO_OUTPUT, 861*4c1900e6SMatthias Ringwald IO_CAPABILITY_KEYBOARD_DISPLAY, // not used by secure simple pairing 862*4c1900e6SMatthias Ringwald } io_capability_t; 863*4c1900e6SMatthias Ringwald 864*4c1900e6SMatthias Ringwald // Authentication requirement flags 865*4c1900e6SMatthias Ringwald #define SM_AUTHREQ_NO_BONDING 0x00 866*4c1900e6SMatthias Ringwald #define SM_AUTHREQ_BONDING 0x01 867*4c1900e6SMatthias Ringwald #define SM_AUTHREQ_MITM_PROTECTION 0x04 868*4c1900e6SMatthias Ringwald 869*4c1900e6SMatthias Ringwald // Key distribution flags used by spec 870*4c1900e6SMatthias Ringwald #define SM_KEYDIST_ENC_KEY 0X01 871*4c1900e6SMatthias Ringwald #define SM_KEYDIST_ID_KEY 0x02 872*4c1900e6SMatthias Ringwald #define SM_KEYDIST_SIGN 0x04 873*4c1900e6SMatthias Ringwald 874*4c1900e6SMatthias Ringwald // Key distribution flags used internally 875*4c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_ENCRYPTION_INFORMATION 0x01 876*4c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_MASTER_IDENTIFICATION 0x02 877*4c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_IDENTITY_INFORMATION 0x04 878*4c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_IDENTITY_ADDRESS_INFORMATION 0x08 879*4c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_SIGNING_IDENTIFICATION 0x10 880*4c1900e6SMatthias Ringwald 881*4c1900e6SMatthias Ringwald // STK Generation Methods 882*4c1900e6SMatthias Ringwald #define SM_STK_GENERATION_METHOD_JUST_WORKS 0x01 883*4c1900e6SMatthias Ringwald #define SM_STK_GENERATION_METHOD_OOB 0x02 884*4c1900e6SMatthias Ringwald #define SM_STK_GENERATION_METHOD_PASSKEY 0x04 885*4c1900e6SMatthias Ringwald 886*4c1900e6SMatthias Ringwald // Pairing Failed Reasons 887*4c1900e6SMatthias Ringwald #define SM_REASON_RESERVED 0x00 888*4c1900e6SMatthias Ringwald #define SM_REASON_PASSKEYT_ENTRY_FAILED 0x01 889*4c1900e6SMatthias Ringwald #define SM_REASON_OOB_NOT_AVAILABLE 0x02 890*4c1900e6SMatthias Ringwald #define SM_REASON_AUTHENTHICATION_REQUIREMENTS 0x03 891*4c1900e6SMatthias Ringwald #define SM_REASON_CONFIRM_VALUE_FAILED 0x04 892*4c1900e6SMatthias Ringwald #define SM_REASON_PAIRING_NOT_SUPPORTED 0x05 893*4c1900e6SMatthias Ringwald #define SM_REASON_ENCRYPTION_KEY_SIZE 0x06 894*4c1900e6SMatthias Ringwald #define SM_REASON_COMMAND_NOT_SUPPORTED 0x07 895*4c1900e6SMatthias Ringwald #define SM_REASON_UNSPECIFIED_REASON 0x08 896*4c1900e6SMatthias Ringwald #define SM_REASON_REPEATED_ATTEMPTS 0x09 897*4c1900e6SMatthias Ringwald // also, invalid parameters 898*4c1900e6SMatthias Ringwald // and reserved 899*4c1900e6SMatthias Ringwald 900*4c1900e6SMatthias Ringwald 90147f4e325SMatthias Ringwald #endif