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 232fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 242fca4dadSMilanka Ringwald * GMBH 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 4480e33422SMatthias Ringwald #ifndef BLUETOOTH_H 4580e33422SMatthias Ringwald #define BLUETOOTH_H 4647f4e325SMatthias Ringwald 4747f4e325SMatthias Ringwald #include <stdint.h> 4847f4e325SMatthias Ringwald 4947f4e325SMatthias Ringwald /** 508974fcd6SMatthias Ringwald * @brief hci connection handle type 518974fcd6SMatthias Ringwald */ 528974fcd6SMatthias Ringwald typedef uint16_t hci_con_handle_t; 538974fcd6SMatthias Ringwald 548974fcd6SMatthias Ringwald /** 558974fcd6SMatthias Ringwald * @brief Length of a bluetooth device address. 568974fcd6SMatthias Ringwald */ 578974fcd6SMatthias Ringwald #define BD_ADDR_LEN 6 588974fcd6SMatthias Ringwald 598974fcd6SMatthias Ringwald /** 608974fcd6SMatthias Ringwald * @brief Bluetooth address 618974fcd6SMatthias Ringwald */ 628974fcd6SMatthias Ringwald typedef uint8_t bd_addr_t[BD_ADDR_LEN]; 638974fcd6SMatthias Ringwald 648974fcd6SMatthias Ringwald /** 658974fcd6SMatthias Ringwald * Address types 668974fcd6SMatthias Ringwald * @note: BTstack uses a custom addr type to refer to classic ACL and SCO devices 678974fcd6SMatthias Ringwald */ 688974fcd6SMatthias Ringwald typedef enum { 698974fcd6SMatthias Ringwald BD_ADDR_TYPE_LE_PUBLIC = 0, 708974fcd6SMatthias Ringwald BD_ADDR_TYPE_LE_RANDOM = 1, 71b95a5a35SMatthias Ringwald BD_ADDR_TYPE_LE_PRIVAT_FALLBACK_PUBLIC = 2, 72b95a5a35SMatthias Ringwald BD_ADDR_TYPE_LE_PRIVAT_FALLBACK_RANDOM = 3, 7312fd3a99SMatthias Ringwald BD_ADDR_TYPE_SCO = 0xfc, 7412fd3a99SMatthias Ringwald BD_ADDR_TYPE_ACL = 0xfd, 7512fd3a99SMatthias Ringwald BD_ADDR_TYPE_UNKNOWN = 0xfe, // also used as 'invalid' 768974fcd6SMatthias Ringwald } bd_addr_type_t; 778974fcd6SMatthias Ringwald 785e91d96cSMatthias Ringwald /** 795e91d96cSMatthias Ringwald * Link types for BR/EDR Connections 805e91d96cSMatthias Ringwald */ 815e91d96cSMatthias Ringwald typedef enum { 825e91d96cSMatthias Ringwald HCI_LINK_TYPE_SCO = 0, 835e91d96cSMatthias Ringwald HCI_LINK_TYPE_ACL = 1, 845e91d96cSMatthias Ringwald HCI_LINK_TYPE_ESCO = 2, 855e91d96cSMatthias Ringwald } hci_link_type_t; 86b95a5a35SMatthias Ringwald 87b95a5a35SMatthias Ringwald 888974fcd6SMatthias Ringwald /** 898974fcd6SMatthias Ringwald * @brief link key 908974fcd6SMatthias Ringwald */ 918974fcd6SMatthias Ringwald #define LINK_KEY_LEN 16 928974fcd6SMatthias Ringwald #define LINK_KEY_STR_LEN (LINK_KEY_LEN*2) 938974fcd6SMatthias Ringwald typedef uint8_t link_key_t[LINK_KEY_LEN]; 948974fcd6SMatthias Ringwald 958974fcd6SMatthias Ringwald /** 968974fcd6SMatthias Ringwald * @brief link key type 978974fcd6SMatthias Ringwald */ 988974fcd6SMatthias Ringwald typedef enum { 99e9f98c4aSMatthias Ringwald INVALID_LINK_KEY = 0xffff, 1008974fcd6SMatthias Ringwald COMBINATION_KEY = 0, // standard pairing 1018974fcd6SMatthias Ringwald LOCAL_UNIT_KEY, // ? 1028974fcd6SMatthias Ringwald REMOTE_UNIT_KEY, // ? 1038974fcd6SMatthias Ringwald DEBUG_COMBINATION_KEY, // SSP with debug 1048974fcd6SMatthias Ringwald UNAUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P192, // SSP Simple Pairing 1058974fcd6SMatthias Ringwald AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P192, // SSP Passkey, Number confirm, OOB 1068974fcd6SMatthias Ringwald CHANGED_COMBINATION_KEY, // Link key changed using Change Connection Lnk Key 1078974fcd6SMatthias Ringwald UNAUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P256, // SSP Simpe Pairing 1088974fcd6SMatthias Ringwald AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P256, // SSP Passkey, Number confirm, OOB 1098974fcd6SMatthias Ringwald } link_key_type_t; 1108974fcd6SMatthias Ringwald 1118974fcd6SMatthias Ringwald /** 112a8c4e5adSMatthias Ringwald * @brief Extended Inquiry Response 113a8c4e5adSMatthias Ringwald */ 114a8c4e5adSMatthias Ringwald #define EXTENDED_INQUIRY_RESPONSE_DATA_LEN 240 115a8c4e5adSMatthias Ringwald 116a8c4e5adSMatthias Ringwald /** 117f6858d14SMatthias Ringwald * @brief Inquiry modes 118f6858d14SMatthias Ringwald */ 119f6858d14SMatthias Ringwald typedef enum { 120f6858d14SMatthias Ringwald INQUIRY_MODE_STANDARD = 0, 121f6858d14SMatthias Ringwald INQUIRY_MODE_RSSI, 122f6858d14SMatthias Ringwald INQUIRY_MODE_RSSI_AND_EIR, 123f6858d14SMatthias Ringwald } inquiry_mode_t; 124f6858d14SMatthias Ringwald 125a29d7266SMatthias Ringwald /** 126a29d7266SMatthias Ringwald * @brief Page Scan Types 127a29d7266SMatthias Ringwald */ 128a29d7266SMatthias Ringwald typedef enum { 129a29d7266SMatthias Ringwald PAGE_SCAN_MODE_STANDARD = 0, 130a29d7266SMatthias Ringwald PAGE_SCAN_MODE_INTERLACED, 131a29d7266SMatthias Ringwald } page_scan_type_t; 132a29d7266SMatthias Ringwald 133a29d7266SMatthias Ringwald /** 134a29d7266SMatthias Ringwald * @brief Inquiry Scan Types 135a29d7266SMatthias Ringwald */ 136a29d7266SMatthias Ringwald typedef enum { 137a29d7266SMatthias Ringwald INQUIRY_SCAN_MODE_STANDARD = 0, 138a29d7266SMatthias Ringwald INQUIRY_SCAN_MODE_INTERLACED, 139a29d7266SMatthias Ringwald } inquiry_scan_type_t; 14085ddcd84SMatthias Ringwald 141671fb338SMatthias Ringwald /** 142d821984bSMatthias Ringwald * Link Supervision Timeout Default, 0x7d00 * 0.625ms = 20s 143d821984bSMatthias Ringwald */ 144d821984bSMatthias Ringwald #define HCI_LINK_SUPERVISION_TIMEOUT_DEFAULT 0x7D00 145d821984bSMatthias Ringwald 146d821984bSMatthias Ringwald /** 147278ff8a9SMatthias Ringwald * Service Type used for QoS Setup and Flow Specification 148278ff8a9SMatthias Ringwald */ 149278ff8a9SMatthias Ringwald typedef enum { 150278ff8a9SMatthias Ringwald HCI_SERVICE_TYPE_NO_TRAFFIC = 0, 151278ff8a9SMatthias Ringwald HCI_SERVICE_TYPE_BEST_EFFORT, 152278ff8a9SMatthias Ringwald HCI_SERVICE_TYPE_GUARANTEED, 153965a4ccfSMatthias Ringwald HCI_SERVICE_TYPE_INVALID, 154278ff8a9SMatthias Ringwald } hci_service_type_t; 155278ff8a9SMatthias Ringwald 156278ff8a9SMatthias Ringwald /** 15747f4e325SMatthias Ringwald * HCI Transport 15847f4e325SMatthias Ringwald */ 15947f4e325SMatthias Ringwald 16047f4e325SMatthias Ringwald /** 16147f4e325SMatthias Ringwald * packet types - used in BTstack and over the H4 UART interface 16247f4e325SMatthias Ringwald */ 16347f4e325SMatthias Ringwald #define HCI_COMMAND_DATA_PACKET 0x01 16447f4e325SMatthias Ringwald #define HCI_ACL_DATA_PACKET 0x02 16547f4e325SMatthias Ringwald #define HCI_SCO_DATA_PACKET 0x03 16647f4e325SMatthias Ringwald #define HCI_EVENT_PACKET 0x04 1670d5b1bafSMatthias Ringwald #define HCI_ISO_DATA_PACKET 0x05 16847f4e325SMatthias Ringwald 16947f4e325SMatthias Ringwald /** 170*99617827SMatthias Ringwald * Other assigned numbers, Assigned_Numbers_Host Controller Interface.pdf 171*99617827SMatthias Ringwald */ 172*99617827SMatthias Ringwald 173*99617827SMatthias Ringwald typedef enum { 174*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_U_LAW_LOG = 0x00, 175*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_A_LAW_LOG, 176*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_CVSD, 177*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_TRANSPARENT, // Indicates that the controller does not do any transcoding or resampling. This is also used for test mode. 178*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_LINEAR_PCM, 179*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_MSBC, 180*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_LC3, 181*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_G_729A, 182*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_RFU, 183*99617827SMatthias Ringwald HCI_AUDIO_CODING_FORMAT_VENDOR_SPECIFIC = 0xFF 184*99617827SMatthias Ringwald } hci_audio_coding_format_t; 185*99617827SMatthias Ringwald 186*99617827SMatthias Ringwald /** 18747f4e325SMatthias Ringwald * HCI Layer 18847f4e325SMatthias Ringwald */ 18947f4e325SMatthias Ringwald 19047f4e325SMatthias Ringwald // 191f193890fSMatthias Ringwald // Error Codes rfom Bluetooth Core Specification 19247f4e325SMatthias Ringwald // 19347f4e325SMatthias Ringwald 194f193890fSMatthias Ringwald /* ENUM_START: BLUETOOTH_ERROR_CODE */ 195616edd56SMatthias Ringwald #define ERROR_CODE_SUCCESS 0x00 19647f4e325SMatthias Ringwald #define ERROR_CODE_UNKNOWN_HCI_COMMAND 0x01 19747f4e325SMatthias Ringwald #define ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER 0x02 19847f4e325SMatthias Ringwald #define ERROR_CODE_HARDWARE_FAILURE 0x03 19947f4e325SMatthias Ringwald #define ERROR_CODE_PAGE_TIMEOUT 0x04 20047f4e325SMatthias Ringwald #define ERROR_CODE_AUTHENTICATION_FAILURE 0x05 20147f4e325SMatthias Ringwald #define ERROR_CODE_PIN_OR_KEY_MISSING 0x06 20247f4e325SMatthias Ringwald #define ERROR_CODE_MEMORY_CAPACITY_EXCEEDED 0x07 20347f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_TIMEOUT 0x08 20447f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_LIMIT_EXCEEDED 0x09 20547f4e325SMatthias Ringwald #define ERROR_CODE_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED 0x0A 20647f4e325SMatthias Ringwald #define ERROR_CODE_ACL_CONNECTION_ALREADY_EXISTS 0x0B 20747f4e325SMatthias Ringwald #define ERROR_CODE_COMMAND_DISALLOWED 0x0C 20847f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES 0x0D 20947f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS 0x0E 21047f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR 0x0F 21147f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED 0x10 21247f4e325SMatthias Ringwald #define ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE 0x11 21347f4e325SMatthias Ringwald #define ERROR_CODE_INVALID_HCI_COMMAND_PARAMETERS 0x12 21447f4e325SMatthias Ringwald #define ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION 0x13 21547f4e325SMatthias Ringwald #define ERROR_CODE_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES 0x14 21647f4e325SMatthias Ringwald #define ERROR_CODE_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF 0x15 21747f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST 0x16 21847f4e325SMatthias Ringwald #define ERROR_CODE_REPEATED_ATTEMPTS 0x17 21947f4e325SMatthias Ringwald #define ERROR_CODE_PAIRING_NOT_ALLOWED 0x18 22047f4e325SMatthias Ringwald #define ERROR_CODE_UNKNOWN_LMP_PDU 0x19 22147f4e325SMatthias Ringwald #define ERROR_CODE_UNSUPPORTED_REMOTE_FEATURE_UNSUPPORTED_LMP_FEATURE 0x1A 22247f4e325SMatthias Ringwald #define ERROR_CODE_SCO_OFFSET_REJECTED 0x1B 22347f4e325SMatthias Ringwald #define ERROR_CODE_SCO_INTERVAL_REJECTED 0x1C 22447f4e325SMatthias Ringwald #define ERROR_CODE_SCO_AIR_MODE_REJECTED 0x1D 22547f4e325SMatthias Ringwald #define ERROR_CODE_INVALID_LMP_PARAMETERS_INVALID_LL_PARAMETERS 0x1E 22647f4e325SMatthias Ringwald #define ERROR_CODE_UNSPECIFIED_ERROR 0x1F 22747f4e325SMatthias Ringwald #define ERROR_CODE_UNSUPPORTED_LMP_PARAMETER_VALUE_UNSUPPORTED_LL_PARAMETER_VALUE 0x20 22847f4e325SMatthias Ringwald #define ERROR_CODE_ROLE_CHANGE_NOT_ALLOWED 0x21 22947f4e325SMatthias Ringwald #define ERROR_CODE_LMP_RESPONSE_TIMEOUT_LL_RESPONSE_TIMEOUT 0x22 23047f4e325SMatthias Ringwald #define ERROR_CODE_LMP_ERROR_TRANSACTION_COLLISION 0x23 23147f4e325SMatthias Ringwald #define ERROR_CODE_LMP_PDU_NOT_ALLOWED 0x24 23247f4e325SMatthias Ringwald #define ERROR_CODE_ENCRYPTION_MODE_NOT_ACCEPTABLE 0x25 23347f4e325SMatthias Ringwald #define ERROR_CODE_LINK_KEY_CANNOT_BE_CHANGED 0x26 23447f4e325SMatthias Ringwald #define ERROR_CODE_REQUESTED_QOS_NOT_SUPPORTED 0x27 23547f4e325SMatthias Ringwald #define ERROR_CODE_INSTANT_PASSED 0x28 23647f4e325SMatthias Ringwald #define ERROR_CODE_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29 23747f4e325SMatthias Ringwald #define ERROR_CODE_DIFFERENT_TRANSACTION_COLLISION 0x2A 23847f4e325SMatthias Ringwald #define ERROR_CODE_RESERVED 0x2B 23947f4e325SMatthias Ringwald #define ERROR_CODE_QOS_UNACCEPTABLE_PARAMETER 0x2C 24047f4e325SMatthias Ringwald #define ERROR_CODE_QOS_REJECTED 0x2D 24147f4e325SMatthias Ringwald #define ERROR_CODE_CHANNEL_CLASSIFICATION_NOT_SUPPORTED 0x2E 24247f4e325SMatthias Ringwald #define ERROR_CODE_INSUFFICIENT_SECURITY 0x2F 24347f4e325SMatthias Ringwald #define ERROR_CODE_PARAMETER_OUT_OF_MANDATORY_RANGE 0x30 24447f4e325SMatthias Ringwald // #define ERROR_CODE_RESERVED 24547f4e325SMatthias Ringwald #define ERROR_CODE_ROLE_SWITCH_PENDING 0x32 24647f4e325SMatthias Ringwald // #define ERROR_CODE_RESERVED 24747f4e325SMatthias Ringwald #define ERROR_CODE_RESERVED_SLOT_VIOLATION 0x34 24847f4e325SMatthias Ringwald #define ERROR_CODE_ROLE_SWITCH_FAILED 0x35 24947f4e325SMatthias Ringwald #define ERROR_CODE_EXTENDED_INQUIRY_RESPONSE_TOO_LARGE 0x36 25047f4e325SMatthias Ringwald #define ERROR_CODE_SECURE_SIMPLE_PAIRING_NOT_SUPPORTED_BY_HOST 0x37 25147f4e325SMatthias Ringwald #define ERROR_CODE_HOST_BUSY_PAIRING 0x38 25247f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND 0x39 25347f4e325SMatthias Ringwald #define ERROR_CODE_CONTROLLER_BUSY 0x3A 25447f4e325SMatthias Ringwald #define ERROR_CODE_UNACCEPTABLE_CONNECTION_PARAMETERS 0x3B 25547f4e325SMatthias Ringwald #define ERROR_CODE_DIRECTED_ADVERTISING_TIMEOUT 0x3C 25647f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3D 25747f4e325SMatthias Ringwald #define ERROR_CODE_CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3E 25847f4e325SMatthias Ringwald #define ERROR_CODE_MAC_CONNECTION_FAILED 0x3F 25947f4e325SMatthias Ringwald #define ERROR_CODE_COARSE_CLOCK_ADJUSTMENT_REJECTED_BUT_WILL_TRY_TO_ADJUST_USING_CLOCK_DRAGGING 0x40 26096c69d4aSMilanka Ringwald 26196c69d4aSMilanka Ringwald // BTstack defined ERRORS, mapped into BLuetooth status code range 26296c69d4aSMilanka Ringwald 26396c69d4aSMilanka Ringwald #define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED 0x50 26496c69d4aSMilanka Ringwald #define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH 0x51 26596c69d4aSMilanka Ringwald #define BTSTACK_ACTIVATION_POWERON_FAILED 0x52 26696c69d4aSMilanka Ringwald #define BTSTACK_ACTIVATION_FAILED_UNKNOWN 0x53 26796c69d4aSMilanka Ringwald #define BTSTACK_NOT_ACTIVATED 0x54 26896c69d4aSMilanka Ringwald #define BTSTACK_BUSY 0x55 26996c69d4aSMilanka Ringwald #define BTSTACK_MEMORY_ALLOC_FAILED 0x56 27096c69d4aSMilanka Ringwald #define BTSTACK_ACL_BUFFERS_FULL 0x57 27196c69d4aSMilanka Ringwald 27296c69d4aSMilanka Ringwald // l2cap errors - enumeration by the command that created them 27396c69d4aSMilanka Ringwald #define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60 27496c69d4aSMilanka Ringwald #define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61 27596c69d4aSMilanka Ringwald #define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62 27696c69d4aSMilanka Ringwald 27796c69d4aSMilanka Ringwald #define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL 0x63 27896c69d4aSMilanka Ringwald #define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING 0x64 27996c69d4aSMilanka Ringwald #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM 0x65 28096c69d4aSMilanka Ringwald #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY 0x66 28196c69d4aSMilanka Ringwald #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x67 28296c69d4aSMilanka Ringwald #define L2CAP_CONNECTION_RESPONSE_RESULT_ERTM_NOT_SUPPORTED 0x68 28396c69d4aSMilanka Ringwald 28496c69d4aSMilanka Ringwald // should be L2CAP_CONNECTION_RTX_TIMEOUT 28596c69d4aSMilanka Ringwald #define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT 0x69 28696c69d4aSMilanka Ringwald #define L2CAP_CONNECTION_BASEBAND_DISCONNECT 0x6A 28796c69d4aSMilanka Ringwald #define L2CAP_SERVICE_ALREADY_REGISTERED 0x6B 28896c69d4aSMilanka Ringwald #define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU 0x6C 28996c69d4aSMilanka Ringwald #define L2CAP_SERVICE_DOES_NOT_EXIST 0x6D 29096c69d4aSMilanka Ringwald #define L2CAP_LOCAL_CID_DOES_NOT_EXIST 0x6E 291198ba16fSMatthias Ringwald #define L2CAP_CONNECTION_RESPONSE_UNKNOWN_ERROR 0x6F 29296c69d4aSMilanka Ringwald 29396c69d4aSMilanka Ringwald #define RFCOMM_MULTIPLEXER_STOPPED 0x70 29496c69d4aSMilanka Ringwald #define RFCOMM_CHANNEL_ALREADY_REGISTERED 0x71 29596c69d4aSMilanka Ringwald #define RFCOMM_NO_OUTGOING_CREDITS 0x72 29696c69d4aSMilanka Ringwald #define RFCOMM_AGGREGATE_FLOW_OFF 0x73 29796c69d4aSMilanka Ringwald #define RFCOMM_DATA_LEN_EXCEEDS_MTU 0x74 29896c69d4aSMilanka Ringwald 299c06a442eSMilanka Ringwald #define HFP_REMOTE_REJECTS_AUDIO_CONNECTION 0x7F 300c06a442eSMilanka Ringwald 30196c69d4aSMilanka Ringwald #define SDP_HANDLE_ALREADY_REGISTERED 0x80 30296c69d4aSMilanka Ringwald #define SDP_QUERY_INCOMPLETE 0x81 30396c69d4aSMilanka Ringwald #define SDP_SERVICE_NOT_FOUND 0x82 30496c69d4aSMilanka Ringwald #define SDP_HANDLE_INVALID 0x83 30596c69d4aSMilanka Ringwald #define SDP_QUERY_BUSY 0x84 30696c69d4aSMilanka Ringwald 30796c69d4aSMilanka Ringwald #define ATT_HANDLE_VALUE_INDICATION_IN_PROGRESS 0x90 30896c69d4aSMilanka Ringwald #define ATT_HANDLE_VALUE_INDICATION_TIMEOUT 0x91 30996c69d4aSMilanka Ringwald #define ATT_HANDLE_VALUE_INDICATION_DISCONNECT 0x92 31096c69d4aSMilanka Ringwald 31196c69d4aSMilanka Ringwald #define GATT_CLIENT_NOT_CONNECTED 0x93 31296c69d4aSMilanka Ringwald #define GATT_CLIENT_BUSY 0x94 31396c69d4aSMilanka Ringwald #define GATT_CLIENT_IN_WRONG_STATE 0x95 31496c69d4aSMilanka Ringwald #define GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS 0x96 31596c69d4aSMilanka Ringwald #define GATT_CLIENT_VALUE_TOO_LONG 0x97 31696c69d4aSMilanka Ringwald #define GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED 0x98 31796c69d4aSMilanka Ringwald #define GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED 0x99 31896c69d4aSMilanka Ringwald 31996c69d4aSMilanka Ringwald #define BNEP_SERVICE_ALREADY_REGISTERED 0xA0 32096c69d4aSMilanka Ringwald #define BNEP_CHANNEL_NOT_CONNECTED 0xA1 32196c69d4aSMilanka Ringwald #define BNEP_DATA_LEN_EXCEEDS_MTU 0xA2 32296c69d4aSMilanka Ringwald 32396c69d4aSMilanka Ringwald // OBEX ERRORS 32496c69d4aSMilanka Ringwald #define OBEX_UNKNOWN_ERROR 0xB0 32596c69d4aSMilanka Ringwald #define OBEX_CONNECT_FAILED 0xB1 32696c69d4aSMilanka Ringwald #define OBEX_DISCONNECTED 0xB2 32796c69d4aSMilanka Ringwald #define OBEX_NOT_FOUND 0xB3 32896c69d4aSMilanka Ringwald #define OBEX_NOT_ACCEPTABLE 0xB4 329fe7c8426SMatthias Ringwald #define OBEX_ABORTED 0xB5 33096c69d4aSMilanka Ringwald 33196c69d4aSMilanka Ringwald #define MESH_ERROR_APPKEY_INDEX_INVALID 0xD0 332f193890fSMatthias Ringwald /* ENUM_END */ 33347f4e325SMatthias Ringwald 33432272f12SMilanka Ringwald 335954cc391SMilanka Ringwald /* ENUM_START: AVRCP_BROWSING_ERROR_CODE */ 336954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_INVALID_COMMAND 0x00 // Sent if TG received a PDU that it did not understand. Valid for All. 337954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_INVALID_PARAMETER 0x01 // Sent if the TG received a PDU with a parameter ID that it did not understand. Sent if there is only one parameter ID in the PDU. Valid for All. 338954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_SPECIFIED_PARAMETER_NOT_FOUND 0x02 // Sent if the parameter ID is understood, but content is wrong or corrupted. Valid for All. 339954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_INTERNAL_ERROR 0x03 // Sent if there are error conditions not covered by a more specific error code. Valid for All. 340954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_SUCCESS 0x04 // This is the status that should be returned if the operation was successful. Valid for All except where the response CType is AV/C REJECTED. 341954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_UID_CHANGED 0x05 // The UIDs on the device have changed. Valid for All. 342954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_RESERVED_06 0x06 // Valid for All. 343954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_INVALID_DIRECTION 0x07 // The Direction parameter is invalid. Valid for Change Path. 344954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_NOT_A_DIRECTORY 0x08 // The UID provided does not refer to a folder item. Valid for Change Path. 345954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_DOES_NOT_EXIST 0x09 // The UID provided does not refer to any currently valid. Valid for Change Path, PlayItem, AddToNowPlaying, GetItemAttributes. 346954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_INVALID_SCOPE 0x0a // The scope parameter is invalid. Valid for GetFolderItems, PlayItem, AddToNowPlayer, GetItemAttributes,. 347954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_RANGE_OUT_OF_BOUNDS 0x0b // The start of range provided is not valid. Valid for GetFolderItems. 348954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_UID_IS_A_DIRECTORY 0x0c // The UID provided refers to a directory, which cannot be handled by this media player. Valid for PlayItem, AddToNowPlaying. 349954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_MEDIA_IN_USES 0x0d // The media is not able to be used for this operation at this time. Valid for PlayItem, AddToNowPlaying. 350954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_NOW_PLAYING_LIST_FULL 0x0e // No more items can be added to the Now Playing List. Valid for AddToNowPlaying. 351954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_SEARCH_NOT_SUPPORTED 0x0f // The Browsed Media Player does not support search. Valid for Search. 352954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_SEARCH_IN_PROGRESS 0x10 // A search operation is already in progress. Valid for Search. 353954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_INVALID_PLAYER_ID 0x11 // The specified Player Id does not refer to a valid player. Valid for SetAddressedPlayer, SetBrowsedPlayer. 354954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_PLAYER_NOT_BROWSABLE 0x12 // The Player Id supplied refers to a Media Player which does not support browsing. Valid for SetBrowsedPlayer. 355954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_PLAYER_NOT_ADDRESSED 0x13 // The Player Id supplied refers to a player which is not currently addressed, and the command is not able to be performed if the player is not set as addressed. Valid for Search SetBrowsedPlayer. 356954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_NO_VALID_SEARCH_RESULTS 0x14 // The Search result list does not contain valid entries, e.g. after being invalidated due to change of browsed player. Valid for GetFolderItems. 357954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_NO_AVAILABLE_PLAYERS 0x15 // Valid for All. 358954cc391SMilanka Ringwald #define AVRCP_BROWSING_ERROR_CODE_ADDRESSED_PLAYER_CHANGED 0x16 // Valid for Register Notification. 359954cc391SMilanka Ringwald // 0x17-0xff Reserved 360954cc391SMilanka Ringwald /* ENUM_END */ 361954cc391SMilanka Ringwald 3628799c043SMatthias Ringwald // HCI roles 3632dceb1d6SMatthias Ringwald typedef enum { 3642dceb1d6SMatthias Ringwald HCI_ROLE_MASTER = 0, 3652dceb1d6SMatthias Ringwald HCI_ROLE_SLAVE = 1, 3662dceb1d6SMatthias Ringwald HCI_ROLE_INVALID = 0xff, 3672dceb1d6SMatthias Ringwald } hci_role_t; 3688799c043SMatthias Ringwald 3698799c043SMatthias Ringwald // packet sizes (max payload) 3708799c043SMatthias Ringwald #define HCI_ACL_DM1_SIZE 17 3718799c043SMatthias Ringwald #define HCI_ACL_DH1_SIZE 27 3728799c043SMatthias Ringwald #define HCI_ACL_2DH1_SIZE 54 3738799c043SMatthias Ringwald #define HCI_ACL_3DH1_SIZE 83 3748799c043SMatthias Ringwald #define HCI_ACL_DM3_SIZE 121 3758799c043SMatthias Ringwald #define HCI_ACL_DH3_SIZE 183 3768799c043SMatthias Ringwald #define HCI_ACL_DM5_SIZE 224 3778799c043SMatthias Ringwald #define HCI_ACL_DH5_SIZE 339 3788799c043SMatthias Ringwald #define HCI_ACL_2DH3_SIZE 367 3798799c043SMatthias Ringwald #define HCI_ACL_3DH3_SIZE 552 3808799c043SMatthias Ringwald #define HCI_ACL_2DH5_SIZE 679 3818799c043SMatthias Ringwald #define HCI_ACL_3DH5_SIZE 1021 3828799c043SMatthias Ringwald 3838799c043SMatthias Ringwald #define LE_ADVERTISING_DATA_SIZE 31 384d565a84bSMatthias Ringwald #define LE_EXTENDED_ADVERTISING_MAX_HANDLE 0xEFu 385d565a84bSMatthias Ringwald #define LE_EXTENDED_ADVERTISING_MAX_CHUNK_LEN 251 386d565a84bSMatthias Ringwald 387d565a84bSMatthias Ringwald // advertising event properties for extended advertising 388d565a84bSMatthias Ringwald #define LE_ADVERTISING_PROPERTIES_CONNECTABLE (1u<<0) 389d565a84bSMatthias Ringwald #define LE_ADVERTISING_PROPERTIES_SCANNABLE (1u<<1) 390d565a84bSMatthias Ringwald #define LE_ADVERTISING_PROPERTIES_DIRECTED (1u<<2) 391d565a84bSMatthias Ringwald #define LE_ADVERTISING_PROPERTIES_HIGH_DUTY_CYCLE (1u<<3) 392d565a84bSMatthias Ringwald #define LE_ADVERTISING_PROPERTIES_LEGACY (1u<<4) 393d565a84bSMatthias Ringwald #define LE_ADVERTISING_PROPERTIES_ANONYMOUS (1u<<5) 394d565a84bSMatthias Ringwald #define LE_ADVERTISING_PROPERTIES_INCLUDE_TX_POWER (1u<<6) 395d565a84bSMatthias Ringwald 39647f4e325SMatthias Ringwald 3973962dc20SMatthias Ringwald // SCO Packet Types 3983962dc20SMatthias Ringwald #define SCO_PACKET_TYPES_NONE 0x0000 3993962dc20SMatthias Ringwald #define SCO_PACKET_TYPES_HV1 0x0001 4003962dc20SMatthias Ringwald #define SCO_PACKET_TYPES_HV3 0x0004 4013962dc20SMatthias Ringwald #define SCO_PACKET_TYPES_EV3 0x0008 4023962dc20SMatthias Ringwald #define SCO_PACKET_TYPES_2EV3 0x0040 4033962dc20SMatthias Ringwald #define SCO_PACKET_TYPES_ALL 0x03FF 4043962dc20SMatthias Ringwald 405c33e56d3SMatthias Ringwald // Link Policy Settings 406c33e56d3SMatthias Ringwald #define LM_LINK_POLICY_DISABLE_ALL_LM_MODES 0 407c33e56d3SMatthias Ringwald #define LM_LINK_POLICY_ENABLE_ROLE_SWITCH 1 408c33e56d3SMatthias Ringwald #define LM_LINK_POLICY_ENABLE_HOLD_MODE 2 40964a93fb5SMatthias Ringwald #define LM_LINK_POLICY_ENABLE_SNIFF_MODE 4 410c33e56d3SMatthias Ringwald 41151fd61e9SMatthias Ringwald // ACL Connection Modes 41251fd61e9SMatthias Ringwald #define ACL_CONNECTION_MODE_ACTIVE 0 41351fd61e9SMatthias Ringwald #define ACL_CONNECTION_MODE_HOLD 1 41451fd61e9SMatthias Ringwald #define ACL_CONNECTION_MODE_SNIFF 2 41551fd61e9SMatthias Ringwald 41647f4e325SMatthias Ringwald /** 41747f4e325SMatthias Ringwald * Default INQ Mode 41847f4e325SMatthias Ringwald */ 4198aee7be2SMilanka Ringwald #define GAP_IAC_GENERAL_INQUIRY 0x9E8B33L // General/Unlimited Inquiry Access Code (GIAC) 4208aee7be2SMilanka Ringwald #define GAP_IAC_LIMITED_INQUIRY 0x9E8B00L // Limited Dedicated Inquiry Access Code (LIAC) 42147f4e325SMatthias Ringwald 42247f4e325SMatthias Ringwald /** 42347f4e325SMatthias Ringwald * SSP IO Capabilities 42447f4e325SMatthias Ringwald */ 42547f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_DISPLAY_ONLY 0 42647f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_DISPLAY_YES_NO 1 42747f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_KEYBOARD_ONLY 2 42847f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_NO_INPUT_NO_OUTPUT 3 42947f4e325SMatthias Ringwald #define SSP_IO_CAPABILITY_UNKNOWN 0xff 43047f4e325SMatthias Ringwald 43147f4e325SMatthias Ringwald 43247f4e325SMatthias Ringwald /** 43347f4e325SMatthias Ringwald * SSP Authentication Requirements, see IO Capability Request Reply Commmand 43447f4e325SMatthias Ringwald */ 43547f4e325SMatthias Ringwald 43647f4e325SMatthias Ringwald // Numeric comparison with automatic accept allowed. 43747f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_NO_BONDING 0x00 43847f4e325SMatthias Ringwald 43947f4e325SMatthias Ringwald // Use IO Capabilities to deter- mine authentication procedure 44047f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_NO_BONDING 0x01 44147f4e325SMatthias Ringwald 44247f4e325SMatthias Ringwald // Numeric compar- ison with automatic accept allowed. 44347f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING 0x02 44447f4e325SMatthias Ringwald 44547f4e325SMatthias Ringwald // Use IO Capabilities to determine authentication procedure 44647f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_DEDICATED_BONDING 0x03 44747f4e325SMatthias Ringwald 44847f4e325SMatthias Ringwald // Numeric Compari- son with automatic accept allowed. 44947f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_GENERAL_BONDING 0x04 45047f4e325SMatthias Ringwald 4518799c043SMatthias Ringwald // Use IO capabilities to determine authentication procedure. 45247f4e325SMatthias Ringwald #define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_GENERAL_BONDING 0x05 45347f4e325SMatthias Ringwald 45447f4e325SMatthias Ringwald 4558799c043SMatthias Ringwald // OGFs 4568799c043SMatthias Ringwald #define OGF_LINK_CONTROL 0x01 4578799c043SMatthias Ringwald #define OGF_LINK_POLICY 0x02 4588799c043SMatthias Ringwald #define OGF_CONTROLLER_BASEBAND 0x03 4598799c043SMatthias Ringwald #define OGF_INFORMATIONAL_PARAMETERS 0x04 4608799c043SMatthias Ringwald #define OGF_STATUS_PARAMETERS 0x05 4618799c043SMatthias Ringwald #define OGF_TESTING 0x06 4628799c043SMatthias Ringwald #define OGF_LE_CONTROLLER 0x08 4638799c043SMatthias Ringwald #define OGF_VENDOR 0x3f 4648799c043SMatthias Ringwald 4658799c043SMatthias Ringwald 46647f4e325SMatthias Ringwald 46747f4e325SMatthias Ringwald 46847f4e325SMatthias Ringwald /** 46947f4e325SMatthias Ringwald * L2CAP Layer 47047f4e325SMatthias Ringwald */ 47147f4e325SMatthias Ringwald 472a8373a41SMatthias Ringwald #define L2CAP_HEADER_SIZE 4 473a8373a41SMatthias Ringwald 474a8373a41SMatthias Ringwald // minimum signaling MTU 475a8373a41SMatthias Ringwald #define L2CAP_MINIMAL_MTU 48 476a8373a41SMatthias Ringwald #define L2CAP_DEFAULT_MTU 672 477a8373a41SMatthias Ringwald 478a8373a41SMatthias Ringwald // Minimum/default MTU 479a8373a41SMatthias Ringwald #define L2CAP_LE_DEFAULT_MTU 23 480a8373a41SMatthias Ringwald 481a8373a41SMatthias Ringwald // L2CAP Fixed Channel IDs 482a8373a41SMatthias Ringwald #define L2CAP_CID_SIGNALING 0x0001 483a8373a41SMatthias Ringwald #define L2CAP_CID_CONNECTIONLESS_CHANNEL 0x0002 484a8373a41SMatthias Ringwald #define L2CAP_CID_ATTRIBUTE_PROTOCOL 0x0004 485a8373a41SMatthias Ringwald #define L2CAP_CID_SIGNALING_LE 0x0005 486a8373a41SMatthias Ringwald #define L2CAP_CID_SECURITY_MANAGER_PROTOCOL 0x0006 4874e65ea07SMatthias Ringwald #define L2CAP_CID_BR_EDR_SECURITY_MANAGER 0x0007 488198ba16fSMatthias Ringwald 489d8c69877SMatthias Ringwald // L2CAP Channels in Basic and Enhanced Retransmission Mode 4908dc9980fSMatthias Ringwald 4918dc9980fSMatthias Ringwald // connection response result 4928dc9980fSMatthias Ringwald #define L2CAP_CONNECTION_RESULT_SUCCESS 0x0000 4938dc9980fSMatthias Ringwald #define L2CAP_CONNECTION_RESULT_PENDING 0x0001 4948dc9980fSMatthias Ringwald #define L2CAP_CONNECTION_RESULT_PSM_NOT_SUPPORTED 0x0002 4958dc9980fSMatthias Ringwald #define L2CAP_CONNECTION_RESULT_SECURITY_BLOCK 0x0003 4968dc9980fSMatthias Ringwald #define L2CAP_CONNECTION_RESULT_NO_RESOURCES_AVAILABLE 0x0004 4978dc9980fSMatthias Ringwald #define L2CAP_CONNECTION_RESULT_INVALID_SOURCE_CID 0x0006 4988dc9980fSMatthias Ringwald #define L2CAP_CONNECTION_RESULT_SOURCE_CID_ALREADY_ALLOCATED 0x0007 4998dc9980fSMatthias Ringwald 5008dc9980fSMatthias Ringwald // L2CAP Channels in LE Credit-Based Flow-Control Mode 5018dc9980fSMatthias Ringwald 5028dc9980fSMatthias Ringwald // connection response result 5038dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_SUCCESS 0x0000 5048dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_SPSM_NOT_SUPPORTED 0x0002 5058dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_NO_RESOURCES_AVAILABLE 0x0004 5068dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_INSUFFICIENT_AUTHENTICATION 0x0005 5078dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_INSUFFICIENT_AUTHORIZATION 0x0006 5088dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_ENCYRPTION_KEY_SIZE_TOO_SHORT 0x0007 5098dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_INSUFFICIENT_ENCRYPTION 0x0008 5108dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_INVALID_SOURCE_CID 0x0009 5118dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_SOURCE_CID_ALREADY_ALLOCATED 0x000A 5128dc9980fSMatthias Ringwald #define L2CAP_CBM_CONNECTION_RESULT_UNACCEPTABLE_PARAMETERS 0x000B 5138dc9980fSMatthias Ringwald 5148dc9980fSMatthias Ringwald 5158dc9980fSMatthias Ringwald // L2CAP Channels in Enhanced Credit-Based Flow-Control Mode 516198ba16fSMatthias Ringwald 517198ba16fSMatthias Ringwald // number of CIDs in single connection+reconfiguration request/response 518bbb517b6SMatthias Ringwald #define L2CAP_ECBM_MAX_CID_ARRAY_SIZE 5 519198ba16fSMatthias Ringwald 5208dc9980fSMatthias Ringwald // connection response result 5218dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_SUCCESS 0x0000 5228dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_REFUSED_SPSM_NOT_SUPPORTED 0x0002 5238dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_SOME_REFUSED_INSUFFICIENT_RESOURCES_AVAILABLE 0x0004 5248dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_REFUSED_INSUFFICIENT_AUTHENTICATION 0x0005 5258dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_REFUSED_INSUFFICIENT_AUTHORIZATION 0x0006 5268dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_REFUSED_ENCYRPTION_KEY_SIZE_TOO_SHORT 0x0007 5278dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_REFUSED_INSUFFICIENT_ENCRYPTION 0x0008 5288dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_SOME_REFUSED_INVALID_SOURCE_CID 0x0009 5298dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_SOME_REFUSED_SOURCE_CID_ALREADY_ALOCATED 0x000A 5308dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_REFUSED_UNACCEPTABLE_PARAMETERS 0x000B 5318dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_REFUSED_INVALID_PARAMETERS 0x000C 5328dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_PENDING_NO_FURTHER_INFORMATION 0x000D 5338dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_PENDING_AUTHENTICATION 0x000E 5348dc9980fSMatthias Ringwald #define L2CAP_ECBM_CONNECTION_RESULT_ALL_PENDING_AUTHORIZATION 0x000F 5358dc9980fSMatthias Ringwald 5368dc9980fSMatthias Ringwald 537198ba16fSMatthias Ringwald // Result for Reconfigure Request 5388dc9980fSMatthias Ringwald #define L2CAP_ECBM_RECONFIGURE_SUCCESS 0 5398dc9980fSMatthias Ringwald #define L2CAP_ECBM_RECONFIGURE_FAILED_MTU_REDUCTION_NOT_ALLOWED 1 5408dc9980fSMatthias Ringwald #define L2CAP_ECBM_RECONFIGURE_FAILED_MPS_REDUCTION_MULTIPLE_CHANNELS 2 5418dc9980fSMatthias Ringwald #define L2CAP_ECBM_RECONFIGURE_FAILED_DESTINATION_CID_INVALID 3 5428dc9980fSMatthias Ringwald #define L2CAP_ECBM_RECONFIGURE_FAILED_UNACCEPTABLE_PARAMETERS 4 543198ba16fSMatthias Ringwald 54466b1fcb3SMatthias Ringwald /** 545235946f1SMatthias Ringwald * SDP Protocol 546ef907034SMatthias Ringwald */ 547ef907034SMatthias Ringwald 548c4b3290dSMatthias Ringwald // Device Vendor ID Sources 549c4b3290dSMatthias Ringwald #define DEVICE_ID_VENDOR_ID_SOURCE_BLUETOOTH 0x0001 550c4b3290dSMatthias Ringwald #define DEVICE_ID_VENDOR_ID_SOURCE_USB 0x0002 551c4b3290dSMatthias Ringwald 552ef907034SMatthias Ringwald // OBEX 553ef907034SMatthias Ringwald #define SDP_vCard_2_1 0x01 554ef907034SMatthias Ringwald #define SDP_vCard_3_0 0x02 555ef907034SMatthias Ringwald #define SDP_vCal_1_0 0x03 556ef907034SMatthias Ringwald #define SDP_iCal_2_0 0x04 557ef907034SMatthias Ringwald #define SDP_vNote 0x05 558ef907034SMatthias Ringwald #define SDP_vMessage 0x06 559ef907034SMatthias Ringwald #define SDP_OBEXFileTypeAny 0xFF 560ef907034SMatthias Ringwald 561ef907034SMatthias Ringwald /** 562e2577bd7SMatthias Ringwald * RFCOMM Protocol 563e2577bd7SMatthias Ringwald */ 564e2577bd7SMatthias Ringwald 565e2577bd7SMatthias Ringwald // Line Status 566e2577bd7SMatthias Ringwald #define LINE_STATUS_NO_ERROR 0x00 567e2577bd7SMatthias Ringwald #define LINE_STATUS_OVERRUN_ERROR 0x03 568e2577bd7SMatthias Ringwald #define LINE_STATUS_PARITY_ERORR 0x05 569e2577bd7SMatthias Ringwald #define LINE_STATUS_FRAMING_ERROR 0x09 570e2577bd7SMatthias Ringwald 571e2577bd7SMatthias Ringwald // Modem Status Flags 572e2577bd7SMatthias Ringwald #define MODEM_STATUS_FC 0x02 573e2577bd7SMatthias Ringwald #define MODEM_STATUS_RTC 0x04 574e2577bd7SMatthias Ringwald #define MODEM_STATUS_RTR 0x08 575e2577bd7SMatthias Ringwald #define MODEM_STATUS_IC 0x40 576e2577bd7SMatthias Ringwald #define MODEM_STATUS_DV 0x80 577e2577bd7SMatthias Ringwald 578e2577bd7SMatthias Ringwald typedef enum rpn_baud { 579e2577bd7SMatthias Ringwald RPN_BAUD_2400 = 0, 580e2577bd7SMatthias Ringwald RPN_BAUD_4800, 581e2577bd7SMatthias Ringwald RPN_BAUD_7200, 582e2577bd7SMatthias Ringwald RPN_BAUD_9600, 583e2577bd7SMatthias Ringwald RPN_BAUD_19200, 584e2577bd7SMatthias Ringwald RPN_BAUD_38400, 585e2577bd7SMatthias Ringwald RPN_BAUD_57600, 586e2577bd7SMatthias Ringwald RPN_BAUD_115200, 587e2577bd7SMatthias Ringwald RPN_BAUD_230400 588e2577bd7SMatthias Ringwald } rpn_baud_t; 589e2577bd7SMatthias Ringwald 590e2577bd7SMatthias Ringwald typedef enum rpn_data_bits { 591e2577bd7SMatthias Ringwald RPN_DATA_BITS_5 = 0, 592e2577bd7SMatthias Ringwald RPN_DATA_BITS_6 = 0, 593e2577bd7SMatthias Ringwald RPN_DATA_BITS_7 = 0, 594e2577bd7SMatthias Ringwald RPN_DATA_BITS_8 = 0 595e2577bd7SMatthias Ringwald } rpn_data_bits_t; 596e2577bd7SMatthias Ringwald 597e2577bd7SMatthias Ringwald typedef enum rpn_stop_bits { 598e2577bd7SMatthias Ringwald RPN_STOP_BITS_1_0 = 0, 599e2577bd7SMatthias Ringwald RPN_STOP_BITS_1_5 600e2577bd7SMatthias Ringwald } rpn_stop_bits_t; 601e2577bd7SMatthias Ringwald 602e2577bd7SMatthias Ringwald typedef enum rpn_parity { 603e2577bd7SMatthias Ringwald RPN_PARITY_NONE = 0, 604e2577bd7SMatthias Ringwald RPN_PARITY_ODD = 1, 605e2577bd7SMatthias Ringwald RPN_PARITY_EVEN = 3, 606e2577bd7SMatthias Ringwald RPN_PARITY_MARK = 5, 607e2577bd7SMatthias Ringwald RPN_PARITY_SPACE = 7, 608e2577bd7SMatthias Ringwald } rpn_parity_t; 609e2577bd7SMatthias Ringwald 610874776bfSMatthias Ringwald #define RPN_FLOW_CONTROL_XONXOFF_ON_INPUT 0x01 611874776bfSMatthias Ringwald #define RPN_FLOW_CONTROL_XONXOFF_ON_OUTPUT 0x02 612874776bfSMatthias Ringwald #define RPN_FLOW_CONTROL_RTR_ON_INPUT 0x04 613874776bfSMatthias Ringwald #define RPN_FLOW_CONTROL_RTR_ON_OUTPUT 0x08 614874776bfSMatthias Ringwald #define RPN_FLOW_CONTROL_RTC_ON_INPUT 0x10 615874776bfSMatthias Ringwald #define RPN_FLOW_CONTROL_RTC_ON_OUTPUT 0x20 616e2577bd7SMatthias Ringwald 617e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_BAUD 0x01 618e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_DATA_BITS 0x02 619e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_STOP_BITS 0x04 620e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_PARITY 0x08 621e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_PARITY_TYPE 0x10 622e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_XON_CHAR 0x20 623e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_XOFF_CHAR 0x40 624e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_RESERVED 0x80 625e2577bd7SMatthias Ringwald 626e2577bd7SMatthias Ringwald // @note: values are identical to rpn_flow_control_t 627e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_XONOFF_ON_INPUT 0x01 628e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_XONOFF_ON_OUTPUT 0x02 629e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTR_ON_INPUT 0x04 630e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTR_ON_OUTPUT 0x08 631e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTC_ON_INPUT 0x10 632e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTC_ON_OUTPUT 0x20 633e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RESERVED_0 0x40 634e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RESERVED_1 0x80 635e2577bd7SMatthias Ringwald 636e2577bd7SMatthias Ringwald /** 63766b1fcb3SMatthias Ringwald * BNEP Protocol 63866b1fcb3SMatthias Ringwald */ 63947f4e325SMatthias Ringwald 64066b1fcb3SMatthias Ringwald #ifndef ETHER_ADDR_LEN 6419a73f75dSMatthias Ringwald #define ETHER_ADDR_LEN 6 64266b1fcb3SMatthias Ringwald #endif 64347f4e325SMatthias Ringwald 64466b1fcb3SMatthias Ringwald #ifndef ETHERTYPE_VLAN 64566b1fcb3SMatthias Ringwald #define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tag */ 64666b1fcb3SMatthias Ringwald #endif 64766b1fcb3SMatthias Ringwald 64866b1fcb3SMatthias Ringwald #define BNEP_MTU_MIN 1691 64966b1fcb3SMatthias Ringwald 65066b1fcb3SMatthias Ringwald 65166b1fcb3SMatthias Ringwald /** 65266b1fcb3SMatthias Ringwald * PAN Profile 65366b1fcb3SMatthias Ringwald */ 65466b1fcb3SMatthias Ringwald 65566b1fcb3SMatthias Ringwald typedef enum { 65666b1fcb3SMatthias Ringwald BNEP_SECURITY_NONE = 0x0000, 65766b1fcb3SMatthias Ringwald BNEP_SECURITY_SERVICE_LEVEL_ENFORCED, 65866b1fcb3SMatthias Ringwald BNEP_SECURITY_802_1X 65966b1fcb3SMatthias Ringwald } security_description_t; 66066b1fcb3SMatthias Ringwald 66166b1fcb3SMatthias Ringwald typedef enum { 66266b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_PSTN = 0x0000, 66366b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_ISDN, 66466b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_DSL, 66566b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_CABLE_MODEM, 66666b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_10MB_ETHERNET, 66766b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_100MB_ETHERNET, 66866b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_4MB_TOKEN_RING, 66966b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_16MB_TOKEN_RING, 67066b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_100MB_TOKEN_RING, 67166b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_FDDI, 67266b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_GSM, 67366b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_CDMA, 67466b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_GPRS, 67566b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_3G, 67666b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_CELULAR, 67766b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_OTHER = 0xFFFE, 67866b1fcb3SMatthias Ringwald PAN_NET_ACCESS_TYPE_NONE 67966b1fcb3SMatthias Ringwald } net_access_type_t; 68047f4e325SMatthias Ringwald 6814c1900e6SMatthias Ringwald /** 6824c1900e6SMatthias Ringwald * ATT 6834c1900e6SMatthias Ringwald */ 6844c1900e6SMatthias Ringwald 6854c1900e6SMatthias Ringwald // Minimum/default MTU 6864c1900e6SMatthias Ringwald #define ATT_DEFAULT_MTU 23 6874c1900e6SMatthias Ringwald 6884c1900e6SMatthias Ringwald // MARK: ATT Error Codes 6899cb80b17SMilanka Ringwald #define ATT_ERROR_SUCCESS 0x00 6904c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_HANDLE 0x01 6914c1900e6SMatthias Ringwald #define ATT_ERROR_READ_NOT_PERMITTED 0x02 6924c1900e6SMatthias Ringwald #define ATT_ERROR_WRITE_NOT_PERMITTED 0x03 6934c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_PDU 0x04 6944c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_AUTHENTICATION 0x05 6954c1900e6SMatthias Ringwald #define ATT_ERROR_REQUEST_NOT_SUPPORTED 0x06 6964c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_OFFSET 0x07 6974c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_AUTHORIZATION 0x08 6984c1900e6SMatthias Ringwald #define ATT_ERROR_PREPARE_QUEUE_FULL 0x09 6994c1900e6SMatthias Ringwald #define ATT_ERROR_ATTRIBUTE_NOT_FOUND 0x0a 7004c1900e6SMatthias Ringwald #define ATT_ERROR_ATTRIBUTE_NOT_LONG 0x0b 7014c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE 0x0c 7024c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LENGTH 0x0d 7034c1900e6SMatthias Ringwald #define ATT_ERROR_UNLIKELY_ERROR 0x0e 7044c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_ENCRYPTION 0x0f 7054c1900e6SMatthias Ringwald #define ATT_ERROR_UNSUPPORTED_GROUP_TYPE 0x10 7064c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_RESOURCES 0x11 7075c562e57SMilanka Ringwald #define ATT_ERROR_VALUE_NOT_ALLOWED 0x13 708204991f3SMilanka Ringwald 7092cc32601SMatthias Ringwald // MARK: ATT Error Codes defined by BTstack 7102865193aSMilanka Ringwald #define ATT_ERROR_HCI_DISCONNECT_RECEIVED 0x1f 71109f91c9fSMatthias Ringwald #define ATT_ERROR_BONDING_INFORMATION_MISSING 0x70 7122865193aSMilanka Ringwald #define ATT_ERROR_DATA_MISMATCH 0x7e 7132865193aSMilanka Ringwald #define ATT_ERROR_TIMEOUT 0x7F 7142865193aSMilanka Ringwald #define ATT_ERROR_WRITE_RESPONSE_PENDING 0x100 7152865193aSMilanka Ringwald 716204991f3SMilanka Ringwald // MARK: ATT Error Codes from Cycling Power Service spec 717204991f3SMilanka Ringwald #define CYCLING_POWER_ERROR_CODE_INAPPROPRIATE_CONNECTION_PARAMETERS 0x80 718204991f3SMilanka Ringwald #define CYCLING_POWER_ERROR_CODE_PROCEDURE_ALREADY_IN_PROGRESS 0xFE 719204991f3SMilanka Ringwald #define CYCLING_POWER_ERROR_CODE_CCC_DESCRIPTOR_IMPROPERLY_CONFIGURED 0xFD 720204991f3SMilanka Ringwald 721204991f3SMilanka Ringwald // MARK: ATT Error Codes from Cycling Speed and Cadence Service spec 722204991f3SMilanka Ringwald #define CYCLING_SPEED_AND_CADENCE_ERROR_CODE_PROCEDURE_ALREADY_IN_PROGRESS 0x80 723204991f3SMilanka Ringwald #define CYCLING_SPEED_AND_CADENCE_ERROR_CODE_CCC_DESCRIPTOR_IMPROPERLY_CONFIGURED 0x81 724204991f3SMilanka Ringwald 7254c1900e6SMatthias Ringwald 7264c1900e6SMatthias Ringwald // MARK: Attribute Property Flags 7274c1900e6SMatthias Ringwald #define ATT_PROPERTY_BROADCAST 0x01 7284c1900e6SMatthias Ringwald #define ATT_PROPERTY_READ 0x02 7294c1900e6SMatthias Ringwald #define ATT_PROPERTY_WRITE_WITHOUT_RESPONSE 0x04 7304c1900e6SMatthias Ringwald #define ATT_PROPERTY_WRITE 0x08 7314c1900e6SMatthias Ringwald #define ATT_PROPERTY_NOTIFY 0x10 7324c1900e6SMatthias Ringwald #define ATT_PROPERTY_INDICATE 0x20 7334c1900e6SMatthias Ringwald #define ATT_PROPERTY_AUTHENTICATED_SIGNED_WRITE 0x40 7344c1900e6SMatthias Ringwald #define ATT_PROPERTY_EXTENDED_PROPERTIES 0x80 7354c1900e6SMatthias Ringwald 7364c1900e6SMatthias Ringwald // MARK: Attribute Property Flag, BTstack extension 7374c1900e6SMatthias Ringwald // value is asked from client 7384c1900e6SMatthias Ringwald #define ATT_PROPERTY_DYNAMIC 0x100 739ff04bac7SMatthias Ringwald 740ff04bac7SMatthias Ringwald // Security levels 741ff04bac7SMatthias Ringwald #define ATT_SECURITY_NONE 0 742ff04bac7SMatthias Ringwald #define ATT_SECURITY_ENCRYPTED 1 743ff04bac7SMatthias Ringwald #define ATT_SECURITY_AUTHENTICATED 2 744ff04bac7SMatthias Ringwald #define ATT_SECURITY_AUTHORIZED 3 745bb96f9f8SMatthias Ringwald #define ATT_SECURITY_AUTHENTICATED_SC 4 746ff04bac7SMatthias Ringwald 7479b31df63SMatthias Ringwald // ATT Transaction Timeout of 30 seconds for Command/Response or Indication/Confirmation 7484c1900e6SMatthias Ringwald #define ATT_TRANSACTION_TIMEOUT_MS 30000 7494c1900e6SMatthias Ringwald 7504c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_NONE 0x0 7514c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_ACTIVE 0x1 7524c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_EXECUTE 0x2 7534c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_CANCEL 0x3 7549b31df63SMatthias Ringwald #define ATT_TRANSACTION_MODE_VALIDATE 0x4 7554c1900e6SMatthias Ringwald 7564c1900e6SMatthias Ringwald // MARK: GATT UUIDs 7574c1900e6SMatthias Ringwald #define GATT_PRIMARY_SERVICE_UUID 0x2800 7584c1900e6SMatthias Ringwald #define GATT_SECONDARY_SERVICE_UUID 0x2801 7594c1900e6SMatthias Ringwald #define GATT_INCLUDE_SERVICE_UUID 0x2802 7604c1900e6SMatthias Ringwald #define GATT_CHARACTERISTICS_UUID 0x2803 7614c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_EXTENDED_PROPERTIES 0x2900 7624c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_USER_DESCRIPTION 0x2901 7634c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION 0x2902 7644c1900e6SMatthias Ringwald #define GATT_SERVER_CHARACTERISTICS_CONFIGURATION 0x2903 7654c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_PRESENTATION_FORMAT 0x2904 7664c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_AGGREGATE_FORMAT 0x2905 7674c1900e6SMatthias Ringwald 7684c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NONE 0 7694c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION 1 7704c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION 2 7714c1900e6SMatthias Ringwald 772b3f03c84SMatthias Ringwald #define GATT_CLIENT_ANY_CONNECTION 0xffff 773b3f03c84SMatthias Ringwald #define GATT_CLIENT_ANY_VALUE_HANDLE 0x0000 774b3f03c84SMatthias Ringwald 7754c1900e6SMatthias Ringwald // GAP Service and Characteristics 7764c1900e6SMatthias Ringwald #define GAP_SERVICE_UUID 0x1800 7774c1900e6SMatthias Ringwald #define GAP_DEVICE_NAME_UUID 0x2a00 7784c1900e6SMatthias Ringwald #define GAP_APPEARANCE_UUID 0x2a01 7794c1900e6SMatthias Ringwald #define GAP_PERIPHERAL_PRIVACY_FLAG 0x2a02 7804c1900e6SMatthias Ringwald #define GAP_RECONNECTION_ADDRESS_UUID 0x2a03 7814c1900e6SMatthias Ringwald #define GAP_PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS_UUID 0x2a04 78217fe8172SMatthias Ringwald #define GAP_SERVICE_CHANGED 0x2a05 7834c1900e6SMatthias Ringwald 784bb7f3677SMilanka Ringwald // Bluetooth GATT types 785bb7f3677SMilanka Ringwald 786bb7f3677SMilanka Ringwald typedef struct { 787bb7f3677SMilanka Ringwald uint16_t year; // 0 - year is not known; or [1582,9999] 788bb7f3677SMilanka Ringwald uint8_t month; // 0 - month is not known; or [1,12] 789bb7f3677SMilanka Ringwald uint8_t day; // 0 - day is not known; or [1,31] 790bb7f3677SMilanka Ringwald uint8_t hours; // [0,23] 791bb7f3677SMilanka Ringwald uint8_t minutes; // [0,59] 792bb7f3677SMilanka Ringwald uint8_t seconds; // [0,59] 793bb7f3677SMilanka Ringwald } gatt_date_time_t; 794bb7f3677SMilanka Ringwald 795f229ad0aSMilanka Ringwald typedef enum { 796f229ad0aSMilanka Ringwald GATT_MICROPHONE_CONTROL_MUTE_OFF = 0x00, 797f229ad0aSMilanka Ringwald GATT_MICROPHONE_CONTROL_MUTE_ON, 798f229ad0aSMilanka Ringwald GATT_MICROPHONE_CONTROL_MUTE_DISABLED 799f229ad0aSMilanka Ringwald } gatt_microphone_control_mute_t; 800f229ad0aSMilanka Ringwald 8014c1900e6SMatthias Ringwald /** 8024c1900e6SMatthias Ringwald * SM - LE Security Manager 8034c1900e6SMatthias Ringwald */ 8044c1900e6SMatthias Ringwald // Bluetooth Spec definitions 8054c1900e6SMatthias Ringwald typedef enum { 8064c1900e6SMatthias Ringwald SM_CODE_PAIRING_REQUEST = 0X01, 8074c1900e6SMatthias Ringwald SM_CODE_PAIRING_RESPONSE, 8084c1900e6SMatthias Ringwald SM_CODE_PAIRING_CONFIRM, 8094c1900e6SMatthias Ringwald SM_CODE_PAIRING_RANDOM, 8104c1900e6SMatthias Ringwald SM_CODE_PAIRING_FAILED, 8114c1900e6SMatthias Ringwald SM_CODE_ENCRYPTION_INFORMATION, 8124c1900e6SMatthias Ringwald SM_CODE_MASTER_IDENTIFICATION, 8134c1900e6SMatthias Ringwald SM_CODE_IDENTITY_INFORMATION, 8144c1900e6SMatthias Ringwald SM_CODE_IDENTITY_ADDRESS_INFORMATION, 8154c1900e6SMatthias Ringwald SM_CODE_SIGNING_INFORMATION, 81674a9b3d5SMatthias Ringwald SM_CODE_SECURITY_REQUEST, 81774a9b3d5SMatthias Ringwald SM_CODE_PAIRING_PUBLIC_KEY, 81874a9b3d5SMatthias Ringwald SM_CODE_PAIRING_DHKEY_CHECK, 81944e8d9acSMatthias Ringwald SM_CODE_KEYPRESS_NOTIFICATION, 8204c1900e6SMatthias Ringwald } SECURITY_MANAGER_COMMANDS; 8214c1900e6SMatthias Ringwald 8224c1900e6SMatthias Ringwald // IO Capability Values 8234c1900e6SMatthias Ringwald typedef enum { 8244c1900e6SMatthias Ringwald IO_CAPABILITY_DISPLAY_ONLY = 0, 8254c1900e6SMatthias Ringwald IO_CAPABILITY_DISPLAY_YES_NO, 8264c1900e6SMatthias Ringwald IO_CAPABILITY_KEYBOARD_ONLY, 8274c1900e6SMatthias Ringwald IO_CAPABILITY_NO_INPUT_NO_OUTPUT, 8284c1900e6SMatthias Ringwald IO_CAPABILITY_KEYBOARD_DISPLAY, // not used by secure simple pairing 8294c1900e6SMatthias Ringwald } io_capability_t; 8304c1900e6SMatthias Ringwald 8314c1900e6SMatthias Ringwald // Authentication requirement flags 8324c1900e6SMatthias Ringwald #define SM_AUTHREQ_NO_BONDING 0x00 8334c1900e6SMatthias Ringwald #define SM_AUTHREQ_BONDING 0x01 8344c1900e6SMatthias Ringwald #define SM_AUTHREQ_MITM_PROTECTION 0x04 83574a9b3d5SMatthias Ringwald #define SM_AUTHREQ_SECURE_CONNECTION 0x08 83674a9b3d5SMatthias Ringwald #define SM_AUTHREQ_KEYPRESS 0x10 83757132f12SMatthias Ringwald #define SM_AUTHREQ_CT2 0x20 8384c1900e6SMatthias Ringwald 8394c1900e6SMatthias Ringwald // Key distribution flags used by spec 84052f9cf63SMatthias Ringwald #define SM_KEYDIST_ENC_KEY 0x01 8414c1900e6SMatthias Ringwald #define SM_KEYDIST_ID_KEY 0x02 8424c1900e6SMatthias Ringwald #define SM_KEYDIST_SIGN 0x04 84352f9cf63SMatthias Ringwald #define SM_KEYDIST_LINK_KEY 0x08 8444c1900e6SMatthias Ringwald 8454c1900e6SMatthias Ringwald // Key distribution flags used internally 8464c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_ENCRYPTION_INFORMATION 0x01 8474c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_MASTER_IDENTIFICATION 0x02 8484c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_IDENTITY_INFORMATION 0x04 8494c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_IDENTITY_ADDRESS_INFORMATION 0x08 8504c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_SIGNING_IDENTIFICATION 0x10 8514c1900e6SMatthias Ringwald 8524c1900e6SMatthias Ringwald // STK Generation Methods 8534c1900e6SMatthias Ringwald #define SM_STK_GENERATION_METHOD_JUST_WORKS 0x01 8544c1900e6SMatthias Ringwald #define SM_STK_GENERATION_METHOD_OOB 0x02 8554c1900e6SMatthias Ringwald #define SM_STK_GENERATION_METHOD_PASSKEY 0x04 856b4343428SMatthias Ringwald #define SM_STK_GENERATION_METHOD_NUMERIC_COMPARISON 0x08 8574c1900e6SMatthias Ringwald 8584c1900e6SMatthias Ringwald // Pairing Failed Reasons 8594c1900e6SMatthias Ringwald #define SM_REASON_RESERVED 0x00 86016a1a3e5SMatthias Ringwald #define SM_REASON_PASSKEY_ENTRY_FAILED 0x01 8614c1900e6SMatthias Ringwald #define SM_REASON_OOB_NOT_AVAILABLE 0x02 8624c1900e6SMatthias Ringwald #define SM_REASON_AUTHENTHICATION_REQUIREMENTS 0x03 8634c1900e6SMatthias Ringwald #define SM_REASON_CONFIRM_VALUE_FAILED 0x04 8644c1900e6SMatthias Ringwald #define SM_REASON_PAIRING_NOT_SUPPORTED 0x05 8654c1900e6SMatthias Ringwald #define SM_REASON_ENCRYPTION_KEY_SIZE 0x06 8664c1900e6SMatthias Ringwald #define SM_REASON_COMMAND_NOT_SUPPORTED 0x07 8674c1900e6SMatthias Ringwald #define SM_REASON_UNSPECIFIED_REASON 0x08 8684c1900e6SMatthias Ringwald #define SM_REASON_REPEATED_ATTEMPTS 0x09 869a9f29768SMatthias Ringwald #define SM_REASON_INVALID_PARAMETERS 0x0a 870a9f29768SMatthias Ringwald #define SM_REASON_DHKEY_CHECK_FAILED 0x0b 871a9f29768SMatthias Ringwald #define SM_REASON_NUMERIC_COMPARISON_FAILED 0x0c 8724e65ea07SMatthias Ringwald #define SM_REASON_BR_EDR_PAIRING_IN_PROGRESS 0x0d 8734e65ea07SMatthias Ringwald #define SM_REASON_CROSS_TRANSPORT_KEY_DERIVATION_NOT_ALLOWED 0x0e 8744e65ea07SMatthias Ringwald #define SM_REASON_KEY_REJECTED 0x0f 875a9f29768SMatthias Ringwald 8764c1900e6SMatthias Ringwald // also, invalid parameters 8774c1900e6SMatthias Ringwald // and reserved 8784c1900e6SMatthias Ringwald 87944e8d9acSMatthias Ringwald // Keypress Notifications 88044e8d9acSMatthias Ringwald #define SM_KEYPRESS_PASSKEY_ENTRY_STARTED 0x00 88144e8d9acSMatthias Ringwald #define SM_KEYPRESS_PASSKEY_DIGIT_ENTERED 0x01 88244e8d9acSMatthias Ringwald #define SM_KEYPRESS_PASSKEY_DIGIT_ERASED 0x02 88344e8d9acSMatthias Ringwald #define SM_KEYPRESS_PASSKEY_CLEARED 0x03 88444e8d9acSMatthias Ringwald #define SM_KEYPRESS_PASSKEY_ENTRY_COMPLETED 0x04 88544e8d9acSMatthias Ringwald 88644e8d9acSMatthias Ringwald 88747f4e325SMatthias Ringwald #endif 888