local fix version of myBlueUSB (http://mbed.org/users/networker/code/myBlueUSB/). - merge deleted files which are required to compile. - enable echo back of received data via RFCOMM.

Dependencies:   AvailableMemory FatFileSystem mbed myUSBHost

Committer:
nobukuma
Date:
Sun Dec 08 21:52:09 2013 +0000
Revision:
2:9f25a7fa1a54
Parent:
0:003889bc474f
???BT??????????????????; ?????????????????

Who changed what in which revision?

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