1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _CS_ADP_TYPE_H_ 16 #define _CS_ADP_TYPE_H_ 17 18 #include"bt_types_def.h" 19 #include"cs_bt_msg.h" 20 21 22 typedef struct{ 23 U8 *data; 24 U16 len; 25 } host_data_struct; 26 27 #define SIZE_OF_LINKKEY 16 28 29 30 typedef uint8_t AppBtScanMode; 31 32 #define BT_NOSCAN 0x00 /* discoverable and connectable are closed*/ 33 #define BT_DISCOVERABLE 0x01 /* discoverable is open but not connectable */ 34 #define BT_CONNECTABLE 0x02 /* connectable is open but not discoverable */ 35 #define BT_ALLSCAN 0x03 /* discoverable and connectable are opened*/ 36 #define BT_LIMITED_ALLSCAN 0x13 /* discoverable and connectable are limited*/ 37 38 39 typedef struct AppBtAccessModeInfo 40 { 41 U16 inqInterval; /* inquiry scan interval */ 42 U16 inqWindow; /* inquiry scan window */ 43 U16 pageInterval; /* page scan interval */ 44 U16 pageWindow; /* page scan window */ 45 } AppBtAccessModeInfo; 46 47 typedef U16 AppBtLinkPolicy; 48 49 #define BT_DISABLE_ALL 0x0000 50 #define BT_ALLOW_ROLE_SWITCH 0x0001 51 #define BT_HOLD_MODE 0x0002 52 #define BT_SNIFF_MODE 0x0004 53 #define BT_PARK_MODE 0x0008 54 #define BT_SCATTER_MODE 0x0010 55 56 57 typedef struct AppBtSniffInfo 58 { 59 U16 maxInterval; 60 U16 minInterval; 61 U16 attempt; 62 U16 timeout; 63 } AppBtSniffInfo; 64 65 #ifndef TimeT 66 typedef U32 TimeT; 67 #endif 68 69 typedef U32 bt_class_of_device; 70 /*************************** 71 * service class fields 72 ***************************/ 73 #define BTM_COD_SERVICE_LMTD_DISCOVER 0x00002000 74 #define BTM_COD_SERVICE_POSITIONING 0x00010000 75 #define BTM_COD_SERVICE_NETWORKING 0x00020000 76 #define BTM_COD_SERVICE_RENDERING 0x00040000 77 #define BTM_COD_SERVICE_CAPTURING 0x00080000 78 #define BTM_COD_SERVICE_OBJ_TRANSFER 0x00100000 79 #define BTM_COD_SERVICE_AUDIO 0x00200000 80 #define BTM_COD_SERVICE_TELEPHONY 0x00400000 81 #define BTM_COD_SERVICE_INFORMATION 0x00800000 82 83 /*************************** 84 * major service class fields. select one 85 ***************************/ 86 #define BTM_COD_MAJOR_MISCELLANEOUS 0x00000000 87 #define BTM_COD_MAJOR_COMPUTER 0x00000100 88 #define BTM_COD_MAJOR_PHONE 0x00000200 89 #define BTM_COD_MAJOR_LAN_ACCESS_PT 0x00000300 90 #define BTM_COD_MAJOR_AUDIO 0x00000400 91 #define BTM_COD_MAJOR_PERIPHERAL 0x00000500 92 #define BTM_COD_MAJOR_IMAGING 0x00000600 93 #define BTM_COD_MAJOR_WEARABLE 0x00000700 94 #define BTM_COD_MAJOR_TOY 0x00000800 95 #define BTM_COD_MAJOR_HEALTH 0x00000900 96 #define BTM_COD_MAJOR_UNCLASSIFIED 0x00001F00 97 98 99 100 /* minor device class field for Computer Major Class */ 101 #define BTM_COD_MINOR_UNCLASSIFIED 0x00000000 102 #define BTM_COD_MINOR_DESKTOP_WORKSTATION 0x00000004 103 #define BTM_COD_MINOR_SERVER_COMPUTER 0x00000008 104 #define BTM_COD_MINOR_LAPTOP 0x0000000C 105 #define BTM_COD_MINOR_HANDHELD_PC_PDA 0x00000010 /* clam shell */ 106 #define BTM_COD_MINOR_PALM_SIZE_PC_PDA 0x00000014 107 #define BTM_COD_MINOR_WEARABLE_COMPUTER 0x00000018/* watch sized */ 108 109 110 /* minor device class field for Phone Major Class */ 111 #define BTM_COD_MINOR_UNCLASSIFIED 0x00000000 112 #define BTM_COD_MINOR_CELLULAR 0x00000004 113 #define BTM_COD_MINOR_CORDLESS 0x00000008 114 #define BTM_COD_MINOR_SMART_PHONE 0x0000000C 115 /* wired modem or voice gatway */ 116 #define BTM_COD_MINOR_WIRED_MDM_V_GTWY 0x00000010 117 #define BTM_COD_MINOR_ISDN_ACCESS 0x00000014 118 119 120 /* minor device class field for LAN Access Point Major Class */ 121 /* Load Factor Field bit 5-7 */ 122 #define BTM_COD_MINOR_FULLY_AVAILABLE 0x00000000 123 #define BTM_COD_MINOR_1_17_UTILIZED 0x00000020 124 #define BTM_COD_MINOR_17_33_UTILIZED 0x00000040 125 #define BTM_COD_MINOR_33_50_UTILIZED 0x00000060 126 #define BTM_COD_MINOR_50_67_UTILIZED 0x00000080 127 #define BTM_COD_MINOR_67_83_UTILIZED 0x000000A0 128 #define BTM_COD_MINOR_83_99_UTILIZED 0x000000C0 129 #define BTM_COD_MINOR_NO_SERVICE_AVAILABLE 0x000000E0 130 131 132 /* minor device class field for Audio/Video Major Class */ 133 #define BTM_COD_MINOR_UNCLASSIFIED 0x00000000 134 #define BTM_COD_MINOR_CONFM_HEADSET 0x00000004 135 #define BTM_COD_MINOR_CONFM_HANDSFREE 0x00000008 136 #define BTM_COD_MINOR_MICROPHONE 0x00000010 137 #define BTM_COD_MINOR_LOUDSPEAKER 0x00000014 138 #define BTM_COD_MINOR_HEADPHONES 0x00000018 139 #define BTM_COD_MINOR_PORTABLE_AUDIO 0x0000001C 140 #define BTM_COD_MINOR_CAR_AUDIO 0x00000020 141 #define BTM_COD_MINOR_SET_TOP_BOX 0x00000024 142 #define BTM_COD_MINOR_HIFI_AUDIO 0x00000028 143 #define BTM_COD_MINOR_VCR 0x0000002C 144 #define BTM_COD_MINOR_VIDEO_CAMERA 0x00000030 145 #define BTM_COD_MINOR_CAMCORDER 0x00000034 146 #define BTM_COD_MINOR_VIDEO_MONITOR 0x00000038 147 #define BTM_COD_MINOR_VIDDISP_LDSPKR 0x0000003C 148 #define BTM_COD_MINOR_VIDEO_CONFERENCING 0x00000040 149 #define BTM_COD_MINOR_GAMING_TOY 0x00000048 150 151 152 /* minor device class field for Peripheral Major Class */ 153 /* Bits 6-7 independently specify mouse, keyboard, or combo mouse/keyboard */ 154 #define BTM_COD_MINOR_KEYBOARD 0x00000040 155 #define BTM_COD_MINOR_POINTING 0x00000080 156 #define BTM_COD_MINOR_COMBO 0x000000C0 157 /* Bits 2-5 OR'd with selection from bits 6-7 */ 158 #define BTM_COD_MINOR_UNCLASSIFIED 0x00000000 159 #define BTM_COD_MINOR_JOYSTICK 0x00000004 160 #define BTM_COD_MINOR_GAMEPAD 0x00000008 161 #define BTM_COD_MINOR_REMOTE_CONTROL 0x0000000C 162 #define BTM_COD_MINOR_SENSING_DEVICE 0x00000010 163 #define BTM_COD_MINOR_DIGITIZING_TABLET 0x00000014 164 #define BTM_COD_MINOR_CARD_READER 0x00000018 /* e.g. SIM card reader */ 165 #define BTM_COD_MINOR_DIGITAL_PAN 0x0000001c 166 #define BTM_COD_MINOR_HAND_SCANNER 0x00000020 167 #define BTM_COD_MINOR_HAND_GESTURAL_INPUT 0x00000024 168 169 170 /* minor device class field for Imaging Major Class */ 171 /* Bits 5-7 independently specify display, camera, scanner, or printer */ 172 #define BTM_COD_MINOR_IMAGE_UNCLASSIFIED 0x00000000 173 #define BTM_COD_MINOR_IMAGE_DISPLAY 0x00000010 174 #define BTM_COD_MINOR_IMAGE_CAMERA 0x00000020 175 #define BTM_COD_MINOR_IMAGE_SCANNER 0x00000040 176 #define BTM_COD_MINOR_IMAGE_PRINTER 0x00000080 177 178 /* class of device masks */ 179 #define BTM_COD_MAJOR_MASK 0x00001F00 180 #define BTM_COD_MINOR_MASK 0x000000FC 181 182 /* End of bt_class_of_device */ 183 184 185 typedef U8 bt_mgr_adp_state; 186 #define APP_MGR_STATE_IDLE 0 187 #define APP_MGR_STATE_PENDING 1 188 #define APP_MGR_STATE_CONNECTED 2 189 190 191 typedef U8 bt_err_type; 192 /*--------------------------------------------------------------------------- 193 * Bt Error Type 194 */ 195 196 #define BT_NO_ERROR 0x00 197 #define BT_UNKNOWN_HCI_CMD 0x01 198 #define BT_NO_CONNECTION 0x02 199 #define BT_HARDWARE_FAILURE 0x03 200 #define BT_PAGE_TIMEOUT 0x04 201 #define BT_AUTHENTICATE_FAILURE 0x05 202 #define BT_MISSING_KEY 0x06 203 #define BT_MEMORY_FULL 0x07 204 #define BT_CONNECTION_TIMEOUT 0x08 205 #define BT_MAX_CONNECTIONS 0x09 206 #define BT_MAX_SCO_CONNECTIONS 0x0a 207 #define BT_ACL_ALREADY_EXISTS 0x0b 208 #define BT_COMMAND_DISALLOWED 0x0c 209 #define BT_LIMITED_RESOURCE 0x0d 210 #define BT_SECURITY_ERROR 0x0e 211 #define BT_PERSONAL_DEVICE 0x0f 212 #define BT_HOST_TIMEOUT 0x10 213 #define BT_UNSUPPORTED_FEATURE 0x11 214 #define BT_INVALID_HCI_PARM 0x12 215 #define BT_USER_TERMINATED 0x13 216 #define BT_LOW_RESOURCES 0x14 217 #define BT_POWER_OFF 0x15 218 #define BT_LOCAL_TERMINATED 0x16 219 #define BT_REPEATED_ATTEMPTS 0x17 220 #define BT_PAIRING_NOT_ALLOWED 0x18 221 #define BT_UNKNOWN_LMP_PDU 0x19 222 #define BT_UNSUPPORTED_REMOTE 0x1a 223 #define BT_SCO_OFFSET_REJECT 0x1b 224 #define BT_SCO_INTERVAL_REJECT 0x1c 225 #define BT_SCO_AIR_MODE_REJECT 0x1d 226 #define BT_INVALID_LMP_PARM 0x1e 227 #define BT_UNSPECIFIED_ERR 0x1f 228 #define BT_UNSUPPORTED_LMP_PARM 0x20 229 #define BT_ROLE_CHG_NOT_ALLOWED 0x21 230 #define BT_LMP_RESPONSE_TIMEOUT 0x22 231 #define BT_LMP_TRANS_COLLISION 0x23 232 #define BT_LMP_PDU_NOT_ALLOWED 0x24 233 #define BT_ENCRYP_MODE_NOT_ACC 0x25 234 #define BT_UNIT_KEY_USED 0x26 235 #define BT_QOS_NOT_SUPPORTED 0x27 236 #define BT_INSTANT_PASSED 0x28 237 #define BT_PAIR_UNITKEY_NO_SUPP 0x29 238 #define BT_NOT_FOUND 0xf1 239 #define BT_REQUEST_CANCELLED 0xf2 240 #define BT_INVALID_SDP_PDU 0xd1 241 #define BT_SDP_DISCONNECT 0xd2 242 #define BT_SDP_NO_RESOURCES 0xd3 243 #define BT_SDP_INTERNAL_ERR 0xd4 244 #define BT_STORE_LINK_KEY_ERR 0xe0 245 246 /* End of Bt Error Type */ 247 248 249 #endif 250