1/* 2 * Copyright (C) 2022-2023 Huawei Device Co., Ltd. 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 16import type { AsyncCallback, Callback } from './@ohos.base'; 17 18/** 19 * Provides methods to operate or manage Bluetooth. 20 * 21 * @namespace bluetoothManager 22 * @syscap SystemCapability.Communication.Bluetooth.Core 23 * @since 9 24 * @deprecated since 10 25 */ 26declare namespace bluetoothManager { 27 /** 28 * Obtains the Bluetooth status of a device. 29 * 30 * @permission ohos.permission.USE_BLUETOOTH 31 * @returns { BluetoothState } Returns the Bluetooth status, which can be {@link BluetoothState#STATE_OFF}, 32 * {@link BluetoothState#STATE_TURNING_ON}, {@link BluetoothState#STATE_ON}, {@link BluetoothState#STATE_TURNING_OFF}, 33 * {@link BluetoothState#STATE_BLE_TURNING_ON}, {@link BluetoothState#STATE_BLE_ON}, 34 * or {@link BluetoothState#STATE_BLE_TURNING_OFF}. 35 * @throws { BusinessError } 201 - Permission denied. 36 * @throws { BusinessError } 801 - Capability not supported. 37 * @throws { BusinessError } 2900001 - Service stopped. 38 * @throws { BusinessError } 2900099 - Operation failed. 39 * @syscap SystemCapability.Communication.Bluetooth.Core 40 * @since 9 41 * @deprecated since 10 42 * @useinstead ohos.bluetooth.access/access#getState 43 */ 44 /** 45 * Obtains the Bluetooth status of a device. 46 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 47 * 48 * @permission ohos.permission.ACCESS_BLUETOOTH 49 * @returns { BluetoothState } Returns the Bluetooth status, which can be {@link BluetoothState#STATE_OFF}, 50 * {@link BluetoothState#STATE_TURNING_ON}, {@link BluetoothState#STATE_ON}, {@link BluetoothState#STATE_TURNING_OFF}, 51 * {@link BluetoothState#STATE_BLE_TURNING_ON}, {@link BluetoothState#STATE_BLE_ON}, 52 * or {@link BluetoothState#STATE_BLE_TURNING_OFF}. 53 * @throws { BusinessError } 201 - Permission denied. 54 * @throws { BusinessError } 801 - Capability not supported. 55 * @throws { BusinessError } 2900001 - Service stopped. 56 * @throws { BusinessError } 2900099 - Operation failed. 57 * @syscap SystemCapability.Communication.Bluetooth.Core 58 * @since 10 59 * @deprecated since 10 60 * @useinstead ohos.bluetooth.access/access#getState 61 */ 62 function getState(): BluetoothState; 63 64 /** 65 * Get the local device connection state to any profile of any remote device. 66 * 67 * @permission ohos.permission.USE_BLUETOOTH 68 * @returns { ProfileConnectionState } One of {@link ProfileConnectionState#STATE_DISCONNECTED}, 69 * {@link ProfileConnectionState#STATE_CONNECTING}, {@link ProfileConnectionState#STATE_CONNECTED}, 70 * {@link ProfileConnectionState#STATE_DISCONNECTING}. 71 * @throws { BusinessError } 201 - Permission denied. 72 * @throws { BusinessError } 801 - Capability not supported. 73 * @throws { BusinessError } 2900001 - Service stopped. 74 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 75 * @throws { BusinessError } 2900099 - Operation failed. 76 * @syscap SystemCapability.Communication.Bluetooth.Core 77 * @since 9 78 * @deprecated since 10 79 * @useinstead ohos.bluetooth.connection/connection#getProfileConnectionState 80 */ 81 /** 82 * Get the local device connection state to any profile of any remote device. 83 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 84 * 85 * @permission ohos.permission.ACCESS_BLUETOOTH 86 * @returns { ProfileConnectionState } One of {@link ProfileConnectionState#STATE_DISCONNECTED}, 87 * {@link ProfileConnectionState#STATE_CONNECTING}, {@link ProfileConnectionState#STATE_CONNECTED}, 88 * {@link ProfileConnectionState#STATE_DISCONNECTING}. 89 * @throws { BusinessError } 201 - Permission denied. 90 * @throws { BusinessError } 801 - Capability not supported. 91 * @throws { BusinessError } 2900001 - Service stopped. 92 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 93 * @throws { BusinessError } 2900099 - Operation failed. 94 * @syscap SystemCapability.Communication.Bluetooth.Core 95 * @since 10 96 * @deprecated since 10 97 * @useinstead ohos.bluetooth.connection/connection#getProfileConnectionState 98 */ 99 function getBtConnectionState(): ProfileConnectionState; 100 101 /** 102 * Starts pairing with a remote Bluetooth device. 103 * 104 * @permission ohos.permission.DISCOVER_BLUETOOTH 105 * @param { string } deviceId - The address of the remote device to pair. 106 * @throws { BusinessError } 201 - Permission denied. 107 * @throws { BusinessError } 401 - Invalid parameter. 108 * @throws { BusinessError } 801 - Capability not supported. 109 * @throws { BusinessError } 2900001 - Service stopped. 110 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 111 * @throws { BusinessError } 2900099 - Operation failed. 112 * @syscap SystemCapability.Communication.Bluetooth.Core 113 * @since 9 114 * @deprecated since 10 115 * @useinstead ohos.bluetooth.connection/connection#pairDevice 116 */ 117 /** 118 * Starts pairing with a remote Bluetooth device. 119 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 120 * 121 * @permission ohos.permission.ACCESS_BLUETOOTH 122 * @param { string } deviceId - The address of the remote device to pair. 123 * @throws { BusinessError } 201 - Permission denied. 124 * @throws { BusinessError } 401 - Invalid parameter. 125 * @throws { BusinessError } 801 - Capability not supported. 126 * @throws { BusinessError } 2900001 - Service stopped. 127 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 128 * @throws { BusinessError } 2900099 - Operation failed. 129 * @syscap SystemCapability.Communication.Bluetooth.Core 130 * @since 10 131 * @deprecated since 10 132 * @useinstead ohos.bluetooth.connection/connection#pairDevice 133 */ 134 function pairDevice(deviceId: string): void; 135 136 /** 137 * Remove a paired remote device. 138 * 139 * @permission ohos.permission.DISCOVER_BLUETOOTH 140 * @param { string } deviceId - The address of the remote device to be removed. 141 * @throws { BusinessError } 201 - Permission denied. 142 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 143 * @throws { BusinessError } 401 - Invalid parameter. 144 * @throws { BusinessError } 801 - Capability not supported. 145 * @throws { BusinessError } 2900001 - Service stopped. 146 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 147 * @throws { BusinessError } 2900099 - Operation failed. 148 * @syscap SystemCapability.Communication.Bluetooth.Core 149 * @systemapi Hide this for inner system use. 150 * @since 9 151 * @deprecated since 10 152 * @useinstead ohos.bluetooth.connection/connection#cancelPairedDevice 153 */ 154 /** 155 * Remove a paired remote device. 156 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 157 * 158 * @permission ohos.permission.ACCESS_BLUETOOTH 159 * @param { string } deviceId - The address of the remote device to be removed. 160 * @throws { BusinessError } 201 - Permission denied. 161 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 162 * @throws { BusinessError } 401 - Invalid parameter. 163 * @throws { BusinessError } 801 - Capability not supported. 164 * @throws { BusinessError } 2900001 - Service stopped. 165 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 166 * @throws { BusinessError } 2900099 - Operation failed. 167 * @syscap SystemCapability.Communication.Bluetooth.Core 168 * @systemapi Hide this for inner system use. 169 * @since 10 170 * @deprecated since 10 171 * @useinstead ohos.bluetooth.connection/connection#cancelPairedDevice 172 */ 173 function cancelPairedDevice(deviceId: string): void; 174 175 /** 176 * Obtains the name of a peer Bluetooth device. 177 * 178 * @permission ohos.permission.USE_BLUETOOTH 179 * @param { string } deviceId - The address of the remote device. 180 * @returns { string } Returns the device name in character string format. 181 * @throws { BusinessError } 201 - Permission denied. 182 * @throws { BusinessError } 401 - Invalid parameter. 183 * @throws { BusinessError } 801 - Capability not supported. 184 * @throws { BusinessError } 2900001 - Service stopped. 185 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 186 * @throws { BusinessError } 2900099 - Operation failed. 187 * @syscap SystemCapability.Communication.Bluetooth.Core 188 * @since 9 189 * @deprecated since 10 190 * @useinstead ohos.bluetooth.connection/connection#getRemoteDeviceName 191 */ 192 /** 193 * Obtains the name of a peer Bluetooth device. 194 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 195 * 196 * @permission ohos.permission.ACCESS_BLUETOOTH 197 * @param { string } deviceId - The address of the remote device. 198 * @returns { string } Returns the device name in character string format. 199 * @throws { BusinessError } 201 - Permission denied. 200 * @throws { BusinessError } 401 - Invalid parameter. 201 * @throws { BusinessError } 801 - Capability not supported. 202 * @throws { BusinessError } 2900001 - Service stopped. 203 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 204 * @throws { BusinessError } 2900099 - Operation failed. 205 * @syscap SystemCapability.Communication.Bluetooth.Core 206 * @since 10 207 * @deprecated since 10 208 * @useinstead ohos.bluetooth.connection/connection#getRemoteDeviceName 209 */ 210 function getRemoteDeviceName(deviceId: string): string; 211 212 /** 213 * Obtains the class of a peer Bluetooth device. 214 * 215 * @permission ohos.permission.USE_BLUETOOTH 216 * @param { string } deviceId - The address of the remote device. 217 * @returns { DeviceClass } The class of the remote device, {@link DeviceClass}. 218 * @throws { BusinessError } 201 - Permission denied. 219 * @throws { BusinessError } 401 - Invalid parameter. 220 * @throws { BusinessError } 801 - Capability not supported. 221 * @throws { BusinessError } 2900001 - Service stopped. 222 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 223 * @throws { BusinessError } 2900099 - Operation failed. 224 * @syscap SystemCapability.Communication.Bluetooth.Core 225 * @since 9 226 * @deprecated since 10 227 * @useinstead ohos.bluetooth.connection/connection#getRemoteDeviceClass 228 */ 229 /** 230 * Obtains the class of a peer Bluetooth device. 231 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 232 * 233 * @permission ohos.permission.ACCESS_BLUETOOTH 234 * @param { string } deviceId - The address of the remote device. 235 * @returns { DeviceClass } The class of the remote device, {@link DeviceClass}. 236 * @throws { BusinessError } 201 - Permission denied. 237 * @throws { BusinessError } 401 - Invalid parameter. 238 * @throws { BusinessError } 801 - Capability not supported. 239 * @throws { BusinessError } 2900001 - Service stopped. 240 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 241 * @throws { BusinessError } 2900099 - Operation failed. 242 * @syscap SystemCapability.Communication.Bluetooth.Core 243 * @since 10 244 * @deprecated since 10 245 * @useinstead ohos.bluetooth.connection/connection#getRemoteDeviceClass 246 */ 247 function getRemoteDeviceClass(deviceId: string): DeviceClass; 248 249 /** 250 * Enables Bluetooth on a device. 251 * 252 * @permission ohos.permission.DISCOVER_BLUETOOTH 253 * @throws { BusinessError } 201 - Permission denied. 254 * @throws { BusinessError } 801 - Capability not supported. 255 * @throws { BusinessError } 2900001 - Service stopped. 256 * @throws { BusinessError } 2900099 - Operation failed. 257 * @syscap SystemCapability.Communication.Bluetooth.Core 258 * @since 9 259 * @deprecated since 10 260 * @useinstead ohos.bluetooth.access/access#enableBluetooth 261 */ 262 /** 263 * Enables Bluetooth on a device. 264 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 265 * 266 * @permission ohos.permission.ACCESS_BLUETOOTH 267 * @throws { BusinessError } 201 - Permission denied. 268 * @throws { BusinessError } 801 - Capability not supported. 269 * @throws { BusinessError } 2900001 - Service stopped. 270 * @throws { BusinessError } 2900099 - Operation failed. 271 * @syscap SystemCapability.Communication.Bluetooth.Core 272 * @since 10 273 * @deprecated since 10 274 * @useinstead ohos.bluetooth.access/access#enableBluetooth 275 */ 276 function enableBluetooth(): void; 277 278 /** 279 * Disables Bluetooth on a device. 280 * 281 * @permission ohos.permission.DISCOVER_BLUETOOTH 282 * @throws { BusinessError } 201 - Permission denied. 283 * @throws { BusinessError } 801 - Capability not supported. 284 * @throws { BusinessError } 2900001 - Service stopped. 285 * @throws { BusinessError } 2900099 - Operation failed. 286 * @syscap SystemCapability.Communication.Bluetooth.Core 287 * @since 9 288 * @deprecated since 10 289 * @useinstead ohos.bluetooth.access/access#disableBluetooth 290 */ 291 /** 292 * Disables Bluetooth on a device. 293 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 294 * 295 * @permission ohos.permission.ACCESS_BLUETOOTH 296 * @throws { BusinessError } 201 - Permission denied. 297 * @throws { BusinessError } 801 - Capability not supported. 298 * @throws { BusinessError } 2900001 - Service stopped. 299 * @throws { BusinessError } 2900099 - Operation failed. 300 * @syscap SystemCapability.Communication.Bluetooth.Core 301 * @since 10 302 * @deprecated since 10 303 * @useinstead ohos.bluetooth.access/access#disableBluetooth 304 */ 305 function disableBluetooth(): void; 306 307 /** 308 * Obtains the Bluetooth local name of a device. 309 * 310 * @permission ohos.permission.USE_BLUETOOTH 311 * @returns { string } Returns the name the device. 312 * @throws { BusinessError } 201 - Permission denied. 313 * @throws { BusinessError } 801 - Capability not supported. 314 * @throws { BusinessError } 2900001 - Service stopped. 315 * @throws { BusinessError } 2900099 - Operation failed. 316 * @syscap SystemCapability.Communication.Bluetooth.Core 317 * @since 9 318 * @deprecated since 10 319 * @useinstead ohos.bluetooth.connection/connection#getLocalName 320 */ 321 /** 322 * Obtains the Bluetooth local name of a device. 323 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 324 * 325 * @permission ohos.permission.ACCESS_BLUETOOTH 326 * @returns { string } Returns the name the device. 327 * @throws { BusinessError } 201 - Permission denied. 328 * @throws { BusinessError } 801 - Capability not supported. 329 * @throws { BusinessError } 2900001 - Service stopped. 330 * @throws { BusinessError } 2900099 - Operation failed. 331 * @syscap SystemCapability.Communication.Bluetooth.Core 332 * @since 10 333 * @deprecated since 10 334 * @useinstead ohos.bluetooth.connection/connection#getLocalName 335 */ 336 function getLocalName(): string; 337 338 /** 339 * Obtains the list of Bluetooth devices that have been paired with the current device. 340 * 341 * @permission ohos.permission.USE_BLUETOOTH 342 * @returns { Array<string> } Returns a list of paired Bluetooth devices's address. 343 * @throws { BusinessError } 201 - Permission denied. 344 * @throws { BusinessError } 801 - Capability not supported. 345 * @throws { BusinessError } 2900001 - Service stopped. 346 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 347 * @throws { BusinessError } 2900099 - Operation failed. 348 * @syscap SystemCapability.Communication.Bluetooth.Core 349 * @since 9 350 * @deprecated since 10 351 * @useinstead ohos.bluetooth.connection/connection#getPairedDevices 352 */ 353 /** 354 * Obtains the list of Bluetooth devices that have been paired with the current device. 355 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 356 * 357 * @permission ohos.permission.ACCESS_BLUETOOTH 358 * @returns { Array<string> } Returns a list of paired Bluetooth devices's address. 359 * @throws { BusinessError } 201 - Permission denied. 360 * @throws { BusinessError } 801 - Capability not supported. 361 * @throws { BusinessError } 2900001 - Service stopped. 362 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 363 * @throws { BusinessError } 2900099 - Operation failed. 364 * @syscap SystemCapability.Communication.Bluetooth.Core 365 * @since 10 366 * @deprecated since 10 367 * @useinstead ohos.bluetooth.connection/connection#getPairedDevices 368 */ 369 function getPairedDevices(): Array<string>; 370 371 /** 372 * Obtains the connection state of profile. 373 * 374 * @permission ohos.permission.USE_BLUETOOTH 375 * @param { ProfileId } profileId - The profile id. 376 * @returns { ProfileConnectionState } Returns the connection state. 377 * @throws { BusinessError } 201 - Permission denied. 378 * @throws { BusinessError } 401 - Invalid parameter. 379 * @throws { BusinessError } 801 - Capability not supported. 380 * @throws { BusinessError } 2900001 - Service stopped. 381 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 382 * @throws { BusinessError } 2900004 - Profile is not supported. 383 * @throws { BusinessError } 2900099 - Operation failed. 384 * @syscap SystemCapability.Communication.Bluetooth.Core 385 * @since 9 386 * @deprecated since 10 387 * @useinstead ohos.bluetooth.connection/connection#getProfileConnectionState 388 */ 389 /** 390 * Obtains the connection state of profile. 391 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 392 * 393 * @permission ohos.permission.ACCESS_BLUETOOTH 394 * @param { ProfileId } profileId - The profile id. 395 * @returns { ProfileConnectionState } Returns the connection state. 396 * @throws { BusinessError } 201 - Permission denied. 397 * @throws { BusinessError } 401 - Invalid parameter. 398 * @throws { BusinessError } 801 - Capability not supported. 399 * @throws { BusinessError } 2900001 - Service stopped. 400 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 401 * @throws { BusinessError } 2900004 - Profile is not supported. 402 * @throws { BusinessError } 2900099 - Operation failed. 403 * @syscap SystemCapability.Communication.Bluetooth.Core 404 * @since 10 405 * @deprecated since 10 406 * @useinstead ohos.bluetooth.connection/connection#getProfileConnectionState 407 */ 408 function getProfileConnectionState(profileId: ProfileId): ProfileConnectionState; 409 410 /** 411 * Sets the confirmation of pairing with a certain device. 412 * 413 * @permission ohos.permission.MANAGE_BLUETOOTH 414 * @param { string } device - The address of the remote device. 415 * @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise. 416 * @throws { BusinessError } 201 - Permission denied. 417 * @throws { BusinessError } 401 - Invalid parameter. 418 * @throws { BusinessError } 801 - Capability not supported. 419 * @throws { BusinessError } 2900001 - Service stopped. 420 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 421 * @throws { BusinessError } 2900099 - Operation failed. 422 * @syscap SystemCapability.Communication.Bluetooth.Core 423 * @since 9 424 * @deprecated since 10 425 * @useinstead ohos.bluetooth.connection/connection#setDevicePairingConfirmation 426 */ 427 /** 428 * Sets the confirmation of pairing with a certain device. 429 * The permission required by this interface is changed from MANAGE_BLUETOOTH to ACCESS_BLUETOOTH and MANAGE_BLUETOOTH. 430 * 431 * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 432 * @param { string } device - The address of the remote device. 433 * @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise. 434 * @throws { BusinessError } 201 - Permission denied. 435 * @throws { BusinessError } 401 - Invalid parameter. 436 * @throws { BusinessError } 801 - Capability not supported. 437 * @throws { BusinessError } 2900001 - Service stopped. 438 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 439 * @throws { BusinessError } 2900099 - Operation failed. 440 * @syscap SystemCapability.Communication.Bluetooth.Core 441 * @since 10 442 * @deprecated since 10 443 * @useinstead ohos.bluetooth.connection/connection#setDevicePairingConfirmation 444 */ 445 function setDevicePairingConfirmation(device: string, accept: boolean): void; 446 447 /** 448 * Sets the Bluetooth friendly name of a device. 449 * 450 * @permission ohos.permission.DISCOVER_BLUETOOTH 451 * @param { string } name - Indicates a valid Bluetooth name. 452 * @throws { BusinessError } 201 - Permission denied. 453 * @throws { BusinessError } 401 - Invalid parameter. 454 * @throws { BusinessError } 801 - Capability not supported. 455 * @throws { BusinessError } 2900001 - Service stopped. 456 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 457 * @throws { BusinessError } 2900099 - Operation failed. 458 * @syscap SystemCapability.Communication.Bluetooth.Core 459 * @since 9 460 * @deprecated since 10 461 * @useinstead ohos.bluetooth.connection/connection#setLocalName 462 */ 463 /** 464 * Sets the Bluetooth friendly name of a device. 465 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 466 * 467 * @permission ohos.permission.ACCESS_BLUETOOTH 468 * @param { string } name - Indicates a valid Bluetooth name. 469 * @throws { BusinessError } 201 - Permission denied. 470 * @throws { BusinessError } 401 - Invalid parameter. 471 * @throws { BusinessError } 801 - Capability not supported. 472 * @throws { BusinessError } 2900001 - Service stopped. 473 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 474 * @throws { BusinessError } 2900099 - Operation failed. 475 * @syscap SystemCapability.Communication.Bluetooth.Core 476 * @since 10 477 * @deprecated since 10 478 * @useinstead ohos.bluetooth.connection/connection#setLocalName 479 */ 480 function setLocalName(name: string): void; 481 482 /** 483 * Sets the Bluetooth scan mode for a device. 484 * 485 * @permission ohos.permission.USE_BLUETOOTH 486 * @param { ScanMode } mode - Indicates the Bluetooth scan mode to set, {@link ScanMode}. 487 * @param { number } duration - Indicates the duration in seconds, in which the host is discoverable. 488 * @throws { BusinessError } 201 - Permission denied. 489 * @throws { BusinessError } 401 - Invalid parameter. 490 * @throws { BusinessError } 801 - Capability not supported. 491 * @throws { BusinessError } 2900001 - Service stopped. 492 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 493 * @throws { BusinessError } 2900099 - Operation failed. 494 * @syscap SystemCapability.Communication.Bluetooth.Core 495 * @since 9 496 * @deprecated since 10 497 * @useinstead ohos.bluetooth.connection/connection#setBluetoothScanMode 498 */ 499 /** 500 * Sets the Bluetooth scan mode for a device. 501 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 502 * 503 * @permission ohos.permission.ACCESS_BLUETOOTH 504 * @param { ScanMode } mode - Indicates the Bluetooth scan mode to set, {@link ScanMode}. 505 * @param { number } duration - Indicates the duration in seconds, in which the host is discoverable. 506 * @throws { BusinessError } 201 - Permission denied. 507 * @throws { BusinessError } 401 - Invalid parameter. 508 * @throws { BusinessError } 801 - Capability not supported. 509 * @throws { BusinessError } 2900001 - Service stopped. 510 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 511 * @throws { BusinessError } 2900099 - Operation failed. 512 * @syscap SystemCapability.Communication.Bluetooth.Core 513 * @since 10 514 * @deprecated since 10 515 * @useinstead ohos.bluetooth.connection/connection#setBluetoothScanMode 516 */ 517 function setBluetoothScanMode(mode: ScanMode, duration: number): void; 518 519 /** 520 * Obtains the Bluetooth scanning mode of a device. 521 * 522 * @permission ohos.permission.USE_BLUETOOTH 523 * @returns { ScanMode } Returns the Bluetooth scanning mode, {@link ScanMode}. 524 * @throws { BusinessError } 201 - Permission denied. 525 * @throws { BusinessError } 801 - Capability not supported. 526 * @throws { BusinessError } 2900001 - Service stopped. 527 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 528 * @throws { BusinessError } 2900099 - Operation failed. 529 * @syscap SystemCapability.Communication.Bluetooth.Core 530 * @since 9 531 * @deprecated since 10 532 * @useinstead ohos.bluetooth.connection/connection#getBluetoothScanMode 533 */ 534 /** 535 * Obtains the Bluetooth scanning mode of a device. 536 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 537 * 538 * @permission ohos.permission.ACCESS_BLUETOOTH 539 * @returns { ScanMode } Returns the Bluetooth scanning mode, {@link ScanMode}. 540 * @throws { BusinessError } 201 - Permission denied. 541 * @throws { BusinessError } 801 - Capability not supported. 542 * @throws { BusinessError } 2900001 - Service stopped. 543 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 544 * @throws { BusinessError } 2900099 - Operation failed. 545 * @syscap SystemCapability.Communication.Bluetooth.Core 546 * @since 10 547 * @deprecated since 10 548 * @useinstead ohos.bluetooth.connection/connection#getBluetoothScanMode 549 */ 550 function getBluetoothScanMode(): ScanMode; 551 552 /** 553 * Starts scanning Bluetooth devices. 554 * 555 * @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION 556 * and ohos.permission.APPROXIMATELY_LOCATION 557 * @throws { BusinessError } 201 - Permission denied. 558 * @throws { BusinessError } 801 - Capability not supported. 559 * @throws { BusinessError } 2900001 - Service stopped. 560 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 561 * @throws { BusinessError } 2900099 - Operation failed. 562 * @syscap SystemCapability.Communication.Bluetooth.Core 563 * @since 9 564 * @deprecated since 10 565 * @useinstead ohos.bluetooth.connection/connection#startBluetoothDiscovery 566 */ 567 /** 568 * Starts scanning Bluetooth devices. 569 * The permission required by this interface is changed from DISCOVER_BLUETOOTH and LOCATION and APPROXIMATELY_LOCATION to ACCESS_BLUETOOTH. 570 * 571 * @permission ohos.permission.ACCESS_BLUETOOTH 572 * @throws { BusinessError } 201 - Permission denied. 573 * @throws { BusinessError } 801 - Capability not supported. 574 * @throws { BusinessError } 2900001 - Service stopped. 575 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 576 * @throws { BusinessError } 2900099 - Operation failed. 577 * @syscap SystemCapability.Communication.Bluetooth.Core 578 * @since 10 579 * @deprecated since 10 580 * @useinstead ohos.bluetooth.connection/connection#startBluetoothDiscovery 581 */ 582 function startBluetoothDiscovery(): void; 583 584 /** 585 * Stops Bluetooth device scanning. 586 * 587 * @permission ohos.permission.DISCOVER_BLUETOOTH 588 * @throws { BusinessError } 201 - Permission denied. 589 * @throws { BusinessError } 801 - Capability not supported. 590 * @throws { BusinessError } 2900001 - Service stopped. 591 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 592 * @throws { BusinessError } 2900099 - Operation failed. 593 * @syscap SystemCapability.Communication.Bluetooth.Core 594 * @since 9 595 * @deprecated since 10 596 * @useinstead ohos.bluetooth.connection/connection#stopBluetoothDiscovery 597 */ 598 /** 599 * Stops Bluetooth device scanning. 600 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 601 * 602 * @permission ohos.permission.ACCESS_BLUETOOTH 603 * @throws { BusinessError } 201 - Permission denied. 604 * @throws { BusinessError } 801 - Capability not supported. 605 * @throws { BusinessError } 2900001 - Service stopped. 606 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 607 * @throws { BusinessError } 2900099 - Operation failed. 608 * @syscap SystemCapability.Communication.Bluetooth.Core 609 * @since 10 610 * @deprecated since 10 611 * @useinstead ohos.bluetooth.connection/connection#stopBluetoothDiscovery 612 */ 613 function stopBluetoothDiscovery(): void; 614 615 /** 616 * Subscribe the event reported when a remote Bluetooth device is discovered. 617 * 618 * @permission ohos.permission.USE_BLUETOOTH 619 * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 620 * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 621 * @throws { BusinessError } 201 - Permission denied. 622 * @throws { BusinessError } 401 - Invalid parameter. 623 * @throws { BusinessError } 801 - Capability not supported. 624 * @throws { BusinessError } 2900099 - Operation failed. 625 * @syscap SystemCapability.Communication.Bluetooth.Core 626 * @since 9 627 * @deprecated since 10 628 * @useinstead ohos.bluetooth.connection/connection.on#event:bluetoothDeviceFind 629 */ 630 /** 631 * Subscribe the event reported when a remote Bluetooth device is discovered. 632 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 633 * 634 * @permission ohos.permission.ACCESS_BLUETOOTH 635 * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 636 * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 637 * @throws { BusinessError } 201 - Permission denied. 638 * @throws { BusinessError } 401 - Invalid parameter. 639 * @throws { BusinessError } 801 - Capability not supported. 640 * @throws { BusinessError } 2900099 - Operation failed. 641 * @syscap SystemCapability.Communication.Bluetooth.Core 642 * @since 10 643 * @deprecated since 10 644 * @useinstead ohos.bluetooth.connection/connection.on#event:bluetoothDeviceFind 645 */ 646 function on(type: 'bluetoothDeviceFind', callback: Callback<Array<string>>): void; 647 648 /** 649 * Unsubscribe the event reported when a remote Bluetooth device is discovered. 650 * 651 * @permission ohos.permission.USE_BLUETOOTH 652 * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 653 * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 654 * @throws { BusinessError } 201 - Permission denied. 655 * @throws { BusinessError } 801 - Capability not supported. 656 * @throws { BusinessError } 2900099 - Operation failed. 657 * @syscap SystemCapability.Communication.Bluetooth.Core 658 * @since 9 659 * @deprecated since 10 660 * @useinstead ohos.bluetooth.connection/connection.off#event:bluetoothDeviceFind 661 */ 662 /** 663 * Unsubscribe the event reported when a remote Bluetooth device is discovered. 664 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 665 * 666 * @permission ohos.permission.ACCESS_BLUETOOTH 667 * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 668 * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 669 * @throws { BusinessError } 201 - Permission denied. 670 * @throws { BusinessError } 801 - Capability not supported. 671 * @throws { BusinessError } 2900099 - Operation failed. 672 * @syscap SystemCapability.Communication.Bluetooth.Core 673 * @since 10 674 * @deprecated since 10 675 * @useinstead ohos.bluetooth.connection/connection.off#event:bluetoothDeviceFind 676 */ 677 function off(type: 'bluetoothDeviceFind', callback?: Callback<Array<string>>): void; 678 679 /** 680 * Subscribe the event reported when a remote Bluetooth device is bonded. 681 * 682 * @permission ohos.permission.USE_BLUETOOTH 683 * @param { 'bondStateChange' } type - Type of the bond state event to listen for. 684 * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event, {@link BondStateParam}. 685 * @throws { BusinessError } 201 - Permission denied. 686 * @throws { BusinessError } 401 - Invalid parameter. 687 * @throws { BusinessError } 801 - Capability not supported. 688 * @throws { BusinessError } 2900099 - Operation failed. 689 * @syscap SystemCapability.Communication.Bluetooth.Core 690 * @since 9 691 * @deprecated since 10 692 * @useinstead ohos.bluetooth.connection/connection.on#event:bondStateChange 693 */ 694 /** 695 * Subscribe the event reported when a remote Bluetooth device is bonded. 696 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 697 * 698 * @permission ohos.permission.ACCESS_BLUETOOTH 699 * @param { 'bondStateChange' } type - Type of the bond state event to listen for. 700 * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event, {@link BondStateParam}. 701 * @throws { BusinessError } 201 - Permission denied. 702 * @throws { BusinessError } 401 - Invalid parameter. 703 * @throws { BusinessError } 801 - Capability not supported. 704 * @throws { BusinessError } 2900099 - Operation failed. 705 * @syscap SystemCapability.Communication.Bluetooth.Core 706 * @since 10 707 * @deprecated since 10 708 * @useinstead ohos.bluetooth.connection/connection.on#event:bondStateChange 709 */ 710 function on(type: 'bondStateChange', callback: Callback<BondStateParam>): void; 711 712 /** 713 * Unsubscribe the event reported when a remote Bluetooth device is bonded. 714 * 715 * @permission ohos.permission.USE_BLUETOOTH 716 * @param { 'bondStateChange' } type - Type of the bond state event to listen for. 717 * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event. 718 * @throws { BusinessError } 201 - Permission denied. 719 * @throws { BusinessError } 401 - Invalid parameter. 720 * @throws { BusinessError } 801 - Capability not supported. 721 * @throws { BusinessError } 2900099 - Operation failed. 722 * @syscap SystemCapability.Communication.Bluetooth.Core 723 * @since 9 724 * @deprecated since 10 725 * @useinstead ohos.bluetooth.connection/connection.off#event:bondStateChange 726 */ 727 /** 728 * Unsubscribe the event reported when a remote Bluetooth device is bonded. 729 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 730 * 731 * @permission ohos.permission.ACCESS_BLUETOOTH 732 * @param { 'bondStateChange' } type - Type of the bond state event to listen for. 733 * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event. 734 * @throws { BusinessError } 201 - Permission denied. 735 * @throws { BusinessError } 401 - Invalid parameter. 736 * @throws { BusinessError } 801 - Capability not supported. 737 * @throws { BusinessError } 2900099 - Operation failed. 738 * @syscap SystemCapability.Communication.Bluetooth.Core 739 * @since 10 740 * @deprecated since 10 741 * @useinstead ohos.bluetooth.connection/connection.off#event:bondStateChange 742 */ 743 function off(type: 'bondStateChange', callback?: Callback<BondStateParam>): void; 744 745 /** 746 * Subscribe the event of a pairing request from a remote Bluetooth device. 747 * 748 * @permission ohos.permission.DISCOVER_BLUETOOTH 749 * @param { 'pinRequired' } type - Type of the pairing request event to listen for. 750 * @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event. 751 * @throws { BusinessError } 201 - Permission denied. 752 * @throws { BusinessError } 401 - Invalid parameter. 753 * @throws { BusinessError } 801 - Capability not supported. 754 * @throws { BusinessError } 2900099 - Operation failed. 755 * @syscap SystemCapability.Communication.Bluetooth.Core 756 * @since 9 757 * @deprecated since 10 758 * @useinstead ohos.bluetooth.connection/connection.on#event:pinRequired 759 */ 760 /** 761 * Subscribe the event of a pairing request from a remote Bluetooth device. 762 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 763 * 764 * @permission ohos.permission.ACCESS_BLUETOOTH 765 * @param { 'pinRequired' } type - Type of the pairing request event to listen for. 766 * @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event. 767 * @throws { BusinessError } 201 - Permission denied. 768 * @throws { BusinessError } 401 - Invalid parameter. 769 * @throws { BusinessError } 801 - Capability not supported. 770 * @throws { BusinessError } 2900099 - Operation failed. 771 * @syscap SystemCapability.Communication.Bluetooth.Core 772 * @since 10 773 * @deprecated since 10 774 * @useinstead ohos.bluetooth.connection/connection.on#event:pinRequired 775 */ 776 function on(type: 'pinRequired', callback: Callback<PinRequiredParam>): void; 777 778 /** 779 * Unsubscribe the event of a pairing request from a remote Bluetooth device. 780 * 781 * @permission ohos.permission.DISCOVER_BLUETOOTH 782 * @param { 'pinRequired' } type - Type of the pairing request event to listen for. 783 * @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event. 784 * @throws { BusinessError } 201 - Permission denied. 785 * @throws { BusinessError } 401 - Invalid parameter. 786 * @throws { BusinessError } 801 - Capability not supported. 787 * @throws { BusinessError } 2900099 - Operation failed. 788 * @syscap SystemCapability.Communication.Bluetooth.Core 789 * @since 9 790 * @deprecated since 10 791 * @useinstead ohos.bluetooth.connection/connection.off#event:pinRequired 792 */ 793 /** 794 * Unsubscribe the event of a pairing request from a remote Bluetooth device. 795 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 796 * 797 * @permission ohos.permission.ACCESS_BLUETOOTH 798 * @param { 'pinRequired' } type - Type of the pairing request event to listen for. 799 * @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event. 800 * @throws { BusinessError } 201 - Permission denied. 801 * @throws { BusinessError } 401 - Invalid parameter. 802 * @throws { BusinessError } 801 - Capability not supported. 803 * @throws { BusinessError } 2900099 - Operation failed. 804 * @syscap SystemCapability.Communication.Bluetooth.Core 805 * @since 10 806 * @deprecated since 10 807 * @useinstead ohos.bluetooth.connection/connection.off#event:pinRequired 808 */ 809 function off(type: 'pinRequired', callback?: Callback<PinRequiredParam>): void; 810 811 /** 812 * Subscribe the event reported when the Bluetooth state changes. 813 * 814 * @permission ohos.permission.USE_BLUETOOTH 815 * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. 816 * @param { Callback<BluetoothState> } callback - Callback used to listen for the Bluetooth state event. 817 * @throws { BusinessError } 201 - Permission denied. 818 * @throws { BusinessError } 401 - Invalid parameter. 819 * @throws { BusinessError } 801 - Capability not supported. 820 * @throws { BusinessError } 2900099 - Operation failed. 821 * @syscap SystemCapability.Communication.Bluetooth.Core 822 * @since 9 823 * @deprecated since 10 824 * @useinstead ohos.bluetooth.access/access.on#event:stateChange 825 */ 826 /** 827 * Subscribe the event reported when the Bluetooth state changes. 828 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 829 * 830 * @permission ohos.permission.ACCESS_BLUETOOTH 831 * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. 832 * @param { Callback<BluetoothState> } callback - Callback used to listen for the Bluetooth state event. 833 * @throws { BusinessError } 201 - Permission denied. 834 * @throws { BusinessError } 401 - Invalid parameter. 835 * @throws { BusinessError } 801 - Capability not supported. 836 * @throws { BusinessError } 2900099 - Operation failed. 837 * @syscap SystemCapability.Communication.Bluetooth.Core 838 * @since 10 839 * @deprecated since 10 840 * @useinstead ohos.bluetooth.access/access.on#event:stateChange 841 */ 842 function on(type: 'stateChange', callback: Callback<BluetoothState>): void; 843 844 /** 845 * Unsubscribe the event reported when the Bluetooth state changes. 846 * 847 * @permission ohos.permission.USE_BLUETOOTH 848 * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. 849 * @param { Callback<BluetoothState> } callback - Callback used to listen for the Bluetooth state event. 850 * @throws { BusinessError } 201 - Permission denied. 851 * @throws { BusinessError } 401 - Invalid parameter. 852 * @throws { BusinessError } 801 - Capability not supported. 853 * @throws { BusinessError } 2900099 - Operation failed. 854 * @syscap SystemCapability.Communication.Bluetooth.Core 855 * @since 9 856 * @deprecated since 10 857 * @useinstead ohos.bluetooth.access/access.off#event:stateChange 858 */ 859 /** 860 * Unsubscribe the event reported when the Bluetooth state changes. 861 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 862 * 863 * @permission ohos.permission.ACCESS_BLUETOOTH 864 * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. 865 * @param { Callback<BluetoothState> } callback - Callback used to listen for the Bluetooth state event. 866 * @throws { BusinessError } 201 - Permission denied. 867 * @throws { BusinessError } 401 - Invalid parameter. 868 * @throws { BusinessError } 801 - Capability not supported. 869 * @throws { BusinessError } 2900099 - Operation failed. 870 * @syscap SystemCapability.Communication.Bluetooth.Core 871 * @since 10 872 * @deprecated since 10 873 * @useinstead ohos.bluetooth.access/access.off#event:stateChange 874 */ 875 function off(type: 'stateChange', callback?: Callback<BluetoothState>): void; 876 877 /** 878 * Creates a Bluetooth server listening socket. 879 * 880 * @permission ohos.permission.USE_BLUETOOTH 881 * @param { string } name - Indicates the service name. 882 * @param { SppOption } option - Indicates the listen parameters {@link SppOption}. 883 * @param { AsyncCallback<number> } callback - Callback used to return a server socket ID. 884 * @throws { BusinessError } 201 - Permission denied. 885 * @throws { BusinessError } 401 - Invalid parameter. 886 * @throws { BusinessError } 801 - Capability not supported. 887 * @throws { BusinessError } 2900001 - Service stopped. 888 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 889 * @throws { BusinessError } 2900004 - Profile is not supported. 890 * @throws { BusinessError } 2900099 - Operation failed. 891 * @syscap SystemCapability.Communication.Bluetooth.Core 892 * @since 9 893 * @deprecated since 10 894 * @useinstead ohos.bluetooth.socket/socket#sppListen 895 */ 896 /** 897 * Creates a Bluetooth server listening socket. 898 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 899 * 900 * @permission ohos.permission.ACCESS_BLUETOOTH 901 * @param { string } name - Indicates the service name. 902 * @param { SppOption } option - Indicates the listen parameters {@link SppOption}. 903 * @param { AsyncCallback<number> } callback - Callback used to return a server socket ID. 904 * @throws { BusinessError } 201 - Permission denied. 905 * @throws { BusinessError } 401 - Invalid parameter. 906 * @throws { BusinessError } 801 - Capability not supported. 907 * @throws { BusinessError } 2900001 - Service stopped. 908 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 909 * @throws { BusinessError } 2900004 - Profile is not supported. 910 * @throws { BusinessError } 2900099 - Operation failed. 911 * @syscap SystemCapability.Communication.Bluetooth.Core 912 * @since 10 913 * @deprecated since 10 914 * @useinstead ohos.bluetooth.socket/socket#sppListen 915 */ 916 function sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void; 917 918 /** 919 * Waits for a remote device to connect. 920 * 921 * @param { number } serverSocket - Indicates the server socket ID, returned by {@link sppListen}. 922 * @param { AsyncCallback<number> } callback - Callback used to return a client socket ID. 923 * @throws { BusinessError } 401 - Invalid parameter. 924 * @throws { BusinessError } 801 - Capability not supported. 925 * @throws { BusinessError } 2900001 - Service stopped. 926 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 927 * @throws { BusinessError } 2900004 - Profile is not supported. 928 * @throws { BusinessError } 2900099 - Operation failed. 929 * @syscap SystemCapability.Communication.Bluetooth.Core 930 * @since 9 931 * @deprecated since 10 932 * @useinstead ohos.bluetooth.socket/socket#sppAccept 933 */ 934 function sppAccept(serverSocket: number, callback: AsyncCallback<number>): void; 935 936 /** 937 * Connects to a remote device over the socket. 938 * 939 * @permission ohos.permission.USE_BLUETOOTH 940 * @param { string } device - The address of the remote device to connect. 941 * @param { SppOption } option - Indicates the connect parameters {@link SppOption}. 942 * @param { AsyncCallback<number> } callback - Callback used to return a client socket ID. 943 * @throws { BusinessError } 201 - Permission denied. 944 * @throws { BusinessError } 401 - Invalid parameter. 945 * @throws { BusinessError } 801 - Capability not supported. 946 * @throws { BusinessError } 2900001 - Service stopped. 947 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 948 * @throws { BusinessError } 2900004 - Profile is not supported. 949 * @throws { BusinessError } 2900099 - Operation failed. 950 * @syscap SystemCapability.Communication.Bluetooth.Core 951 * @since 9 952 * @deprecated since 10 953 * @useinstead ohos.bluetooth.socket/socket#sppConnect 954 */ 955 /** 956 * Connects to a remote device over the socket. 957 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 958 * 959 * @permission ohos.permission.ACCESS_BLUETOOTH 960 * @param { string } device - The address of the remote device to connect. 961 * @param { SppOption } option - Indicates the connect parameters {@link SppOption}. 962 * @param { AsyncCallback<number> } callback - Callback used to return a client socket ID. 963 * @throws { BusinessError } 201 - Permission denied. 964 * @throws { BusinessError } 401 - Invalid parameter. 965 * @throws { BusinessError } 801 - Capability not supported. 966 * @throws { BusinessError } 2900001 - Service stopped. 967 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 968 * @throws { BusinessError } 2900004 - Profile is not supported. 969 * @throws { BusinessError } 2900099 - Operation failed. 970 * @syscap SystemCapability.Communication.Bluetooth.Core 971 * @since 10 972 * @deprecated since 10 973 * @useinstead ohos.bluetooth.socket/socket#sppConnect 974 */ 975 function sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void; 976 977 /** 978 * Disables an spp server socket and releases related resources. 979 * 980 * @param { number } socket - Indicates the server socket ID, returned by {@link sppListen}. 981 * @throws { BusinessError } 401 - Invalid parameter. 982 * @throws { BusinessError } 801 - Capability not supported. 983 * @throws { BusinessError } 2900001 - Service stopped. 984 * @throws { BusinessError } 2900099 - Operation failed. 985 * @syscap SystemCapability.Communication.Bluetooth.Core 986 * @since 9 987 * @deprecated since 10 988 * @useinstead ohos.bluetooth.socket/socket#sppCloseServerSocket 989 */ 990 function sppCloseServerSocket(socket: number): void; 991 992 /** 993 * Disables an spp client socket and releases related resources. 994 * 995 * @param { number } socket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. 996 * @throws { BusinessError } 401 - Invalid parameter. 997 * @throws { BusinessError } 801 - Capability not supported. 998 * @throws { BusinessError } 2900001 - Service stopped. 999 * @throws { BusinessError } 2900099 - Operation failed. 1000 * @syscap SystemCapability.Communication.Bluetooth.Core 1001 * @since 9 1002 * @deprecated since 10 1003 * @useinstead ohos.bluetooth.socket/socket#sppCloseClientSocket 1004 */ 1005 function sppCloseClientSocket(socket: number): void; 1006 1007 /** 1008 * Write data through the socket. 1009 * 1010 * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. 1011 * @param { ArrayBuffer } data - Indicates the data to write. 1012 * @throws { BusinessError } 401 - Invalid parameter. 1013 * @throws { BusinessError } 801 - Capability not supported. 1014 * @throws { BusinessError } 2901054 - IO error. 1015 * @throws { BusinessError } 2900099 - Operation failed. 1016 * @syscap SystemCapability.Communication.Bluetooth.Core 1017 * @since 9 1018 * @deprecated since 10 1019 * @useinstead ohos.bluetooth.socket/socket#sppWrite 1020 */ 1021 function sppWrite(clientSocket: number, data: ArrayBuffer): void; 1022 1023 /** 1024 * Subscribe the event reported when data is read from the socket. 1025 * 1026 * @param { 'sppRead' } type - Type of the spp read event to listen for. 1027 * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. 1028 * @param { Callback<ArrayBuffer> } callback - Callback used to listen for the spp read event. 1029 * @throws { BusinessError } 401 - Invalid parameter. 1030 * @throws { BusinessError } 801 - Capability not supported. 1031 * @throws { BusinessError } 2901054 - IO error. 1032 * @throws { BusinessError } 2900099 - Operation failed. 1033 * @syscap SystemCapability.Communication.Bluetooth.Core 1034 * @since 9 1035 * @deprecated since 10 1036 * @useinstead ohos.bluetooth.socket/socket.on#event:sppRead 1037 */ 1038 function on(type: 'sppRead', clientSocket: number, callback: Callback<ArrayBuffer>): void; 1039 1040 /** 1041 * Unsubscribe the event reported when data is read from the socket. 1042 * 1043 * @param { 'sppRead' } type - Type of the spp read event to listen for. 1044 * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. 1045 * @param { Callback<ArrayBuffer> } callback - Callback used to listen for the spp read event. 1046 * @throws { BusinessError } 401 - Invalid parameter. 1047 * @throws { BusinessError } 801 - Capability not supported. 1048 * @syscap SystemCapability.Communication.Bluetooth.Core 1049 * @since 9 1050 * @deprecated since 10 1051 * @useinstead ohos.bluetooth.socket/socket.off#event:sppRead 1052 */ 1053 function off(type: 'sppRead', clientSocket: number, callback?: Callback<ArrayBuffer>): void; 1054 1055 /** 1056 * Obtains the instance of profile. 1057 * 1058 * @param { ProfileId } profileId - The profile id.. 1059 * @returns { A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile } Returns the instance of profile. 1060 * @throws { BusinessError } 401 - Invalid parameter. 1061 * @throws { BusinessError } 801 - Capability not supported. 1062 * @syscap SystemCapability.Communication.Bluetooth.Core 1063 * @since 9 1064 * @deprecated since 10 1065 */ 1066 function getProfileInstance( 1067 profileId: ProfileId 1068 ): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile; 1069 1070 /** 1071 * Base interface of profile. 1072 * 1073 * @typedef BaseProfile 1074 * @syscap SystemCapability.Communication.Bluetooth.Core 1075 * @since 9 1076 * @deprecated since 10 1077 * @useinstead ohos.bluetooth.baseProfile/baseProfile.BaseProfile 1078 */ 1079 interface BaseProfile { 1080 /** 1081 * Obtains the connected devices list of profile. 1082 * 1083 * @permission ohos.permission.USE_BLUETOOTH 1084 * @returns { Array<string> } Returns the address of connected devices list. 1085 * @throws { BusinessError } 201 - Permission denied. 1086 * @throws { BusinessError } 801 - Capability not supported. 1087 * @throws { BusinessError } 2900001 - Service stopped. 1088 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1089 * @throws { BusinessError } 2900004 - Profile is not supported. 1090 * @throws { BusinessError } 2900099 - Operation failed. 1091 * @syscap SystemCapability.Communication.Bluetooth.Core 1092 * @since 9 1093 * @deprecated since 10 1094 * @useinstead ohos.bluetooth.baseProfile/baseProfile#getConnectedDevices 1095 */ 1096 /** 1097 * Obtains the connected devices list of profile. 1098 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 1099 * 1100 * @permission ohos.permission.ACCESS_BLUETOOTH 1101 * @returns { Array<string> } Returns the address of connected devices list. 1102 * @throws { BusinessError } 201 - Permission denied. 1103 * @throws { BusinessError } 801 - Capability not supported. 1104 * @throws { BusinessError } 2900001 - Service stopped. 1105 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1106 * @throws { BusinessError } 2900004 - Profile is not supported. 1107 * @throws { BusinessError } 2900099 - Operation failed. 1108 * @syscap SystemCapability.Communication.Bluetooth.Core 1109 * @since 10 1110 * @deprecated since 10 1111 * @useinstead ohos.bluetooth.baseProfile/baseProfile#getConnectedDevices 1112 */ 1113 getConnectionDevices(): Array<string>; 1114 1115 /** 1116 * Obtains the profile state of device. 1117 * 1118 * @permission ohos.permission.USE_BLUETOOTH 1119 * @param { string } device - The address of bluetooth device. 1120 * @returns { ProfileConnectionState } Returns {@link ProfileConnectionState} of device. 1121 * @throws { BusinessError } 201 - Permission denied. 1122 * @throws { BusinessError } 401 - Invalid parameter. 1123 * @throws { BusinessError } 801 - Capability not supported. 1124 * @throws { BusinessError } 2900001 - Service stopped. 1125 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1126 * @throws { BusinessError } 2900004 - Profile is not supported. 1127 * @throws { BusinessError } 2900099 - Operation failed. 1128 * @syscap SystemCapability.Communication.Bluetooth.Core 1129 * @since 9 1130 * @deprecated since 10 1131 * @useinstead ohos.bluetooth.baseProfile/baseProfile#getConnectionState 1132 */ 1133 /** 1134 * Obtains the profile state of device. 1135 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 1136 * 1137 * @permission ohos.permission.ACCESS_BLUETOOTH 1138 * @param { string } device - The address of bluetooth device. 1139 * @returns { ProfileConnectionState } Returns {@link ProfileConnectionState} of device. 1140 * @throws { BusinessError } 201 - Permission denied. 1141 * @throws { BusinessError } 401 - Invalid parameter. 1142 * @throws { BusinessError } 801 - Capability not supported. 1143 * @throws { BusinessError } 2900001 - Service stopped. 1144 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1145 * @throws { BusinessError } 2900004 - Profile is not supported. 1146 * @throws { BusinessError } 2900099 - Operation failed. 1147 * @syscap SystemCapability.Communication.Bluetooth.Core 1148 * @since 10 1149 * @deprecated since 10 1150 * @useinstead ohos.bluetooth.baseProfile/baseProfile#getConnectionState 1151 */ 1152 getDeviceState(device: string): ProfileConnectionState; 1153 } 1154 1155 /** 1156 * Manager a2dp source profile. 1157 * 1158 * @typedef A2dpSourceProfile 1159 * @syscap SystemCapability.Communication.Bluetooth.Core 1160 * @since 9 1161 * @deprecated since 10 1162 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile 1163 */ 1164 interface A2dpSourceProfile extends BaseProfile { 1165 /** 1166 * Connect to device with a2dp. 1167 * 1168 * @permission ohos.permission.DISCOVER_BLUETOOTH 1169 * @param { string } device - The address of the remote device to connect. 1170 * @throws { BusinessError } 201 - Permission denied. 1171 * @throws { BusinessError } 401 - Invalid parameter. 1172 * @throws { BusinessError } 801 - Capability not supported. 1173 * @throws { BusinessError } 2900001 - Service stopped. 1174 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1175 * @throws { BusinessError } 2900004 - Profile is not supported. 1176 * @throws { BusinessError } 2900099 - Operation failed. 1177 * @syscap SystemCapability.Communication.Bluetooth.Core 1178 * @since 9 1179 * @deprecated since 10 1180 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#connect 1181 */ 1182 /** 1183 * Connect to device with a2dp. 1184 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 1185 * 1186 * @permission ohos.permission.ACCESS_BLUETOOTH 1187 * @param { string } device - The address of the remote device to connect. 1188 * @throws { BusinessError } 201 - Permission denied. 1189 * @throws { BusinessError } 401 - Invalid parameter. 1190 * @throws { BusinessError } 801 - Capability not supported. 1191 * @throws { BusinessError } 2900001 - Service stopped. 1192 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1193 * @throws { BusinessError } 2900004 - Profile is not supported. 1194 * @throws { BusinessError } 2900099 - Operation failed. 1195 * @syscap SystemCapability.Communication.Bluetooth.Core 1196 * @since 10 1197 * @deprecated since 10 1198 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#connect 1199 */ 1200 connect(device: string): void; 1201 1202 /** 1203 * Disconnect to device with a2dp. 1204 * 1205 * @permission ohos.permission.DISCOVER_BLUETOOTH 1206 * @param { string } device - The address of the remote device to disconnect. 1207 * @throws { BusinessError } 201 - Permission denied. 1208 * @throws { BusinessError } 401 - Invalid parameter. 1209 * @throws { BusinessError } 801 - Capability not supported. 1210 * @throws { BusinessError } 2900001 - Service stopped. 1211 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1212 * @throws { BusinessError } 2900004 - Profile is not supported. 1213 * @throws { BusinessError } 2900099 - Operation failed. 1214 * @syscap SystemCapability.Communication.Bluetooth.Core 1215 * @since 9 1216 * @deprecated since 10 1217 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#disconnect 1218 */ 1219 /** 1220 * Disconnect to device with a2dp. 1221 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 1222 * 1223 * @permission ohos.permission.ACCESS_BLUETOOTH 1224 * @param { string } device - The address of the remote device to disconnect. 1225 * @throws { BusinessError } 201 - Permission denied. 1226 * @throws { BusinessError } 401 - Invalid parameter. 1227 * @throws { BusinessError } 801 - Capability not supported. 1228 * @throws { BusinessError } 2900001 - Service stopped. 1229 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1230 * @throws { BusinessError } 2900004 - Profile is not supported. 1231 * @throws { BusinessError } 2900099 - Operation failed. 1232 * @syscap SystemCapability.Communication.Bluetooth.Core 1233 * @since 10 1234 * @deprecated since 10 1235 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#disconnect 1236 */ 1237 disconnect(device: string): void; 1238 1239 /** 1240 * Subscribe the event reported when the profile connection state changes . 1241 * 1242 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1243 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1244 * @throws { BusinessError } 401 - Invalid parameter. 1245 * @throws { BusinessError } 801 - Capability not supported. 1246 * @syscap SystemCapability.Communication.Bluetooth.Core 1247 * @since 9 1248 * @deprecated since 10 1249 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile.on#event:connectionStateChange 1250 */ 1251 /** 1252 * Subscribe the event reported when the profile connection state changes. 1253 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1254 * 1255 * @permission ohos.permission.ACCESS_BLUETOOTH 1256 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1257 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1258 * @throws { BusinessError } 401 - Invalid parameter. 1259 * @throws { BusinessError } 801 - Capability not supported. 1260 * @syscap SystemCapability.Communication.Bluetooth.Core 1261 * @since 10 1262 * @deprecated since 10 1263 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile.on#event:connectionStateChange 1264 */ 1265 on(type: 'connectionStateChange', callback: Callback<StateChangeParam>): void; 1266 1267 /** 1268 * Unsubscribe the event reported when the profile connection state changes . 1269 * 1270 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1271 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1272 * @throws { BusinessError } 401 - Invalid parameter. 1273 * @throws { BusinessError } 801 - Capability not supported. 1274 * @syscap SystemCapability.Communication.Bluetooth.Core 1275 * @since 9 1276 * @deprecated since 10 1277 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile.off#event:connectionStateChange 1278 */ 1279 /** 1280 * Unsubscribe the event reported when the profile connection state changes. 1281 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1282 * 1283 * @permission ohos.permission.ACCESS_BLUETOOTH 1284 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1285 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1286 * @throws { BusinessError } 401 - Invalid parameter. 1287 * @throws { BusinessError } 801 - Capability not supported. 1288 * @syscap SystemCapability.Communication.Bluetooth.Core 1289 * @since 10 1290 * @deprecated since 10 1291 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile.off#event:connectionStateChange 1292 */ 1293 off(type: 'connectionStateChange', callback?: Callback<StateChangeParam>): void; 1294 1295 /** 1296 * Obtains the playing state of device. 1297 * 1298 * @param { string } device - The address of the remote device. 1299 * @returns { PlayingState } Returns {@link PlayingState} of the remote device. 1300 * @throws { BusinessError } 401 - Invalid parameter. 1301 * @throws { BusinessError } 801 - Capability not supported. 1302 * @throws { BusinessError } 2900001 - Service stopped. 1303 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1304 * @throws { BusinessError } 2900004 - Profile is not supported. 1305 * @throws { BusinessError } 2900099 - Operation failed. 1306 * @syscap SystemCapability.Communication.Bluetooth.Core 1307 * @since 9 1308 * @deprecated since 10 1309 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#getPlayingState 1310 */ 1311 /** 1312 * Obtains the playing state of device. 1313 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1314 * 1315 * @permission ohos.permission.ACCESS_BLUETOOTH 1316 * @param { string } device - The address of the remote device. 1317 * @returns { PlayingState } Returns {@link PlayingState} of the remote device. 1318 * @throws { BusinessError } 401 - Invalid parameter. 1319 * @throws { BusinessError } 801 - Capability not supported. 1320 * @throws { BusinessError } 2900001 - Service stopped. 1321 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1322 * @throws { BusinessError } 2900004 - Profile is not supported. 1323 * @throws { BusinessError } 2900099 - Operation failed. 1324 * @syscap SystemCapability.Communication.Bluetooth.Core 1325 * @since 10 1326 * @deprecated since 10 1327 * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#getPlayingState 1328 */ 1329 getPlayingState(device: string): PlayingState; 1330 } 1331 1332 /** 1333 * Manager handsfree AG profile. 1334 * 1335 * @typedef HandsFreeAudioGatewayProfile 1336 * @syscap SystemCapability.Communication.Bluetooth.Core 1337 * @since 9 1338 * @deprecated since 10 1339 * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile 1340 */ 1341 interface HandsFreeAudioGatewayProfile extends BaseProfile { 1342 /** 1343 * Connect to device with hfp. 1344 * 1345 * @permission ohos.permission.DISCOVER_BLUETOOTH 1346 * @param { string } device - The address of the remote device to connect. 1347 * @throws { BusinessError } 201 - Permission denied. 1348 * @throws { BusinessError } 401 - Invalid parameter. 1349 * @throws { BusinessError } 801 - Capability not supported. 1350 * @throws { BusinessError } 2900001 - Service stopped. 1351 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1352 * @throws { BusinessError } 2900004 - Profile is not supported. 1353 * @throws { BusinessError } 2900099 - Operation failed. 1354 * @syscap SystemCapability.Communication.Bluetooth.Core 1355 * @since 9 1356 * @deprecated since 10 1357 * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile#connect 1358 */ 1359 /** 1360 * Connect to device with hfp. 1361 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 1362 * 1363 * @permission ohos.permission.ACCESS_BLUETOOTH 1364 * @param { string } device - The address of the remote device to connect. 1365 * @throws { BusinessError } 201 - Permission denied. 1366 * @throws { BusinessError } 401 - Invalid parameter. 1367 * @throws { BusinessError } 801 - Capability not supported. 1368 * @throws { BusinessError } 2900001 - Service stopped. 1369 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1370 * @throws { BusinessError } 2900004 - Profile is not supported. 1371 * @throws { BusinessError } 2900099 - Operation failed. 1372 * @syscap SystemCapability.Communication.Bluetooth.Core 1373 * @since 10 1374 * @deprecated since 10 1375 * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile#connect 1376 */ 1377 connect(device: string): void; 1378 1379 /** 1380 * Disconnect to device with hfp. 1381 * 1382 * @permission ohos.permission.DISCOVER_BLUETOOTH 1383 * @param { string } device - The address of the remote device to disconnect. 1384 * @throws { BusinessError } 201 - Permission denied. 1385 * @throws { BusinessError } 401 - Invalid parameter. 1386 * @throws { BusinessError } 801 - Capability not supported. 1387 * @throws { BusinessError } 2900001 - Service stopped. 1388 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1389 * @throws { BusinessError } 2900004 - Profile is not supported. 1390 * @throws { BusinessError } 2900099 - Operation failed. 1391 * @syscap SystemCapability.Communication.Bluetooth.Core 1392 * @since 9 1393 * @deprecated since 10 1394 * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile#disconnect 1395 */ 1396 /** 1397 * Disconnect to device with hfp. 1398 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 1399 * 1400 * @permission ohos.permission.ACCESS_BLUETOOTH 1401 * @param { string } device - The address of the remote device to disconnect. 1402 * @throws { BusinessError } 201 - Permission denied. 1403 * @throws { BusinessError } 401 - Invalid parameter. 1404 * @throws { BusinessError } 801 - Capability not supported. 1405 * @throws { BusinessError } 2900001 - Service stopped. 1406 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1407 * @throws { BusinessError } 2900004 - Profile is not supported. 1408 * @throws { BusinessError } 2900099 - Operation failed. 1409 * @syscap SystemCapability.Communication.Bluetooth.Core 1410 * @since 10 1411 * @deprecated since 10 1412 * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile#disconnect 1413 */ 1414 disconnect(device: string): void; 1415 1416 /** 1417 * Subscribe the event reported when the profile connection state changes . 1418 * 1419 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1420 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1421 * @throws { BusinessError } 401 - Invalid parameter. 1422 * @throws { BusinessError } 801 - Capability not supported. 1423 * @syscap SystemCapability.Communication.Bluetooth.Core 1424 * @since 9 1425 * @deprecated since 10 1426 * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile.on#event:connectionStateChange 1427 */ 1428 /** 1429 * Subscribe the event reported when the profile connection state changes. 1430 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1431 * 1432 * @permission ohos.permission.ACCESS_BLUETOOTH 1433 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1434 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1435 * @throws { BusinessError } 401 - Invalid parameter. 1436 * @throws { BusinessError } 801 - Capability not supported. 1437 * @syscap SystemCapability.Communication.Bluetooth.Core 1438 * @since 10 1439 * @deprecated since 10 1440 * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile.on#event:connectionStateChange 1441 */ 1442 on(type: 'connectionStateChange', callback: Callback<StateChangeParam>): void; 1443 1444 /** 1445 * Unsubscribe the event reported when the profile connection state changes . 1446 * 1447 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1448 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1449 * @throws { BusinessError } 401 - Invalid parameter. 1450 * @throws { BusinessError } 801 - Capability not supported. 1451 * @syscap SystemCapability.Communication.Bluetooth.Core 1452 * @since 9 1453 * @deprecated since 10 1454 * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile.off#event:connectionStateChange 1455 */ 1456 /** 1457 * Unsubscribe the event reported when the profile connection state changes. 1458 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1459 * 1460 * @permission ohos.permission.ACCESS_BLUETOOTH 1461 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1462 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1463 * @throws { BusinessError } 401 - Invalid parameter. 1464 * @throws { BusinessError } 801 - Capability not supported. 1465 * @syscap SystemCapability.Communication.Bluetooth.Core 1466 * @since 10 1467 * @deprecated since 10 1468 * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile.off#event:connectionStateChange 1469 */ 1470 off(type: 'connectionStateChange', callback?: Callback<StateChangeParam>): void; 1471 } 1472 1473 /** 1474 * Manager hid host profile. 1475 * 1476 * @typedef HidHostProfile 1477 * @syscap SystemCapability.Communication.Bluetooth.Core 1478 * @since 9 1479 * @deprecated since 10 1480 * @useinstead ohos.bluetooth.hid/hid.HidHostProfile 1481 */ 1482 interface HidHostProfile extends BaseProfile { 1483 /** 1484 * Connect to device with hid host. 1485 * 1486 * @permission ohos.permission.DISCOVER_BLUETOOTH 1487 * @param { string } device - The address of the remote device to connect. 1488 * @throws { BusinessError } 201 - Permission denied. 1489 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1490 * @throws { BusinessError } 401 - Invalid parameter. 1491 * @throws { BusinessError } 801 - Capability not supported. 1492 * @throws { BusinessError } 2900001 - Service stopped. 1493 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1494 * @throws { BusinessError } 2900004 - Profile is not supported. 1495 * @throws { BusinessError } 2900099 - Operation failed. 1496 * @syscap SystemCapability.Communication.Bluetooth.Core 1497 * @systemapi Hide this for inner system use. 1498 * @since 9 1499 * @deprecated since 10 1500 * @useinstead ohos.bluetooth.hid/hid.HidHostProfile#connect 1501 */ 1502 /** 1503 * Connect to device with hid host. 1504 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH and MANAGE_BLUETOOTH. 1505 * 1506 * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 1507 * @param { string } device - The address of the remote device to connect. 1508 * @throws { BusinessError } 201 - Permission denied. 1509 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1510 * @throws { BusinessError } 401 - Invalid parameter. 1511 * @throws { BusinessError } 801 - Capability not supported. 1512 * @throws { BusinessError } 2900001 - Service stopped. 1513 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1514 * @throws { BusinessError } 2900004 - Profile is not supported. 1515 * @throws { BusinessError } 2900099 - Operation failed. 1516 * @syscap SystemCapability.Communication.Bluetooth.Core 1517 * @systemapi Hide this for inner system use. 1518 * @since 10 1519 * @deprecated since 10 1520 * @useinstead ohos.bluetooth.hid/hid.HidHostProfile#connect 1521 */ 1522 connect(device: string): void; 1523 1524 /** 1525 * Disconnect to device with hid host. 1526 * 1527 * @permission ohos.permission.DISCOVER_BLUETOOTH 1528 * @param { string } device - The address of the remote device to disconnect. 1529 * @throws { BusinessError } 201 - Permission denied. 1530 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1531 * @throws { BusinessError } 401 - Invalid parameter. 1532 * @throws { BusinessError } 801 - Capability not supported. 1533 * @throws { BusinessError } 2900001 - Service stopped. 1534 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1535 * @throws { BusinessError } 2900004 - Profile is not supported. 1536 * @throws { BusinessError } 2900099 - Operation failed. 1537 * @syscap SystemCapability.Communication.Bluetooth.Core 1538 * @systemapi Hide this for inner system use. 1539 * @since 9 1540 * @deprecated since 10 1541 * @useinstead ohos.bluetooth.hid/hid.HidHostProfile#disconnect 1542 */ 1543 /** 1544 * Disconnect to device with hid host. 1545 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH and MANAGE_BLUETOOTH. 1546 * 1547 * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 1548 * @param { string } device - The address of the remote device to disconnect. 1549 * @throws { BusinessError } 201 - Permission denied. 1550 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1551 * @throws { BusinessError } 401 - Invalid parameter. 1552 * @throws { BusinessError } 801 - Capability not supported. 1553 * @throws { BusinessError } 2900001 - Service stopped. 1554 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1555 * @throws { BusinessError } 2900004 - Profile is not supported. 1556 * @throws { BusinessError } 2900099 - Operation failed. 1557 * @syscap SystemCapability.Communication.Bluetooth.Core 1558 * @systemapi Hide this for inner system use. 1559 * @since 10 1560 * @deprecated since 10 1561 * @useinstead ohos.bluetooth.hid/hid.HidHostProfile#disconnect 1562 */ 1563 disconnect(device: string): void; 1564 1565 /** 1566 * Subscribe the event reported when the profile connection state changes . 1567 * 1568 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1569 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1570 * @throws { BusinessError } 401 - Invalid parameter. 1571 * @throws { BusinessError } 801 - Capability not supported. 1572 * @syscap SystemCapability.Communication.Bluetooth.Core 1573 * @since 9 1574 * @deprecated since 10 1575 * @useinstead ohos.bluetooth.hid/hid.HidHostProfile.on#event:connectionStateChange 1576 */ 1577 /** 1578 * Subscribe the event reported when the profile connection state changes. 1579 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1580 * 1581 * @permission ohos.permission.ACCESS_BLUETOOTH 1582 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1583 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1584 * @throws { BusinessError } 401 - Invalid parameter. 1585 * @throws { BusinessError } 801 - Capability not supported. 1586 * @syscap SystemCapability.Communication.Bluetooth.Core 1587 * @since 10 1588 * @deprecated since 10 1589 * @useinstead ohos.bluetooth.hid/hid.HidHostProfile.on#event:connectionStateChange 1590 */ 1591 on(type: 'connectionStateChange', callback: Callback<StateChangeParam>): void; 1592 1593 /** 1594 * Unsubscribe the event reported when the profile connection state changes. 1595 * 1596 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. 1597 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1598 * @throws { BusinessError } 401 - Invalid parameter. 1599 * @throws { BusinessError } 801 - Capability not supported. 1600 * @syscap SystemCapability.Communication.Bluetooth.Core 1601 * @since 9 1602 * @deprecated since 10 1603 * @useinstead ohos.bluetooth.hid/hid.HidHostProfile.off#event:connectionStateChange 1604 */ 1605 /** 1606 * Unsubscribe the event reported when the profile connection state changes. 1607 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1608 * 1609 * @permission ohos.permission.ACCESS_BLUETOOTH 1610 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. 1611 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1612 * @throws { BusinessError } 401 - Invalid parameter. 1613 * @throws { BusinessError } 801 - Capability not supported. 1614 * @syscap SystemCapability.Communication.Bluetooth.Core 1615 * @since 10 1616 * @deprecated since 10 1617 * @useinstead ohos.bluetooth.hid/hid.HidHostProfile.off#event:connectionStateChange 1618 */ 1619 off(type: 'connectionStateChange', callback?: Callback<StateChangeParam>): void; 1620 } 1621 1622 /** 1623 * Manager pan profile. 1624 * 1625 * @typedef PanProfile 1626 * @syscap SystemCapability.Communication.Bluetooth.Core 1627 * @since 9 1628 * @deprecated since 10 1629 * @useinstead ohos.bluetooth.pan/pan.PanProfile 1630 */ 1631 interface PanProfile extends BaseProfile { 1632 /** 1633 * Disconnect to device with pan. 1634 * 1635 * @permission ohos.permission.USE_BLUETOOTH 1636 * @param { string } device - The address of the remote device to disconnect. 1637 * @throws { BusinessError } 201 - Permission denied. 1638 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1639 * @throws { BusinessError } 401 - Invalid parameter. 1640 * @throws { BusinessError } 801 - Capability not supported. 1641 * @throws { BusinessError } 2900001 - Service stopped. 1642 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1643 * @throws { BusinessError } 2900004 - Profile is not supported. 1644 * @throws { BusinessError } 2900099 - Operation failed. 1645 * @syscap SystemCapability.Communication.Bluetooth.Core 1646 * @systemapi Hide this for inner system use. 1647 * @since 9 1648 * @deprecated since 10 1649 * @useinstead ohos.bluetooth.pan/pan.PanProfile#disconnect 1650 */ 1651 /** 1652 * Disconnect to device with pan. 1653 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 1654 * 1655 * @permission ohos.permission.ACCESS_BLUETOOTH 1656 * @param { string } device - The address of the remote device to disconnect. 1657 * @throws { BusinessError } 201 - Permission denied. 1658 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1659 * @throws { BusinessError } 401 - Invalid parameter. 1660 * @throws { BusinessError } 801 - Capability not supported. 1661 * @throws { BusinessError } 2900001 - Service stopped. 1662 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1663 * @throws { BusinessError } 2900004 - Profile is not supported. 1664 * @throws { BusinessError } 2900099 - Operation failed. 1665 * @syscap SystemCapability.Communication.Bluetooth.Core 1666 * @systemapi Hide this for inner system use. 1667 * @since 10 1668 * @deprecated since 10 1669 * @useinstead ohos.bluetooth.pan/pan.PanProfile#disconnect 1670 */ 1671 disconnect(device: string): void; 1672 1673 /** 1674 * Subscribe the event reported when the profile connection state changes . 1675 * 1676 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1677 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1678 * @throws { BusinessError } 401 - Invalid parameter. 1679 * @throws { BusinessError } 801 - Capability not supported. 1680 * @syscap SystemCapability.Communication.Bluetooth.Core 1681 * @since 9 1682 * @deprecated since 10 1683 * @useinstead ohos.bluetooth.pan/pan.PanProfile.on#event:connectionStateChange 1684 */ 1685 /** 1686 * Subscribe the event reported when the profile connection state changes. 1687 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1688 * 1689 * @permission ohos.permission.ACCESS_BLUETOOTH 1690 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . 1691 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1692 * @throws { BusinessError } 401 - Invalid parameter. 1693 * @throws { BusinessError } 801 - Capability not supported. 1694 * @syscap SystemCapability.Communication.Bluetooth.Core 1695 * @since 10 1696 * @deprecated since 10 1697 * @useinstead ohos.bluetooth.pan/pan.PanProfile.on#event:connectionStateChange 1698 */ 1699 on(type: 'connectionStateChange', callback: Callback<StateChangeParam>): void; 1700 1701 /** 1702 * Unsubscribe the event reported when the profile connection state changes. 1703 * 1704 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. 1705 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1706 * @throws { BusinessError } 401 - Invalid parameter. 1707 * @throws { BusinessError } 801 - Capability not supported. 1708 * @syscap SystemCapability.Communication.Bluetooth.Core 1709 * @since 9 1710 * @deprecated since 10 1711 * @useinstead ohos.bluetooth.pan/pan.PanProfile.off#event:connectionStateChange 1712 */ 1713 /** 1714 * Unsubscribe the event reported when the profile connection state changes. 1715 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1716 * 1717 * @permission ohos.permission.ACCESS_BLUETOOTH 1718 * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. 1719 * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 1720 * @throws { BusinessError } 401 - Invalid parameter. 1721 * @throws { BusinessError } 801 - Capability not supported. 1722 * @syscap SystemCapability.Communication.Bluetooth.Core 1723 * @since 10 1724 * @deprecated since 10 1725 * @useinstead ohos.bluetooth.pan/pan.PanProfile.off#event:connectionStateChange 1726 */ 1727 off(type: 'connectionStateChange', callback?: Callback<StateChangeParam>): void; 1728 1729 /** 1730 * Enable bluetooth tethering. 1731 * 1732 * @permission ohos.permission.DISCOVER_BLUETOOTH 1733 * @param { boolean } enable - Specifies whether to enable tethering. The value {@code true} indicates 1734 * that tethering is enabled, and the value {@code false} indicates that tethering is disabled. 1735 * @throws { BusinessError } 201 - Permission denied. 1736 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1737 * @throws { BusinessError } 401 - Invalid parameter. 1738 * @throws { BusinessError } 801 - Capability not supported. 1739 * @throws { BusinessError } 2900001 - Service stopped. 1740 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1741 * @throws { BusinessError } 2900004 - Profile is not supported. 1742 * @throws { BusinessError } 2900099 - Operation failed. 1743 * @syscap SystemCapability.Communication.Bluetooth.Core 1744 * @systemapi Hide this for inner system use. 1745 * @since 9 1746 * @deprecated since 10 1747 * @useinstead ohos.bluetooth.pan/pan.PanProfile#setTethering 1748 */ 1749 /** 1750 * Enable bluetooth tethering. 1751 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH and MANAGE_BLUETOOTH. 1752 * 1753 * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 1754 * @param { boolean } enable - Specifies whether to enable tethering. The value {@code true} indicates 1755 * that tethering is enabled, and the value {@code false} indicates that tethering is disabled. 1756 * @throws { BusinessError } 201 - Permission denied. 1757 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1758 * @throws { BusinessError } 401 - Invalid parameter. 1759 * @throws { BusinessError } 801 - Capability not supported. 1760 * @throws { BusinessError } 2900001 - Service stopped. 1761 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1762 * @throws { BusinessError } 2900004 - Profile is not supported. 1763 * @throws { BusinessError } 2900099 - Operation failed. 1764 * @syscap SystemCapability.Communication.Bluetooth.Core 1765 * @systemapi Hide this for inner system use. 1766 * @since 10 1767 * @deprecated since 10 1768 * @useinstead ohos.bluetooth.pan/pan.PanProfile#setTethering 1769 */ 1770 setTethering(enable: boolean): void; 1771 1772 /** 1773 * Obtains the tethering enable or disable. 1774 * 1775 * @returns { boolean } Returns the value {@code true} is tethering is on, returns {@code false} otherwise. 1776 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1777 * @throws { BusinessError } 801 - Capability not supported. 1778 * @syscap SystemCapability.Communication.Bluetooth.Core 1779 * @systemapi Hide this for inner system use. 1780 * @since 9 1781 * @deprecated since 10 1782 * @useinstead ohos.bluetooth.pan/pan.PanProfile#isTetheringOn 1783 */ 1784 /** 1785 * Obtains the tethering enable or disable. 1786 * The permission required by this interface is changed to ACCESS_BLUETOOTH. 1787 * 1788 * @permission ohos.permission.ACCESS_BLUETOOTH 1789 * @returns { boolean } Returns the value {@code true} is tethering is on, returns {@code false} otherwise. 1790 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 1791 * @throws { BusinessError } 801 - Capability not supported. 1792 * @syscap SystemCapability.Communication.Bluetooth.Core 1793 * @systemapi Hide this for inner system use. 1794 * @since 10 1795 * @deprecated since 10 1796 * @useinstead ohos.bluetooth.pan/pan.PanProfile#isTetheringOn 1797 */ 1798 isTetheringOn(): boolean; 1799 } 1800 1801 namespace BLE { 1802 /** 1803 * create a JavaScript Gatt server instance. 1804 * 1805 * @returns { GattServer } Returns a JavaScript Gatt server instance {@code GattServer}. 1806 * @syscap SystemCapability.Communication.Bluetooth.Core 1807 * @since 9 1808 * @deprecated since 10 1809 * @useinstead ohos.bluetooth.ble/ble#createGattServer 1810 */ 1811 function createGattServer(): GattServer; 1812 1813 /** 1814 * create a JavaScript Gatt client device instance. 1815 * 1816 * @param { string } deviceId - The address of the remote device. 1817 * @returns { GattClientDevice } Returns a JavaScript Gatt client device instance {@code GattClientDevice}. 1818 * @throws { BusinessError } 401 - Invalid parameter. 1819 * @throws { BusinessError } 801 - Capability not supported. 1820 * @syscap SystemCapability.Communication.Bluetooth.Core 1821 * @since 9 1822 * @deprecated since 10 1823 * @useinstead ohos.bluetooth.ble/ble#createGattClientDevice 1824 */ 1825 function createGattClientDevice(deviceId: string): GattClientDevice; 1826 1827 /** 1828 * Obtains the list of devices in the connected status. 1829 * 1830 * @permission ohos.permission.USE_BLUETOOTH 1831 * @returns { Array<string> } Returns the list of device address. 1832 * @throws { BusinessError } 201 - Permission denied. 1833 * @throws { BusinessError } 801 - Capability not supported. 1834 * @throws { BusinessError } 2900001 - Service stopped. 1835 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1836 * @throws { BusinessError } 2900099 - Operation failed. 1837 * @syscap SystemCapability.Communication.Bluetooth.Core 1838 * @since 9 1839 * @deprecated since 10 1840 * @useinstead ohos.bluetooth.ble/ble#getConnectedBLEDevices 1841 */ 1842 /** 1843 * Obtains the list of devices in the connected status. 1844 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 1845 * 1846 * @permission ohos.permission.ACCESS_BLUETOOTH 1847 * @returns { Array<string> } Returns the list of device address. 1848 * @throws { BusinessError } 201 - Permission denied. 1849 * @throws { BusinessError } 801 - Capability not supported. 1850 * @throws { BusinessError } 2900001 - Service stopped. 1851 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1852 * @throws { BusinessError } 2900099 - Operation failed. 1853 * @syscap SystemCapability.Communication.Bluetooth.Core 1854 * @since 10 1855 * @deprecated since 10 1856 * @useinstead ohos.bluetooth.ble/ble#getConnectedBLEDevices 1857 */ 1858 function getConnectedBLEDevices(): Array<string>; 1859 1860 /** 1861 * Starts scanning for specified BLE devices with filters. 1862 * 1863 * @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH and ohos.permission.LOCATION 1864 * and ohos.permission.APPROXIMATELY_LOCATION 1865 * @param { Array<ScanFilter> } filters - Indicates the list of filters used to filter out specified devices. 1866 * If you do not want to use filter, set this parameter to {@code null}. 1867 * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. 1868 * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} 1869 * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. 1870 * @throws { BusinessError } 201 - Permission denied. 1871 * @throws { BusinessError } 401 - Invalid parameter. 1872 * @throws { BusinessError } 801 - Capability not supported. 1873 * @throws { BusinessError } 2900001 - Service stopped. 1874 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1875 * @throws { BusinessError } 2900099 - Operation failed. 1876 * @syscap SystemCapability.Communication.Bluetooth.Core 1877 * @since 9 1878 * @deprecated since 10 1879 * @useinstead ohos.bluetooth.ble/ble#startBLEScan 1880 */ 1881 /** 1882 * Starts scanning for specified BLE devices with filters. 1883 * The permission required by this interface is changed from DISCOVER_BLUETOOTH and MANAGE_BLUETOOTH and LOCATION to ACCESS_BLUETOOTH. 1884 * 1885 * @permission ohos.permission.ACCESS_BLUETOOTH 1886 * @param { Array<ScanFilter> } filters - Indicates the list of filters used to filter out specified devices. 1887 * If you do not want to use filter, set this parameter to {@code null}. 1888 * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. 1889 * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} 1890 * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. 1891 * @throws { BusinessError } 201 - Permission denied. 1892 * @throws { BusinessError } 401 - Invalid parameter. 1893 * @throws { BusinessError } 801 - Capability not supported. 1894 * @throws { BusinessError } 2900001 - Service stopped. 1895 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1896 * @throws { BusinessError } 2900099 - Operation failed. 1897 * @syscap SystemCapability.Communication.Bluetooth.Core 1898 * @since 10 1899 * @deprecated since 10 1900 * @useinstead ohos.bluetooth.ble/ble#startBLEScan 1901 */ 1902 function startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void; 1903 1904 /** 1905 * Stops BLE scanning. 1906 * 1907 * @permission ohos.permission.DISCOVER_BLUETOOTH 1908 * @throws { BusinessError } 201 - Permission denied. 1909 * @throws { BusinessError } 801 - Capability not supported. 1910 * @throws { BusinessError } 2900001 - Service stopped. 1911 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1912 * @throws { BusinessError } 2900099 - Operation failed. 1913 * @syscap SystemCapability.Communication.Bluetooth.Core 1914 * @since 9 1915 * @deprecated since 10 1916 * @useinstead ohos.bluetooth.ble/ble#stopBLEScan 1917 */ 1918 /** 1919 * Stops BLE scanning. 1920 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 1921 * 1922 * @permission ohos.permission.ACCESS_BLUETOOTH 1923 * @throws { BusinessError } 201 - Permission denied. 1924 * @throws { BusinessError } 801 - Capability not supported. 1925 * @throws { BusinessError } 2900001 - Service stopped. 1926 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 1927 * @throws { BusinessError } 2900099 - Operation failed. 1928 * @syscap SystemCapability.Communication.Bluetooth.Core 1929 * @since 10 1930 * @deprecated since 10 1931 * @useinstead ohos.bluetooth.ble/ble#stopBLEScan 1932 */ 1933 function stopBLEScan(): void; 1934 1935 /** 1936 * Subscribe BLE scan result. 1937 * 1938 * @permission ohos.permission.USE_BLUETOOTH 1939 * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. 1940 * @param { Callback<Array<ScanResult>> } callback - Callback used to listen for the scan result event. 1941 * @throws { BusinessError } 201 - Permission denied. 1942 * @throws { BusinessError } 401 - Invalid parameter. 1943 * @throws { BusinessError } 801 - Capability not supported. 1944 * @throws { BusinessError } 2900099 - Operation failed. 1945 * @syscap SystemCapability.Communication.Bluetooth.Core 1946 * @since 9 1947 * @deprecated since 10 1948 * @useinstead ohos.bluetooth.ble/ble.on#event:BLEDeviceFind 1949 */ 1950 /** 1951 * Subscribe BLE scan result. 1952 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 1953 * 1954 * @permission ohos.permission.ACCESS_BLUETOOTH 1955 * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. 1956 * @param { Callback<Array<ScanResult>> } callback - Callback used to listen for the scan result event. 1957 * @throws { BusinessError } 201 - Permission denied. 1958 * @throws { BusinessError } 401 - Invalid parameter. 1959 * @throws { BusinessError } 801 - Capability not supported. 1960 * @throws { BusinessError } 2900099 - Operation failed. 1961 * @syscap SystemCapability.Communication.Bluetooth.Core 1962 * @since 10 1963 * @deprecated since 10 1964 * @useinstead ohos.bluetooth.ble/ble.on#event:BLEDeviceFind 1965 */ 1966 function on(type: 'BLEDeviceFind', callback: Callback<Array<ScanResult>>): void; 1967 1968 /** 1969 * Unsubscribe BLE scan result. 1970 * 1971 * @permission ohos.permission.USE_BLUETOOTH 1972 * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. 1973 * @param { Callback<Array<ScanResult>> } callback - Callback used to listen for the scan result event. 1974 * @throws { BusinessError } 201 - Permission denied. 1975 * @throws { BusinessError } 401 - Invalid parameter. 1976 * @throws { BusinessError } 801 - Capability not supported. 1977 * @throws { BusinessError } 2900099 - Operation failed. 1978 * @syscap SystemCapability.Communication.Bluetooth.Core 1979 * @since 9 1980 * @deprecated since 10 1981 * @useinstead ohos.bluetooth.ble/ble.off#event:BLEDeviceFind 1982 */ 1983 /** 1984 * Unsubscribe BLE scan result. 1985 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 1986 * 1987 * @permission ohos.permission.ACCESS_BLUETOOTH 1988 * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. 1989 * @param { Callback<Array<ScanResult>> } callback - Callback used to listen for the scan result event. 1990 * @throws { BusinessError } 201 - Permission denied. 1991 * @throws { BusinessError } 401 - Invalid parameter. 1992 * @throws { BusinessError } 801 - Capability not supported. 1993 * @throws { BusinessError } 2900099 - Operation failed. 1994 * @syscap SystemCapability.Communication.Bluetooth.Core 1995 * @since 10 1996 * @deprecated since 10 1997 * @useinstead ohos.bluetooth.ble/ble.off#event:BLEDeviceFind 1998 */ 1999 function off(type: 'BLEDeviceFind', callback?: Callback<Array<ScanResult>>): void; 2000 } 2001 2002 /** 2003 * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. 2004 * 2005 * @typedef GattServer 2006 * @syscap SystemCapability.Communication.Bluetooth.Core 2007 * @since 9 2008 * @deprecated since 10 2009 * @useinstead ohos.bluetooth.ble/ble.GattServer 2010 */ 2011 interface GattServer { 2012 /** 2013 * Starts BLE advertising. 2014 * 2015 * @permission ohos.permission.DISCOVER_BLUETOOTH 2016 * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. 2017 * If you need to use the default value, set this parameter to {@code null}. 2018 * @param { AdvertiseData } advData - Indicates the advertising data. 2019 * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. 2020 * @throws { BusinessError } 201 - Permission denied. 2021 * @throws { BusinessError } 401 - Invalid parameter. 2022 * @throws { BusinessError } 801 - Capability not supported. 2023 * @throws { BusinessError } 2900001 - Service stopped. 2024 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2025 * @throws { BusinessError } 2900099 - Operation failed. 2026 * @syscap SystemCapability.Communication.Bluetooth.Core 2027 * @since 9 2028 * @deprecated since 10 2029 * @useinstead ohos.bluetooth.ble/ble#startAdvertising 2030 */ 2031 /** 2032 * Starts BLE advertising. 2033 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 2034 * 2035 * @permission ohos.permission.ACCESS_BLUETOOTH 2036 * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. 2037 * If you need to use the default value, set this parameter to {@code null}. 2038 * @param { AdvertiseData } advData - Indicates the advertising data. 2039 * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. 2040 * @throws { BusinessError } 201 - Permission denied. 2041 * @throws { BusinessError } 401 - Invalid parameter. 2042 * @throws { BusinessError } 801 - Capability not supported. 2043 * @throws { BusinessError } 2900001 - Service stopped. 2044 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2045 * @throws { BusinessError } 2900099 - Operation failed. 2046 * @syscap SystemCapability.Communication.Bluetooth.Core 2047 * @since 10 2048 * @deprecated since 10 2049 * @useinstead ohos.bluetooth.ble/ble#startAdvertising 2050 */ 2051 startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void; 2052 2053 /** 2054 * Stops BLE advertising. 2055 * 2056 * @permission ohos.permission.DISCOVER_BLUETOOTH 2057 * @throws { BusinessError } 201 - Permission denied. 2058 * @throws { BusinessError } 801 - Capability not supported. 2059 * @throws { BusinessError } 2900001 - Service stopped. 2060 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2061 * @throws { BusinessError } 2900099 - Operation failed. 2062 * @syscap SystemCapability.Communication.Bluetooth.Core 2063 * @since 9 2064 * @deprecated since 10 2065 * @useinstead ohos.bluetooth.ble/ble#stopAdvertising 2066 */ 2067 /** 2068 * Stops BLE advertising. 2069 * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. 2070 * 2071 * @permission ohos.permission.ACCESS_BLUETOOTH 2072 * @throws { BusinessError } 201 - Permission denied. 2073 * @throws { BusinessError } 801 - Capability not supported. 2074 * @throws { BusinessError } 2900001 - Service stopped. 2075 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2076 * @throws { BusinessError } 2900099 - Operation failed. 2077 * @syscap SystemCapability.Communication.Bluetooth.Core 2078 * @since 10 2079 * @deprecated since 10 2080 * @useinstead ohos.bluetooth.ble/ble#stopAdvertising 2081 */ 2082 stopAdvertising(): void; 2083 2084 /** 2085 * Adds a specified service to be hosted. 2086 * <p>The added service and its characteristics are provided by the local device. 2087 * 2088 * @permission ohos.permission.USE_BLUETOOTH 2089 * @param { GattService } service - Indicates the service to add. 2090 * @throws { BusinessError } 201 - Permission denied. 2091 * @throws { BusinessError } 401 - Invalid parameter. 2092 * @throws { BusinessError } 801 - Capability not supported. 2093 * @throws { BusinessError } 2900001 - Service stopped. 2094 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2095 * @throws { BusinessError } 2900099 - Operation failed. 2096 * @syscap SystemCapability.Communication.Bluetooth.Core 2097 * @since 9 2098 * @deprecated since 10 2099 * @useinstead ohos.bluetooth.ble/ble.GattServer#addService 2100 */ 2101 /** 2102 * Adds a specified service to be hosted. 2103 * <p>The added service and its characteristics are provided by the local device. 2104 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2105 * 2106 * @permission ohos.permission.ACCESS_BLUETOOTH 2107 * @param { GattService } service - Indicates the service to add. 2108 * @throws { BusinessError } 201 - Permission denied. 2109 * @throws { BusinessError } 401 - Invalid parameter. 2110 * @throws { BusinessError } 801 - Capability not supported. 2111 * @throws { BusinessError } 2900001 - Service stopped. 2112 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2113 * @throws { BusinessError } 2900099 - Operation failed. 2114 * @syscap SystemCapability.Communication.Bluetooth.Core 2115 * @since 10 2116 * @deprecated since 10 2117 * @useinstead ohos.bluetooth.ble/ble.GattServer#addService 2118 */ 2119 addService(service: GattService): void; 2120 2121 /** 2122 * Removes a specified service from the list of GATT services provided by this device. 2123 * 2124 * @permission ohos.permission.USE_BLUETOOTH 2125 * @param { string } serviceUuid - Indicates the UUID of the service to remove. 2126 * @throws { BusinessError } 201 - Permission denied. 2127 * @throws { BusinessError } 401 - Invalid parameter. 2128 * @throws { BusinessError } 801 - Capability not supported. 2129 * @throws { BusinessError } 2900001 - Service stopped. 2130 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2131 * @throws { BusinessError } 2900004 - Profile is not supported. 2132 * @throws { BusinessError } 2900099 - Operation failed. 2133 * @syscap SystemCapability.Communication.Bluetooth.Core 2134 * @since 9 2135 * @deprecated since 10 2136 * @useinstead ohos.bluetooth.ble/ble.GattServer#removeService 2137 */ 2138 /** 2139 * Removes a specified service from the list of GATT services provided by this device. 2140 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2141 * 2142 * @permission ohos.permission.ACCESS_BLUETOOTH 2143 * @param { string } serviceUuid - Indicates the UUID of the service to remove. 2144 * @throws { BusinessError } 201 - Permission denied. 2145 * @throws { BusinessError } 401 - Invalid parameter. 2146 * @throws { BusinessError } 801 - Capability not supported. 2147 * @throws { BusinessError } 2900001 - Service stopped. 2148 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2149 * @throws { BusinessError } 2900004 - Profile is not supported. 2150 * @throws { BusinessError } 2900099 - Operation failed. 2151 * @syscap SystemCapability.Communication.Bluetooth.Core 2152 * @since 10 2153 * @deprecated since 10 2154 * @useinstead ohos.bluetooth.ble/ble.GattServer#removeService 2155 */ 2156 removeService(serviceUuid: string): void; 2157 2158 /** 2159 * Closes this {@code GattServer} object and unregisters its callbacks. 2160 * 2161 * @permission ohos.permission.USE_BLUETOOTH 2162 * @throws { BusinessError } 201 - Permission denied. 2163 * @throws { BusinessError } 801 - Capability not supported. 2164 * @throws { BusinessError } 2900001 - Service stopped. 2165 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2166 * @throws { BusinessError } 2900099 - Operation failed. 2167 * @syscap SystemCapability.Communication.Bluetooth.Core 2168 * @since 9 2169 * @deprecated since 10 2170 * @useinstead ohos.bluetooth.ble/ble.GattServer#close 2171 */ 2172 /** 2173 * Closes this {@code GattServer} object and unregisters its callbacks. 2174 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2175 * 2176 * @permission ohos.permission.ACCESS_BLUETOOTH 2177 * @throws { BusinessError } 201 - Permission denied. 2178 * @throws { BusinessError } 801 - Capability not supported. 2179 * @throws { BusinessError } 2900001 - Service stopped. 2180 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2181 * @throws { BusinessError } 2900099 - Operation failed. 2182 * @syscap SystemCapability.Communication.Bluetooth.Core 2183 * @since 10 2184 * @deprecated since 10 2185 * @useinstead ohos.bluetooth.ble/ble.GattServer#close 2186 */ 2187 close(): void; 2188 2189 /** 2190 * Sends a notification of a change in a specified local characteristic. 2191 * <p>This method should be called for every BLE peripheral device that has requested notifications. 2192 * 2193 * @permission ohos.permission.USE_BLUETOOTH 2194 * @param { string } deviceId - Indicates the address of the BLE peripheral device to receive the notification. 2195 * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. 2196 * @throws { BusinessError } 201 - Permission denied. 2197 * @throws { BusinessError } 401 - Invalid parameter. 2198 * @throws { BusinessError } 801 - Capability not supported. 2199 * @throws { BusinessError } 2900001 - Service stopped. 2200 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2201 * @throws { BusinessError } 2900099 - Operation failed. 2202 * @syscap SystemCapability.Communication.Bluetooth.Core 2203 * @since 9 2204 * @deprecated since 10 2205 * @useinstead ohos.bluetooth.ble/ble.GattServer#notifyCharacteristicChanged 2206 */ 2207 /** 2208 * Sends a notification of a change in a specified local characteristic. 2209 * <p>This method should be called for every BLE peripheral device that has requested notifications. 2210 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2211 * 2212 * @permission ohos.permission.ACCESS_BLUETOOTH 2213 * @param { string } deviceId - Indicates the address of the BLE peripheral device to receive the notification. 2214 * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. 2215 * @throws { BusinessError } 201 - Permission denied. 2216 * @throws { BusinessError } 401 - Invalid parameter. 2217 * @throws { BusinessError } 801 - Capability not supported. 2218 * @throws { BusinessError } 2900001 - Service stopped. 2219 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2220 * @throws { BusinessError } 2900099 - Operation failed. 2221 * @syscap SystemCapability.Communication.Bluetooth.Core 2222 * @since 10 2223 * @deprecated since 10 2224 * @useinstead ohos.bluetooth.ble/ble.GattServer#notifyCharacteristicChanged 2225 */ 2226 notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): void; 2227 2228 /** 2229 * Sends a response to a specified read or write request to a given BLE peripheral device. 2230 * 2231 * @permission ohos.permission.USE_BLUETOOTH 2232 * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. 2233 * @throws { BusinessError } 201 - Permission denied. 2234 * @throws { BusinessError } 401 - Invalid parameter. 2235 * @throws { BusinessError } 801 - Capability not supported. 2236 * @throws { BusinessError } 2900001 - Service stopped. 2237 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2238 * @throws { BusinessError } 2900099 - Operation failed. 2239 * @syscap SystemCapability.Communication.Bluetooth.Core 2240 * @since 9 2241 * @deprecated since 10 2242 * @useinstead ohos.bluetooth.ble/ble.GattServer#sendResponse 2243 */ 2244 /** 2245 * Sends a response to a specified read or write request to a given BLE peripheral device. 2246 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2247 * 2248 * @permission ohos.permission.ACCESS_BLUETOOTH 2249 * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. 2250 * @throws { BusinessError } 201 - Permission denied. 2251 * @throws { BusinessError } 401 - Invalid parameter. 2252 * @throws { BusinessError } 801 - Capability not supported. 2253 * @throws { BusinessError } 2900001 - Service stopped. 2254 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2255 * @throws { BusinessError } 2900099 - Operation failed. 2256 * @syscap SystemCapability.Communication.Bluetooth.Core 2257 * @since 10 2258 * @deprecated since 10 2259 * @useinstead ohos.bluetooth.ble/ble.GattServer#sendResponse 2260 */ 2261 sendResponse(serverResponse: ServerResponse): void; 2262 2263 /** 2264 * Subscribe characteristic read event. 2265 * 2266 * @permission ohos.permission.USE_BLUETOOTH 2267 * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. 2268 * @param { Callback<CharacteristicReadRequest> } callback - Callback used to listen for the characteristic read event. 2269 * @throws { BusinessError } 201 - Permission denied. 2270 * @throws { BusinessError } 401 - Invalid parameter. 2271 * @throws { BusinessError } 801 - Capability not supported. 2272 * @syscap SystemCapability.Communication.Bluetooth.Core 2273 * @since 9 2274 * @deprecated since 10 2275 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:characteristicRead 2276 */ 2277 /** 2278 * Subscribe characteristic read event. 2279 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2280 * 2281 * @permission ohos.permission.ACCESS_BLUETOOTH 2282 * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. 2283 * @param { Callback<CharacteristicReadRequest> } callback - Callback used to listen for the characteristic read event. 2284 * @throws { BusinessError } 201 - Permission denied. 2285 * @throws { BusinessError } 401 - Invalid parameter. 2286 * @throws { BusinessError } 801 - Capability not supported. 2287 * @syscap SystemCapability.Communication.Bluetooth.Core 2288 * @since 10 2289 * @deprecated since 10 2290 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:characteristicRead 2291 */ 2292 on(type: 'characteristicRead', callback: Callback<CharacteristicReadRequest>): void; 2293 2294 /** 2295 * Unsubscribe characteristic read event. 2296 * 2297 * @permission ohos.permission.USE_BLUETOOTH 2298 * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. 2299 * @param { Callback<CharacteristicReadRequest> } callback - Callback used to listen for the characteristic read event. 2300 * @throws { BusinessError } 201 - Permission denied. 2301 * @throws { BusinessError } 401 - Invalid parameter. 2302 * @throws { BusinessError } 801 - Capability not supported. 2303 * @syscap SystemCapability.Communication.Bluetooth.Core 2304 * @since 9 2305 * @deprecated since 10 2306 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:characteristicRead 2307 */ 2308 /** 2309 * Unsubscribe characteristic read event. 2310 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2311 * 2312 * @permission ohos.permission.ACCESS_BLUETOOTH 2313 * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. 2314 * @param { Callback<CharacteristicReadRequest> } callback - Callback used to listen for the characteristic read event. 2315 * @throws { BusinessError } 201 - Permission denied. 2316 * @throws { BusinessError } 401 - Invalid parameter. 2317 * @throws { BusinessError } 801 - Capability not supported. 2318 * @syscap SystemCapability.Communication.Bluetooth.Core 2319 * @since 10 2320 * @deprecated since 10 2321 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:characteristicRead 2322 */ 2323 off(type: 'characteristicRead', callback?: Callback<CharacteristicReadRequest>): void; 2324 2325 /** 2326 * Subscribe characteristic write event. 2327 * 2328 * @permission ohos.permission.USE_BLUETOOTH 2329 * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. 2330 * @param { Callback<CharacteristicWriteRequest> } callback - Callback used to listen for the characteristic write event. 2331 * @throws { BusinessError } 201 - Permission denied. 2332 * @throws { BusinessError } 401 - Invalid parameter. 2333 * @throws { BusinessError } 801 - Capability not supported. 2334 * @syscap SystemCapability.Communication.Bluetooth.Core 2335 * @since 9 2336 * @deprecated since 10 2337 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:characteristicWrite 2338 */ 2339 /** 2340 * Subscribe characteristic write event. 2341 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2342 * 2343 * @permission ohos.permission.ACCESS_BLUETOOTH 2344 * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. 2345 * @param { Callback<CharacteristicWriteRequest> } callback - Callback used to listen for the characteristic write event. 2346 * @throws { BusinessError } 201 - Permission denied. 2347 * @throws { BusinessError } 401 - Invalid parameter. 2348 * @throws { BusinessError } 801 - Capability not supported. 2349 * @syscap SystemCapability.Communication.Bluetooth.Core 2350 * @since 10 2351 * @deprecated since 10 2352 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:characteristicWrite 2353 */ 2354 on(type: 'characteristicWrite', callback: Callback<CharacteristicWriteRequest>): void; 2355 2356 /** 2357 * Unsubscribe characteristic write event. 2358 * 2359 * @permission ohos.permission.USE_BLUETOOTH 2360 * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. 2361 * @param { Callback<CharacteristicWriteRequest> } callback - Callback used to listen for the characteristic write event. 2362 * @throws { BusinessError } 201 - Permission denied. 2363 * @throws { BusinessError } 401 - Invalid parameter. 2364 * @throws { BusinessError } 801 - Capability not supported. 2365 * @syscap SystemCapability.Communication.Bluetooth.Core 2366 * @since 9 2367 * @deprecated since 10 2368 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:characteristicWrite 2369 */ 2370 /** 2371 * Unsubscribe characteristic write event. 2372 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2373 * 2374 * @permission ohos.permission.ACCESS_BLUETOOTH 2375 * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. 2376 * @param { Callback<CharacteristicWriteRequest> } callback - Callback used to listen for the characteristic write event. 2377 * @throws { BusinessError } 201 - Permission denied. 2378 * @throws { BusinessError } 401 - Invalid parameter. 2379 * @throws { BusinessError } 801 - Capability not supported. 2380 * @syscap SystemCapability.Communication.Bluetooth.Core 2381 * @since 10 2382 * @deprecated since 10 2383 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:characteristicWrite 2384 */ 2385 off(type: 'characteristicWrite', callback?: Callback<CharacteristicWriteRequest>): void; 2386 2387 /** 2388 * Subscribe descriptor read event. 2389 * 2390 * @permission ohos.permission.USE_BLUETOOTH 2391 * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. 2392 * @param { Callback<DescriptorReadRequest> } callback - Callback used to listen for the descriptor read event. 2393 * @throws { BusinessError } 201 - Permission denied. 2394 * @throws { BusinessError } 401 - Invalid parameter. 2395 * @throws { BusinessError } 801 - Capability not supported. 2396 * @syscap SystemCapability.Communication.Bluetooth.Core 2397 * @since 9 2398 * @deprecated since 10 2399 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:descriptorRead 2400 */ 2401 /** 2402 * Subscribe descriptor read event. 2403 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2404 * 2405 * @permission ohos.permission.ACCESS_BLUETOOTH 2406 * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. 2407 * @param { Callback<DescriptorReadRequest> } callback - Callback used to listen for the descriptor read event. 2408 * @throws { BusinessError } 201 - Permission denied. 2409 * @throws { BusinessError } 401 - Invalid parameter. 2410 * @throws { BusinessError } 801 - Capability not supported. 2411 * @syscap SystemCapability.Communication.Bluetooth.Core 2412 * @since 10 2413 * @deprecated since 10 2414 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:descriptorRead 2415 */ 2416 on(type: 'descriptorRead', callback: Callback<DescriptorReadRequest>): void; 2417 2418 /** 2419 * Unsubscribe descriptor read event. 2420 * 2421 * @permission ohos.permission.USE_BLUETOOTH 2422 * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. 2423 * @param { Callback<DescriptorReadRequest> } callback - Callback used to listen for the descriptor read event. 2424 * @throws { BusinessError } 201 - Permission denied. 2425 * @throws { BusinessError } 401 - Invalid parameter. 2426 * @throws { BusinessError } 801 - Capability not supported. 2427 * @syscap SystemCapability.Communication.Bluetooth.Core 2428 * @since 9 2429 * @deprecated since 10 2430 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:descriptorRead 2431 */ 2432 /** 2433 * Unsubscribe descriptor read event. 2434 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2435 * 2436 * @permission ohos.permission.ACCESS_BLUETOOTH 2437 * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. 2438 * @param { Callback<DescriptorReadRequest> } callback - Callback used to listen for the descriptor read event. 2439 * @throws { BusinessError } 201 - Permission denied. 2440 * @throws { BusinessError } 401 - Invalid parameter. 2441 * @throws { BusinessError } 801 - Capability not supported. 2442 * @syscap SystemCapability.Communication.Bluetooth.Core 2443 * @since 10 2444 * @deprecated since 10 2445 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:descriptorRead 2446 */ 2447 off(type: 'descriptorRead', callback?: Callback<DescriptorReadRequest>): void; 2448 2449 /** 2450 * Subscribe descriptor write event. 2451 * 2452 * @permission ohos.permission.USE_BLUETOOTH 2453 * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. 2454 * @param { Callback<DescriptorWriteRequest> } callback - Callback used to listen for the descriptor write event. 2455 * @throws { BusinessError } 201 - Permission denied. 2456 * @throws { BusinessError } 401 - Invalid parameter. 2457 * @throws { BusinessError } 801 - Capability not supported. 2458 * @syscap SystemCapability.Communication.Bluetooth.Core 2459 * @since 9 2460 * @deprecated since 10 2461 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:descriptorWrite 2462 */ 2463 /** 2464 * Subscribe descriptor write event. 2465 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2466 * 2467 * @permission ohos.permission.ACCESS_BLUETOOTH 2468 * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. 2469 * @param { Callback<DescriptorWriteRequest> } callback - Callback used to listen for the descriptor write event. 2470 * @throws { BusinessError } 201 - Permission denied. 2471 * @throws { BusinessError } 401 - Invalid parameter. 2472 * @throws { BusinessError } 801 - Capability not supported. 2473 * @syscap SystemCapability.Communication.Bluetooth.Core 2474 * @since 10 2475 * @deprecated since 10 2476 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:descriptorWrite 2477 */ 2478 on(type: 'descriptorWrite', callback: Callback<DescriptorWriteRequest>): void; 2479 2480 /** 2481 * Unsubscribe descriptor write event. 2482 * 2483 * @permission ohos.permission.USE_BLUETOOTH 2484 * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. 2485 * @param { Callback<DescriptorWriteRequest> } callback - Callback used to listen for the descriptor write event. 2486 * @throws { BusinessError } 201 - Permission denied. 2487 * @throws { BusinessError } 401 - Invalid parameter. 2488 * @throws { BusinessError } 801 - Capability not supported. 2489 * @syscap SystemCapability.Communication.Bluetooth.Core 2490 * @since 9 2491 * @deprecated since 10 2492 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:descriptorWrite 2493 */ 2494 /** 2495 * Unsubscribe descriptor write event. 2496 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2497 * 2498 * @permission ohos.permission.ACCESS_BLUETOOTH 2499 * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. 2500 * @param { Callback<DescriptorWriteRequest> } callback - Callback used to listen for the descriptor write event. 2501 * @throws { BusinessError } 201 - Permission denied. 2502 * @throws { BusinessError } 401 - Invalid parameter. 2503 * @throws { BusinessError } 801 - Capability not supported. 2504 * @syscap SystemCapability.Communication.Bluetooth.Core 2505 * @since 10 2506 * @deprecated since 10 2507 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:descriptorWrite 2508 */ 2509 off(type: 'descriptorWrite', callback?: Callback<DescriptorWriteRequest>): void; 2510 2511 /** 2512 * Subscribe server connection state changed event. 2513 * 2514 * @permission ohos.permission.USE_BLUETOOTH 2515 * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. 2516 * @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event. 2517 * @throws { BusinessError } 201 - Permission denied. 2518 * @throws { BusinessError } 401 - Invalid parameter. 2519 * @throws { BusinessError } 801 - Capability not supported. 2520 * @syscap SystemCapability.Communication.Bluetooth.Core 2521 * @since 9 2522 * @deprecated since 10 2523 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:connectionStateChange 2524 */ 2525 /** 2526 * Subscribe server connection state changed event. 2527 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2528 * 2529 * @permission ohos.permission.ACCESS_BLUETOOTH 2530 * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. 2531 * @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event. 2532 * @throws { BusinessError } 201 - Permission denied. 2533 * @throws { BusinessError } 401 - Invalid parameter. 2534 * @throws { BusinessError } 801 - Capability not supported. 2535 * @syscap SystemCapability.Communication.Bluetooth.Core 2536 * @since 10 2537 * @deprecated since 10 2538 * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:connectionStateChange 2539 */ 2540 on(type: 'connectStateChange', callback: Callback<BLEConnectChangedState>): void; 2541 2542 /** 2543 * Unsubscribe server connection state changed event. 2544 * 2545 * @permission ohos.permission.USE_BLUETOOTH 2546 * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. 2547 * @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event. 2548 * @throws { BusinessError } 201 - Permission denied. 2549 * @throws { BusinessError } 401 - Invalid parameter. 2550 * @throws { BusinessError } 801 - Capability not supported. 2551 * @syscap SystemCapability.Communication.Bluetooth.Core 2552 * @since 9 2553 * @deprecated since 10 2554 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:connectionStateChange 2555 */ 2556 /** 2557 * Unsubscribe server connection state changed event. 2558 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2559 * 2560 * @permission ohos.permission.ACCESS_BLUETOOTH 2561 * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. 2562 * @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event. 2563 * @throws { BusinessError } 201 - Permission denied. 2564 * @throws { BusinessError } 401 - Invalid parameter. 2565 * @throws { BusinessError } 801 - Capability not supported. 2566 * @syscap SystemCapability.Communication.Bluetooth.Core 2567 * @since 10 2568 * @deprecated since 10 2569 * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:connectionStateChange 2570 */ 2571 off(type: 'connectStateChange', callback?: Callback<BLEConnectChangedState>): void; 2572 } 2573 2574 /** 2575 * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. 2576 * 2577 * @typedef GattClientDevice 2578 * @syscap SystemCapability.Communication.Bluetooth.Core 2579 * @since 9 2580 * @deprecated since 10 2581 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice 2582 */ 2583 interface GattClientDevice { 2584 /** 2585 * Connects to a BLE peripheral device. 2586 * <p>The 'BLEConnectionStateChange' event is subscribed to return the connection state. 2587 * 2588 * @permission ohos.permission.USE_BLUETOOTH 2589 * @throws { BusinessError } 201 - Permission denied. 2590 * @throws { BusinessError } 801 - Capability not supported. 2591 * @throws { BusinessError } 2900001 - Service stopped. 2592 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2593 * @throws { BusinessError } 2900099 - Operation failed. 2594 * @syscap SystemCapability.Communication.Bluetooth.Core 2595 * @since 9 2596 * @deprecated since 10 2597 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#connect 2598 */ 2599 /** 2600 * Connects to a BLE peripheral device. 2601 * <p>The 'BLEConnectionStateChange' event is subscribed to return the connection state. 2602 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2603 * 2604 * @permission ohos.permission.ACCESS_BLUETOOTH 2605 * @throws { BusinessError } 201 - Permission denied. 2606 * @throws { BusinessError } 801 - Capability not supported. 2607 * @throws { BusinessError } 2900001 - Service stopped. 2608 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2609 * @throws { BusinessError } 2900099 - Operation failed. 2610 * @syscap SystemCapability.Communication.Bluetooth.Core 2611 * @since 10 2612 * @deprecated since 10 2613 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#connect 2614 */ 2615 connect(): void; 2616 2617 /** 2618 * Disconnects from or stops an ongoing connection to a BLE peripheral device. 2619 * 2620 * @permission ohos.permission.USE_BLUETOOTH 2621 * @throws { BusinessError } 201 - Permission denied. 2622 * @throws { BusinessError } 801 - Capability not supported. 2623 * @throws { BusinessError } 2900001 - Service stopped. 2624 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2625 * @throws { BusinessError } 2900099 - Operation failed. 2626 * @syscap SystemCapability.Communication.Bluetooth.Core 2627 * @since 9 2628 * @deprecated since 10 2629 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#disconnect 2630 */ 2631 /** 2632 * Disconnects from or stops an ongoing connection to a BLE peripheral device. 2633 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2634 * 2635 * @permission ohos.permission.ACCESS_BLUETOOTH 2636 * @throws { BusinessError } 201 - Permission denied. 2637 * @throws { BusinessError } 801 - Capability not supported. 2638 * @throws { BusinessError } 2900001 - Service stopped. 2639 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2640 * @throws { BusinessError } 2900099 - Operation failed. 2641 * @syscap SystemCapability.Communication.Bluetooth.Core 2642 * @since 10 2643 * @deprecated since 10 2644 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#disconnect 2645 */ 2646 disconnect(): void; 2647 2648 /** 2649 * Disables a BLE peripheral device. 2650 * <p> This method unregisters the device and clears the registered callbacks and handles. 2651 * 2652 * @permission ohos.permission.USE_BLUETOOTH 2653 * @throws { BusinessError } 201 - Permission denied. 2654 * @throws { BusinessError } 801 - Capability not supported. 2655 * @throws { BusinessError } 2900001 - Service stopped. 2656 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2657 * @throws { BusinessError } 2900099 - Operation failed. 2658 * @syscap SystemCapability.Communication.Bluetooth.Core 2659 * @since 9 2660 * @deprecated since 10 2661 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#close 2662 */ 2663 /** 2664 * Disables a BLE peripheral device. 2665 * <p> This method unregisters the device and clears the registered callbacks and handles. 2666 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2667 * 2668 * @permission ohos.permission.ACCESS_BLUETOOTH 2669 * @throws { BusinessError } 201 - Permission denied. 2670 * @throws { BusinessError } 801 - Capability not supported. 2671 * @throws { BusinessError } 2900001 - Service stopped. 2672 * @throws { BusinessError } 2900003 - Bluetooth switch is off. 2673 * @throws { BusinessError } 2900099 - Operation failed. 2674 * @syscap SystemCapability.Communication.Bluetooth.Core 2675 * @since 10 2676 * @deprecated since 10 2677 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#close 2678 */ 2679 close(): void; 2680 2681 /** 2682 * Obtains the name of BLE peripheral device. 2683 * 2684 * @permission ohos.permission.USE_BLUETOOTH 2685 * @param { AsyncCallback<string> } callback - Callback used to obtain the device name. 2686 * @throws { BusinessError } 201 - Permission denied. 2687 * @throws { BusinessError } 401 - Invalid parameter. 2688 * @throws { BusinessError } 801 - Capability not supported. 2689 * @throws { BusinessError } 2900001 - Service stopped. 2690 * @throws { BusinessError } 2900099 - Operation failed. 2691 * @syscap SystemCapability.Communication.Bluetooth.Core 2692 * @since 9 2693 * @deprecated since 10 2694 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getDeviceName 2695 */ 2696 /** 2697 * Obtains the name of BLE peripheral device. 2698 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2699 * 2700 * @permission ohos.permission.ACCESS_BLUETOOTH 2701 * @param { AsyncCallback<string> } callback - Callback used to obtain the device name. 2702 * @throws { BusinessError } 201 - Permission denied. 2703 * @throws { BusinessError } 401 - Invalid parameter. 2704 * @throws { BusinessError } 801 - Capability not supported. 2705 * @throws { BusinessError } 2900001 - Service stopped. 2706 * @throws { BusinessError } 2900099 - Operation failed. 2707 * @syscap SystemCapability.Communication.Bluetooth.Core 2708 * @since 10 2709 * @deprecated since 10 2710 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getDeviceName 2711 */ 2712 getDeviceName(callback: AsyncCallback<string>): void; 2713 2714 /** 2715 * Obtains the name of BLE peripheral device. 2716 * 2717 * @permission ohos.permission.USE_BLUETOOTH 2718 * @returns { Promise<string> } Returns a string representation of the name if obtained; 2719 * returns {@code null} if the name fails to be obtained or the name does not exist. 2720 * @throws { BusinessError } 201 - Permission denied. 2721 * @throws { BusinessError } 401 - Invalid parameter. 2722 * @throws { BusinessError } 801 - Capability not supported. 2723 * @throws { BusinessError } 2900001 - Service stopped. 2724 * @throws { BusinessError } 2900099 - Operation failed. 2725 * @syscap SystemCapability.Communication.Bluetooth.Core 2726 * @since 9 2727 * @deprecated since 10 2728 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getDeviceName 2729 */ 2730 /** 2731 * Obtains the name of BLE peripheral device. 2732 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2733 * 2734 * @permission ohos.permission.ACCESS_BLUETOOTH 2735 * @returns { Promise<string> } Returns a string representation of the name if obtained; 2736 * returns {@code null} if the name fails to be obtained or the name does not exist. 2737 * @throws { BusinessError } 201 - Permission denied. 2738 * @throws { BusinessError } 401 - Invalid parameter. 2739 * @throws { BusinessError } 801 - Capability not supported. 2740 * @throws { BusinessError } 2900001 - Service stopped. 2741 * @throws { BusinessError } 2900099 - Operation failed. 2742 * @syscap SystemCapability.Communication.Bluetooth.Core 2743 * @since 10 2744 * @deprecated since 10 2745 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getDeviceName 2746 */ 2747 getDeviceName(): Promise<string>; 2748 2749 /** 2750 * Starts discovering services. 2751 * 2752 * @permission ohos.permission.USE_BLUETOOTH 2753 * @param { AsyncCallback<Array<GattService>> } callback - Callback used to catch the services. 2754 * @throws { BusinessError } 201 - Permission denied. 2755 * @throws { BusinessError } 401 - Invalid parameter. 2756 * @throws { BusinessError } 801 - Capability not supported. 2757 * @throws { BusinessError } 2900001 - Service stopped. 2758 * @throws { BusinessError } 2900099 - Operation failed. 2759 * @syscap SystemCapability.Communication.Bluetooth.Core 2760 * @since 9 2761 * @deprecated since 10 2762 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getServices 2763 */ 2764 /** 2765 * Starts discovering services. 2766 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2767 * 2768 * @permission ohos.permission.ACCESS_BLUETOOTH 2769 * @param { AsyncCallback<Array<GattService>> } callback - Callback used to catch the services. 2770 * @throws { BusinessError } 201 - Permission denied. 2771 * @throws { BusinessError } 401 - Invalid parameter. 2772 * @throws { BusinessError } 801 - Capability not supported. 2773 * @throws { BusinessError } 2900001 - Service stopped. 2774 * @throws { BusinessError } 2900099 - Operation failed. 2775 * @syscap SystemCapability.Communication.Bluetooth.Core 2776 * @since 10 2777 * @deprecated since 10 2778 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getServices 2779 */ 2780 getServices(callback: AsyncCallback<Array<GattService>>): void; 2781 2782 /** 2783 * Starts discovering services. 2784 * 2785 * @permission ohos.permission.USE_BLUETOOTH 2786 * @returns { Promise<Array<GattService>> } Returns the list of services {@link GattService} of the BLE peripheral device. 2787 * @throws { BusinessError } 201 - Permission denied. 2788 * @throws { BusinessError } 401 - Invalid parameter. 2789 * @throws { BusinessError } 801 - Capability not supported. 2790 * @throws { BusinessError } 2900001 - Service stopped. 2791 * @throws { BusinessError } 2900099 - Operation failed. 2792 * @syscap SystemCapability.Communication.Bluetooth.Core 2793 * @since 9 2794 * @deprecated since 10 2795 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getServices 2796 */ 2797 /** 2798 * Starts discovering services. 2799 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2800 * 2801 * @permission ohos.permission.ACCESS_BLUETOOTH 2802 * @returns { Promise<Array<GattService>> } Returns the list of services {@link GattService} of the BLE peripheral device. 2803 * @throws { BusinessError } 201 - Permission denied. 2804 * @throws { BusinessError } 401 - Invalid parameter. 2805 * @throws { BusinessError } 801 - Capability not supported. 2806 * @throws { BusinessError } 2900001 - Service stopped. 2807 * @throws { BusinessError } 2900099 - Operation failed. 2808 * @syscap SystemCapability.Communication.Bluetooth.Core 2809 * @since 10 2810 * @deprecated since 10 2811 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getServices 2812 */ 2813 getServices(): Promise<Array<GattService>>; 2814 2815 /** 2816 * Reads the characteristic of a BLE peripheral device. 2817 * 2818 * @permission ohos.permission.USE_BLUETOOTH 2819 * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. 2820 * @param { AsyncCallback<BLECharacteristic> } callback - Callback invoked to return the characteristic value read. 2821 * @throws { BusinessError } 201 - Permission denied. 2822 * @throws { BusinessError } 401 - Invalid parameter. 2823 * @throws { BusinessError } 801 - Capability not supported. 2824 * @throws { BusinessError } 2900001 - Service stopped. 2825 * @throws { BusinessError } 2901000 - Read forbidden. 2826 * @throws { BusinessError } 2900099 - Operation failed. 2827 * @syscap SystemCapability.Communication.Bluetooth.Core 2828 * @since 9 2829 * @deprecated since 10 2830 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readCharacteristicValue 2831 */ 2832 /** 2833 * Reads the characteristic of a BLE peripheral device. 2834 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2835 * 2836 * @permission ohos.permission.ACCESS_BLUETOOTH 2837 * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. 2838 * @param { AsyncCallback<BLECharacteristic> } callback - Callback invoked to return the characteristic value read. 2839 * @throws { BusinessError } 201 - Permission denied. 2840 * @throws { BusinessError } 401 - Invalid parameter. 2841 * @throws { BusinessError } 801 - Capability not supported. 2842 * @throws { BusinessError } 2900001 - Service stopped. 2843 * @throws { BusinessError } 2901000 - Read forbidden. 2844 * @throws { BusinessError } 2900099 - Operation failed. 2845 * @syscap SystemCapability.Communication.Bluetooth.Core 2846 * @since 10 2847 * @deprecated since 10 2848 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readCharacteristicValue 2849 */ 2850 readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void; 2851 2852 /** 2853 * Reads the characteristic of a BLE peripheral device. 2854 * 2855 * @permission ohos.permission.USE_BLUETOOTH 2856 * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. 2857 * @returns { Promise<BLECharacteristic> } - Promise used to return the characteristic value read. 2858 * @throws { BusinessError } 201 - Permission denied. 2859 * @throws { BusinessError } 401 - Invalid parameter. 2860 * @throws { BusinessError } 801 - Capability not supported. 2861 * @throws { BusinessError } 2900001 - Service stopped. 2862 * @throws { BusinessError } 2901000 - Read forbidden. 2863 * @throws { BusinessError } 2900099 - Operation failed. 2864 * @syscap SystemCapability.Communication.Bluetooth.Core 2865 * @since 9 2866 * @deprecated since 10 2867 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readCharacteristicValue 2868 */ 2869 /** 2870 * Reads the characteristic of a BLE peripheral device. 2871 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2872 * 2873 * @permission ohos.permission.ACCESS_BLUETOOTH 2874 * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. 2875 * @returns { Promise<BLECharacteristic> } - Promise used to return the characteristic value read. 2876 * @throws { BusinessError } 201 - Permission denied. 2877 * @throws { BusinessError } 401 - Invalid parameter. 2878 * @throws { BusinessError } 801 - Capability not supported. 2879 * @throws { BusinessError } 2900001 - Service stopped. 2880 * @throws { BusinessError } 2901000 - Read forbidden. 2881 * @throws { BusinessError } 2900099 - Operation failed. 2882 * @syscap SystemCapability.Communication.Bluetooth.Core 2883 * @since 10 2884 * @deprecated since 10 2885 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readCharacteristicValue 2886 */ 2887 readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic>; 2888 2889 /** 2890 * Reads the descriptor of a BLE peripheral device. 2891 * 2892 * @permission ohos.permission.USE_BLUETOOTH 2893 * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. 2894 * @param { AsyncCallback<BLEDescriptor> } callback - Callback invoked to return the descriptor read. 2895 * @throws { BusinessError } 201 - Permission denied. 2896 * @throws { BusinessError } 401 - Invalid parameter. 2897 * @throws { BusinessError } 801 - Capability not supported. 2898 * @throws { BusinessError } 2900001 - Service stopped. 2899 * @throws { BusinessError } 2901000 - Read forbidden. 2900 * @throws { BusinessError } 2900099 - Operation failed. 2901 * @syscap SystemCapability.Communication.Bluetooth.Core 2902 * @since 9 2903 * @deprecated since 10 2904 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readDescriptorValue 2905 */ 2906 /** 2907 * Reads the descriptor of a BLE peripheral device. 2908 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2909 * 2910 * @permission ohos.permission.ACCESS_BLUETOOTH 2911 * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. 2912 * @param { AsyncCallback<BLEDescriptor> } callback - Callback invoked to return the descriptor read. 2913 * @throws { BusinessError } 201 - Permission denied. 2914 * @throws { BusinessError } 401 - Invalid parameter. 2915 * @throws { BusinessError } 801 - Capability not supported. 2916 * @throws { BusinessError } 2900001 - Service stopped. 2917 * @throws { BusinessError } 2901000 - Read forbidden. 2918 * @throws { BusinessError } 2900099 - Operation failed. 2919 * @syscap SystemCapability.Communication.Bluetooth.Core 2920 * @since 10 2921 * @deprecated since 10 2922 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readDescriptorValue 2923 */ 2924 readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void; 2925 2926 /** 2927 * Reads the descriptor of a BLE peripheral device. 2928 * 2929 * @permission ohos.permission.USE_BLUETOOTH 2930 * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. 2931 * @returns { Promise<BLEDescriptor> } - Promise used to return the descriptor read. 2932 * @throws { BusinessError } 201 - Permission denied. 2933 * @throws { BusinessError } 401 - Invalid parameter. 2934 * @throws { BusinessError } 801 - Capability not supported. 2935 * @throws { BusinessError } 2900001 - Service stopped. 2936 * @throws { BusinessError } 2901000 - Read forbidden. 2937 * @throws { BusinessError } 2900099 - Operation failed. 2938 * @syscap SystemCapability.Communication.Bluetooth.Core 2939 * @since 9 2940 * @deprecated since 10 2941 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readDescriptorValue 2942 */ 2943 /** 2944 * Reads the descriptor of a BLE peripheral device. 2945 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2946 * 2947 * @permission ohos.permission.ACCESS_BLUETOOTH 2948 * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. 2949 * @returns { Promise<BLEDescriptor> } - Promise used to return the descriptor read. 2950 * @throws { BusinessError } 201 - Permission denied. 2951 * @throws { BusinessError } 401 - Invalid parameter. 2952 * @throws { BusinessError } 801 - Capability not supported. 2953 * @throws { BusinessError } 2900001 - Service stopped. 2954 * @throws { BusinessError } 2901000 - Read forbidden. 2955 * @throws { BusinessError } 2900099 - Operation failed. 2956 * @syscap SystemCapability.Communication.Bluetooth.Core 2957 * @since 10 2958 * @deprecated since 10 2959 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readDescriptorValue 2960 */ 2961 readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor>; 2962 2963 /** 2964 * Writes the characteristic of a BLE peripheral device. 2965 * 2966 * @permission ohos.permission.USE_BLUETOOTH 2967 * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. 2968 * @throws { BusinessError } 201 - Permission denied. 2969 * @throws { BusinessError } 401 - Invalid parameter. 2970 * @throws { BusinessError } 801 - Capability not supported. 2971 * @throws { BusinessError } 2900001 - Service stopped. 2972 * @throws { BusinessError } 2901001 - Write forbidden. 2973 * @throws { BusinessError } 2900099 - Operation failed. 2974 * @syscap SystemCapability.Communication.Bluetooth.Core 2975 * @since 9 2976 * @deprecated since 10 2977 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#writeCharacteristicValue 2978 */ 2979 /** 2980 * Writes the characteristic of a BLE peripheral device. 2981 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 2982 * 2983 * @permission ohos.permission.ACCESS_BLUETOOTH 2984 * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. 2985 * @throws { BusinessError } 201 - Permission denied. 2986 * @throws { BusinessError } 401 - Invalid parameter. 2987 * @throws { BusinessError } 801 - Capability not supported. 2988 * @throws { BusinessError } 2900001 - Service stopped. 2989 * @throws { BusinessError } 2901001 - Write forbidden. 2990 * @throws { BusinessError } 2900099 - Operation failed. 2991 * @syscap SystemCapability.Communication.Bluetooth.Core 2992 * @since 10 2993 * @deprecated since 10 2994 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#writeCharacteristicValue 2995 */ 2996 writeCharacteristicValue(characteristic: BLECharacteristic): void; 2997 2998 /** 2999 * Writes the descriptor of a BLE peripheral device. 3000 * 3001 * @permission ohos.permission.USE_BLUETOOTH 3002 * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. 3003 * @throws { BusinessError } 201 - Permission denied. 3004 * @throws { BusinessError } 401 - Invalid parameter. 3005 * @throws { BusinessError } 801 - Capability not supported. 3006 * @throws { BusinessError } 2900001 - Service stopped. 3007 * @throws { BusinessError } 2901001 - Write forbidden. 3008 * @throws { BusinessError } 2900099 - Operation failed. 3009 * @syscap SystemCapability.Communication.Bluetooth.Core 3010 * @since 9 3011 * @deprecated since 10 3012 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#writeDescriptorValue 3013 */ 3014 /** 3015 * Writes the descriptor of a BLE peripheral device. 3016 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 3017 * 3018 * @permission ohos.permission.ACCESS_BLUETOOTH 3019 * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. 3020 * @throws { BusinessError } 201 - Permission denied. 3021 * @throws { BusinessError } 401 - Invalid parameter. 3022 * @throws { BusinessError } 801 - Capability not supported. 3023 * @throws { BusinessError } 2900001 - Service stopped. 3024 * @throws { BusinessError } 2901001 - Write forbidden. 3025 * @throws { BusinessError } 2900099 - Operation failed. 3026 * @syscap SystemCapability.Communication.Bluetooth.Core 3027 * @since 10 3028 * @deprecated since 10 3029 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#writeDescriptorValue 3030 */ 3031 writeDescriptorValue(descriptor: BLEDescriptor): void; 3032 3033 /** 3034 * Get the RSSI value of this BLE peripheral device. 3035 * 3036 * @permission ohos.permission.USE_BLUETOOTH 3037 * @param { AsyncCallback<number> } callback - Callback invoked to return the RSSI, in dBm. 3038 * @throws { BusinessError } 201 - Permission denied. 3039 * @throws { BusinessError } 401 - Invalid parameter. 3040 * @throws { BusinessError } 801 - Capability not supported. 3041 * @throws { BusinessError } 2900099 - Operation failed. 3042 * @syscap SystemCapability.Communication.Bluetooth.Core 3043 * @since 9 3044 * @deprecated since 10 3045 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getRssiValue 3046 */ 3047 /** 3048 * Get the RSSI value of this BLE peripheral device. 3049 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 3050 * 3051 * @permission ohos.permission.ACCESS_BLUETOOTH 3052 * @param { AsyncCallback<number> } callback - Callback invoked to return the RSSI, in dBm. 3053 * @throws { BusinessError } 201 - Permission denied. 3054 * @throws { BusinessError } 401 - Invalid parameter. 3055 * @throws { BusinessError } 801 - Capability not supported. 3056 * @throws { BusinessError } 2900099 - Operation failed. 3057 * @syscap SystemCapability.Communication.Bluetooth.Core 3058 * @since 10 3059 * @deprecated since 10 3060 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getRssiValue 3061 */ 3062 getRssiValue(callback: AsyncCallback<number>): void; 3063 3064 /** 3065 * Get the RSSI value of this BLE peripheral device. 3066 * 3067 * @permission ohos.permission.USE_BLUETOOTH 3068 * @returns { Promise<number> } Returns the RSSI value. 3069 * @throws { BusinessError } 201 - Permission denied. 3070 * @throws { BusinessError } 401 - Invalid parameter. 3071 * @throws { BusinessError } 801 - Capability not supported. 3072 * @throws { BusinessError } 2900099 - Operation failed. 3073 * @syscap SystemCapability.Communication.Bluetooth.Core 3074 * @since 9 3075 * @deprecated since 10 3076 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getRssiValue 3077 */ 3078 /** 3079 * Get the RSSI value of this BLE peripheral device. 3080 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 3081 * 3082 * @permission ohos.permission.ACCESS_BLUETOOTH 3083 * @returns { Promise<number> } Returns the RSSI value. 3084 * @throws { BusinessError } 201 - Permission denied. 3085 * @throws { BusinessError } 401 - Invalid parameter. 3086 * @throws { BusinessError } 801 - Capability not supported. 3087 * @throws { BusinessError } 2900099 - Operation failed. 3088 * @syscap SystemCapability.Communication.Bluetooth.Core 3089 * @since 10 3090 * @deprecated since 10 3091 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getRssiValue 3092 */ 3093 getRssiValue(): Promise<number>; 3094 3095 /** 3096 * Set the mtu size of a BLE peripheral device. 3097 * 3098 * @permission ohos.permission.USE_BLUETOOTH 3099 * @param { number } mtu - The maximum transmission unit. 3100 * @throws { BusinessError } 201 - Permission denied. 3101 * @throws { BusinessError } 401 - Invalid parameter. 3102 * @throws { BusinessError } 801 - Capability not supported. 3103 * @throws { BusinessError } 2900001 - Service stopped. 3104 * @throws { BusinessError } 2900099 - Operation failed. 3105 * @syscap SystemCapability.Communication.Bluetooth.Core 3106 * @since 9 3107 * @deprecated since 10 3108 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#setBLEMtuSize 3109 */ 3110 /** 3111 * Set the mtu size of a BLE peripheral device. 3112 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 3113 * 3114 * @permission ohos.permission.ACCESS_BLUETOOTH 3115 * @param { number } mtu - The maximum transmission unit. 3116 * @throws { BusinessError } 201 - Permission denied. 3117 * @throws { BusinessError } 401 - Invalid parameter. 3118 * @throws { BusinessError } 801 - Capability not supported. 3119 * @throws { BusinessError } 2900001 - Service stopped. 3120 * @throws { BusinessError } 2900099 - Operation failed. 3121 * @syscap SystemCapability.Communication.Bluetooth.Core 3122 * @since 10 3123 * @deprecated since 10 3124 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#setBLEMtuSize 3125 */ 3126 setBLEMtuSize(mtu: number): void; 3127 3128 /** 3129 * Enables or disables notification of a characteristic when value changed. 3130 * 3131 * @permission ohos.permission.USE_BLUETOOTH 3132 * @param { BLECharacteristic } characteristic - BLE characteristic to listen for. 3133 * @param { boolean } enable - Specifies whether to enable notification of the characteristic. The value {@code true} indicates 3134 * that notification is enabled, and the value {@code false} indicates that notification is disabled. 3135 * @throws { BusinessError } 201 - Permission denied. 3136 * @throws { BusinessError } 401 - Invalid parameter. 3137 * @throws { BusinessError } 801 - Capability not supported. 3138 * @throws { BusinessError } 2900001 - Service stopped. 3139 * @throws { BusinessError } 2900099 - Operation failed. 3140 * @syscap SystemCapability.Communication.Bluetooth.Core 3141 * @since 9 3142 * @deprecated since 10 3143 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#setCharacteristicChangeNotification 3144 */ 3145 /** 3146 * Enables or disables notification of a characteristic when value changed. 3147 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 3148 * 3149 * @permission ohos.permission.ACCESS_BLUETOOTH 3150 * @param { BLECharacteristic } characteristic - BLE characteristic to listen for. 3151 * @param { boolean } enable - Specifies whether to enable notification of the characteristic. The value {@code true} indicates 3152 * that notification is enabled, and the value {@code false} indicates that notification is disabled. 3153 * @throws { BusinessError } 201 - Permission denied. 3154 * @throws { BusinessError } 401 - Invalid parameter. 3155 * @throws { BusinessError } 801 - Capability not supported. 3156 * @throws { BusinessError } 2900001 - Service stopped. 3157 * @throws { BusinessError } 2900099 - Operation failed. 3158 * @syscap SystemCapability.Communication.Bluetooth.Core 3159 * @since 10 3160 * @deprecated since 10 3161 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#setCharacteristicChangeNotification 3162 */ 3163 setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): void; 3164 3165 /** 3166 * Subscribe characteristic value changed event. 3167 * 3168 * @permission ohos.permission.USE_BLUETOOTH 3169 * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. 3170 * @param { Callback<BLECharacteristic> } callback - Callback used to listen for the characteristic value changed event. 3171 * @throws { BusinessError } 201 - Permission denied. 3172 * @throws { BusinessError } 801 - Capability not supported. 3173 * @syscap SystemCapability.Communication.Bluetooth.Core 3174 * @since 9 3175 * @deprecated since 10 3176 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.on#event:BLECharacteristicChange 3177 */ 3178 /** 3179 * Subscribe characteristic value changed event. 3180 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 3181 * 3182 * @permission ohos.permission.ACCESS_BLUETOOTH 3183 * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. 3184 * @param { Callback<BLECharacteristic> } callback - Callback used to listen for the characteristic value changed event. 3185 * @throws { BusinessError } 201 - Permission denied. 3186 * @throws { BusinessError } 801 - Capability not supported. 3187 * @syscap SystemCapability.Communication.Bluetooth.Core 3188 * @since 10 3189 * @deprecated since 10 3190 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.on#event:BLECharacteristicChange 3191 */ 3192 on(type: 'BLECharacteristicChange', callback: Callback<BLECharacteristic>): void; 3193 3194 /** 3195 * Unsubscribe characteristic value changed event. 3196 * 3197 * @permission ohos.permission.USE_BLUETOOTH 3198 * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. 3199 * @param { Callback<BLECharacteristic> } callback - Callback used to listen for the characteristic value changed event. 3200 * @throws { BusinessError } 201 - Permission denied. 3201 * @throws { BusinessError } 801 - Capability not supported. 3202 * @syscap SystemCapability.Communication.Bluetooth.Core 3203 * @since 9 3204 * @deprecated since 10 3205 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.off#event:BLECharacteristicChange 3206 */ 3207 /** 3208 * Unsubscribe characteristic value changed event. 3209 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 3210 * 3211 * @permission ohos.permission.ACCESS_BLUETOOTH 3212 * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. 3213 * @param { Callback<BLECharacteristic> } callback - Callback used to listen for the characteristic value changed event. 3214 * @throws { BusinessError } 201 - Permission denied. 3215 * @throws { BusinessError } 801 - Capability not supported. 3216 * @syscap SystemCapability.Communication.Bluetooth.Core 3217 * @since 10 3218 * @deprecated since 10 3219 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.off#event:BLECharacteristicChange 3220 */ 3221 off(type: 'BLECharacteristicChange', callback?: Callback<BLECharacteristic>): void; 3222 3223 /** 3224 * Subscribe client connection state changed event. 3225 * 3226 * @permission ohos.permission.USE_BLUETOOTH 3227 * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. 3228 * @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event. 3229 * @throws { BusinessError } 201 - Permission denied. 3230 * @throws { BusinessError } 801 - Capability not supported. 3231 * @syscap SystemCapability.Communication.Bluetooth.Core 3232 * @since 9 3233 * @deprecated since 10 3234 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.on#event:BLEConnectionStateChange 3235 */ 3236 /** 3237 * Subscribe client connection state changed event. 3238 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 3239 * 3240 * @permission ohos.permission.ACCESS_BLUETOOTH 3241 * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. 3242 * @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event. 3243 * @throws { BusinessError } 201 - Permission denied. 3244 * @throws { BusinessError } 801 - Capability not supported. 3245 * @syscap SystemCapability.Communication.Bluetooth.Core 3246 * @since 10 3247 * @deprecated since 10 3248 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.on#event:BLEConnectionStateChange 3249 */ 3250 on(type: 'BLEConnectionStateChange', callback: Callback<BLEConnectChangedState>): void; 3251 3252 /** 3253 * Unsubscribe client connection state changed event. 3254 * 3255 * @permission ohos.permission.USE_BLUETOOTH 3256 * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. 3257 * @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event. 3258 * @throws { BusinessError } 201 - Permission denied. 3259 * @throws { BusinessError } 801 - Capability not supported. 3260 * @syscap SystemCapability.Communication.Bluetooth.Core 3261 * @since 9 3262 * @deprecated since 10 3263 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.off#event:BLEConnectionStateChange 3264 */ 3265 /** 3266 * Unsubscribe client connection state changed event. 3267 * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. 3268 * 3269 * @permission ohos.permission.ACCESS_BLUETOOTH 3270 * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. 3271 * @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event. 3272 * @throws { BusinessError } 201 - Permission denied. 3273 * @throws { BusinessError } 801 - Capability not supported. 3274 * @syscap SystemCapability.Communication.Bluetooth.Core 3275 * @since 10 3276 * @deprecated since 10 3277 * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.off#event:BLEConnectionStateChange 3278 */ 3279 off(type: 'BLEConnectionStateChange', callback?: Callback<BLEConnectChangedState>): void; 3280 } 3281 3282 /** 3283 * Describes the Gatt service. 3284 * 3285 * @typedef GattService 3286 * @syscap SystemCapability.Communication.Bluetooth.Core 3287 * @since 9 3288 * @deprecated since 10 3289 * @useinstead ohos.bluetooth.ble/ble.GattService 3290 */ 3291 interface GattService { 3292 /** 3293 * The UUID of a GattService instance 3294 * 3295 * @syscap SystemCapability.Communication.Bluetooth.Core 3296 * @since 9 3297 * @deprecated since 10 3298 * @useinstead ohos.bluetooth.ble/ble.GattService#serviceUuid 3299 */ 3300 serviceUuid: string; 3301 /** 3302 * Indicates whether the GattService instance is primary or secondary. 3303 * 3304 * @syscap SystemCapability.Communication.Bluetooth.Core 3305 * @since 9 3306 * @deprecated since 10 3307 * @useinstead ohos.bluetooth.ble/ble.GattService#isPrimary 3308 */ 3309 isPrimary: boolean; 3310 /** 3311 * The {@link BLECharacteristic} list belongs to this GattService instance 3312 * 3313 * @syscap SystemCapability.Communication.Bluetooth.Core 3314 * @since 9 3315 * @deprecated since 10 3316 * @useinstead ohos.bluetooth.ble/ble.GattService#characteristics 3317 */ 3318 characteristics: Array<BLECharacteristic>; 3319 /** 3320 * The list of GATT services contained in the service 3321 * 3322 * @syscap SystemCapability.Communication.Bluetooth.Core 3323 * @since 9 3324 * @deprecated since 10 3325 * @useinstead ohos.bluetooth.ble/ble.GattService#includeServices 3326 */ 3327 includeServices?: Array<GattService>; 3328 } 3329 3330 /** 3331 * Describes the Gatt characteristic. 3332 * 3333 * @typedef BLECharacteristic 3334 * @syscap SystemCapability.Communication.Bluetooth.Core 3335 * @since 9 3336 * @deprecated since 10 3337 * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic 3338 */ 3339 interface BLECharacteristic { 3340 /** 3341 * The UUID of the {@link GattService} instance to which the characteristic belongs 3342 * 3343 * @syscap SystemCapability.Communication.Bluetooth.Core 3344 * @since 9 3345 * @deprecated since 10 3346 * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic#serviceUuid 3347 */ 3348 serviceUuid: string; 3349 /** 3350 * The UUID of a BLECharacteristic instance 3351 * 3352 * @syscap SystemCapability.Communication.Bluetooth.Core 3353 * @since 9 3354 * @deprecated since 10 3355 * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic#characteristicUuid 3356 */ 3357 characteristicUuid: string; 3358 /** 3359 * The value of a BLECharacteristic instance 3360 * 3361 * @syscap SystemCapability.Communication.Bluetooth.Core 3362 * @since 9 3363 * @deprecated since 10 3364 * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic#characteristicValue 3365 */ 3366 characteristicValue: ArrayBuffer; 3367 /** 3368 * The list of {@link BLEDescriptor} contained in the characteristic 3369 * 3370 * @syscap SystemCapability.Communication.Bluetooth.Core 3371 * @since 9 3372 * @deprecated since 10 3373 * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic#descriptors 3374 */ 3375 descriptors: Array<BLEDescriptor>; 3376 } 3377 3378 /** 3379 * Describes the Gatt descriptor. 3380 * 3381 * @typedef BLEDescriptor 3382 * @syscap SystemCapability.Communication.Bluetooth.Core 3383 * @since 9 3384 * @deprecated since 10 3385 * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor 3386 */ 3387 interface BLEDescriptor { 3388 /** 3389 * The UUID of the {@link GattService} instance to which the descriptor belongs 3390 * 3391 * @syscap SystemCapability.Communication.Bluetooth.Core 3392 * @since 9 3393 * @deprecated since 10 3394 * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor#serviceUuid 3395 */ 3396 serviceUuid: string; 3397 /** 3398 * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs 3399 * 3400 * @syscap SystemCapability.Communication.Bluetooth.Core 3401 * @since 9 3402 * @deprecated since 10 3403 * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor#characteristicUuid 3404 */ 3405 characteristicUuid: string; 3406 /** 3407 * The UUID of the BLEDescriptor instance 3408 * 3409 * @syscap SystemCapability.Communication.Bluetooth.Core 3410 * @since 9 3411 * @deprecated since 10 3412 * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor#descriptorUuid 3413 */ 3414 descriptorUuid: string; 3415 /** 3416 * The value of the BLEDescriptor instance 3417 * 3418 * @syscap SystemCapability.Communication.Bluetooth.Core 3419 * @since 9 3420 * @deprecated since 10 3421 * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor#descriptorValue 3422 */ 3423 descriptorValue: ArrayBuffer; 3424 } 3425 3426 /** 3427 * Describes the value of the indication or notification sent by the Gatt server. 3428 * 3429 * @typedef NotifyCharacteristic 3430 * @syscap SystemCapability.Communication.Bluetooth.Core 3431 * @since 9 3432 * @deprecated since 10 3433 * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic 3434 */ 3435 interface NotifyCharacteristic { 3436 /** 3437 * The UUID of the {@link GattService} instance to which the characteristic belongs 3438 * 3439 * @syscap SystemCapability.Communication.Bluetooth.Core 3440 * @since 9 3441 * @deprecated since 10 3442 * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic#serviceUuid 3443 */ 3444 serviceUuid: string; 3445 /** 3446 * The UUID of a NotifyCharacteristic instance 3447 * 3448 * @syscap SystemCapability.Communication.Bluetooth.Core 3449 * @since 9 3450 * @deprecated since 10 3451 * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic#characteristicUuid 3452 */ 3453 characteristicUuid: string; 3454 /** 3455 * The value of a NotifyCharacteristic instance 3456 * 3457 * @syscap SystemCapability.Communication.Bluetooth.Core 3458 * @since 9 3459 * @deprecated since 10 3460 * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic#characteristicValue 3461 */ 3462 characteristicValue: ArrayBuffer; 3463 /** 3464 * Specifies whether to request confirmation from the BLE peripheral device (indication) or 3465 * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. 3466 * 3467 * @syscap SystemCapability.Communication.Bluetooth.Core 3468 * @since 9 3469 * @deprecated since 10 3470 * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic#confirm 3471 */ 3472 confirm: boolean; 3473 } 3474 3475 /** 3476 * Describes the parameters of the Gatt client's characteristic read request. 3477 * 3478 * @typedef CharacteristicReadRequest 3479 * @syscap SystemCapability.Communication.Bluetooth.Core 3480 * @since 9 3481 * @deprecated since 10 3482 * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest 3483 */ 3484 interface CharacteristicReadRequest { 3485 /** 3486 * Indicates the address of the client that initiates the read request 3487 * 3488 * @syscap SystemCapability.Communication.Bluetooth.Core 3489 * @since 9 3490 * @deprecated since 10 3491 * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#deviceId 3492 */ 3493 deviceId: string; 3494 /** 3495 * The Id of the read request 3496 * 3497 * @syscap SystemCapability.Communication.Bluetooth.Core 3498 * @since 9 3499 * @deprecated since 10 3500 * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#transId 3501 */ 3502 transId: number; 3503 /** 3504 * Indicates the byte offset of the start position for reading characteristic value 3505 * 3506 * @syscap SystemCapability.Communication.Bluetooth.Core 3507 * @since 9 3508 * @deprecated since 10 3509 * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#offset 3510 */ 3511 offset: number; 3512 /** 3513 * The UUID of a CharacteristicReadRequest instance 3514 * 3515 * @syscap SystemCapability.Communication.Bluetooth.Core 3516 * @since 9 3517 * @deprecated since 10 3518 * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#characteristicUuid 3519 */ 3520 characteristicUuid: string; 3521 /** 3522 * The UUID of the service to which the characteristic belongs 3523 * 3524 * @syscap SystemCapability.Communication.Bluetooth.Core 3525 * @since 9 3526 * @deprecated since 10 3527 * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#serviceUuid 3528 */ 3529 serviceUuid: string; 3530 } 3531 3532 /** 3533 * Describes the parameters of the of the Gatt client's characteristic write request. 3534 * 3535 * @typedef CharacteristicWriteRequest 3536 * @syscap SystemCapability.Communication.Bluetooth.Core 3537 * @since 9 3538 * @deprecated since 10 3539 * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest 3540 */ 3541 interface CharacteristicWriteRequest { 3542 /** 3543 * Indicates the address of the client that initiates the write request 3544 * 3545 * @syscap SystemCapability.Communication.Bluetooth.Core 3546 * @since 9 3547 * @deprecated since 10 3548 * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#deviceId 3549 */ 3550 deviceId: string; 3551 /** 3552 * The Id of the write request 3553 * 3554 * @syscap SystemCapability.Communication.Bluetooth.Core 3555 * @since 9 3556 * @deprecated since 10 3557 * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#transId 3558 */ 3559 transId: number; 3560 /** 3561 * Indicates the byte offset of the start position for writing characteristic value 3562 * 3563 * @syscap SystemCapability.Communication.Bluetooth.Core 3564 * @since 9 3565 * @deprecated since 10 3566 * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#offset 3567 */ 3568 offset: number; 3569 /** 3570 * Whether this request should be pending for later operation 3571 * 3572 * @syscap SystemCapability.Communication.Bluetooth.Core 3573 * @since 9 3574 * @deprecated since 10 3575 * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#isPrepared 3576 */ 3577 isPrep: boolean; 3578 /** 3579 * Whether the remote client need a response 3580 * 3581 * @syscap SystemCapability.Communication.Bluetooth.Core 3582 * @since 9 3583 * @deprecated since 10 3584 * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#needRsp 3585 */ 3586 needRsp: boolean; 3587 /** 3588 * Indicates the value to be written 3589 * 3590 * @syscap SystemCapability.Communication.Bluetooth.Core 3591 * @since 9 3592 * @deprecated since 10 3593 * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#value 3594 */ 3595 value: ArrayBuffer; 3596 /** 3597 * The UUID of a CharacteristicWriteRequest instance 3598 * 3599 * @syscap SystemCapability.Communication.Bluetooth.Core 3600 * @since 9 3601 * @deprecated since 10 3602 * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#characteristicUuid 3603 */ 3604 characteristicUuid: string; 3605 /** 3606 * The UUID of the service to which the characteristic belongs 3607 * 3608 * @syscap SystemCapability.Communication.Bluetooth.Core 3609 * @since 9 3610 * @deprecated since 10 3611 * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#serviceUuid 3612 */ 3613 serviceUuid: string; 3614 } 3615 3616 /** 3617 * Describes the parameters of the Gatt client's descriptor read request. 3618 * 3619 * @typedef DescriptorReadRequest 3620 * @syscap SystemCapability.Communication.Bluetooth.Core 3621 * @since 9 3622 * @deprecated since 10 3623 * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest 3624 */ 3625 interface DescriptorReadRequest { 3626 /** 3627 * Indicates the address of the client that initiates the read request 3628 * 3629 * @syscap SystemCapability.Communication.Bluetooth.Core 3630 * @since 9 3631 * @deprecated since 10 3632 * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#deviceId 3633 */ 3634 deviceId: string; 3635 /** 3636 * The Id of the read request 3637 * 3638 * @syscap SystemCapability.Communication.Bluetooth.Core 3639 * @since 9 3640 * @deprecated since 10 3641 * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#transId 3642 */ 3643 transId: number; 3644 /** 3645 * Indicates the byte offset of the start position for reading characteristic value 3646 * 3647 * @syscap SystemCapability.Communication.Bluetooth.Core 3648 * @since 9 3649 * @deprecated since 10 3650 * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#offset 3651 */ 3652 offset: number; 3653 /** 3654 * The UUID of a DescriptorReadRequest instance 3655 * 3656 * @syscap SystemCapability.Communication.Bluetooth.Core 3657 * @since 9 3658 * @deprecated since 10 3659 * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#descriptorUuid 3660 */ 3661 descriptorUuid: string; 3662 /** 3663 * The UUID of the characteristic to which the descriptor belongs 3664 * 3665 * @syscap SystemCapability.Communication.Bluetooth.Core 3666 * @since 9 3667 * @deprecated since 10 3668 * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#characteristicUuid 3669 */ 3670 characteristicUuid: string; 3671 /** 3672 * The UUID of the service to which the descriptor belongs 3673 * 3674 * @syscap SystemCapability.Communication.Bluetooth.Core 3675 * @since 9 3676 * @deprecated since 10 3677 * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#serviceUuid 3678 */ 3679 serviceUuid: string; 3680 } 3681 3682 /** 3683 * Describes the parameters of the Gatt client's characteristic write request. 3684 * 3685 * @typedef DescriptorWriteRequest 3686 * @syscap SystemCapability.Communication.Bluetooth.Core 3687 * @since 9 3688 * @deprecated since 10 3689 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest 3690 */ 3691 interface DescriptorWriteRequest { 3692 /** 3693 * Indicates the address of the client that initiates the write request 3694 * 3695 * @syscap SystemCapability.Communication.Bluetooth.Core 3696 * @since 9 3697 * @deprecated since 10 3698 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#deviceId 3699 */ 3700 deviceId: string; 3701 /** 3702 * The Id of the write request 3703 * 3704 * @syscap SystemCapability.Communication.Bluetooth.Core 3705 * @since 9 3706 * @deprecated since 10 3707 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#transId 3708 */ 3709 transId: number; 3710 /** 3711 * Indicates the byte offset of the start position for writing characteristic value 3712 * 3713 * @syscap SystemCapability.Communication.Bluetooth.Core 3714 * @since 9 3715 * @deprecated since 10 3716 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#offset 3717 */ 3718 offset: number; 3719 /** 3720 * Whether this request should be pending for later operation 3721 * 3722 * @syscap SystemCapability.Communication.Bluetooth.Core 3723 * @since 9 3724 * @deprecated since 10 3725 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#isPrepared 3726 */ 3727 isPrep: boolean; 3728 /** 3729 * Whether the remote client need a response 3730 * 3731 * @syscap SystemCapability.Communication.Bluetooth.Core 3732 * @since 9 3733 * @deprecated since 10 3734 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#needRsp 3735 */ 3736 needRsp: boolean; 3737 /** 3738 * Indicates the value to be written 3739 * 3740 * @syscap SystemCapability.Communication.Bluetooth.Core 3741 * @since 9 3742 * @deprecated since 10 3743 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#value 3744 */ 3745 value: ArrayBuffer; 3746 /** 3747 * The UUID of a DescriptorWriteRequest instance 3748 * 3749 * @syscap SystemCapability.Communication.Bluetooth.Core 3750 * @since 9 3751 * @deprecated since 10 3752 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#descriptorUuid 3753 */ 3754 descriptorUuid: string; 3755 /** 3756 * The UUID of the characteristic to which the descriptor belongs 3757 * 3758 * @syscap SystemCapability.Communication.Bluetooth.Core 3759 * @since 9 3760 * @deprecated since 10 3761 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#characteristicUuid 3762 */ 3763 characteristicUuid: string; 3764 /** 3765 * The UUID of the service to which the descriptor belongs 3766 * 3767 * @syscap SystemCapability.Communication.Bluetooth.Core 3768 * @since 9 3769 * @deprecated since 10 3770 * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#serviceUuid 3771 */ 3772 serviceUuid: string; 3773 } 3774 3775 /** 3776 * Describes the parameters of a response send by the server to a specified read or write request. 3777 * 3778 * @typedef ServerResponse 3779 * @syscap SystemCapability.Communication.Bluetooth.Core 3780 * @since 9 3781 * @deprecated since 10 3782 * @useinstead ohos.bluetooth.ble/ble.ServerResponse 3783 */ 3784 interface ServerResponse { 3785 /** 3786 * Indicates the address of the client to which to send the response 3787 * 3788 * @syscap SystemCapability.Communication.Bluetooth.Core 3789 * @since 9 3790 * @deprecated since 10 3791 * @useinstead ohos.bluetooth.ble/ble.ServerResponse#deviceId 3792 */ 3793 deviceId: string; 3794 /** 3795 * The Id of the write request 3796 * 3797 * @syscap SystemCapability.Communication.Bluetooth.Core 3798 * @since 9 3799 * @deprecated since 10 3800 * @useinstead ohos.bluetooth.ble/ble.ServerResponse#transId 3801 */ 3802 transId: number; 3803 /** 3804 * Indicates the status of the read or write request, set this parameter to '0' in normal cases 3805 * 3806 * @syscap SystemCapability.Communication.Bluetooth.Core 3807 * @since 9 3808 * @deprecated since 10 3809 * @useinstead ohos.bluetooth.ble/ble.ServerResponse#status 3810 */ 3811 status: number; 3812 /** 3813 * Indicates the byte offset of the start position for reading or writing operation 3814 * 3815 * @syscap SystemCapability.Communication.Bluetooth.Core 3816 * @since 9 3817 * @deprecated since 10 3818 * @useinstead ohos.bluetooth.ble/ble.ServerResponse#offset 3819 */ 3820 offset: number; 3821 /** 3822 * Indicates the value to be sent 3823 * 3824 * @syscap SystemCapability.Communication.Bluetooth.Core 3825 * @since 9 3826 * @deprecated since 10 3827 * @useinstead ohos.bluetooth.ble/ble.ServerResponse#value 3828 */ 3829 value: ArrayBuffer; 3830 } 3831 3832 /** 3833 * Describes the Gatt profile connection state. 3834 * 3835 * @typedef BLEConnectChangedState 3836 * @syscap SystemCapability.Communication.Bluetooth.Core 3837 * @since 9 3838 * @deprecated since 10 3839 * @useinstead ohos.bluetooth.ble/ble.BLEConnectionChangeState 3840 */ 3841 interface BLEConnectChangedState { 3842 /** 3843 * Indicates the peer device address 3844 * 3845 * @syscap SystemCapability.Communication.Bluetooth.Core 3846 * @since 9 3847 * @deprecated since 10 3848 * @useinstead ohos.bluetooth.ble/ble.BLEConnectionChangeState#deviceId 3849 */ 3850 deviceId: string; 3851 /** 3852 * Connection state of the Gatt profile 3853 * 3854 * @syscap SystemCapability.Communication.Bluetooth.Core 3855 * @since 9 3856 * @deprecated since 10 3857 * @useinstead ohos.bluetooth.ble/ble.BLEConnectionChangeState#state 3858 */ 3859 state: ProfileConnectionState; 3860 } 3861 3862 /** 3863 * Describes the contents of the scan results. 3864 * 3865 * @typedef ScanResult 3866 * @syscap SystemCapability.Communication.Bluetooth.Core 3867 * @since 9 3868 * @deprecated since 10 3869 * @useinstead ohos.bluetooth.ble/ble.ScanResult 3870 */ 3871 interface ScanResult { 3872 /** 3873 * Address of the scanned device 3874 * 3875 * @syscap SystemCapability.Communication.Bluetooth.Core 3876 * @since 9 3877 * @deprecated since 10 3878 * @useinstead ohos.bluetooth.ble/ble.ScanResult#deviceId 3879 */ 3880 deviceId: string; 3881 /** 3882 * RSSI of the remote device 3883 * 3884 * @syscap SystemCapability.Communication.Bluetooth.Core 3885 * @since 9 3886 * @deprecated since 10 3887 * @useinstead ohos.bluetooth.ble/ble.ScanResult#rssi 3888 */ 3889 rssi: number; 3890 /** 3891 * The raw data of broadcast packet 3892 * 3893 * @syscap SystemCapability.Communication.Bluetooth.Core 3894 * @since 9 3895 * @deprecated since 10 3896 * @useinstead ohos.bluetooth.ble/ble.ScanResult#data 3897 */ 3898 data: ArrayBuffer; 3899 } 3900 3901 /** 3902 * Describes the settings for BLE advertising. 3903 * 3904 * @typedef AdvertiseSetting 3905 * @syscap SystemCapability.Communication.Bluetooth.Core 3906 * @since 9 3907 * @deprecated since 10 3908 * @useinstead ohos.bluetooth.ble/ble.AdvertiseSetting 3909 */ 3910 interface AdvertiseSetting { 3911 /** 3912 * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) 3913 * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) 3914 * Default slot value for the advertising interval, which is {@code 1600} (1s) 3915 * 3916 * @syscap SystemCapability.Communication.Bluetooth.Core 3917 * @since 9 3918 * @deprecated since 10 3919 * @useinstead ohos.bluetooth.ble/ble.AdvertiseSetting#interval 3920 */ 3921 interval?: number; 3922 /** 3923 * Minimum transmission power level for advertising, which is {@code -127} 3924 * Maximum transmission power level for advertising, which is {@code 1} 3925 * Default transmission power level for advertising, which is {@code -7} 3926 * 3927 * @syscap SystemCapability.Communication.Bluetooth.Core 3928 * @since 9 3929 * @deprecated since 10 3930 * @useinstead ohos.bluetooth.ble/ble.AdvertiseSetting#txPower 3931 */ 3932 txPower?: number; 3933 /** 3934 * Indicates whether the BLE is connectable, default is {@code true} 3935 * 3936 * @syscap SystemCapability.Communication.Bluetooth.Core 3937 * @since 9 3938 * @deprecated since 10 3939 * @useinstead ohos.bluetooth.ble/ble.AdvertiseSetting#connectable 3940 */ 3941 connectable?: boolean; 3942 } 3943 3944 /** 3945 * Describes the advertising data. 3946 * 3947 * @typedef AdvertiseData 3948 * @syscap SystemCapability.Communication.Bluetooth.Core 3949 * @since 9 3950 * @deprecated since 10 3951 * @useinstead ohos.bluetooth.ble/ble.AdvertiseData 3952 */ 3953 interface AdvertiseData { 3954 /** 3955 * The specified service UUID list to this advertisement 3956 * 3957 * @syscap SystemCapability.Communication.Bluetooth.Core 3958 * @since 9 3959 * @deprecated since 10 3960 * @useinstead ohos.bluetooth.ble/ble.AdvertiseData#serviceUuids 3961 */ 3962 serviceUuids: Array<string>; 3963 /** 3964 * The specified manufacturer data list to this advertisement 3965 * 3966 * @syscap SystemCapability.Communication.Bluetooth.Core 3967 * @since 9 3968 * @deprecated since 10 3969 * @useinstead ohos.bluetooth.ble/ble.AdvertiseData#manufactureData 3970 */ 3971 manufactureData: Array<ManufactureData>; 3972 /** 3973 * The specified service data list to this advertisement 3974 * 3975 * @syscap SystemCapability.Communication.Bluetooth.Core 3976 * @since 9 3977 * @deprecated since 10 3978 * @useinstead ohos.bluetooth.ble/ble.AdvertiseData#serviceData 3979 */ 3980 serviceData: Array<ServiceData>; 3981 } 3982 3983 /** 3984 * Describes the manufacturer data. 3985 * 3986 * @typedef ManufactureData 3987 * @syscap SystemCapability.Communication.Bluetooth.Core 3988 * @since 9 3989 * @deprecated since 10 3990 * @useinstead ohos.bluetooth.ble/ble.ManufactureData 3991 */ 3992 interface ManufactureData { 3993 /** 3994 * Indicates the manufacturer ID assigned by Bluetooth SIG 3995 * 3996 * @syscap SystemCapability.Communication.Bluetooth.Core 3997 * @since 9 3998 * @deprecated since 10 3999 * @useinstead ohos.bluetooth.ble/ble.ManufactureData#manufactureId 4000 */ 4001 manufactureId: number; 4002 /** 4003 * Indicates the manufacturer data to add 4004 * 4005 * @syscap SystemCapability.Communication.Bluetooth.Core 4006 * @since 9 4007 * @deprecated since 10 4008 * @useinstead ohos.bluetooth.ble/ble.ManufactureData#manufactureValue 4009 */ 4010 manufactureValue: ArrayBuffer; 4011 } 4012 4013 /** 4014 * Describes the service data. 4015 * 4016 * @typedef ServiceData 4017 * @syscap SystemCapability.Communication.Bluetooth.Core 4018 * @since 9 4019 * @deprecated since 10 4020 * @useinstead ohos.bluetooth.ble/ble.ServiceData 4021 */ 4022 interface ServiceData { 4023 /** 4024 * Indicates the UUID of the service data to add 4025 * 4026 * @syscap SystemCapability.Communication.Bluetooth.Core 4027 * @since 9 4028 * @deprecated since 10 4029 * @useinstead ohos.bluetooth.ble/ble.ServiceData#serviceUuid 4030 */ 4031 serviceUuid: string; 4032 /** 4033 * Indicates the service data to add 4034 * 4035 * @syscap SystemCapability.Communication.Bluetooth.Core 4036 * @since 9 4037 * @deprecated since 10 4038 * @useinstead ohos.bluetooth.ble/ble.ServiceData#serviceValue 4039 */ 4040 serviceValue: ArrayBuffer; 4041 } 4042 4043 /** 4044 * Describes the criteria for filtering scanning results can be set. 4045 * 4046 * @typedef ScanFilter 4047 * @syscap SystemCapability.Communication.Bluetooth.Core 4048 * @since 9 4049 * @deprecated since 10 4050 * @useinstead ohos.bluetooth.ble/ble.ScanFilter 4051 */ 4052 interface ScanFilter { 4053 /** 4054 * The address of a BLE peripheral device 4055 * 4056 * @syscap SystemCapability.Communication.Bluetooth.Core 4057 * @since 9 4058 * @deprecated since 10 4059 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#deviceId 4060 */ 4061 deviceId?: string; 4062 4063 /** 4064 * The name of a BLE peripheral device 4065 * 4066 * @syscap SystemCapability.Communication.Bluetooth.Core 4067 * @since 9 4068 * @deprecated since 10 4069 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#name 4070 */ 4071 name?: string; 4072 4073 /** 4074 * The service UUID of a BLE peripheral device 4075 * 4076 * @syscap SystemCapability.Communication.Bluetooth.Core 4077 * @since 9 4078 * @deprecated since 10 4079 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceUuid 4080 */ 4081 serviceUuid?: string; 4082 4083 /** 4084 * Service UUID mask. 4085 * 4086 * @syscap SystemCapability.Communication.Bluetooth.Core 4087 * @since 9 4088 * @deprecated since 10 4089 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceUuidMask 4090 */ 4091 serviceUuidMask?: string; 4092 4093 /** 4094 * Service solicitation UUID. 4095 * 4096 * @syscap SystemCapability.Communication.Bluetooth.Core 4097 * @since 9 4098 * @deprecated since 10 4099 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceSolicitationUuid 4100 */ 4101 serviceSolicitationUuid?: string; 4102 4103 /** 4104 * Service solicitation UUID mask. 4105 * 4106 * @syscap SystemCapability.Communication.Bluetooth.Core 4107 * @since 9 4108 * @deprecated since 10 4109 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceSolicitationUuidMask 4110 */ 4111 serviceSolicitationUuidMask?: string; 4112 4113 /** 4114 * Service data. 4115 * 4116 * @syscap SystemCapability.Communication.Bluetooth.Core 4117 * @since 9 4118 * @deprecated since 10 4119 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceData 4120 */ 4121 serviceData?: ArrayBuffer; 4122 4123 /** 4124 * Service data mask. 4125 * 4126 * @syscap SystemCapability.Communication.Bluetooth.Core 4127 * @since 9 4128 * @deprecated since 10 4129 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceDataMask 4130 */ 4131 serviceDataMask?: ArrayBuffer; 4132 4133 /** 4134 * Manufacture id. 4135 * 4136 * @syscap SystemCapability.Communication.Bluetooth.Core 4137 * @since 9 4138 * @deprecated since 10 4139 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#manufactureId 4140 */ 4141 manufactureId?: number; 4142 4143 /** 4144 * Manufacture data. 4145 * 4146 * @syscap SystemCapability.Communication.Bluetooth.Core 4147 * @since 9 4148 * @deprecated since 10 4149 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#manufactureData 4150 */ 4151 manufactureData?: ArrayBuffer; 4152 4153 /** 4154 * Manufacture data mask. 4155 * 4156 * @syscap SystemCapability.Communication.Bluetooth.Core 4157 * @since 9 4158 * @deprecated since 10 4159 * @useinstead ohos.bluetooth.ble/ble.ScanFilter#manufactureDataMask 4160 */ 4161 manufactureDataMask?: ArrayBuffer; 4162 } 4163 4164 /** 4165 * Describes the parameters for scan. 4166 * 4167 * @typedef ScanOptions 4168 * @syscap SystemCapability.Communication.Bluetooth.Core 4169 * @since 9 4170 * @deprecated since 10 4171 * @useinstead ohos.bluetooth.ble/ble.ScanOptions 4172 */ 4173 interface ScanOptions { 4174 /** 4175 * Time of delay for reporting the scan result 4176 * 4177 * @syscap SystemCapability.Communication.Bluetooth.Core 4178 * @since 9 4179 * @deprecated since 10 4180 * @useinstead ohos.bluetooth.ble/ble.ScanOptions#interval 4181 */ 4182 interval?: number; 4183 /** 4184 * Bluetooth LE scan mode 4185 * 4186 * @syscap SystemCapability.Communication.Bluetooth.Core 4187 * @since 9 4188 * @deprecated since 10 4189 * @useinstead ohos.bluetooth.ble/ble.ScanOptions#dutyMode 4190 */ 4191 dutyMode?: ScanDuty; 4192 /** 4193 * Match mode for Bluetooth LE scan filters hardware match 4194 * 4195 * @syscap SystemCapability.Communication.Bluetooth.Core 4196 * @since 9 4197 * @deprecated since 10 4198 * @useinstead ohos.bluetooth.ble/ble.ScanOptions#matchMode 4199 */ 4200 matchMode?: MatchMode; 4201 } 4202 4203 /** 4204 * Describes the spp parameters. 4205 * 4206 * @typedef SppOption 4207 * @syscap SystemCapability.Communication.Bluetooth.Core 4208 * @since 9 4209 * @deprecated since 10 4210 * @useinstead ohos.bluetooth.socket/socket.SppOptions 4211 */ 4212 interface SppOption { 4213 /** 4214 * Indicates the UUID in the SDP record. 4215 * 4216 * @syscap SystemCapability.Communication.Bluetooth.Core 4217 * @since 9 4218 * @deprecated since 10 4219 * @useinstead ohos.bluetooth.socket/socket.SppOptions#uuid 4220 */ 4221 uuid: string; 4222 /** 4223 * Indicates secure channel or not 4224 * 4225 * @syscap SystemCapability.Communication.Bluetooth.Core 4226 * @since 9 4227 * @deprecated since 10 4228 * @useinstead ohos.bluetooth.socket/socket.SppOptions#secure 4229 */ 4230 secure: boolean; 4231 /** 4232 * Spp link type {@link SppType} 4233 * 4234 * @syscap SystemCapability.Communication.Bluetooth.Core 4235 * @since 9 4236 * @deprecated since 10 4237 * @useinstead ohos.bluetooth.socket/socket.SppOptions#type 4238 */ 4239 type: SppType; 4240 } 4241 4242 /** 4243 * Describes the bond key param. 4244 * 4245 * @typedef PinRequiredParam 4246 * @syscap SystemCapability.Communication.Bluetooth.Core 4247 * @since 9 4248 * @deprecated since 10 4249 * @useinstead ohos.bluetooth.connection/connection.PinRequiredParam 4250 */ 4251 interface PinRequiredParam { 4252 /** 4253 * ID of the device to pair. 4254 * 4255 * @syscap SystemCapability.Communication.Bluetooth.Core 4256 * @since 9 4257 * @deprecated since 10 4258 * @useinstead ohos.bluetooth.connection/connection.PinRequiredParam#deviceId 4259 */ 4260 deviceId: string; 4261 /** 4262 * Key for the device pairing. 4263 * 4264 * @syscap SystemCapability.Communication.Bluetooth.Core 4265 * @since 9 4266 * @deprecated since 10 4267 * @useinstead ohos.bluetooth.connection/connection.PinRequiredParam#pinCode 4268 */ 4269 pinCode: string; 4270 } 4271 4272 /** 4273 * Describes the class of a bluetooth device. 4274 * 4275 * @typedef DeviceClass 4276 * @syscap SystemCapability.Communication.Bluetooth.Core 4277 * @since 9 4278 * @deprecated since 10 4279 * @useinstead ohos.bluetooth.connection/connection.DeviceClass 4280 */ 4281 interface DeviceClass { 4282 /** 4283 * Major classes of Bluetooth devices. 4284 * 4285 * @syscap SystemCapability.Communication.Bluetooth.Core 4286 * @since 9 4287 * @deprecated since 10 4288 * @useinstead ohos.bluetooth.connection/connection.DeviceClass#majorClass 4289 */ 4290 majorClass: MajorClass; 4291 /** 4292 * Major and minor classes of Bluetooth devices. 4293 * 4294 * @syscap SystemCapability.Communication.Bluetooth.Core 4295 * @since 9 4296 * @deprecated since 10 4297 * @useinstead ohos.bluetooth.connection/connection.DeviceClass#majorMinorClass 4298 */ 4299 majorMinorClass: MajorMinorClass; 4300 /** 4301 * Class of the device. 4302 * 4303 * @syscap SystemCapability.Communication.Bluetooth.Core 4304 * @since 9 4305 * @deprecated since 10 4306 * @useinstead ohos.bluetooth.connection/connection.DeviceClass#classOfDevice 4307 */ 4308 classOfDevice: number; 4309 } 4310 4311 /** 4312 * Describes the class of a bluetooth device. 4313 * 4314 * @typedef BondStateParam 4315 * @syscap SystemCapability.Communication.Bluetooth.Core 4316 * @since 9 4317 * @deprecated since 10 4318 * @useinstead ohos.bluetooth.connection/connection.BondStateParam 4319 */ 4320 interface BondStateParam { 4321 /** 4322 * Address of a Bluetooth device. 4323 * 4324 * @syscap SystemCapability.Communication.Bluetooth.Core 4325 * @since 9 4326 * @deprecated since 10 4327 * @useinstead ohos.bluetooth.connection/connection.BondStateParam#deviceId 4328 */ 4329 deviceId: string; 4330 /** 4331 * Profile connection state of the device. 4332 * 4333 * @syscap SystemCapability.Communication.Bluetooth.Core 4334 * @since 9 4335 * @deprecated since 10 4336 * @useinstead ohos.bluetooth.connection/connection.BondStateParam#state 4337 */ 4338 state: BondState; 4339 } 4340 4341 /** 4342 * Profile state change parameters. 4343 * 4344 * @typedef StateChangeParam 4345 * @syscap SystemCapability.Communication.Bluetooth.Core 4346 * @since 9 4347 * @deprecated since 10 4348 * @useinstead ohos.bluetooth.baseProfile/baseProfile.StateChangeParam 4349 */ 4350 interface StateChangeParam { 4351 /** 4352 * The address of device 4353 * 4354 * @syscap SystemCapability.Communication.Bluetooth.Core 4355 * @since 9 4356 * @deprecated since 10 4357 * @useinstead ohos.bluetooth.baseProfile/baseProfile.StateChangeParam#deviceId 4358 */ 4359 deviceId: string; 4360 4361 /** 4362 * Profile state value 4363 * 4364 * @syscap SystemCapability.Communication.Bluetooth.Core 4365 * @since 9 4366 * @deprecated since 10 4367 * @useinstead ohos.bluetooth.baseProfile/baseProfile.StateChangeParam#state 4368 */ 4369 state: ProfileConnectionState; 4370 } 4371 4372 /** 4373 * The enum of scan duty. 4374 * 4375 * @enum { number } 4376 * @syscap SystemCapability.Communication.Bluetooth.Core 4377 * @since 9 4378 * @deprecated since 10 4379 * @useinstead ohos.bluetooth.ble/ble.ScanDuty 4380 */ 4381 enum ScanDuty { 4382 /** 4383 * low power mode 4384 * 4385 * @syscap SystemCapability.Communication.Bluetooth.Core 4386 * @since 9 4387 * @deprecated since 10 4388 * @useinstead ohos.bluetooth.ble/ble.ScanDuty#SCAN_MODE_LOW_POWER 4389 */ 4390 SCAN_MODE_LOW_POWER = 0, 4391 /** 4392 * balanced power mode 4393 * 4394 * @syscap SystemCapability.Communication.Bluetooth.Core 4395 * @since 9 4396 * @deprecated since 10 4397 * @useinstead ohos.bluetooth.ble/ble.ScanDuty#SCAN_MODE_BALANCED 4398 */ 4399 SCAN_MODE_BALANCED = 1, 4400 /** 4401 * Scan using highest duty cycle 4402 * 4403 * @syscap SystemCapability.Communication.Bluetooth.Core 4404 * @since 9 4405 * @deprecated since 10 4406 * @useinstead ohos.bluetooth.ble/ble.ScanDuty#SCAN_MODE_LOW_LATENCY 4407 */ 4408 SCAN_MODE_LOW_LATENCY = 2 4409 } 4410 4411 /** 4412 * The enum of BLE match mode. 4413 * 4414 * @enum { number } 4415 * @syscap SystemCapability.Communication.Bluetooth.Core 4416 * @since 9 4417 * @deprecated since 10 4418 * @useinstead ohos.bluetooth.ble/ble.MatchMode 4419 */ 4420 enum MatchMode { 4421 /** 4422 * aggressive mode 4423 * 4424 * @syscap SystemCapability.Communication.Bluetooth.Core 4425 * @since 9 4426 * @deprecated since 10 4427 * @useinstead ohos.bluetooth.ble/ble.MatchMode#MATCH_MODE_AGGRESSIVE 4428 */ 4429 MATCH_MODE_AGGRESSIVE = 1, 4430 /** 4431 * sticky mode 4432 * 4433 * @syscap SystemCapability.Communication.Bluetooth.Core 4434 * @since 9 4435 * @deprecated since 10 4436 * @useinstead ohos.bluetooth.ble/ble.MatchMode#MATCH_MODE_STICKY 4437 */ 4438 MATCH_MODE_STICKY = 2 4439 } 4440 4441 /** 4442 * The enum of profile connection state. 4443 * 4444 * @enum { number } 4445 * @syscap SystemCapability.Communication.Bluetooth.Core 4446 * @since 9 4447 * @deprecated since 10 4448 * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState 4449 */ 4450 enum ProfileConnectionState { 4451 /** 4452 * the current profile is disconnected 4453 * 4454 * @syscap SystemCapability.Communication.Bluetooth.Core 4455 * @since 9 4456 * @deprecated since 10 4457 * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState#STATE_DISCONNECTED 4458 */ 4459 STATE_DISCONNECTED = 0, 4460 /** 4461 * the current profile is being connected 4462 * 4463 * @syscap SystemCapability.Communication.Bluetooth.Core 4464 * @since 9 4465 * @deprecated since 10 4466 * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState#STATE_CONNECTING 4467 */ 4468 STATE_CONNECTING = 1, 4469 /** 4470 * the current profile is connected 4471 * 4472 * @syscap SystemCapability.Communication.Bluetooth.Core 4473 * @since 9 4474 * @deprecated since 10 4475 * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState#STATE_CONNECTED 4476 */ 4477 STATE_CONNECTED = 2, 4478 /** 4479 * the current profile is being disconnected 4480 * 4481 * @syscap SystemCapability.Communication.Bluetooth.Core 4482 * @since 9 4483 * @deprecated since 10 4484 * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState#STATE_DISCONNECTING 4485 */ 4486 STATE_DISCONNECTING = 3 4487 } 4488 4489 /** 4490 * The enum of bluetooth state. 4491 * 4492 * @enum { number } 4493 * @syscap SystemCapability.Communication.Bluetooth.Core 4494 * @since 9 4495 * @deprecated since 10 4496 * @useinstead ohos.bluetooth.access/access.BluetoothState 4497 */ 4498 enum BluetoothState { 4499 /** 4500 * Indicates the local Bluetooth is off 4501 * 4502 * @syscap SystemCapability.Communication.Bluetooth.Core 4503 * @since 9 4504 * @deprecated since 10 4505 * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_OFF 4506 */ 4507 STATE_OFF = 0, 4508 /** 4509 * Indicates the local Bluetooth is turning on 4510 * 4511 * @syscap SystemCapability.Communication.Bluetooth.Core 4512 * @since 9 4513 * @deprecated since 10 4514 * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_TURNING_ON 4515 */ 4516 STATE_TURNING_ON = 1, 4517 /** 4518 * Indicates the local Bluetooth is on, and ready for use 4519 * 4520 * @syscap SystemCapability.Communication.Bluetooth.Core 4521 * @since 9 4522 * @deprecated since 10 4523 * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_ON 4524 */ 4525 STATE_ON = 2, 4526 /** 4527 * Indicates the local Bluetooth is turning off 4528 * 4529 * @syscap SystemCapability.Communication.Bluetooth.Core 4530 * @since 9 4531 * @deprecated since 10 4532 * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_TURNING_OFF 4533 */ 4534 STATE_TURNING_OFF = 3, 4535 /** 4536 * Indicates the local Bluetooth is turning LE mode on 4537 * 4538 * @syscap SystemCapability.Communication.Bluetooth.Core 4539 * @since 9 4540 * @deprecated since 10 4541 * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_BLE_TURNING_ON 4542 */ 4543 STATE_BLE_TURNING_ON = 4, 4544 /** 4545 * Indicates the local Bluetooth is in LE only mode 4546 * 4547 * @syscap SystemCapability.Communication.Bluetooth.Core 4548 * @since 9 4549 * @deprecated since 10 4550 * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_BLE_ON 4551 */ 4552 STATE_BLE_ON = 5, 4553 /** 4554 * Indicates the local Bluetooth is turning off LE only mode 4555 * 4556 * @syscap SystemCapability.Communication.Bluetooth.Core 4557 * @since 9 4558 * @deprecated since 10 4559 * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_BLE_TURNING_OFF 4560 */ 4561 STATE_BLE_TURNING_OFF = 6 4562 } 4563 4564 /** 4565 * The enum of SPP type. 4566 * 4567 * @enum { number } 4568 * @syscap SystemCapability.Communication.Bluetooth.Core 4569 * @since 9 4570 * @deprecated since 10 4571 * @useinstead ohos.bluetooth.socket/socket.SppType 4572 */ 4573 enum SppType { 4574 /** 4575 * RFCOMM 4576 * 4577 * @syscap SystemCapability.Communication.Bluetooth.Core 4578 * @since 9 4579 * @deprecated since 10 4580 * @useinstead ohos.bluetooth.socket/socket.SppType#SPP_RFCOMM 4581 */ 4582 SPP_RFCOMM 4583 } 4584 4585 /** 4586 * The enum of BR scan mode. 4587 * 4588 * @enum { number } 4589 * @syscap SystemCapability.Communication.Bluetooth.Core 4590 * @since 9 4591 * @deprecated since 10 4592 * @useinstead ohos.bluetooth.connection/connection.ScanMode 4593 */ 4594 enum ScanMode { 4595 /** 4596 * Indicates the scan mode is none 4597 * 4598 * @syscap SystemCapability.Communication.Bluetooth.Core 4599 * @since 9 4600 * @deprecated since 10 4601 * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_NONE 4602 */ 4603 SCAN_MODE_NONE = 0, 4604 /** 4605 * Indicates the scan mode is connectable 4606 * 4607 * @syscap SystemCapability.Communication.Bluetooth.Core 4608 * @since 9 4609 * @deprecated since 10 4610 * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_CONNECTABLE 4611 */ 4612 SCAN_MODE_CONNECTABLE = 1, 4613 /** 4614 * Indicates the scan mode is general discoverable 4615 * 4616 * @syscap SystemCapability.Communication.Bluetooth.Core 4617 * @since 9 4618 * @deprecated since 10 4619 * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_GENERAL_DISCOVERABLE 4620 */ 4621 SCAN_MODE_GENERAL_DISCOVERABLE = 2, 4622 /** 4623 * Indicates the scan mode is limited discoverable 4624 * 4625 * @syscap SystemCapability.Communication.Bluetooth.Core 4626 * @since 9 4627 * @deprecated since 10 4628 * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_LIMITED_DISCOVERABLE 4629 */ 4630 SCAN_MODE_LIMITED_DISCOVERABLE = 3, 4631 /** 4632 * Indicates the scan mode is connectable and general discoverable 4633 * 4634 * @syscap SystemCapability.Communication.Bluetooth.Core 4635 * @since 9 4636 * @deprecated since 10 4637 * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE 4638 */ 4639 SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4, 4640 /** 4641 * Indicates the scan mode is connectable and limited discoverable 4642 * 4643 * @syscap SystemCapability.Communication.Bluetooth.Core 4644 * @since 9 4645 * @deprecated since 10 4646 * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE 4647 */ 4648 SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5 4649 } 4650 4651 /** 4652 * The enum of bond state. 4653 * 4654 * @enum { number } 4655 * @syscap SystemCapability.Communication.Bluetooth.Core 4656 * @since 9 4657 * @deprecated since 10 4658 * @useinstead ohos.bluetooth.connection/connection.BondState 4659 */ 4660 enum BondState { 4661 /** 4662 * Indicate the bond state is invalid 4663 * 4664 * @syscap SystemCapability.Communication.Bluetooth.Core 4665 * @since 9 4666 * @deprecated since 10 4667 * @useinstead ohos.bluetooth.connection/connection.BondState#BOND_STATE_INVALID 4668 */ 4669 BOND_STATE_INVALID = 0, 4670 /** 4671 * Indicate the bond state is bonding 4672 * 4673 * @syscap SystemCapability.Communication.Bluetooth.Core 4674 * @since 9 4675 * @deprecated since 10 4676 * @useinstead ohos.bluetooth.connection/connection.BondState#BOND_STATE_BONDING 4677 */ 4678 BOND_STATE_BONDING = 1, 4679 /** 4680 * Indicate the bond state is bonded 4681 * 4682 * @syscap SystemCapability.Communication.Bluetooth.Core 4683 * @since 9 4684 * @deprecated since 10 4685 * @useinstead ohos.bluetooth.connection/connection.BondState#BOND_STATE_BONDED 4686 */ 4687 BOND_STATE_BONDED = 2 4688 } 4689 4690 /** 4691 * The enum of major class of a bluetooth device. 4692 * 4693 * @enum { number } 4694 * @syscap SystemCapability.Communication.Bluetooth.Core 4695 * @since 9 4696 * @deprecated since 10 4697 * @useinstead ohos.bluetooth.constant/constant.MajorClass 4698 */ 4699 enum MajorClass { 4700 /** 4701 * Miscellaneous device. 4702 * 4703 * @syscap SystemCapability.Communication.Bluetooth.Core 4704 * @since 9 4705 * @deprecated since 10 4706 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_MISC 4707 */ 4708 MAJOR_MISC = 0x0000, 4709 /** 4710 * Computer. 4711 * 4712 * @syscap SystemCapability.Communication.Bluetooth.Core 4713 * @since 9 4714 * @deprecated since 10 4715 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_COMPUTER 4716 */ 4717 MAJOR_COMPUTER = 0x0100, 4718 /** 4719 * Mobile phone. 4720 * 4721 * @syscap SystemCapability.Communication.Bluetooth.Core 4722 * @since 9 4723 * @deprecated since 10 4724 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_PHONE 4725 */ 4726 MAJOR_PHONE = 0x0200, 4727 /** 4728 * Network device. 4729 * 4730 * @syscap SystemCapability.Communication.Bluetooth.Core 4731 * @since 9 4732 * @deprecated since 10 4733 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_NETWORKING 4734 */ 4735 MAJOR_NETWORKING = 0x0300, 4736 /** 4737 * Audio or video device. 4738 * 4739 * @syscap SystemCapability.Communication.Bluetooth.Core 4740 * @since 9 4741 * @deprecated since 10 4742 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_AUDIO_VIDEO 4743 */ 4744 MAJOR_AUDIO_VIDEO = 0x0400, 4745 /** 4746 * Peripheral device. 4747 * 4748 * @syscap SystemCapability.Communication.Bluetooth.Core 4749 * @since 9 4750 * @deprecated since 10 4751 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_PERIPHERAL 4752 */ 4753 MAJOR_PERIPHERAL = 0x0500, 4754 /** 4755 * Imaging device. 4756 * 4757 * @syscap SystemCapability.Communication.Bluetooth.Core 4758 * @since 9 4759 * @deprecated since 10 4760 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_IMAGING 4761 */ 4762 MAJOR_IMAGING = 0x0600, 4763 /** 4764 * Wearable device. 4765 * 4766 * @syscap SystemCapability.Communication.Bluetooth.Core 4767 * @since 9 4768 * @deprecated since 10 4769 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_WEARABLE 4770 */ 4771 MAJOR_WEARABLE = 0x0700, 4772 /** 4773 * Toy. 4774 * 4775 * @syscap SystemCapability.Communication.Bluetooth.Core 4776 * @since 9 4777 * @deprecated since 10 4778 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_TOY 4779 */ 4780 MAJOR_TOY = 0x0800, 4781 /** 4782 * Health device. 4783 * 4784 * @syscap SystemCapability.Communication.Bluetooth.Core 4785 * @since 9 4786 * @deprecated since 10 4787 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_HEALTH 4788 */ 4789 MAJOR_HEALTH = 0x0900, 4790 /** 4791 * Unclassified device. 4792 * 4793 * @syscap SystemCapability.Communication.Bluetooth.Core 4794 * @since 9 4795 * @deprecated since 10 4796 * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_UNCATEGORIZED 4797 */ 4798 MAJOR_UNCATEGORIZED = 0x1F00 4799 } 4800 4801 /** 4802 * The enum of major minor class of a bluetooth device. 4803 * 4804 * @enum { number } 4805 * @syscap SystemCapability.Communication.Bluetooth.Core 4806 * @since 9 4807 * @deprecated since 10 4808 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass 4809 */ 4810 enum MajorMinorClass { 4811 /** 4812 * The Minor Device Class field 4813 * Computer Major Class 4814 * 4815 * @syscap SystemCapability.Communication.Bluetooth.Core 4816 * @since 9 4817 * @deprecated since 10 4818 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_UNCATEGORIZED 4819 */ 4820 COMPUTER_UNCATEGORIZED = 0x0100, 4821 /** 4822 * Desktop computer. 4823 * 4824 * @syscap SystemCapability.Communication.Bluetooth.Core 4825 * @since 9 4826 * @deprecated since 10 4827 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_DESKTOP 4828 */ 4829 COMPUTER_DESKTOP = 0x0104, 4830 /** 4831 * Server. 4832 * 4833 * @syscap SystemCapability.Communication.Bluetooth.Core 4834 * @since 9 4835 * @deprecated since 10 4836 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_SERVER 4837 */ 4838 COMPUTER_SERVER = 0x0108, 4839 /** 4840 * Laptop. 4841 * 4842 * @syscap SystemCapability.Communication.Bluetooth.Core 4843 * @since 9 4844 * @deprecated since 10 4845 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_LAPTOP 4846 */ 4847 COMPUTER_LAPTOP = 0x010C, 4848 /** 4849 * Hand-held computer. 4850 * 4851 * @syscap SystemCapability.Communication.Bluetooth.Core 4852 * @since 9 4853 * @deprecated since 10 4854 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_HANDHELD_PC_PDA 4855 */ 4856 COMPUTER_HANDHELD_PC_PDA = 0x0110, 4857 /** 4858 * Palmtop computer. 4859 * 4860 * @syscap SystemCapability.Communication.Bluetooth.Core 4861 * @since 9 4862 * @deprecated since 10 4863 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_PALM_SIZE_PC_PDA 4864 */ 4865 COMPUTER_PALM_SIZE_PC_PDA = 0x0114, 4866 /** 4867 * Wearable computer. 4868 * 4869 * @syscap SystemCapability.Communication.Bluetooth.Core 4870 * @since 9 4871 * @deprecated since 10 4872 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_WEARABLE 4873 */ 4874 COMPUTER_WEARABLE = 0x0118, 4875 /** 4876 * Tablet. 4877 * 4878 * @syscap SystemCapability.Communication.Bluetooth.Core 4879 * @since 9 4880 * @deprecated since 10 4881 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_TABLET 4882 */ 4883 COMPUTER_TABLET = 0x011C, 4884 4885 /** 4886 * Phone Major Class 4887 * 4888 * @syscap SystemCapability.Communication.Bluetooth.Core 4889 * @since 9 4890 * @deprecated since 10 4891 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_UNCATEGORIZED 4892 */ 4893 PHONE_UNCATEGORIZED = 0x0200, 4894 /** 4895 * Portable phone. 4896 * 4897 * @syscap SystemCapability.Communication.Bluetooth.Core 4898 * @since 9 4899 * @deprecated since 10 4900 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_CELLULAR 4901 */ 4902 PHONE_CELLULAR = 0x0204, 4903 /** 4904 * Cordless phone. 4905 * 4906 * @syscap SystemCapability.Communication.Bluetooth.Core 4907 * @since 9 4908 * @deprecated since 10 4909 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_CORDLESS 4910 */ 4911 PHONE_CORDLESS = 0x0208, 4912 /** 4913 * Smartphone. 4914 * 4915 * @syscap SystemCapability.Communication.Bluetooth.Core 4916 * @since 9 4917 * @deprecated since 10 4918 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_SMART 4919 */ 4920 PHONE_SMART = 0x020C, 4921 /** 4922 * Modem or gateway phone. 4923 * 4924 * @syscap SystemCapability.Communication.Bluetooth.Core 4925 * @since 9 4926 * @deprecated since 10 4927 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_MODEM_OR_GATEWAY 4928 */ 4929 PHONE_MODEM_OR_GATEWAY = 0x0210, 4930 /** 4931 * ISDN phone. 4932 * 4933 * @syscap SystemCapability.Communication.Bluetooth.Core 4934 * @since 9 4935 * @deprecated since 10 4936 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_ISDN 4937 */ 4938 PHONE_ISDN = 0x0214, 4939 4940 /** 4941 * LAN/Network Access Point Major Class 4942 * 4943 * @syscap SystemCapability.Communication.Bluetooth.Core 4944 * @since 9 4945 * @deprecated since 10 4946 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_FULLY_AVAILABLE 4947 */ 4948 NETWORK_FULLY_AVAILABLE = 0x0300, 4949 /** 4950 * Device used on network 1 to 17. 4951 * 4952 * @syscap SystemCapability.Communication.Bluetooth.Core 4953 * @since 9 4954 * @deprecated since 10 4955 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_1_TO_17_UTILIZED 4956 */ 4957 NETWORK_1_TO_17_UTILIZED = 0x0320, 4958 /** 4959 * Device used on network 17 to 33. 4960 * 4961 * @syscap SystemCapability.Communication.Bluetooth.Core 4962 * @since 9 4963 * @deprecated since 10 4964 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_17_TO_33_UTILIZED 4965 */ 4966 NETWORK_17_TO_33_UTILIZED = 0x0340, 4967 /** 4968 * Device used on network 33 to 50. 4969 * 4970 * @syscap SystemCapability.Communication.Bluetooth.Core 4971 * @since 9 4972 * @deprecated since 10 4973 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_33_TO_50_UTILIZED 4974 */ 4975 NETWORK_33_TO_50_UTILIZED = 0x0360, 4976 /** 4977 * Device used on network 60 to 67. 4978 * 4979 * @syscap SystemCapability.Communication.Bluetooth.Core 4980 * @since 9 4981 * @deprecated since 10 4982 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_60_TO_67_UTILIZED 4983 */ 4984 NETWORK_60_TO_67_UTILIZED = 0x0380, 4985 /** 4986 * Device used on network 67 to 83. 4987 * 4988 * @syscap SystemCapability.Communication.Bluetooth.Core 4989 * @since 9 4990 * @deprecated since 10 4991 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_67_TO_83_UTILIZED 4992 */ 4993 NETWORK_67_TO_83_UTILIZED = 0x03A0, 4994 /** 4995 * Device used on network 83 to 99. 4996 * 4997 * @syscap SystemCapability.Communication.Bluetooth.Core 4998 * @since 9 4999 * @deprecated since 10 5000 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_83_TO_99_UTILIZED 5001 */ 5002 NETWORK_83_TO_99_UTILIZED = 0x03C0, 5003 /** 5004 * Device without network service. 5005 * 5006 * @syscap SystemCapability.Communication.Bluetooth.Core 5007 * @since 9 5008 * @deprecated since 10 5009 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_NO_SERVICE 5010 */ 5011 NETWORK_NO_SERVICE = 0x03E0, 5012 5013 /** 5014 * Unclassified audio or video device. 5015 * 5016 * @syscap SystemCapability.Communication.Bluetooth.Core 5017 * @since 9 5018 * @deprecated since 10 5019 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_UNCATEGORIZED 5020 */ 5021 AUDIO_VIDEO_UNCATEGORIZED = 0x0400, 5022 /** 5023 * Wearable audio or video headset. 5024 * 5025 * @syscap SystemCapability.Communication.Bluetooth.Core 5026 * @since 9 5027 * @deprecated since 10 5028 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_WEARABLE_HEADSET 5029 */ 5030 AUDIO_VIDEO_WEARABLE_HEADSET = 0x0404, 5031 /** 5032 * Hands-free audio or video device. 5033 * 5034 * @syscap SystemCapability.Communication.Bluetooth.Core 5035 * @since 9 5036 * @deprecated since 10 5037 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_HANDSFREE 5038 */ 5039 AUDIO_VIDEO_HANDSFREE = 0x0408, 5040 /** 5041 * Audio or video microphone. 5042 * 5043 * @syscap SystemCapability.Communication.Bluetooth.Core 5044 * @since 9 5045 * @deprecated since 10 5046 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_MICROPHONE 5047 */ 5048 AUDIO_VIDEO_MICROPHONE = 0x0410, 5049 /** 5050 * Audio or video loudspeaker. 5051 * 5052 * @syscap SystemCapability.Communication.Bluetooth.Core 5053 * @since 9 5054 * @deprecated since 10 5055 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_LOUDSPEAKER 5056 */ 5057 AUDIO_VIDEO_LOUDSPEAKER = 0x0414, 5058 /** 5059 * Audio or video headphones. 5060 * 5061 * @syscap SystemCapability.Communication.Bluetooth.Core 5062 * @since 9 5063 * @deprecated since 10 5064 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_HEADPHONES 5065 */ 5066 AUDIO_VIDEO_HEADPHONES = 0x0418, 5067 /** 5068 * Portable audio or video device. 5069 * 5070 * @syscap SystemCapability.Communication.Bluetooth.Core 5071 * @since 9 5072 * @deprecated since 10 5073 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_PORTABLE_AUDIO 5074 */ 5075 AUDIO_VIDEO_PORTABLE_AUDIO = 0x041C, 5076 /** 5077 * In-vehicle audio or video device. 5078 * 5079 * @syscap SystemCapability.Communication.Bluetooth.Core 5080 * @since 9 5081 * @deprecated since 10 5082 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_CAR_AUDIO 5083 */ 5084 AUDIO_VIDEO_CAR_AUDIO = 0x0420, 5085 /** 5086 * Audio or video STB device. 5087 * 5088 * @syscap SystemCapability.Communication.Bluetooth.Core 5089 * @since 9 5090 * @deprecated since 10 5091 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_SET_TOP_BOX 5092 */ 5093 AUDIO_VIDEO_SET_TOP_BOX = 0x0424, 5094 /** 5095 * High-fidelity speaker device. 5096 * 5097 * @syscap SystemCapability.Communication.Bluetooth.Core 5098 * @since 9 5099 * @deprecated since 10 5100 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_HIFI_AUDIO 5101 */ 5102 AUDIO_VIDEO_HIFI_AUDIO = 0x0428, 5103 /** 5104 * Video cassette recording (VCR) device. 5105 * 5106 * @syscap SystemCapability.Communication.Bluetooth.Core 5107 * @since 9 5108 * @deprecated since 10 5109 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VCR 5110 */ 5111 AUDIO_VIDEO_VCR = 0x042C, 5112 /** 5113 * Camera. 5114 * 5115 * @syscap SystemCapability.Communication.Bluetooth.Core 5116 * @since 9 5117 * @deprecated since 10 5118 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_CAMERA 5119 */ 5120 AUDIO_VIDEO_VIDEO_CAMERA = 0x0430, 5121 /** 5122 * Camcorder. 5123 * 5124 * @syscap SystemCapability.Communication.Bluetooth.Core 5125 * @since 9 5126 * @deprecated since 10 5127 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_CAMCORDER 5128 */ 5129 AUDIO_VIDEO_CAMCORDER = 0x0434, 5130 /** 5131 * Audio or video monitor. 5132 * 5133 * @syscap SystemCapability.Communication.Bluetooth.Core 5134 * @since 9 5135 * @deprecated since 10 5136 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_MONITOR 5137 */ 5138 AUDIO_VIDEO_VIDEO_MONITOR = 0x0438, 5139 /** 5140 * Video display or loudspeaker. 5141 * 5142 * @syscap SystemCapability.Communication.Bluetooth.Core 5143 * @since 9 5144 * @deprecated since 10 5145 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER 5146 */ 5147 AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x043C, 5148 /** 5149 * Video conferencing device. 5150 * 5151 * @syscap SystemCapability.Communication.Bluetooth.Core 5152 * @since 9 5153 * @deprecated since 10 5154 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_CONFERENCING 5155 */ 5156 AUDIO_VIDEO_VIDEO_CONFERENCING = 0x0440, 5157 /** 5158 * Audio or video gaming toy. 5159 * 5160 * @syscap SystemCapability.Communication.Bluetooth.Core 5161 * @since 9 5162 * @deprecated since 10 5163 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_GAMING_TOY 5164 */ 5165 AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x0448, 5166 5167 /** 5168 * Peripheral Major Class 5169 * 5170 * @syscap SystemCapability.Communication.Bluetooth.Core 5171 * @since 9 5172 * @deprecated since 10 5173 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_NON_KEYBOARD_NON_POINTING 5174 */ 5175 PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500, 5176 /** 5177 * Keyboard device. 5178 * 5179 * @syscap SystemCapability.Communication.Bluetooth.Core 5180 * @since 9 5181 * @deprecated since 10 5182 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_KEYBOARD 5183 */ 5184 PERIPHERAL_KEYBOARD = 0x0540, 5185 /** 5186 * Pointing peripheral device. 5187 * 5188 * @syscap SystemCapability.Communication.Bluetooth.Core 5189 * @since 9 5190 * @deprecated since 10 5191 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_POINTING_DEVICE 5192 */ 5193 PERIPHERAL_POINTING_DEVICE = 0x0580, 5194 /** 5195 * Keyboard pointing device. 5196 * 5197 * @syscap SystemCapability.Communication.Bluetooth.Core 5198 * @since 9 5199 * @deprecated since 10 5200 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_KEYBOARD_POINTING 5201 */ 5202 PERIPHERAL_KEYBOARD_POINTING = 0x05C0, 5203 /** 5204 * Unclassified peripheral device. 5205 * 5206 * @syscap SystemCapability.Communication.Bluetooth.Core 5207 * @since 9 5208 * @deprecated since 10 5209 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_UNCATEGORIZED 5210 */ 5211 PERIPHERAL_UNCATEGORIZED = 0x0500, 5212 /** 5213 * Peripheral joystick. 5214 * 5215 * @syscap SystemCapability.Communication.Bluetooth.Core 5216 * @since 9 5217 * @deprecated since 10 5218 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_JOYSTICK 5219 */ 5220 PERIPHERAL_JOYSTICK = 0x0504, 5221 /** 5222 * Peripheral game pad. 5223 * 5224 * @syscap SystemCapability.Communication.Bluetooth.Core 5225 * @since 9 5226 * @deprecated since 10 5227 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_GAMEPAD 5228 */ 5229 PERIPHERAL_GAMEPAD = 0x0508, 5230 /** 5231 * Peripheral remote control device. 5232 * 5233 * @syscap SystemCapability.Communication.Bluetooth.Core 5234 * @since 9 5235 * @deprecated since 10 5236 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_REMOTE_CONTROL 5237 */ 5238 PERIPHERAL_REMOTE_CONTROL = 0x05C0, 5239 /** 5240 * Peripheral sensing device. 5241 * 5242 * @syscap SystemCapability.Communication.Bluetooth.Core 5243 * @since 9 5244 * @deprecated since 10 5245 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_SENSING_DEVICE 5246 */ 5247 PERIPHERAL_SENSING_DEVICE = 0x0510, 5248 /** 5249 * Peripheral digitizer tablet. 5250 * 5251 * @syscap SystemCapability.Communication.Bluetooth.Core 5252 * @since 9 5253 * @deprecated since 10 5254 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_DIGITIZER_TABLET 5255 */ 5256 PERIPHERAL_DIGITIZER_TABLET = 0x0514, 5257 /** 5258 * Peripheral card reader. 5259 * 5260 * @syscap SystemCapability.Communication.Bluetooth.Core 5261 * @since 9 5262 * @deprecated since 10 5263 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_CARD_READER 5264 */ 5265 PERIPHERAL_CARD_READER = 0x0518, 5266 /** 5267 * Peripheral digital pen. 5268 * 5269 * @syscap SystemCapability.Communication.Bluetooth.Core 5270 * @since 9 5271 * @deprecated since 10 5272 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_DIGITAL_PEN 5273 */ 5274 PERIPHERAL_DIGITAL_PEN = 0x051C, 5275 /** 5276 * Peripheral RFID scanner. 5277 * 5278 * @syscap SystemCapability.Communication.Bluetooth.Core 5279 * @since 9 5280 * @deprecated since 10 5281 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_SCANNER_RFID 5282 */ 5283 PERIPHERAL_SCANNER_RFID = 0x0520, 5284 /** 5285 * Gesture input device. 5286 * 5287 * @syscap SystemCapability.Communication.Bluetooth.Core 5288 * @since 9 5289 * @deprecated since 10 5290 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_GESTURAL_INPUT 5291 */ 5292 PERIPHERAL_GESTURAL_INPUT = 0x0522, 5293 5294 /** 5295 * Imaging Major Class 5296 * 5297 * @syscap SystemCapability.Communication.Bluetooth.Core 5298 * @since 9 5299 * @deprecated since 10 5300 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_UNCATEGORIZED 5301 */ 5302 IMAGING_UNCATEGORIZED = 0x0600, 5303 /** 5304 * Imaging display device. 5305 * 5306 * @syscap SystemCapability.Communication.Bluetooth.Core 5307 * @since 9 5308 * @deprecated since 10 5309 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_DISPLAY 5310 */ 5311 IMAGING_DISPLAY = 0x0610, 5312 /** 5313 * Imaging camera device. 5314 * 5315 * @syscap SystemCapability.Communication.Bluetooth.Core 5316 * @since 9 5317 * @deprecated since 10 5318 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_CAMERA 5319 */ 5320 IMAGING_CAMERA = 0x0620, 5321 /** 5322 * Imaging scanner. 5323 * 5324 * @syscap SystemCapability.Communication.Bluetooth.Core 5325 * @since 9 5326 * @deprecated since 10 5327 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_SCANNER 5328 */ 5329 IMAGING_SCANNER = 0x0640, 5330 /** 5331 * Imaging printer. 5332 * 5333 * @syscap SystemCapability.Communication.Bluetooth.Core 5334 * @since 9 5335 * @deprecated since 10 5336 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_PRINTER 5337 */ 5338 IMAGING_PRINTER = 0x0680, 5339 5340 /** 5341 * Wearable Major Class 5342 * 5343 * @syscap SystemCapability.Communication.Bluetooth.Core 5344 * @since 9 5345 * @deprecated since 10 5346 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_UNCATEGORIZED 5347 */ 5348 WEARABLE_UNCATEGORIZED = 0x0700, 5349 /** 5350 * Smart watch. 5351 * 5352 * @syscap SystemCapability.Communication.Bluetooth.Core 5353 * @since 9 5354 * @deprecated since 10 5355 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_WRIST_WATCH 5356 */ 5357 WEARABLE_WRIST_WATCH = 0x0704, 5358 /** 5359 * Wearable pager. 5360 * 5361 * @syscap SystemCapability.Communication.Bluetooth.Core 5362 * @since 9 5363 * @deprecated since 10 5364 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_PAGER 5365 */ 5366 WEARABLE_PAGER = 0x0708, 5367 /** 5368 * Smart jacket. 5369 * 5370 * @syscap SystemCapability.Communication.Bluetooth.Core 5371 * @since 9 5372 * @deprecated since 10 5373 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_JACKET 5374 */ 5375 WEARABLE_JACKET = 0x070C, 5376 /** 5377 * Wearable helmet. 5378 * 5379 * @syscap SystemCapability.Communication.Bluetooth.Core 5380 * @since 9 5381 * @deprecated since 10 5382 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_HELMET 5383 */ 5384 WEARABLE_HELMET = 0x0710, 5385 /** 5386 * Wearable glasses. 5387 * 5388 * @syscap SystemCapability.Communication.Bluetooth.Core 5389 * @since 9 5390 * @deprecated since 10 5391 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_GLASSES 5392 */ 5393 WEARABLE_GLASSES = 0x0714, 5394 5395 /** 5396 * Minor Device Class field - Toy Major Class 5397 * 5398 * @syscap SystemCapability.Communication.Bluetooth.Core 5399 * @since 9 5400 * @deprecated since 10 5401 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_UNCATEGORIZED 5402 */ 5403 TOY_UNCATEGORIZED = 0x0800, 5404 /** 5405 * Toy robot. 5406 * 5407 * @syscap SystemCapability.Communication.Bluetooth.Core 5408 * @since 9 5409 * @deprecated since 10 5410 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_ROBOT 5411 */ 5412 TOY_ROBOT = 0x0804, 5413 /** 5414 * Toy vehicle. 5415 * 5416 * @syscap SystemCapability.Communication.Bluetooth.Core 5417 * @since 9 5418 * @deprecated since 10 5419 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_VEHICLE 5420 */ 5421 TOY_VEHICLE = 0x0808, 5422 /** 5423 * Humanoid toy doll. 5424 * 5425 * @syscap SystemCapability.Communication.Bluetooth.Core 5426 * @since 9 5427 * @deprecated since 10 5428 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_DOLL_ACTION_FIGURE 5429 */ 5430 TOY_DOLL_ACTION_FIGURE = 0x080C, 5431 /** 5432 * Toy controller. 5433 * 5434 * @syscap SystemCapability.Communication.Bluetooth.Core 5435 * @since 9 5436 * @deprecated since 10 5437 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_CONTROLLER 5438 */ 5439 TOY_CONTROLLER = 0x0810, 5440 /** 5441 * Toy gaming device. 5442 * 5443 * @syscap SystemCapability.Communication.Bluetooth.Core 5444 * @since 9 5445 * @deprecated since 10 5446 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_GAME 5447 */ 5448 TOY_GAME = 0x0814, 5449 5450 /** 5451 * Minor Device Class field - Health 5452 * 5453 * @syscap SystemCapability.Communication.Bluetooth.Core 5454 * @since 9 5455 * @deprecated since 10 5456 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_UNCATEGORIZED 5457 */ 5458 HEALTH_UNCATEGORIZED = 0x0900, 5459 /** 5460 * Blood pressure device. 5461 * 5462 * @syscap SystemCapability.Communication.Bluetooth.Core 5463 * @since 9 5464 * @deprecated since 10 5465 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_BLOOD_PRESSURE 5466 */ 5467 HEALTH_BLOOD_PRESSURE = 0x0904, 5468 /** 5469 * Thermometer. 5470 * 5471 * @syscap SystemCapability.Communication.Bluetooth.Core 5472 * @since 9 5473 * @deprecated since 10 5474 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_THERMOMETER 5475 */ 5476 HEALTH_THERMOMETER = 0x0908, 5477 /** 5478 * Body scale. 5479 * 5480 * @syscap SystemCapability.Communication.Bluetooth.Core 5481 * @since 9 5482 * @deprecated since 10 5483 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_WEIGHING 5484 */ 5485 HEALTH_WEIGHING = 0x090C, 5486 /** 5487 * Blood glucose monitor. 5488 * 5489 * @syscap SystemCapability.Communication.Bluetooth.Core 5490 * @since 9 5491 * @deprecated since 10 5492 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_GLUCOSE 5493 */ 5494 HEALTH_GLUCOSE = 0x0910, 5495 /** 5496 * Pulse oximeter. 5497 * 5498 * @syscap SystemCapability.Communication.Bluetooth.Core 5499 * @since 9 5500 * @deprecated since 10 5501 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_PULSE_OXIMETER 5502 */ 5503 HEALTH_PULSE_OXIMETER = 0x0914, 5504 /** 5505 * Heart rate monitor. 5506 * 5507 * @syscap SystemCapability.Communication.Bluetooth.Core 5508 * @since 9 5509 * @deprecated since 10 5510 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_PULSE_RATE 5511 */ 5512 HEALTH_PULSE_RATE = 0x0918, 5513 /** 5514 * Health data display. 5515 * 5516 * @syscap SystemCapability.Communication.Bluetooth.Core 5517 * @since 9 5518 * @deprecated since 10 5519 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_DATA_DISPLAY 5520 */ 5521 HEALTH_DATA_DISPLAY = 0x091C, 5522 /** 5523 * Step counter. 5524 * 5525 * @syscap SystemCapability.Communication.Bluetooth.Core 5526 * @since 9 5527 * @deprecated since 10 5528 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_STEP_COUNTER 5529 */ 5530 HEALTH_STEP_COUNTER = 0x0920, 5531 /** 5532 * Body composition analyzer. 5533 * 5534 * @syscap SystemCapability.Communication.Bluetooth.Core 5535 * @since 9 5536 * @deprecated since 10 5537 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_BODY_COMPOSITION_ANALYZER 5538 */ 5539 HEALTH_BODY_COMPOSITION_ANALYZER = 0x0924, 5540 /** 5541 * Hygrometer. 5542 * 5543 * @syscap SystemCapability.Communication.Bluetooth.Core 5544 * @since 9 5545 * @deprecated since 10 5546 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_PEAK_FLOW_MONITOR 5547 */ 5548 HEALTH_PEAK_FLOW_MONITOR = 0x0928, 5549 /** 5550 * Medication monitor. 5551 * 5552 * @syscap SystemCapability.Communication.Bluetooth.Core 5553 * @since 9 5554 * @deprecated since 10 5555 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_MEDICATION_MONITOR 5556 */ 5557 HEALTH_MEDICATION_MONITOR = 0x092C, 5558 /** 5559 * Prosthetic knee. 5560 * 5561 * @syscap SystemCapability.Communication.Bluetooth.Core 5562 * @since 9 5563 * @deprecated since 10 5564 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_KNEE_PROSTHESIS 5565 */ 5566 HEALTH_KNEE_PROSTHESIS = 0x0930, 5567 /** 5568 * Prosthetic ankle. 5569 * 5570 * @syscap SystemCapability.Communication.Bluetooth.Core 5571 * @since 9 5572 * @deprecated since 10 5573 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_ANKLE_PROSTHESIS 5574 */ 5575 HEALTH_ANKLE_PROSTHESIS = 0x0934, 5576 /** 5577 * Generic health management device. 5578 * 5579 * @syscap SystemCapability.Communication.Bluetooth.Core 5580 * @since 9 5581 * @deprecated since 10 5582 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_GENERIC_HEALTH_MANAGER 5583 */ 5584 HEALTH_GENERIC_HEALTH_MANAGER = 0x0938, 5585 /** 5586 * Personal mobility device. 5587 * 5588 * @syscap SystemCapability.Communication.Bluetooth.Core 5589 * @since 9 5590 * @deprecated since 10 5591 * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_PERSONAL_MOBILITY_DEVICE 5592 */ 5593 HEALTH_PERSONAL_MOBILITY_DEVICE = 0x093C 5594 } 5595 5596 /** 5597 * The enum of a2dp playing state. 5598 * 5599 * @enum { number } 5600 * @syscap SystemCapability.Communication.Bluetooth.Core 5601 * @since 9 5602 * @deprecated since 10 5603 * @useinstead ohos.bluetooth.a2dp/a2dp.PlayingState 5604 */ 5605 enum PlayingState { 5606 /** 5607 * Not playing. 5608 * 5609 * @syscap SystemCapability.Communication.Bluetooth.Core 5610 * @since 9 5611 * @deprecated since 10 5612 * @useinstead ohos.bluetooth.a2dp/a2dp.PlayingState#STATE_NOT_PLAYING 5613 */ 5614 STATE_NOT_PLAYING, 5615 /** 5616 * Playing. 5617 * 5618 * @syscap SystemCapability.Communication.Bluetooth.Core 5619 * @since 9 5620 * @deprecated since 10 5621 * @useinstead ohos.bluetooth.a2dp/a2dp.PlayingState#STATE_PLAYING 5622 */ 5623 STATE_PLAYING 5624 } 5625 5626 /** 5627 * The enum of profile id. 5628 * 5629 * @enum { number } 5630 * @syscap SystemCapability.Communication.Bluetooth.Core 5631 * @since 9 5632 * @deprecated since 10 5633 * @useinstead ohos.bluetooth.constant/constant.ProfileId 5634 */ 5635 enum ProfileId { 5636 /** 5637 * A2DP profile. 5638 * 5639 * @syscap SystemCapability.Communication.Bluetooth.Core 5640 * @since 9 5641 * @deprecated since 10 5642 * @useinstead ohos.bluetooth.constant/constant.ProfileId#PROFILE_A2DP_SOURCE 5643 */ 5644 PROFILE_A2DP_SOURCE = 1, 5645 5646 /** 5647 * HFP profile. 5648 * 5649 * @syscap SystemCapability.Communication.Bluetooth.Core 5650 * @since 9 5651 * @deprecated since 10 5652 * @useinstead ohos.bluetooth.constant/constant.ProfileId#PROFILE_HANDSFREE_AUDIO_GATEWAY 5653 */ 5654 PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4, 5655 5656 /** 5657 * Human Interface Device (HID) profile. 5658 * 5659 * @syscap SystemCapability.Communication.Bluetooth.Core 5660 * @since 9 5661 * @deprecated since 10 5662 * @useinstead ohos.bluetooth.constant/constant.ProfileId#PROFILE_HID_HOST 5663 */ 5664 PROFILE_HID_HOST = 6, 5665 5666 /** 5667 * PAN profile. 5668 * 5669 * @syscap SystemCapability.Communication.Bluetooth.Core 5670 * @since 9 5671 * @deprecated since 10 5672 * @useinstead ohos.bluetooth.constant/constant.ProfileId#PROFILE_PAN_NETWORK 5673 */ 5674 PROFILE_PAN_NETWORK = 7 5675 } 5676} 5677 5678export default bluetoothManager;