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