xref: /btstack/src/bluetooth.h (revision 941b385515135f788c7f6fa8f909e61c676ddca8)
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 
391*941b3855SMatthias Ringwald #define HCI_EVENT_VENDOR_SPECIFIC                          0xFF
392*941b3855SMatthias Ringwald 
39347f4e325SMatthias Ringwald /**
39447f4e325SMatthias Ringwald  * @format 11211B2221
39547f4e325SMatthias Ringwald  * @param subevent_code
39647f4e325SMatthias Ringwald  * @param status
39747f4e325SMatthias Ringwald  * @param connection_handle
39847f4e325SMatthias Ringwald  * @param role
39947f4e325SMatthias Ringwald  * @param peer_address_type
40047f4e325SMatthias Ringwald  * @param peer_address
40147f4e325SMatthias Ringwald  * @param conn_interval
40247f4e325SMatthias Ringwald  * @param conn_latency
40347f4e325SMatthias Ringwald  * @param supervision_timeout
40447f4e325SMatthias Ringwald  * @param master_clock_accuracy
40547f4e325SMatthias Ringwald  */
40647f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_CONNECTION_COMPLETE                0x01
40747f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_ADVERTISING_REPORT                 0x02
40847f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE         0x03
40947f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04
41047f4e325SMatthias Ringwald #define HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST              0x05
41147f4e325SMatthias Ringwald 
41247f4e325SMatthias Ringwald // last used HCI_EVENT in 2.1 is 0x3d
41347f4e325SMatthias Ringwald // last used HCI_EVENT in 4.1 is 0x57
41447f4e325SMatthias Ringwald 
41547f4e325SMatthias Ringwald /**
41647f4e325SMatthias Ringwald  * L2CAP Layer
41747f4e325SMatthias Ringwald  */
41847f4e325SMatthias Ringwald 
419a8373a41SMatthias Ringwald #define L2CAP_HEADER_SIZE 4
420a8373a41SMatthias Ringwald 
421a8373a41SMatthias Ringwald #define L2CAP_SIG_ID_INVALID 0
422a8373a41SMatthias Ringwald 
423a8373a41SMatthias Ringwald // size of HCI ACL + L2CAP Header for regular data packets (8)
424a8373a41SMatthias Ringwald #define COMPLETE_L2CAP_HEADER (HCI_ACL_HEADER_SIZE + L2CAP_HEADER_SIZE)
425a8373a41SMatthias Ringwald 
426a8373a41SMatthias Ringwald // minimum signaling MTU
427a8373a41SMatthias Ringwald #define L2CAP_MINIMAL_MTU 48
428a8373a41SMatthias Ringwald #define L2CAP_DEFAULT_MTU 672
429a8373a41SMatthias Ringwald 
430a8373a41SMatthias Ringwald // Minimum/default MTU
431a8373a41SMatthias Ringwald #define L2CAP_LE_DEFAULT_MTU  23
432a8373a41SMatthias Ringwald 
433a8373a41SMatthias Ringwald // L2CAP Fixed Channel IDs
434a8373a41SMatthias Ringwald #define L2CAP_CID_SIGNALING                 0x0001
435a8373a41SMatthias Ringwald #define L2CAP_CID_CONNECTIONLESS_CHANNEL    0x0002
436a8373a41SMatthias Ringwald #define L2CAP_CID_ATTRIBUTE_PROTOCOL        0x0004
437a8373a41SMatthias Ringwald #define L2CAP_CID_SIGNALING_LE              0x0005
438a8373a41SMatthias Ringwald #define L2CAP_CID_SECURITY_MANAGER_PROTOCOL 0x0006
439a8373a41SMatthias Ringwald 
440a8373a41SMatthias Ringwald // L2CAP Configuration Result Codes
441a8373a41SMatthias Ringwald #define L2CAP_CONF_RESULT_UNKNOWN_OPTIONS   0x0003
442a8373a41SMatthias Ringwald 
443a8373a41SMatthias Ringwald // L2CAP Reject Result Codes
444a8373a41SMatthias Ringwald #define L2CAP_REJ_CMD_UNKNOWN               0x0000
445a8373a41SMatthias Ringwald 
446a8373a41SMatthias Ringwald // Response Timeout eXpired
447a8373a41SMatthias Ringwald #define L2CAP_RTX_TIMEOUT_MS   10000
448a8373a41SMatthias Ringwald 
449a8373a41SMatthias Ringwald // Extended Response Timeout eXpired
450a8373a41SMatthias Ringwald #define L2CAP_ERTX_TIMEOUT_MS 120000
451a8373a41SMatthias Ringwald 
45247f4e325SMatthias Ringwald // Fixed PSM numbers
45347f4e325SMatthias Ringwald #define PSM_SDP           0x01
45447f4e325SMatthias Ringwald #define PSM_RFCOMM 		  0x03
45547f4e325SMatthias Ringwald #define PSM_BNEP   	      0x0F
45647f4e325SMatthias Ringwald #define PSM_HID_CONTROL   0x11
45747f4e325SMatthias Ringwald #define PSM_HID_INTERRUPT 0x13
45847f4e325SMatthias Ringwald 
45966b1fcb3SMatthias Ringwald /**
460ef907034SMatthias Ringwald  * SDP Protocl
461ef907034SMatthias Ringwald  */
462ef907034SMatthias Ringwald 
463ef907034SMatthias Ringwald  // PDU Types
464ef907034SMatthias Ringwald typedef enum {
465ef907034SMatthias Ringwald     SDP_Invalid = 0,
466ef907034SMatthias Ringwald 	SDP_ErrorResponse = 1,
467ef907034SMatthias Ringwald 	SDP_ServiceSearchRequest,
468ef907034SMatthias Ringwald 	SDP_ServiceSearchResponse,
469ef907034SMatthias Ringwald 	SDP_ServiceAttributeRequest,
470ef907034SMatthias Ringwald 	SDP_ServiceAttributeResponse,
471ef907034SMatthias Ringwald 	SDP_ServiceSearchAttributeRequest,
472ef907034SMatthias Ringwald 	SDP_ServiceSearchAttributeResponse
473ef907034SMatthias Ringwald } SDP_PDU_ID_t;
474ef907034SMatthias Ringwald 
475ef907034SMatthias Ringwald // UNIVERSAL ATTRIBUTE DEFINITIONS
476ef907034SMatthias Ringwald #define SDP_ServiceRecordHandle     0x0000
477ef907034SMatthias Ringwald #define SDP_ServiceClassIDList      0x0001
478ef907034SMatthias Ringwald #define SDP_ServiceRecordState      0x0002
479ef907034SMatthias Ringwald #define SDP_ServiceID               0x0003
480ef907034SMatthias Ringwald #define SDP_ProtocolDescriptorList  0x0004
481ef907034SMatthias Ringwald #define SDP_BrowseGroupList		    0x0005
482ef907034SMatthias Ringwald #define SDP_LanguageBaseAttributeIDList 0x0006
483ef907034SMatthias Ringwald #define SDP_ServiceInfoTimeToLive	0x0007
484ef907034SMatthias Ringwald #define SDP_ServiceAvailability		0x0008
485ef907034SMatthias Ringwald #define SDP_BluetoothProfileDescriptorList 0x0009
486ef907034SMatthias Ringwald #define SDP_DocumentationURL		0x000a
487ef907034SMatthias Ringwald #define SDP_ClientExecutableURL     0x000b
488ef907034SMatthias Ringwald #define SDP_IconURL                 0x000c
489ef907034SMatthias Ringwald #define SDP_AdditionalProtocolDescriptorList 0x000d
490ef907034SMatthias Ringwald #define SDP_SupportedFormatsList    0x0303
491ef907034SMatthias Ringwald 
492ef907034SMatthias Ringwald // SERVICE CLASSES
493ef907034SMatthias Ringwald #define SDP_OBEXObjectPush          0x1105
494ef907034SMatthias Ringwald #define SDP_OBEXFileTransfer        0x1106
495ef907034SMatthias Ringwald #define SDP_PublicBrowseGroup       0x1002
496ef907034SMatthias Ringwald #define SDP_HSP                     0x1108
497ef907034SMatthias Ringwald #define SDP_Headset_AG              0x1112
498ef907034SMatthias Ringwald #define SDP_PANU                    0x1115
499ef907034SMatthias Ringwald #define SDP_NAP                     0x1116
500ef907034SMatthias Ringwald #define SDP_GN                      0x1117
501ef907034SMatthias Ringwald #define SDP_Handsfree               0x111E
502ef907034SMatthias Ringwald #define SDP_HandsfreeAudioGateway   0x111F
503ef907034SMatthias Ringwald #define SDP_Headset_HS              0x1131
504ef907034SMatthias Ringwald #define SDP_GenericAudio            0x1203
505ef907034SMatthias Ringwald 
506ef907034SMatthias Ringwald 
507ef907034SMatthias Ringwald // PROTOCOLS
508ef907034SMatthias Ringwald #define SDP_SDPProtocol       0x0001
509ef907034SMatthias Ringwald #define SDP_UDPProtocol       0x0002
510ef907034SMatthias Ringwald #define SDP_RFCOMMProtocol    0x0003
511ef907034SMatthias Ringwald #define SDP_OBEXProtocol      0x0008
512ef907034SMatthias Ringwald #define SDP_L2CAPProtocol     0x0100
513ef907034SMatthias Ringwald #define SDP_BNEPProtocol      0x000F
514ef907034SMatthias Ringwald #define SDP_AVDTPProtocol     0x0019
515ef907034SMatthias Ringwald 
516ef907034SMatthias Ringwald // OFFSETS FOR LOCALIZED ATTRIBUTES - SDP_LanguageBaseAttributeIDList
517ef907034SMatthias Ringwald #define SDP_Offest_ServiceName      0x0000
518ef907034SMatthias Ringwald #define SDP_Offest_ServiceDescription 0x0001
519ef907034SMatthias Ringwald #define SDP_Offest_ProviderName     0x0002
520ef907034SMatthias Ringwald 
521ef907034SMatthias Ringwald // OBEX
522ef907034SMatthias Ringwald #define SDP_vCard_2_1       0x01
523ef907034SMatthias Ringwald #define SDP_vCard_3_0       0x02
524ef907034SMatthias Ringwald #define SDP_vCal_1_0        0x03
525ef907034SMatthias Ringwald #define SDP_iCal_2_0        0x04
526ef907034SMatthias Ringwald #define SDP_vNote           0x05
527ef907034SMatthias Ringwald #define SDP_vMessage        0x06
528ef907034SMatthias Ringwald #define SDP_OBEXFileTypeAny 0xFF
529ef907034SMatthias Ringwald 
530ef907034SMatthias Ringwald /**
531e2577bd7SMatthias Ringwald  * RFCOMM Protocol
532e2577bd7SMatthias Ringwald  */
533e2577bd7SMatthias Ringwald 
534e2577bd7SMatthias Ringwald // Control field values      bit no.       1 2 3 4 PF 6 7 8
535e2577bd7SMatthias Ringwald #define BT_RFCOMM_SABM       0x3F       // 1 1 1 1  1 1 0 0
536e2577bd7SMatthias Ringwald #define BT_RFCOMM_UA         0x73       // 1 1 0 0  1 1 1 0
537e2577bd7SMatthias Ringwald #define BT_RFCOMM_DM         0x0F       // 1 1 1 1  0 0 0 0
538e2577bd7SMatthias Ringwald #define BT_RFCOMM_DM_PF      0x1F		// 1 1 1 1  1 0 0 0
539e2577bd7SMatthias Ringwald #define BT_RFCOMM_DISC       0x53       // 1 1 0 0  1 0 1 0
540e2577bd7SMatthias Ringwald #define BT_RFCOMM_UIH        0xEF       // 1 1 1 1  0 1 1 1
541e2577bd7SMatthias Ringwald #define BT_RFCOMM_UIH_PF     0xFF       // 1 1 1 1  0 1 1 1
542e2577bd7SMatthias Ringwald 
543e2577bd7SMatthias Ringwald // Multiplexer message types
544e2577bd7SMatthias Ringwald #define BT_RFCOMM_CLD_CMD    0xC3
545e2577bd7SMatthias Ringwald #define BT_RFCOMM_FCON_CMD   0xA3
546e2577bd7SMatthias Ringwald #define BT_RFCOMM_FCON_RSP   0xA1
547e2577bd7SMatthias Ringwald #define BT_RFCOMM_FCOFF_CMD  0x63
548e2577bd7SMatthias Ringwald #define BT_RFCOMM_FCOFF_RSP  0x61
549e2577bd7SMatthias Ringwald #define BT_RFCOMM_MSC_CMD    0xE3
550e2577bd7SMatthias Ringwald #define BT_RFCOMM_MSC_RSP    0xE1
551e2577bd7SMatthias Ringwald #define BT_RFCOMM_NSC_RSP    0x11
552e2577bd7SMatthias Ringwald #define BT_RFCOMM_PN_CMD     0x83
553e2577bd7SMatthias Ringwald #define BT_RFCOMM_PN_RSP     0x81
554e2577bd7SMatthias Ringwald #define BT_RFCOMM_RLS_CMD    0x53
555e2577bd7SMatthias Ringwald #define BT_RFCOMM_RLS_RSP    0x51
556e2577bd7SMatthias Ringwald #define BT_RFCOMM_RPN_CMD    0x93
557e2577bd7SMatthias Ringwald #define BT_RFCOMM_RPN_RSP    0x91
558e2577bd7SMatthias Ringwald #define BT_RFCOMM_TEST_CMD   0x23
559e2577bd7SMatthias Ringwald #define BT_RFCOMM_TEST_RSP   0x21
560e2577bd7SMatthias Ringwald 
561e2577bd7SMatthias Ringwald // Line Status
562e2577bd7SMatthias Ringwald #define LINE_STATUS_NO_ERROR       0x00
563e2577bd7SMatthias Ringwald #define LINE_STATUS_OVERRUN_ERROR  0x03
564e2577bd7SMatthias Ringwald #define LINE_STATUS_PARITY_ERORR   0x05
565e2577bd7SMatthias Ringwald #define LINE_STATUS_FRAMING_ERROR  0x09
566e2577bd7SMatthias Ringwald 
567e2577bd7SMatthias Ringwald // Modem Status Flags
568e2577bd7SMatthias Ringwald #define MODEM_STATUS_FC   0x02
569e2577bd7SMatthias Ringwald #define MODEM_STATUS_RTC  0x04
570e2577bd7SMatthias Ringwald #define MODEM_STATUS_RTR  0x08
571e2577bd7SMatthias Ringwald #define MODEM_STATUS_IC   0x40
572e2577bd7SMatthias Ringwald #define MODEM_STATUS_DV   0x80
573e2577bd7SMatthias Ringwald 
574e2577bd7SMatthias Ringwald typedef enum rpn_baud {
575e2577bd7SMatthias Ringwald     RPN_BAUD_2400 = 0,
576e2577bd7SMatthias Ringwald     RPN_BAUD_4800,
577e2577bd7SMatthias Ringwald     RPN_BAUD_7200,
578e2577bd7SMatthias Ringwald     RPN_BAUD_9600,
579e2577bd7SMatthias Ringwald     RPN_BAUD_19200,
580e2577bd7SMatthias Ringwald     RPN_BAUD_38400,
581e2577bd7SMatthias Ringwald     RPN_BAUD_57600,
582e2577bd7SMatthias Ringwald     RPN_BAUD_115200,
583e2577bd7SMatthias Ringwald     RPN_BAUD_230400
584e2577bd7SMatthias Ringwald } rpn_baud_t;
585e2577bd7SMatthias Ringwald 
586e2577bd7SMatthias Ringwald typedef enum rpn_data_bits {
587e2577bd7SMatthias Ringwald     RPN_DATA_BITS_5 = 0,
588e2577bd7SMatthias Ringwald     RPN_DATA_BITS_6 = 0,
589e2577bd7SMatthias Ringwald     RPN_DATA_BITS_7 = 0,
590e2577bd7SMatthias Ringwald     RPN_DATA_BITS_8 = 0
591e2577bd7SMatthias Ringwald } rpn_data_bits_t;
592e2577bd7SMatthias Ringwald 
593e2577bd7SMatthias Ringwald typedef enum rpn_stop_bits {
594e2577bd7SMatthias Ringwald     RPN_STOP_BITS_1_0 = 0,
595e2577bd7SMatthias Ringwald     RPN_STOP_BITS_1_5
596e2577bd7SMatthias Ringwald } rpn_stop_bits_t;
597e2577bd7SMatthias Ringwald 
598e2577bd7SMatthias Ringwald typedef enum rpn_parity {
599e2577bd7SMatthias Ringwald     RPN_PARITY_NONE  = 0,
600e2577bd7SMatthias Ringwald     RPN_PARITY_ODD   = 1,
601e2577bd7SMatthias Ringwald     RPN_PARITY_EVEN  = 3,
602e2577bd7SMatthias Ringwald     RPN_PARITY_MARK  = 5,
603e2577bd7SMatthias Ringwald     RPN_PARITY_SPACE = 7,
604e2577bd7SMatthias Ringwald } rpn_parity_t;
605e2577bd7SMatthias Ringwald 
606e2577bd7SMatthias Ringwald typedef enum rpn_flow_control {
607e2577bd7SMatthias Ringwald     RPN_FLOW_CONTROL_XONXOFF_ON_INPUT  = 1 << 0,
608e2577bd7SMatthias Ringwald     RPN_FLOW_CONTROL_XONXOFF_ON_OUTPUT = 1 << 1,
609e2577bd7SMatthias Ringwald     RPN_FLOW_CONTROL_RTR_ON_INPUT  = 1 << 2,
610e2577bd7SMatthias Ringwald     RPN_FLOW_CONTROL_RTR_ON_OUTPUT = 1 << 3,
611e2577bd7SMatthias Ringwald     RPN_FLOW_CONTROL_RTC_ON_INPUT  = 1 << 4,
612e2577bd7SMatthias Ringwald     RPN_FLOW_CONTROL_RTC_ON_OUTPUT = 1 << 5,
613e2577bd7SMatthias Ringwald } rpn_flow_control_t;
614e2577bd7SMatthias Ringwald 
615e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_BAUD             0x01
616e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_DATA_BITS        0x02
617e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_STOP_BITS        0x04
618e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_PARITY           0x08
619e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_PARITY_TYPE      0x10
620e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_XON_CHAR         0x20
621e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_XOFF_CHAR        0x40
622e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_0_RESERVED         0x80
623e2577bd7SMatthias Ringwald 
624e2577bd7SMatthias Ringwald // @note: values are identical to rpn_flow_control_t
625e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_XONOFF_ON_INPUT  0x01
626e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_XONOFF_ON_OUTPUT 0x02
627e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTR_ON_INPUT     0x04
628e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTR_ON_OUTPUT    0x08
629e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTC_ON_INPUT     0x10
630e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RTC_ON_OUTPUT    0x20
631e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RESERVED_0       0x40
632e2577bd7SMatthias Ringwald #define RPN_PARAM_MASK_1_RESERVED_1       0x80
633e2577bd7SMatthias Ringwald 
634e2577bd7SMatthias Ringwald /**
63566b1fcb3SMatthias Ringwald  * BNEP Protocol
63666b1fcb3SMatthias Ringwald  */
63747f4e325SMatthias Ringwald 
63866b1fcb3SMatthias Ringwald #ifndef ETHER_ADDR_LEN
63966b1fcb3SMatthias Ringwald #define ETHER_ADDR_LEN sizeof(bd_addr_t)
64066b1fcb3SMatthias Ringwald #endif
64147f4e325SMatthias Ringwald 
64266b1fcb3SMatthias Ringwald #ifndef ETHERTYPE_VLAN
64366b1fcb3SMatthias Ringwald #define	ETHERTYPE_VLAN		                            0x8100 /* IEEE 802.1Q VLAN tag */
64466b1fcb3SMatthias Ringwald #endif
64566b1fcb3SMatthias Ringwald 
64666b1fcb3SMatthias Ringwald #define BNEP_MTU_MIN                                    1691
64766b1fcb3SMatthias Ringwald 
64866b1fcb3SMatthias Ringwald #define BNEP_EXT_FLAG                                   0x80
64966b1fcb3SMatthias Ringwald #define BNEP_TYPE_MASK                                  0x7F
65066b1fcb3SMatthias Ringwald #define	BNEP_TYPE(header)                               ((header) & BNEP_TYPE_MASK)
65166b1fcb3SMatthias Ringwald #define BNEP_HEADER_HAS_EXT(x)	                        (((x) & BNEP_EXT_FLAG) == BNEP_EXT_FLAG)
65266b1fcb3SMatthias Ringwald 
65366b1fcb3SMatthias Ringwald /* BNEP packet types */
65466b1fcb3SMatthias Ringwald #define	BNEP_PKT_TYPE_GENERAL_ETHERNET                  0x00
65566b1fcb3SMatthias Ringwald #define	BNEP_PKT_TYPE_CONTROL                           0x01
65666b1fcb3SMatthias Ringwald #define	BNEP_PKT_TYPE_COMPRESSED_ETHERNET               0x02
65766b1fcb3SMatthias Ringwald #define	BNEP_PKT_TYPE_COMPRESSED_ETHERNET_SOURCE_ONLY   0x03
65866b1fcb3SMatthias Ringwald #define	BNEP_PKT_TYPE_COMPRESSED_ETHERNET_DEST_ONLY     0x04
65966b1fcb3SMatthias Ringwald 
66066b1fcb3SMatthias Ringwald /* BNEP control types */
66166b1fcb3SMatthias Ringwald #define	BNEP_CONTROL_TYPE_COMMAND_NOT_UNDERSTOOD        0x00
66266b1fcb3SMatthias Ringwald #define	BNEP_CONTROL_TYPE_SETUP_CONNECTION_REQUEST      0x01
66366b1fcb3SMatthias Ringwald #define	BNEP_CONTROL_TYPE_SETUP_CONNECTION_RESPONSE     0x02
66466b1fcb3SMatthias Ringwald #define	BNEP_CONTROL_TYPE_FILTER_NET_TYPE_SET           0x03
66566b1fcb3SMatthias Ringwald #define	BNEP_CONTROL_TYPE_FILTER_NET_TYPE_RESPONSE      0x04
66666b1fcb3SMatthias Ringwald #define	BNEP_CONTROL_TYPE_FILTER_MULTI_ADDR_SET         0x05
66766b1fcb3SMatthias Ringwald #define	BNEP_CONTROL_TYPE_FILTER_MULTI_ADDR_RESPONSE    0x06
66866b1fcb3SMatthias Ringwald 
66966b1fcb3SMatthias Ringwald /* BNEP extension header types */
67066b1fcb3SMatthias Ringwald #define	BNEP_EXT_HEADER_TYPE_EXTENSION_CONTROL          0x00
67166b1fcb3SMatthias Ringwald 
67266b1fcb3SMatthias Ringwald /* BNEP setup response codes */
67366b1fcb3SMatthias Ringwald #define	BNEP_RESP_SETUP_SUCCESS                         0x0000
67466b1fcb3SMatthias Ringwald #define	BNEP_RESP_SETUP_INVALID_DEST_UUID               0x0001
67566b1fcb3SMatthias Ringwald #define	BNEP_RESP_SETUP_INVALID_SOURCE_UUID             0x0002
67666b1fcb3SMatthias Ringwald #define	BNEP_RESP_SETUP_INVALID_SERVICE_UUID_SIZE       0x0003
67766b1fcb3SMatthias Ringwald #define	BNEP_RESP_SETUP_CONNECTION_NOT_ALLOWED          0x0004
67866b1fcb3SMatthias Ringwald 
67966b1fcb3SMatthias Ringwald /* BNEP filter response codes */
68066b1fcb3SMatthias Ringwald #define	BNEP_RESP_FILTER_SUCCESS                        0x0000
68166b1fcb3SMatthias Ringwald #define	BNEP_RESP_FILTER_UNSUPPORTED_REQUEST            0x0001
68266b1fcb3SMatthias Ringwald #define	BNEP_RESP_FILTER_ERR_INVALID_RANGE              0x0002
68366b1fcb3SMatthias Ringwald #define	BNEP_RESP_FILTER_ERR_TOO_MANY_FILTERS           0x0003
68466b1fcb3SMatthias Ringwald #define	BNEP_RESP_FILTER_ERR_SECURITY                   0x0004
68566b1fcb3SMatthias Ringwald 
68666b1fcb3SMatthias Ringwald /**
68766b1fcb3SMatthias Ringwald  * PAN Profile
68866b1fcb3SMatthias Ringwald  */
68966b1fcb3SMatthias Ringwald 
69066b1fcb3SMatthias Ringwald typedef enum {
69166b1fcb3SMatthias Ringwald 	PANU_UUID = 0x1115,
69266b1fcb3SMatthias Ringwald 	NAP_UUID = 0x1116,
69366b1fcb3SMatthias Ringwald 	GN_UUID = 0x1117
69466b1fcb3SMatthias Ringwald } bnep_service_uuid_t;
69566b1fcb3SMatthias Ringwald 
69666b1fcb3SMatthias Ringwald typedef enum {
69766b1fcb3SMatthias Ringwald 	BNEP_SECURITY_NONE = 0x0000,
69866b1fcb3SMatthias Ringwald 	BNEP_SECURITY_SERVICE_LEVEL_ENFORCED,
69966b1fcb3SMatthias Ringwald 	BNEP_SECURITY_802_1X
70066b1fcb3SMatthias Ringwald } security_description_t;
70166b1fcb3SMatthias Ringwald 
70266b1fcb3SMatthias Ringwald typedef enum {
70366b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_PSTN = 0x0000,
70466b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_ISDN,
70566b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_DSL,
70666b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_CABLE_MODEM,
70766b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_10MB_ETHERNET,
70866b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_100MB_ETHERNET,
70966b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_4MB_TOKEN_RING,
71066b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_16MB_TOKEN_RING,
71166b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_100MB_TOKEN_RING,
71266b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_FDDI,
71366b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_GSM,
71466b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_CDMA,
71566b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_GPRS,
71666b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_3G,
71766b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_CELULAR,
71866b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_OTHER = 0xFFFE,
71966b1fcb3SMatthias Ringwald 	PAN_NET_ACCESS_TYPE_NONE
72066b1fcb3SMatthias Ringwald } net_access_type_t;
72147f4e325SMatthias Ringwald 
7224c1900e6SMatthias Ringwald /**
7234c1900e6SMatthias Ringwald  * ATT
7244c1900e6SMatthias Ringwald  */
7254c1900e6SMatthias Ringwald 
7264c1900e6SMatthias Ringwald // Minimum/default MTU
7274c1900e6SMatthias Ringwald #define ATT_DEFAULT_MTU               23
7284c1900e6SMatthias Ringwald 
7294c1900e6SMatthias Ringwald // MARK: Attribute PDU Opcodes
7304c1900e6SMatthias Ringwald #define ATT_ERROR_RESPONSE              0x01
7314c1900e6SMatthias Ringwald 
7324c1900e6SMatthias Ringwald #define ATT_EXCHANGE_MTU_REQUEST        0x02
7334c1900e6SMatthias Ringwald #define ATT_EXCHANGE_MTU_RESPONSE       0x03
7344c1900e6SMatthias Ringwald 
7354c1900e6SMatthias Ringwald #define ATT_FIND_INFORMATION_REQUEST    0x04
7364c1900e6SMatthias Ringwald #define ATT_FIND_INFORMATION_REPLY      0x05
7374c1900e6SMatthias Ringwald #define ATT_FIND_BY_TYPE_VALUE_REQUEST  0x06
7384c1900e6SMatthias Ringwald #define ATT_FIND_BY_TYPE_VALUE_RESPONSE 0x07
7394c1900e6SMatthias Ringwald 
7404c1900e6SMatthias Ringwald #define ATT_READ_BY_TYPE_REQUEST        0x08
7414c1900e6SMatthias Ringwald #define ATT_READ_BY_TYPE_RESPONSE       0x09
7424c1900e6SMatthias Ringwald #define ATT_READ_REQUEST                0x0a
7434c1900e6SMatthias Ringwald #define ATT_READ_RESPONSE               0x0b
7444c1900e6SMatthias Ringwald #define ATT_READ_BLOB_REQUEST           0x0c
7454c1900e6SMatthias Ringwald #define ATT_READ_BLOB_RESPONSE          0x0d
7464c1900e6SMatthias Ringwald #define ATT_READ_MULTIPLE_REQUEST       0x0e
7474c1900e6SMatthias Ringwald #define ATT_READ_MULTIPLE_RESPONSE      0x0f
7484c1900e6SMatthias Ringwald #define ATT_READ_BY_GROUP_TYPE_REQUEST  0x10
7494c1900e6SMatthias Ringwald #define ATT_READ_BY_GROUP_TYPE_RESPONSE 0x11
7504c1900e6SMatthias Ringwald 
7514c1900e6SMatthias Ringwald #define ATT_WRITE_REQUEST               0x12
7524c1900e6SMatthias Ringwald #define ATT_WRITE_RESPONSE              0x13
7534c1900e6SMatthias Ringwald 
7544c1900e6SMatthias Ringwald #define ATT_PREPARE_WRITE_REQUEST       0x16
7554c1900e6SMatthias Ringwald #define ATT_PREPARE_WRITE_RESPONSE      0x17
7564c1900e6SMatthias Ringwald #define ATT_EXECUTE_WRITE_REQUEST       0x18
7574c1900e6SMatthias Ringwald #define ATT_EXECUTE_WRITE_RESPONSE      0x19
7584c1900e6SMatthias Ringwald 
7594c1900e6SMatthias Ringwald #define ATT_HANDLE_VALUE_NOTIFICATION   0x1b
7604c1900e6SMatthias Ringwald #define ATT_HANDLE_VALUE_INDICATION     0x1d
7614c1900e6SMatthias Ringwald #define ATT_HANDLE_VALUE_CONFIRMATION   0x1e
7624c1900e6SMatthias Ringwald 
7634c1900e6SMatthias Ringwald 
7644c1900e6SMatthias Ringwald #define ATT_WRITE_COMMAND                0x52
7654c1900e6SMatthias Ringwald #define ATT_SIGNED_WRITE_COMMAND         0xD2
7664c1900e6SMatthias Ringwald 
7674c1900e6SMatthias Ringwald // MARK: ATT Error Codes
7684c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_HANDLE                   0x01
7694c1900e6SMatthias Ringwald #define ATT_ERROR_READ_NOT_PERMITTED               0x02
7704c1900e6SMatthias Ringwald #define ATT_ERROR_WRITE_NOT_PERMITTED              0x03
7714c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_PDU                      0x04
7724c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_AUTHENTICATION      0x05
7734c1900e6SMatthias Ringwald #define ATT_ERROR_REQUEST_NOT_SUPPORTED            0x06
7744c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_OFFSET                   0x07
7754c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_AUTHORIZATION       0x08
7764c1900e6SMatthias Ringwald #define ATT_ERROR_PREPARE_QUEUE_FULL               0x09
7774c1900e6SMatthias Ringwald #define ATT_ERROR_ATTRIBUTE_NOT_FOUND              0x0a
7784c1900e6SMatthias Ringwald #define ATT_ERROR_ATTRIBUTE_NOT_LONG               0x0b
7794c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE 0x0c
7804c1900e6SMatthias Ringwald #define ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LENGTH   0x0d
7814c1900e6SMatthias Ringwald #define ATT_ERROR_UNLIKELY_ERROR                   0x0e
7824c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_ENCRYPTION          0x0f
7834c1900e6SMatthias Ringwald #define ATT_ERROR_UNSUPPORTED_GROUP_TYPE           0x10
7844c1900e6SMatthias Ringwald #define ATT_ERROR_INSUFFICIENT_RESOURCES           0x11
7854c1900e6SMatthias Ringwald 
7864c1900e6SMatthias Ringwald // MARK: Attribute Property Flags
7874c1900e6SMatthias Ringwald #define ATT_PROPERTY_BROADCAST           0x01
7884c1900e6SMatthias Ringwald #define ATT_PROPERTY_READ                0x02
7894c1900e6SMatthias Ringwald #define ATT_PROPERTY_WRITE_WITHOUT_RESPONSE 0x04
7904c1900e6SMatthias Ringwald #define ATT_PROPERTY_WRITE               0x08
7914c1900e6SMatthias Ringwald #define ATT_PROPERTY_NOTIFY              0x10
7924c1900e6SMatthias Ringwald #define ATT_PROPERTY_INDICATE            0x20
7934c1900e6SMatthias Ringwald #define ATT_PROPERTY_AUTHENTICATED_SIGNED_WRITE 0x40
7944c1900e6SMatthias Ringwald #define ATT_PROPERTY_EXTENDED_PROPERTIES 0x80
7954c1900e6SMatthias Ringwald 
7964c1900e6SMatthias Ringwald // MARK: Attribute Property Flag, BTstack extension
7974c1900e6SMatthias Ringwald // value is asked from client
7984c1900e6SMatthias Ringwald #define ATT_PROPERTY_DYNAMIC             0x100
7994c1900e6SMatthias Ringwald // 128 bit UUID used
8004c1900e6SMatthias Ringwald #define ATT_PROPERTY_UUID128             0x200
8014c1900e6SMatthias Ringwald // Authentication required
8024c1900e6SMatthias Ringwald #define ATT_PROPERTY_AUTHENTICATION_REQUIRED 0x400
8034c1900e6SMatthias Ringwald // Authorization from user required
8044c1900e6SMatthias Ringwald #define ATT_PROPERTY_AUTHORIZATION_REQUIRED  0x800
8054c1900e6SMatthias Ringwald // Encryption key size stored in upper 4 bits, 0 == no encryption, encryption key size - 1 otherwise
8064c1900e6SMatthias Ringwald 
8074c1900e6SMatthias Ringwald // ATT Transaction Timeout of 30 seconds for Command/Response or Incidationc/Confirmation
8084c1900e6SMatthias Ringwald #define ATT_TRANSACTION_TIMEOUT_MS     30000
8094c1900e6SMatthias Ringwald 
8104c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_NONE      0x0
8114c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_ACTIVE    0x1
8124c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_EXECUTE   0x2
8134c1900e6SMatthias Ringwald #define ATT_TRANSACTION_MODE_CANCEL    0x3
8144c1900e6SMatthias Ringwald 
8154c1900e6SMatthias Ringwald // MARK: GATT UUIDs
8164c1900e6SMatthias Ringwald #define GATT_PRIMARY_SERVICE_UUID                   0x2800
8174c1900e6SMatthias Ringwald #define GATT_SECONDARY_SERVICE_UUID                 0x2801
8184c1900e6SMatthias Ringwald #define GATT_INCLUDE_SERVICE_UUID                   0x2802
8194c1900e6SMatthias Ringwald #define GATT_CHARACTERISTICS_UUID                   0x2803
8204c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_EXTENDED_PROPERTIES     0x2900
8214c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_USER_DESCRIPTION        0x2901
8224c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION   0x2902
8234c1900e6SMatthias Ringwald #define GATT_SERVER_CHARACTERISTICS_CONFIGURATION   0x2903
8244c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_PRESENTATION_FORMAT     0x2904
8254c1900e6SMatthias Ringwald #define GATT_CHARACTERISTIC_AGGREGATE_FORMAT        0x2905
8264c1900e6SMatthias Ringwald 
8274c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NONE          0
8284c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION  1
8294c1900e6SMatthias Ringwald #define GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION    2
8304c1900e6SMatthias Ringwald 
8314c1900e6SMatthias Ringwald // GAP Service and Characteristics
8324c1900e6SMatthias Ringwald #define GAP_SERVICE_UUID               0x1800
8334c1900e6SMatthias Ringwald #define GAP_DEVICE_NAME_UUID           0x2a00
8344c1900e6SMatthias Ringwald #define GAP_APPEARANCE_UUID            0x2a01
8354c1900e6SMatthias Ringwald #define GAP_PERIPHERAL_PRIVACY_FLAG    0x2a02
8364c1900e6SMatthias Ringwald #define GAP_RECONNECTION_ADDRESS_UUID  0x2a03
8374c1900e6SMatthias Ringwald #define GAP_PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS_UUID 0x2a04
8384c1900e6SMatthias Ringwald 
8394c1900e6SMatthias Ringwald /**
8404c1900e6SMatthias Ringwald  * SM - LE Security Manager
8414c1900e6SMatthias Ringwald  */
8424c1900e6SMatthias Ringwald // Bluetooth Spec definitions
8434c1900e6SMatthias Ringwald typedef enum {
8444c1900e6SMatthias Ringwald     SM_CODE_PAIRING_REQUEST = 0X01,
8454c1900e6SMatthias Ringwald     SM_CODE_PAIRING_RESPONSE,
8464c1900e6SMatthias Ringwald     SM_CODE_PAIRING_CONFIRM,
8474c1900e6SMatthias Ringwald     SM_CODE_PAIRING_RANDOM,
8484c1900e6SMatthias Ringwald     SM_CODE_PAIRING_FAILED,
8494c1900e6SMatthias Ringwald     SM_CODE_ENCRYPTION_INFORMATION,
8504c1900e6SMatthias Ringwald     SM_CODE_MASTER_IDENTIFICATION,
8514c1900e6SMatthias Ringwald     SM_CODE_IDENTITY_INFORMATION,
8524c1900e6SMatthias Ringwald     SM_CODE_IDENTITY_ADDRESS_INFORMATION,
8534c1900e6SMatthias Ringwald     SM_CODE_SIGNING_INFORMATION,
8544c1900e6SMatthias Ringwald     SM_CODE_SECURITY_REQUEST
8554c1900e6SMatthias Ringwald } SECURITY_MANAGER_COMMANDS;
8564c1900e6SMatthias Ringwald 
8574c1900e6SMatthias Ringwald // IO Capability Values
8584c1900e6SMatthias Ringwald typedef enum {
8594c1900e6SMatthias Ringwald     IO_CAPABILITY_DISPLAY_ONLY = 0,
8604c1900e6SMatthias Ringwald     IO_CAPABILITY_DISPLAY_YES_NO,
8614c1900e6SMatthias Ringwald     IO_CAPABILITY_KEYBOARD_ONLY,
8624c1900e6SMatthias Ringwald     IO_CAPABILITY_NO_INPUT_NO_OUTPUT,
8634c1900e6SMatthias Ringwald     IO_CAPABILITY_KEYBOARD_DISPLAY, // not used by secure simple pairing
8644c1900e6SMatthias Ringwald } io_capability_t;
8654c1900e6SMatthias Ringwald 
8664c1900e6SMatthias Ringwald // Authentication requirement flags
8674c1900e6SMatthias Ringwald #define SM_AUTHREQ_NO_BONDING 0x00
8684c1900e6SMatthias Ringwald #define SM_AUTHREQ_BONDING 0x01
8694c1900e6SMatthias Ringwald #define SM_AUTHREQ_MITM_PROTECTION 0x04
8704c1900e6SMatthias Ringwald 
8714c1900e6SMatthias Ringwald // Key distribution flags used by spec
8724c1900e6SMatthias Ringwald #define SM_KEYDIST_ENC_KEY 0X01
8734c1900e6SMatthias Ringwald #define SM_KEYDIST_ID_KEY  0x02
8744c1900e6SMatthias Ringwald #define SM_KEYDIST_SIGN    0x04
8754c1900e6SMatthias Ringwald 
8764c1900e6SMatthias Ringwald // Key distribution flags used internally
8774c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_ENCRYPTION_INFORMATION       0x01
8784c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_MASTER_IDENTIFICATION        0x02
8794c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_IDENTITY_INFORMATION         0x04
8804c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_IDENTITY_ADDRESS_INFORMATION 0x08
8814c1900e6SMatthias Ringwald #define SM_KEYDIST_FLAG_SIGNING_IDENTIFICATION       0x10
8824c1900e6SMatthias Ringwald 
8834c1900e6SMatthias Ringwald // STK Generation Methods
8844c1900e6SMatthias Ringwald #define SM_STK_GENERATION_METHOD_JUST_WORKS 0x01
8854c1900e6SMatthias Ringwald #define SM_STK_GENERATION_METHOD_OOB        0x02
8864c1900e6SMatthias Ringwald #define SM_STK_GENERATION_METHOD_PASSKEY    0x04
8874c1900e6SMatthias Ringwald 
8884c1900e6SMatthias Ringwald // Pairing Failed Reasons
8894c1900e6SMatthias Ringwald #define SM_REASON_RESERVED                     0x00
8904c1900e6SMatthias Ringwald #define SM_REASON_PASSKEYT_ENTRY_FAILED        0x01
8914c1900e6SMatthias Ringwald #define SM_REASON_OOB_NOT_AVAILABLE            0x02
8924c1900e6SMatthias Ringwald #define SM_REASON_AUTHENTHICATION_REQUIREMENTS 0x03
8934c1900e6SMatthias Ringwald #define SM_REASON_CONFIRM_VALUE_FAILED         0x04
8944c1900e6SMatthias Ringwald #define SM_REASON_PAIRING_NOT_SUPPORTED        0x05
8954c1900e6SMatthias Ringwald #define SM_REASON_ENCRYPTION_KEY_SIZE          0x06
8964c1900e6SMatthias Ringwald #define SM_REASON_COMMAND_NOT_SUPPORTED        0x07
8974c1900e6SMatthias Ringwald #define SM_REASON_UNSPECIFIED_REASON           0x08
8984c1900e6SMatthias Ringwald #define SM_REASON_REPEATED_ATTEMPTS            0x09
8994c1900e6SMatthias Ringwald // also, invalid parameters
9004c1900e6SMatthias Ringwald // and reserved
9014c1900e6SMatthias Ringwald 
9024c1900e6SMatthias Ringwald 
90347f4e325SMatthias Ringwald #endif