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