BlueUSB and Waveplayer merged

Dependencies:   SDFileSystem mbed-rtos mbed wave_player

Fork of z_test_BlueUSBv1 by Stuart Kent

Committer:
ballaw
Date:
Tue Nov 18 22:30:37 2014 +0000
Revision:
4:9ed8c7187958
Parent:
0:606b230e5b4a
dgf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
peterbarrett1967 0:606b230e5b4a 1 /*
peterbarrett1967 0:606b230e5b4a 2 Copyright (c) 2010 Peter Barrett
peterbarrett1967 0:606b230e5b4a 3
peterbarrett1967 0:606b230e5b4a 4 Permission is hereby granted, free of charge, to any person obtaining a copy
peterbarrett1967 0:606b230e5b4a 5 of this software and associated documentation files (the "Software"), to deal
peterbarrett1967 0:606b230e5b4a 6 in the Software without restriction, including without limitation the rights
peterbarrett1967 0:606b230e5b4a 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
peterbarrett1967 0:606b230e5b4a 8 copies of the Software, and to permit persons to whom the Software is
peterbarrett1967 0:606b230e5b4a 9 furnished to do so, subject to the following conditions:
peterbarrett1967 0:606b230e5b4a 10
peterbarrett1967 0:606b230e5b4a 11 The above copyright notice and this permission notice shall be included in
peterbarrett1967 0:606b230e5b4a 12 all copies or substantial portions of the Software.
peterbarrett1967 0:606b230e5b4a 13
peterbarrett1967 0:606b230e5b4a 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
peterbarrett1967 0:606b230e5b4a 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
peterbarrett1967 0:606b230e5b4a 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
peterbarrett1967 0:606b230e5b4a 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
peterbarrett1967 0:606b230e5b4a 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
peterbarrett1967 0:606b230e5b4a 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
peterbarrett1967 0:606b230e5b4a 20 THE SOFTWARE.
peterbarrett1967 0:606b230e5b4a 21 */
peterbarrett1967 0:606b230e5b4a 22
peterbarrett1967 0:606b230e5b4a 23 #ifndef HCI_PRIVATE_H_INCLUDED
peterbarrett1967 0:606b230e5b4a 24 #define HCI_PRIVATE_H_INCLUDED
peterbarrett1967 0:606b230e5b4a 25
peterbarrett1967 0:606b230e5b4a 26 #define HCI_OP_INQUIRY 0x0401
peterbarrett1967 0:606b230e5b4a 27 #define HCI_OP_INQUIRY_CANCEL 0x0402
peterbarrett1967 0:606b230e5b4a 28 #define HCI_OP_EXIT_PERIODIC_INQ 0x0404
peterbarrett1967 0:606b230e5b4a 29 #define HCI_OP_CREATE_CONN 0x0405
peterbarrett1967 0:606b230e5b4a 30 #define HCI_OP_DISCONNECT 0x0406
peterbarrett1967 0:606b230e5b4a 31 #define HCI_OP_ADD_SCO 0x0407
peterbarrett1967 0:606b230e5b4a 32 #define HCI_OP_CREATE_CONN_CANCEL 0x0408
peterbarrett1967 0:606b230e5b4a 33 #define HCI_OP_ACCEPT_CONN_REQ 0x0409
peterbarrett1967 0:606b230e5b4a 34 #define HCI_OP_REJECT_CONN_REQ 0x040a
peterbarrett1967 0:606b230e5b4a 35 #define HCI_OP_LINK_KEY_REPLY 0x040b
peterbarrett1967 0:606b230e5b4a 36 #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
peterbarrett1967 0:606b230e5b4a 37 #define HCI_OP_PIN_CODE_REPLY 0x040d
peterbarrett1967 0:606b230e5b4a 38 #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
peterbarrett1967 0:606b230e5b4a 39 #define HCI_OP_CHANGE_CONN_PTYPE 0x040f
peterbarrett1967 0:606b230e5b4a 40 #define HCI_OP_AUTH_REQUESTED 0x0411
peterbarrett1967 0:606b230e5b4a 41 #define HCI_OP_SET_CONN_ENCRYPT 0x0413
peterbarrett1967 0:606b230e5b4a 42 #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
peterbarrett1967 0:606b230e5b4a 43 #define HCI_OP_REMOTE_NAME_REQ 0x0419
peterbarrett1967 0:606b230e5b4a 44 #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
peterbarrett1967 0:606b230e5b4a 45 #define HCI_OP_READ_REMOTE_FEATURES 0x041b
peterbarrett1967 0:606b230e5b4a 46 #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
peterbarrett1967 0:606b230e5b4a 47 #define HCI_OP_READ_REMOTE_VERSION 0x041d
peterbarrett1967 0:606b230e5b4a 48 #define HCI_OP_SETUP_SYNC_CONN 0x0428
peterbarrett1967 0:606b230e5b4a 49 #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
peterbarrett1967 0:606b230e5b4a 50 #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
peterbarrett1967 0:606b230e5b4a 51
peterbarrett1967 0:606b230e5b4a 52 #define HCI_OP_SNIFF_MODE 0x0803
peterbarrett1967 0:606b230e5b4a 53 #define HCI_OP_EXIT_SNIFF_MODE 0x0804
peterbarrett1967 0:606b230e5b4a 54 #define HCI_OP_ROLE_DISCOVERY 0x0809
peterbarrett1967 0:606b230e5b4a 55 #define HCI_OP_SWITCH_ROLE 0x080b
peterbarrett1967 0:606b230e5b4a 56 #define HCI_OP_READ_LINK_POLICY 0x080c
peterbarrett1967 0:606b230e5b4a 57 #define HCI_OP_WRITE_LINK_POLICY 0x080d
peterbarrett1967 0:606b230e5b4a 58 #define HCI_OP_READ_DEF_LINK_POLICY 0x080e
peterbarrett1967 0:606b230e5b4a 59 #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
peterbarrett1967 0:606b230e5b4a 60 #define HCI_OP_SNIFF_SUBRATE 0x0811
peterbarrett1967 0:606b230e5b4a 61
peterbarrett1967 0:606b230e5b4a 62
peterbarrett1967 0:606b230e5b4a 63 #define HCI_OP_SET_EVENT_MASK 0x0c01
peterbarrett1967 0:606b230e5b4a 64 #define HCI_OP_RESET 0x0c03
peterbarrett1967 0:606b230e5b4a 65 #define HCI_OP_SET_EVENT_FLT 0x0c05
peterbarrett1967 0:606b230e5b4a 66 #define HCI_OP_WRITE_LOCAL_NAME 0x0c13
peterbarrett1967 0:606b230e5b4a 67 #define HCI_OP_READ_LOCAL_NAME 0x0c14
peterbarrett1967 0:606b230e5b4a 68 #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16
peterbarrett1967 0:606b230e5b4a 69 #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
peterbarrett1967 0:606b230e5b4a 70 #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
peterbarrett1967 0:606b230e5b4a 71 #define HCI_OP_READ_AUTH_ENABLE 0x0c1f
peterbarrett1967 0:606b230e5b4a 72 #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20
peterbarrett1967 0:606b230e5b4a 73 #define HCI_OP_READ_ENCRYPT_MODE 0x0c21
peterbarrett1967 0:606b230e5b4a 74 #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22
peterbarrett1967 0:606b230e5b4a 75 #define ENCRYPT_DISABLED 0x00
peterbarrett1967 0:606b230e5b4a 76 #define ENCRYPT_P2P 0x01
peterbarrett1967 0:606b230e5b4a 77 #define ENCRYPT_BOTH 0x02
peterbarrett1967 0:606b230e5b4a 78 #define HCI_OP_READ_CLASS_OF_DEV 0x0c23
peterbarrett1967 0:606b230e5b4a 79 #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24
peterbarrett1967 0:606b230e5b4a 80 #define HCI_OP_READ_VOICE_SETTING 0x0c25
peterbarrett1967 0:606b230e5b4a 81 #define HCI_OP_WRITE_VOICE_SETTING 0x0c26
peterbarrett1967 0:606b230e5b4a 82 #define HCI_OP_HOST_BUFFER_SIZE 0x0c33
peterbarrett1967 0:606b230e5b4a 83 #define HCI_OP_READ_SSP_MODE 0x0c55
peterbarrett1967 0:606b230e5b4a 84 #define HCI_OP_WRITE_SSP_MODE 0x0c56
peterbarrett1967 0:606b230e5b4a 85
peterbarrett1967 0:606b230e5b4a 86 #define HCI_OP_READ_LOCAL_VERSION 0x1001
peterbarrett1967 0:606b230e5b4a 87 #define HCI_OP_READ_LOCAL_COMMANDS 0x1002
peterbarrett1967 0:606b230e5b4a 88 #define HCI_OP_READ_LOCAL_FEATURES 0x1003
peterbarrett1967 0:606b230e5b4a 89 #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
peterbarrett1967 0:606b230e5b4a 90 #define HCI_OP_READ_BUFFER_SIZE 0x1005
peterbarrett1967 0:606b230e5b4a 91 #define HCI_OP_READ_BD_ADDR 0x1009
peterbarrett1967 0:606b230e5b4a 92
peterbarrett1967 0:606b230e5b4a 93 // events
peterbarrett1967 0:606b230e5b4a 94 #define HCI_EV_INQUIRY_COMPLETE 0x01
peterbarrett1967 0:606b230e5b4a 95 #define HCI_EV_INQUIRY_RESULT 0x02
peterbarrett1967 0:606b230e5b4a 96 #define HCI_EV_CONN_COMPLETE 0x03
peterbarrett1967 0:606b230e5b4a 97 #define HCI_EV_CONN_REQUEST 0x04
peterbarrett1967 0:606b230e5b4a 98 #define HCI_EV_DISCONN_COMPLETE 0x05
peterbarrett1967 0:606b230e5b4a 99 #define HCI_EV_AUTH_COMPLETE 0x06
peterbarrett1967 0:606b230e5b4a 100 #define HCI_EV_REMOTE_NAME 0x07
peterbarrett1967 0:606b230e5b4a 101 #define HCI_EV_ENCRYPT_CHANGE 0x08
peterbarrett1967 0:606b230e5b4a 102 #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
peterbarrett1967 0:606b230e5b4a 103 #define HCI_EV_REMOTE_FEATURES 0x0b
peterbarrett1967 0:606b230e5b4a 104 #define HCI_EV_REMOTE_VERSION 0x0c
peterbarrett1967 0:606b230e5b4a 105 #define HCI_EV_QOS_SETUP_COMPLETE 0x0d
peterbarrett1967 0:606b230e5b4a 106 #define HCI_EV_CMD_COMPLETE 0x0e
peterbarrett1967 0:606b230e5b4a 107 #define HCI_EV_CMD_STATUS 0x0f
peterbarrett1967 0:606b230e5b4a 108 #define HCI_EV_ROLE_CHANGE 0x12
peterbarrett1967 0:606b230e5b4a 109 #define HCI_EV_NUM_COMP_PKTS 0x13
peterbarrett1967 0:606b230e5b4a 110 #define HCI_EV_MODE_CHANGE 0x14
peterbarrett1967 0:606b230e5b4a 111 #define HCI_EV_PIN_CODE_REQ 0x16
peterbarrett1967 0:606b230e5b4a 112 #define HCI_EV_LINK_KEY_REQ 0x17
peterbarrett1967 0:606b230e5b4a 113 #define HCI_EV_LINK_KEY_NOTIFY 0x18
peterbarrett1967 0:606b230e5b4a 114 #define HCI_EV_CLOCK_OFFSET 0x1c
peterbarrett1967 0:606b230e5b4a 115 #define HCI_EV_PKT_TYPE_CHANGE 0x1d
peterbarrett1967 0:606b230e5b4a 116 #define HCI_EV_PSCAN_REP_MODE 0x20
peterbarrett1967 0:606b230e5b4a 117 #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
peterbarrett1967 0:606b230e5b4a 118 #define HCI_EV_REMOTE_EXT_FEATURES 0x23
peterbarrett1967 0:606b230e5b4a 119 #define HCI_EV_SYNC_CONN_COMPLETE 0x2c
peterbarrett1967 0:606b230e5b4a 120 #define HCI_EV_SYNC_CONN_CHANGED 0x2d
peterbarrett1967 0:606b230e5b4a 121 #define HCI_EV_SNIFF_SUBRATE 0x2e
peterbarrett1967 0:606b230e5b4a 122 #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
peterbarrett1967 0:606b230e5b4a 123 #define HCI_EV_IO_CAPA_REQUEST 0x31
peterbarrett1967 0:606b230e5b4a 124 #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
peterbarrett1967 0:606b230e5b4a 125 #define HCI_EV_REMOTE_HOST_FEATURES 0x3d
peterbarrett1967 0:606b230e5b4a 126
peterbarrett1967 0:606b230e5b4a 127 /* Possible error codes */
peterbarrett1967 0:606b230e5b4a 128 #define HCI_UNKNOWN_HCI_COMMAND 0x01
peterbarrett1967 0:606b230e5b4a 129 #define HCI_NO_CONNECTION 0x02
peterbarrett1967 0:606b230e5b4a 130 #define HCI_HW_FAILURE 0x03
peterbarrett1967 0:606b230e5b4a 131 #define HCI_PAGE_TIMEOUT 0x04
peterbarrett1967 0:606b230e5b4a 132 #define HCI_AUTHENTICATION_FAILURE 0x05
peterbarrett1967 0:606b230e5b4a 133 #define HCI_KEY_MISSING 0x06
peterbarrett1967 0:606b230e5b4a 134 #define HCI_MEMORY_FULL 0x07
peterbarrett1967 0:606b230e5b4a 135 #define HCI_CONN_TIMEOUT 0x08
peterbarrett1967 0:606b230e5b4a 136 #define HCI_MAX_NUMBER_OF_CONNECTIONS 0x09
peterbarrett1967 0:606b230e5b4a 137 #define HCI_MAX_NUMBER_OF_SCO_CONNECTIONS_TO_DEVICE 0x0A
peterbarrett1967 0:606b230e5b4a 138 #define HCI_ACL_CONNECTION_EXISTS 0x0B
peterbarrett1967 0:606b230e5b4a 139 #define HCI_COMMAND_DISSALLOWED 0x0C
peterbarrett1967 0:606b230e5b4a 140 #define HCI_HOST_REJECTED_DUE_TO_LIMITED_RESOURCES 0x0D
peterbarrett1967 0:606b230e5b4a 141 #define HCI_HOST_REJECTED_DUE_TO_SECURITY_REASONS 0x0E
peterbarrett1967 0:606b230e5b4a 142 #define HCI_HOST_REJECTED_DUE_TO_REMOTE_DEVICE_ONLY_PERSONAL_SERVICE 0x0F
peterbarrett1967 0:606b230e5b4a 143 #define HCI_HOST_TIMEOUT 0x10
peterbarrett1967 0:606b230e5b4a 144 #define HCI_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE 0x11
peterbarrett1967 0:606b230e5b4a 145 #define HCI_INVALID_HCI_COMMAND_PARAMETERS 0x12
peterbarrett1967 0:606b230e5b4a 146 #define HCI_OTHER_END_TERMINATED_CONN_USER_ENDED 0x13
peterbarrett1967 0:606b230e5b4a 147 #define HCI_OTHER_END_TERMINATED_CONN_LOW_RESOURCES 0x14
peterbarrett1967 0:606b230e5b4a 148 #define HCI_OTHER_END_TERMINATED_CONN_ABOUT_TO_POWER_OFF 0x15
peterbarrett1967 0:606b230e5b4a 149 #define HCI_CONN_TERMINATED_BY_LOCAL_HOST 0x16
peterbarrett1967 0:606b230e5b4a 150 #define HCI_REPETED_ATTEMPTS 0x17
peterbarrett1967 0:606b230e5b4a 151 #define HCI_PAIRING_NOT_ALLOWED 0x18
peterbarrett1967 0:606b230e5b4a 152 #define HCI_UNKNOWN_LMP_PDU 0x19
peterbarrett1967 0:606b230e5b4a 153 #define HCI_UNSUPPORTED_REMOTE_FEATURE 0x1A
peterbarrett1967 0:606b230e5b4a 154 #define HCI_SCO_OFFSET_REJECTED 0x1B
peterbarrett1967 0:606b230e5b4a 155 #define HCI_SCO_INTERVAL_REJECTED 0x1C
peterbarrett1967 0:606b230e5b4a 156 #define HCI_SCO_AIR_MODE_REJECTED 0x1D
peterbarrett1967 0:606b230e5b4a 157 #define HCI_INVALID_LMP_PARAMETERS 0x1E
peterbarrett1967 0:606b230e5b4a 158 #define HCI_UNSPECIFIED_ERROR 0x1F
peterbarrett1967 0:606b230e5b4a 159 #define HCI_UNSUPPORTED_LMP_PARAMETER_VALUE 0x20
peterbarrett1967 0:606b230e5b4a 160 #define HCI_ROLE_CHANGE_NOT_ALLOWED 0x21
peterbarrett1967 0:606b230e5b4a 161 #define HCI_LMP_RESPONSE_TIMEOUT 0x22
peterbarrett1967 0:606b230e5b4a 162 #define HCI_LMP_ERROR_TRANSACTION_COLLISION 0x23
peterbarrett1967 0:606b230e5b4a 163 #define HCI_LMP_PDU_NOT_ALLOWED 0x24
peterbarrett1967 0:606b230e5b4a 164 #define HCI_ENCRYPTION_MODE_NOT_ACCEPTABLE 0x25
peterbarrett1967 0:606b230e5b4a 165 #define HCI_UNIT_KEY_USED 0x26
peterbarrett1967 0:606b230e5b4a 166 #define HCI_QOS_NOT_SUPPORTED 0x27
peterbarrett1967 0:606b230e5b4a 167 #define HCI_INSTANT_PASSED 0x28
peterbarrett1967 0:606b230e5b4a 168 #define HCI_PAIRING_UNIT_KEY_NOT_SUPPORTED 0x29
peterbarrett1967 0:606b230e5b4a 169
peterbarrett1967 0:606b230e5b4a 170 const char* EvtStr(int evt)
peterbarrett1967 0:606b230e5b4a 171 {
peterbarrett1967 0:606b230e5b4a 172 switch (evt)
peterbarrett1967 0:606b230e5b4a 173 {
peterbarrett1967 0:606b230e5b4a 174 case HCI_EV_INQUIRY_COMPLETE: return "HCI_EV_INQUIRY_COMPLETE";
peterbarrett1967 0:606b230e5b4a 175 case HCI_EV_INQUIRY_RESULT: return "HCI_EV_INQUIRY_RESULT";
peterbarrett1967 0:606b230e5b4a 176 case HCI_EV_CONN_COMPLETE: return "HCI_EV_CONN_COMPLETE";
peterbarrett1967 0:606b230e5b4a 177 case HCI_EV_CONN_REQUEST: return "HCI_EV_CONN_REQUEST";
peterbarrett1967 0:606b230e5b4a 178 case HCI_EV_DISCONN_COMPLETE: return "HCI_EV_DISCONN_COMPLETE";
peterbarrett1967 0:606b230e5b4a 179 case HCI_EV_AUTH_COMPLETE: return "HCI_EV_AUTH_COMPLETE";
peterbarrett1967 0:606b230e5b4a 180 case HCI_EV_REMOTE_NAME: return "HCI_EV_REMOTE_NAME";
peterbarrett1967 0:606b230e5b4a 181 case HCI_EV_ENCRYPT_CHANGE: return "HCI_EV_ENCRYPT_CHANGE";
peterbarrett1967 0:606b230e5b4a 182 case HCI_EV_CHANGE_LINK_KEY_COMPLETE : return "HCI_EV_CHANGE_LINK_KEY_COMPLETE";
peterbarrett1967 0:606b230e5b4a 183 case HCI_EV_REMOTE_FEATURES: return "HCI_EV_REMOTE_FEATURES";
peterbarrett1967 0:606b230e5b4a 184 case HCI_EV_REMOTE_VERSION: return "HCI_EV_REMOTE_VERSION";
peterbarrett1967 0:606b230e5b4a 185 case HCI_EV_QOS_SETUP_COMPLETE : return "HCI_EV_QOS_SETUP_COMPLETE";
peterbarrett1967 0:606b230e5b4a 186 case HCI_EV_CMD_COMPLETE: return "HCI_EV_CMD_COMPLETE";
peterbarrett1967 0:606b230e5b4a 187 case HCI_EV_CMD_STATUS: return "HCI_EV_CMD_STATUS";
peterbarrett1967 0:606b230e5b4a 188 case HCI_EV_ROLE_CHANGE: return "HCI_EV_ROLE_CHANGE";
peterbarrett1967 0:606b230e5b4a 189 case HCI_EV_NUM_COMP_PKTS: return "HCI_EV_NUM_COMP_PKTS";
peterbarrett1967 0:606b230e5b4a 190 case HCI_EV_MODE_CHANGE: return "HCI_EV_MODE_CHANGE";
peterbarrett1967 0:606b230e5b4a 191 case HCI_EV_PIN_CODE_REQ: return "HCI_EV_PIN_CODE_REQ";
peterbarrett1967 0:606b230e5b4a 192 case HCI_EV_LINK_KEY_REQ: return "HCI_EV_LINK_KEY_REQ";
peterbarrett1967 0:606b230e5b4a 193 case HCI_EV_LINK_KEY_NOTIFY: return "HCI_EV_LINK_KEY_NOTIFY";
peterbarrett1967 0:606b230e5b4a 194 case HCI_EV_CLOCK_OFFSET: return "HCI_EV_CLOCK_OFFSET";
peterbarrett1967 0:606b230e5b4a 195 case HCI_EV_PKT_TYPE_CHANGE: return "HCI_EV_PKT_TYPE_CHANGE";
peterbarrett1967 0:606b230e5b4a 196 case HCI_EV_PSCAN_REP_MODE: return "HCI_EV_PSCAN_REP_MODE";
peterbarrett1967 0:606b230e5b4a 197 case HCI_EV_INQUIRY_RESULT_WITH_RSSI : return "HCI_EV_INQUIRY_RESULT_WITH_RSSI";
peterbarrett1967 0:606b230e5b4a 198 case HCI_EV_REMOTE_EXT_FEATURES: return "HCI_EV_REMOTE_EXT_FEATURES";
peterbarrett1967 0:606b230e5b4a 199 case HCI_EV_SYNC_CONN_COMPLETE: return "HCI_EV_SYNC_CONN_COMPLETE";
peterbarrett1967 0:606b230e5b4a 200 case HCI_EV_SYNC_CONN_CHANGED: return "HCI_EV_SYNC_CONN_CHANGED";
peterbarrett1967 0:606b230e5b4a 201 case HCI_EV_SNIFF_SUBRATE: return "HCI_EV_SNIFF_SUBRATE";
peterbarrett1967 0:606b230e5b4a 202 case HCI_EV_EXTENDED_INQUIRY_RESULT: return "HCI_EV_EXTENDED_INQUIRY_RESULT";
peterbarrett1967 0:606b230e5b4a 203 case HCI_EV_IO_CAPA_REQUEST: return "HCI_EV_IO_CAPA_REQUEST";
peterbarrett1967 0:606b230e5b4a 204 case HCI_EV_SIMPLE_PAIR_COMPLETE: return "HCI_EV_SIMPLE_PAIR_COMPLETE";
peterbarrett1967 0:606b230e5b4a 205 case HCI_EV_REMOTE_HOST_FEATURES: return "HCI_EV_REMOTE_HOST_FEATURES";
peterbarrett1967 0:606b230e5b4a 206 }
peterbarrett1967 0:606b230e5b4a 207 return "Unknown Event";
peterbarrett1967 0:606b230e5b4a 208 }
peterbarrett1967 0:606b230e5b4a 209
peterbarrett1967 0:606b230e5b4a 210 const char* CmdStr(int cmd)
peterbarrett1967 0:606b230e5b4a 211 {
peterbarrett1967 0:606b230e5b4a 212 switch (cmd)
peterbarrett1967 0:606b230e5b4a 213 {
peterbarrett1967 0:606b230e5b4a 214 // 0x04XX
peterbarrett1967 0:606b230e5b4a 215 case HCI_OP_INQUIRY: return "HCI_OP_INQUIRY";
peterbarrett1967 0:606b230e5b4a 216 case HCI_OP_INQUIRY_CANCEL: return "HCI_OP_INQUIRY_CANCEL";
peterbarrett1967 0:606b230e5b4a 217 case HCI_OP_EXIT_PERIODIC_INQ: return "HCI_OP_EXIT_PERIODIC_INQ";
peterbarrett1967 0:606b230e5b4a 218 case HCI_OP_CREATE_CONN: return "HCI_OP_CREATE_CONN";
peterbarrett1967 0:606b230e5b4a 219 case HCI_OP_DISCONNECT: return "HCI_OP_DISCONNECT";
peterbarrett1967 0:606b230e5b4a 220 case HCI_OP_ADD_SCO: return "HCI_OP_ADD_SCO";
peterbarrett1967 0:606b230e5b4a 221 case HCI_OP_CREATE_CONN_CANCEL: return "HCI_OP_CREATE_CONN_CANCEL";
peterbarrett1967 0:606b230e5b4a 222 case HCI_OP_ACCEPT_CONN_REQ: return "HCI_OP_ACCEPT_CONN_REQ";
peterbarrett1967 0:606b230e5b4a 223 case HCI_OP_REJECT_CONN_REQ: return "HCI_OP_REJECT_CONN_REQ";
peterbarrett1967 0:606b230e5b4a 224 case HCI_OP_LINK_KEY_REPLY: return "HCI_OP_LINK_KEY_REPLY";
peterbarrett1967 0:606b230e5b4a 225 case HCI_OP_LINK_KEY_NEG_REPLY: return "HCI_OP_LINK_KEY_NEG_REPLY";
peterbarrett1967 0:606b230e5b4a 226 case HCI_OP_PIN_CODE_REPLY: return "HCI_OP_PIN_CODE_REPLY";
peterbarrett1967 0:606b230e5b4a 227 case HCI_OP_PIN_CODE_NEG_REPLY: return "HCI_OP_PIN_CODE_NEG_REPLY";
peterbarrett1967 0:606b230e5b4a 228 case HCI_OP_CHANGE_CONN_PTYPE: return "HCI_OP_CHANGE_CONN_PTYPE";
peterbarrett1967 0:606b230e5b4a 229 case HCI_OP_AUTH_REQUESTED: return "HCI_OP_AUTH_REQUESTED";
peterbarrett1967 0:606b230e5b4a 230 case HCI_OP_SET_CONN_ENCRYPT: return "HCI_OP_SET_CONN_ENCRYPT";
peterbarrett1967 0:606b230e5b4a 231 case HCI_OP_CHANGE_CONN_LINK_KEY: return "HCI_OP_CHANGE_CONN_LINK_KEY";
peterbarrett1967 0:606b230e5b4a 232 case HCI_OP_REMOTE_NAME_REQ: return "HCI_OP_REMOTE_NAME_REQ";
peterbarrett1967 0:606b230e5b4a 233 case HCI_OP_REMOTE_NAME_REQ_CANCEL: return "HCI_OP_REMOTE_NAME_REQ_CANCEL";
peterbarrett1967 0:606b230e5b4a 234 case HCI_OP_READ_REMOTE_FEATURES: return "HCI_OP_READ_REMOTE_FEATURES";
peterbarrett1967 0:606b230e5b4a 235 case HCI_OP_READ_REMOTE_EXT_FEATURES: return "HCI_OP_READ_REMOTE_EXT_FEATURES";
peterbarrett1967 0:606b230e5b4a 236 case HCI_OP_READ_REMOTE_VERSION: return "HCI_OP_READ_REMOTE_VERSION";
peterbarrett1967 0:606b230e5b4a 237 case HCI_OP_SETUP_SYNC_CONN: return "HCI_OP_SETUP_SYNC_CONN";
peterbarrett1967 0:606b230e5b4a 238 case HCI_OP_ACCEPT_SYNC_CONN_REQ: return "HCI_OP_ACCEPT_SYNC_CONN_REQ";
peterbarrett1967 0:606b230e5b4a 239 case HCI_OP_REJECT_SYNC_CONN_REQ: return "HCI_OP_REJECT_SYNC_CONN_REQ";
peterbarrett1967 0:606b230e5b4a 240 // 0x0CXX
peterbarrett1967 0:606b230e5b4a 241 case HCI_OP_SET_EVENT_MASK: return "HCI_OP_SET_EVENT_MASK";
peterbarrett1967 0:606b230e5b4a 242 case HCI_OP_RESET: return "HCI_OP_RESET";
peterbarrett1967 0:606b230e5b4a 243 case HCI_OP_SET_EVENT_FLT: return "HCI_OP_SET_EVENT_FLT";
peterbarrett1967 0:606b230e5b4a 244 case HCI_OP_WRITE_LOCAL_NAME: return "HCI_OP_WRITE_LOCAL_NAME";
peterbarrett1967 0:606b230e5b4a 245 case HCI_OP_READ_LOCAL_NAME: return "HCI_OP_READ_LOCAL_NAME";
peterbarrett1967 0:606b230e5b4a 246 case HCI_OP_WRITE_CA_TIMEOUT: return "HCI_OP_WRITE_CA_TIMEOUT";
peterbarrett1967 0:606b230e5b4a 247 case HCI_OP_WRITE_PG_TIMEOUT: return "HCI_OP_WRITE_PG_TIMEOUT";
peterbarrett1967 0:606b230e5b4a 248 case HCI_OP_WRITE_SCAN_ENABLE: return "HCI_OP_WRITE_SCAN_ENABLE";
peterbarrett1967 0:606b230e5b4a 249 case HCI_OP_READ_AUTH_ENABLE: return "HCI_OP_READ_AUTH_ENABLE";
peterbarrett1967 0:606b230e5b4a 250 case HCI_OP_WRITE_AUTH_ENABLE: return "HCI_OP_WRITE_AUTH_ENABLE";
peterbarrett1967 0:606b230e5b4a 251 case HCI_OP_READ_ENCRYPT_MODE: return "HCI_OP_READ_ENCRYPT_MODE";
peterbarrett1967 0:606b230e5b4a 252 case HCI_OP_WRITE_ENCRYPT_MODE: return "HCI_OP_WRITE_ENCRYPT_MODE";
peterbarrett1967 0:606b230e5b4a 253 case HCI_OP_READ_CLASS_OF_DEV: return "HCI_OP_READ_CLASS_OF_DEV";
peterbarrett1967 0:606b230e5b4a 254 case HCI_OP_WRITE_CLASS_OF_DEV: return "HCI_OP_WRITE_CLASS_OF_DEV";
peterbarrett1967 0:606b230e5b4a 255 case HCI_OP_READ_VOICE_SETTING: return "HCI_OP_READ_VOICE_SETTING";
peterbarrett1967 0:606b230e5b4a 256 case HCI_OP_WRITE_VOICE_SETTING: return "HCI_OP_WRITE_VOICE_SETTING";
peterbarrett1967 0:606b230e5b4a 257 case HCI_OP_HOST_BUFFER_SIZE: return "HCI_OP_HOST_BUFFER_SIZE";
peterbarrett1967 0:606b230e5b4a 258 case HCI_OP_READ_SSP_MODE: return "HCI_OP_READ_SSP_MODE";
peterbarrett1967 0:606b230e5b4a 259 case HCI_OP_WRITE_SSP_MODE: return "HCI_OP_WRITE_SSP_MODE";
peterbarrett1967 0:606b230e5b4a 260
peterbarrett1967 0:606b230e5b4a 261 // 10xx
peterbarrett1967 0:606b230e5b4a 262 case HCI_OP_READ_LOCAL_VERSION: return "HCI_OP_READ_LOCAL_VERSION";
peterbarrett1967 0:606b230e5b4a 263 case HCI_OP_READ_LOCAL_COMMANDS: return "HCI_OP_READ_LOCAL_COMMANDS";
peterbarrett1967 0:606b230e5b4a 264 case HCI_OP_READ_LOCAL_FEATURES: return "HCI_OP_READ_LOCAL_FEATURES";
peterbarrett1967 0:606b230e5b4a 265 case HCI_OP_READ_LOCAL_EXT_FEATURES: return "HCI_OP_READ_LOCAL_EXT_FEATURES";
peterbarrett1967 0:606b230e5b4a 266 case HCI_OP_READ_BUFFER_SIZE: return "HCI_OP_READ_BUFFER_SIZE";
peterbarrett1967 0:606b230e5b4a 267 case HCI_OP_READ_BD_ADDR: return "HCI_OP_READ_BD_ADDR";
peterbarrett1967 0:606b230e5b4a 268 }
peterbarrett1967 0:606b230e5b4a 269 return "Unknown Cmd";
peterbarrett1967 0:606b230e5b4a 270 }
peterbarrett1967 0:606b230e5b4a 271
peterbarrett1967 0:606b230e5b4a 272 const char* HCIErrStr(int err)
peterbarrett1967 0:606b230e5b4a 273 {
peterbarrett1967 0:606b230e5b4a 274 switch (err)
peterbarrett1967 0:606b230e5b4a 275 {
peterbarrett1967 0:606b230e5b4a 276 case 0: return "OK";
peterbarrett1967 0:606b230e5b4a 277 case HCI_UNKNOWN_HCI_COMMAND: return "HCI_UNKNOWN_HCI_COMMAND";
peterbarrett1967 0:606b230e5b4a 278 case HCI_NO_CONNECTION: return "HCI_NO_CONNECTION";
peterbarrett1967 0:606b230e5b4a 279 case HCI_HW_FAILURE: return "HCI_HW_FAILURE";
peterbarrett1967 0:606b230e5b4a 280 case HCI_PAGE_TIMEOUT: return "HCI_PAGE_TIMEOUT";
peterbarrett1967 0:606b230e5b4a 281 case HCI_AUTHENTICATION_FAILURE: return "HCI_AUTHENTICATION_FAILURE";
peterbarrett1967 0:606b230e5b4a 282 case HCI_KEY_MISSING: return "HCI_KEY_MISSING";
peterbarrett1967 0:606b230e5b4a 283 case HCI_MEMORY_FULL: return "HCI_MEMORY_FULL";
peterbarrett1967 0:606b230e5b4a 284 case HCI_CONN_TIMEOUT: return "HCI_CONN_TIMEOUT";
peterbarrett1967 0:606b230e5b4a 285 case HCI_MAX_NUMBER_OF_CONNECTIONS: return "HCI_CONN_TIMEOUT";
peterbarrett1967 0:606b230e5b4a 286 case HCI_MAX_NUMBER_OF_SCO_CONNECTIONS_TO_DEVICE: return "HCI_MAX_NUMBER_OF_SCO_CONNECTIONS_TO_DEVICE";
peterbarrett1967 0:606b230e5b4a 287 case HCI_ACL_CONNECTION_EXISTS: return "HCI_ACL_CONNECTION_EXISTS";
peterbarrett1967 0:606b230e5b4a 288 case HCI_COMMAND_DISSALLOWED: return "HCI_COMMAND_DISSALLOWED";
peterbarrett1967 0:606b230e5b4a 289 case HCI_HOST_REJECTED_DUE_TO_LIMITED_RESOURCES: return "HCI_HOST_REJECTED_DUE_TO_LIMITED_RESOURCES";
peterbarrett1967 0:606b230e5b4a 290 case HCI_HOST_REJECTED_DUE_TO_SECURITY_REASONS: return "HCI_HOST_REJECTED_DUE_TO_SECURITY_REASONS";
peterbarrett1967 0:606b230e5b4a 291 case HCI_HOST_REJECTED_DUE_TO_REMOTE_DEVICE_ONLY_PERSONAL_SERVICE: return "HCI_HOST_REJECTED_DUE_TO_REMOTE_DEVICE_ONLY_PERSONAL_SERVICE";
peterbarrett1967 0:606b230e5b4a 292 case HCI_HOST_TIMEOUT: return "HCI_HOST_TIMEOUT";
peterbarrett1967 0:606b230e5b4a 293 case HCI_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE: return "HCI_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE";
peterbarrett1967 0:606b230e5b4a 294 case HCI_INVALID_HCI_COMMAND_PARAMETERS: return "HCI_INVALID_HCI_COMMAND_PARAMETERS";
peterbarrett1967 0:606b230e5b4a 295 case HCI_OTHER_END_TERMINATED_CONN_USER_ENDED: return "HCI_OTHER_END_TERMINATED_CONN_USER_ENDED";
peterbarrett1967 0:606b230e5b4a 296 case HCI_OTHER_END_TERMINATED_CONN_LOW_RESOURCES: return "HCI_OTHER_END_TERMINATED_CONN_LOW_RESOURCES";
peterbarrett1967 0:606b230e5b4a 297 case HCI_OTHER_END_TERMINATED_CONN_ABOUT_TO_POWER_OFF: return "HCI_OTHER_END_TERMINATED_CONN_ABOUT_TO_POWER_OFF";
peterbarrett1967 0:606b230e5b4a 298 case HCI_CONN_TERMINATED_BY_LOCAL_HOST: return "HCI_CONN_TERMINATED_BY_LOCAL_HOST";
peterbarrett1967 0:606b230e5b4a 299 case HCI_REPETED_ATTEMPTS: return "HCI_REPETED_ATTEMPTS";
peterbarrett1967 0:606b230e5b4a 300 case HCI_PAIRING_NOT_ALLOWED: return "HCI_PAIRING_NOT_ALLOWED";
peterbarrett1967 0:606b230e5b4a 301 case HCI_UNKNOWN_LMP_PDU: return "HCI_UNKNOWN_LMP_PDU";
peterbarrett1967 0:606b230e5b4a 302 case HCI_UNSUPPORTED_REMOTE_FEATURE: return "HCI_UNSUPPORTED_REMOTE_FEATURE";
peterbarrett1967 0:606b230e5b4a 303 case HCI_SCO_OFFSET_REJECTED: return "HCI_SCO_OFFSET_REJECTED";
peterbarrett1967 0:606b230e5b4a 304 case HCI_SCO_INTERVAL_REJECTED: return "HCI_SCO_INTERVAL_REJECTED";
peterbarrett1967 0:606b230e5b4a 305 case HCI_SCO_AIR_MODE_REJECTED: return "HCI_SCO_AIR_MODE_REJECTED";
peterbarrett1967 0:606b230e5b4a 306 case HCI_INVALID_LMP_PARAMETERS: return "HCI_INVALID_LMP_PARAMETERS";
peterbarrett1967 0:606b230e5b4a 307 case HCI_UNSPECIFIED_ERROR: return "HCI_UNSPECIFIED_ERROR";
peterbarrett1967 0:606b230e5b4a 308 case HCI_UNSUPPORTED_LMP_PARAMETER_VALUE: return "HCI_UNSUPPORTED_LMP_PARAMETER_VALUE";
peterbarrett1967 0:606b230e5b4a 309 case HCI_ROLE_CHANGE_NOT_ALLOWED: return "HCI_ROLE_CHANGE_NOT_ALLOWED";
peterbarrett1967 0:606b230e5b4a 310 case HCI_LMP_RESPONSE_TIMEOUT: return "HCI_LMP_RESPONSE_TIMEOUT";
peterbarrett1967 0:606b230e5b4a 311 case HCI_LMP_ERROR_TRANSACTION_COLLISION: return "HCI_LMP_ERROR_TRANSACTION_COLLISION";
peterbarrett1967 0:606b230e5b4a 312 case HCI_LMP_PDU_NOT_ALLOWED: return "HCI_LMP_PDU_NOT_ALLOWED";
peterbarrett1967 0:606b230e5b4a 313 case HCI_ENCRYPTION_MODE_NOT_ACCEPTABLE: return "HCI_ENCRYPTION_MODE_NOT_ACCEPTABLE";
peterbarrett1967 0:606b230e5b4a 314 case HCI_UNIT_KEY_USED: return "HCI_UNIT_KEY_USED";
peterbarrett1967 0:606b230e5b4a 315 case HCI_QOS_NOT_SUPPORTED: return "HCI_QOS_NOT_SUPPORTED";
peterbarrett1967 0:606b230e5b4a 316 case HCI_INSTANT_PASSED: return "HCI_INSTANT_PASSED";
peterbarrett1967 0:606b230e5b4a 317 case HCI_PAIRING_UNIT_KEY_NOT_SUPPORTED: return "HCI_PAIRING_UNIT_KEY_NOT_SUPPORTED";
peterbarrett1967 0:606b230e5b4a 318 };
peterbarrett1967 0:606b230e5b4a 319 return "Unknow HCI err";
peterbarrett1967 0:606b230e5b4a 320 };
peterbarrett1967 0:606b230e5b4a 321
peterbarrett1967 0:606b230e5b4a 322
peterbarrett1967 0:606b230e5b4a 323 #endif // HCI_PRIVATE_H_INCLUDED