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 3240 /** 3241 * Describes the Gatt descriptor. 3242 * 3243 * @typedef BLEDescriptor 3244 * @syscap SystemCapability.Communication.Bluetooth.Core 3245 * @since 10 3246 */ 3247 /** 3248 * Describes the Gatt descriptor. 3249 * 3250 * @typedef BLEDescriptor 3251 * @syscap SystemCapability.Communication.Bluetooth.Core 3252 * @atomicservice 3253 * @since 12 3254 */ 3255 /** 3256 * Describes the Gatt descriptor. 3257 * 3258 * @typedef BLEDescriptor 3259 * @syscap SystemCapability.Communication.Bluetooth.Core 3260 * @crossplatform 3261 * @atomicservice 3262 * @since 13 3263 */ 3264 interface BLEDescriptor { 3265 /** 3266 * The UUID of the {@link GattService} instance to which the descriptor belongs 3267 * 3268 * @type { string } 3269 * @syscap SystemCapability.Communication.Bluetooth.Core 3270 * @since 10 3271 */ 3272 /** 3273 * The UUID of the {@link GattService} instance to which the descriptor belongs 3274 * 3275 * @type { string } 3276 * @syscap SystemCapability.Communication.Bluetooth.Core 3277 * @atomicservice 3278 * @since 12 3279 */ 3280 /** 3281 * The UUID of the {@link GattService} instance to which the descriptor belongs 3282 * 3283 * @type { string } 3284 * @syscap SystemCapability.Communication.Bluetooth.Core 3285 * @crossplatform 3286 * @atomicservice 3287 * @since 13 3288 */ 3289 serviceUuid: string; 3290 /** 3291 * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs 3292 * 3293 * @type { string } 3294 * @syscap SystemCapability.Communication.Bluetooth.Core 3295 * @since 10 3296 */ 3297 /** 3298 * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs 3299 * 3300 * @type { string } 3301 * @syscap SystemCapability.Communication.Bluetooth.Core 3302 * @atomicservice 3303 * @since 12 3304 */ 3305 /** 3306 * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs 3307 * 3308 * @type { string } 3309 * @syscap SystemCapability.Communication.Bluetooth.Core 3310 * @crossplatform 3311 * @atomicservice 3312 * @since 13 3313 */ 3314 characteristicUuid: string; 3315 /** 3316 * The UUID of the BLEDescriptor instance 3317 * 3318 * @type { string } 3319 * @syscap SystemCapability.Communication.Bluetooth.Core 3320 * @since 10 3321 */ 3322 /** 3323 * The UUID of the BLEDescriptor instance 3324 * 3325 * @type { string } 3326 * @syscap SystemCapability.Communication.Bluetooth.Core 3327 * @atomicservice 3328 * @since 12 3329 */ 3330 /** 3331 * The UUID of the BLEDescriptor instance 3332 * 3333 * @type { string } 3334 * @syscap SystemCapability.Communication.Bluetooth.Core 3335 * @crossplatform 3336 * @atomicservice 3337 * @since 13 3338 */ 3339 descriptorUuid: string; 3340 /** 3341 * The value of the BLEDescriptor instance 3342 * 3343 * @type { ArrayBuffer } 3344 * @syscap SystemCapability.Communication.Bluetooth.Core 3345 * @since 10 3346 */ 3347 /** 3348 * The value of the BLEDescriptor instance 3349 * 3350 * @type { ArrayBuffer } 3351 * @syscap SystemCapability.Communication.Bluetooth.Core 3352 * @atomicservice 3353 * @since 12 3354 */ 3355 /** 3356 * The value of the BLEDescriptor instance 3357 * 3358 * @type { ArrayBuffer } 3359 * @syscap SystemCapability.Communication.Bluetooth.Core 3360 * @crossplatform 3361 * @atomicservice 3362 * @since 13 3363 */ 3364 descriptorValue: ArrayBuffer; 3365 } 3366 3367 /** 3368 * Describes the value of the indication or notification sent by the Gatt server. 3369 * 3370 * @typedef NotifyCharacteristic 3371 * @syscap SystemCapability.Communication.Bluetooth.Core 3372 * @since 10 3373 */ 3374 /** 3375 * Describes the value of the indication or notification sent by the Gatt server. 3376 * 3377 * @typedef NotifyCharacteristic 3378 * @syscap SystemCapability.Communication.Bluetooth.Core 3379 * @atomicservice 3380 * @since 12 3381 */ 3382 /** 3383 * Describes the value of the indication or notification sent by the Gatt server. 3384 * 3385 * @typedef NotifyCharacteristic 3386 * @syscap SystemCapability.Communication.Bluetooth.Core 3387 * @crossplatform 3388 * @atomicservice 3389 * @since 13 3390 */ 3391 interface NotifyCharacteristic { 3392 /** 3393 * The UUID of the {@link GattService} instance to which the characteristic belongs 3394 * 3395 * @type { string } 3396 * @syscap SystemCapability.Communication.Bluetooth.Core 3397 * @since 10 3398 */ 3399 /** 3400 * The UUID of the {@link GattService} instance to which the characteristic belongs 3401 * 3402 * @type { string } 3403 * @syscap SystemCapability.Communication.Bluetooth.Core 3404 * @atomicservice 3405 * @since 12 3406 */ 3407 /** 3408 * The UUID of the {@link GattService} instance to which the characteristic belongs 3409 * 3410 * @type { string } 3411 * @syscap SystemCapability.Communication.Bluetooth.Core 3412 * @crossplatform 3413 * @atomicservice 3414 * @since 13 3415 */ 3416 serviceUuid: string; 3417 /** 3418 * The UUID of a NotifyCharacteristic instance 3419 * 3420 * @type { string } 3421 * @syscap SystemCapability.Communication.Bluetooth.Core 3422 * @since 10 3423 */ 3424 /** 3425 * The UUID of a NotifyCharacteristic instance 3426 * 3427 * @type { string } 3428 * @syscap SystemCapability.Communication.Bluetooth.Core 3429 * @atomicservice 3430 * @since 12 3431 */ 3432 /** 3433 * The UUID of a NotifyCharacteristic instance 3434 * 3435 * @type { string } 3436 * @syscap SystemCapability.Communication.Bluetooth.Core 3437 * @crossplatform 3438 * @atomicservice 3439 * @since 13 3440 */ 3441 characteristicUuid: string; 3442 /** 3443 * The value of a NotifyCharacteristic instance 3444 * 3445 * @type { ArrayBuffer } 3446 * @syscap SystemCapability.Communication.Bluetooth.Core 3447 * @since 10 3448 */ 3449 /** 3450 * The value of a NotifyCharacteristic instance 3451 * 3452 * @type { ArrayBuffer } 3453 * @syscap SystemCapability.Communication.Bluetooth.Core 3454 * @atomicservice 3455 * @since 12 3456 */ 3457 /** 3458 * The value of a NotifyCharacteristic instance 3459 * 3460 * @type { ArrayBuffer } 3461 * @syscap SystemCapability.Communication.Bluetooth.Core 3462 * @crossplatform 3463 * @atomicservice 3464 * @since 13 3465 */ 3466 characteristicValue: ArrayBuffer; 3467 /** 3468 * Specifies whether to request confirmation from the BLE peripheral device (indication) or 3469 * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. 3470 * 3471 * @type { boolean } 3472 * @syscap SystemCapability.Communication.Bluetooth.Core 3473 * @since 10 3474 */ 3475 /** 3476 * Specifies whether to request confirmation from the BLE peripheral device (indication) or 3477 * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. 3478 * 3479 * @type { boolean } 3480 * @syscap SystemCapability.Communication.Bluetooth.Core 3481 * @atomicservice 3482 * @since 12 3483 */ 3484 confirm: boolean; 3485 } 3486 3487 /** 3488 * Describes the parameters of the Gatt client's characteristic read request. 3489 * 3490 * @typedef CharacteristicReadRequest 3491 * @syscap SystemCapability.Communication.Bluetooth.Core 3492 * @since 10 3493 */ 3494 /** 3495 * Describes the parameters of the Gatt client's characteristic read request. 3496 * 3497 * @typedef CharacteristicReadRequest 3498 * @syscap SystemCapability.Communication.Bluetooth.Core 3499 * @atomicservice 3500 * @since 12 3501 */ 3502 /** 3503 * Describes the parameters of the Gatt client's characteristic read request. 3504 * 3505 * @typedef CharacteristicReadRequest 3506 * @syscap SystemCapability.Communication.Bluetooth.Core 3507 * @crossplatform 3508 * @atomicservice 3509 * @since 13 3510 */ 3511 interface CharacteristicReadRequest { 3512 /** 3513 * Indicates the address of the client that initiates the read request 3514 * 3515 * @type { string } 3516 * @syscap SystemCapability.Communication.Bluetooth.Core 3517 * @since 10 3518 */ 3519 /** 3520 * Indicates the address of the client that initiates the read request 3521 * 3522 * @type { string } 3523 * @syscap SystemCapability.Communication.Bluetooth.Core 3524 * @atomicservice 3525 * @since 12 3526 */ 3527 /** 3528 * Indicates the address of the client that initiates the read request 3529 * 3530 * @type { string } 3531 * @syscap SystemCapability.Communication.Bluetooth.Core 3532 * @crossplatform 3533 * @atomicservice 3534 * @since 13 3535 */ 3536 deviceId: string; 3537 /** 3538 * The Id of the read request 3539 * 3540 * @type { number } 3541 * @syscap SystemCapability.Communication.Bluetooth.Core 3542 * @since 10 3543 */ 3544 /** 3545 * The Id of the read request 3546 * 3547 * @type { number } 3548 * @syscap SystemCapability.Communication.Bluetooth.Core 3549 * @atomicservice 3550 * @since 12 3551 */ 3552 /** 3553 * The Id of the read request 3554 * 3555 * @type { number } 3556 * @syscap SystemCapability.Communication.Bluetooth.Core 3557 * @crossplatform 3558 * @atomicservice 3559 * @since 13 3560 */ 3561 transId: number; 3562 /** 3563 * Indicates the byte offset of the start position for reading characteristic value 3564 * 3565 * @type { number } 3566 * @syscap SystemCapability.Communication.Bluetooth.Core 3567 * @since 10 3568 */ 3569 /** 3570 * Indicates the byte offset of the start position for reading characteristic value 3571 * 3572 * @type { number } 3573 * @syscap SystemCapability.Communication.Bluetooth.Core 3574 * @atomicservice 3575 * @since 12 3576 */ 3577 offset: number; 3578 /** 3579 * The UUID of a CharacteristicReadRequest instance 3580 * 3581 * @type { string } 3582 * @syscap SystemCapability.Communication.Bluetooth.Core 3583 * @since 10 3584 */ 3585 /** 3586 * The UUID of a CharacteristicReadRequest instance 3587 * 3588 * @type { string } 3589 * @syscap SystemCapability.Communication.Bluetooth.Core 3590 * @atomicservice 3591 * @since 12 3592 */ 3593 /** 3594 * The UUID of a CharacteristicReadRequest instance 3595 * 3596 * @type { string } 3597 * @syscap SystemCapability.Communication.Bluetooth.Core 3598 * @crossplatform 3599 * @atomicservice 3600 * @since 13 3601 */ 3602 characteristicUuid: string; 3603 /** 3604 * The UUID of the service to which the characteristic belongs 3605 * 3606 * @type { string } 3607 * @syscap SystemCapability.Communication.Bluetooth.Core 3608 * @since 10 3609 */ 3610 /** 3611 * The UUID of the service to which the characteristic belongs 3612 * 3613 * @type { string } 3614 * @syscap SystemCapability.Communication.Bluetooth.Core 3615 * @atomicservice 3616 * @since 12 3617 */ 3618 /** 3619 * The UUID of the service to which the characteristic belongs 3620 * 3621 * @type { string } 3622 * @syscap SystemCapability.Communication.Bluetooth.Core 3623 * @crossplatform 3624 * @atomicservice 3625 * @since 13 3626 */ 3627 serviceUuid: string; 3628 } 3629 3630 /** 3631 * Describes the parameters of the of the Gatt client's characteristic write request. 3632 * 3633 * @typedef CharacteristicWriteRequest 3634 * @syscap SystemCapability.Communication.Bluetooth.Core 3635 * @since 10 3636 */ 3637 /** 3638 * Describes the parameters of the of the Gatt client's characteristic write request. 3639 * 3640 * @typedef CharacteristicWriteRequest 3641 * @syscap SystemCapability.Communication.Bluetooth.Core 3642 * @atomicservice 3643 * @since 12 3644 */ 3645 /** 3646 * Describes the parameters of the of the Gatt client's characteristic write request. 3647 * 3648 * @typedef CharacteristicWriteRequest 3649 * @syscap SystemCapability.Communication.Bluetooth.Core 3650 * @crossplatform 3651 * @atomicservice 3652 * @since 13 3653 */ 3654 interface CharacteristicWriteRequest { 3655 /** 3656 * Indicates the address of the client that initiates the write request 3657 * 3658 * @type { string } 3659 * @syscap SystemCapability.Communication.Bluetooth.Core 3660 * @since 10 3661 */ 3662 /** 3663 * Indicates the address of the client that initiates the write request 3664 * 3665 * @type { string } 3666 * @syscap SystemCapability.Communication.Bluetooth.Core 3667 * @atomicservice 3668 * @since 12 3669 */ 3670 /** 3671 * Indicates the address of the client that initiates the write request 3672 * 3673 * @type { string } 3674 * @syscap SystemCapability.Communication.Bluetooth.Core 3675 * @crossplatform 3676 * @atomicservice 3677 * @since 13 3678 */ 3679 deviceId: string; 3680 /** 3681 * The Id of the write request 3682 * 3683 * @type { number } 3684 * @syscap SystemCapability.Communication.Bluetooth.Core 3685 * @since 10 3686 */ 3687 /** 3688 * The Id of the write request 3689 * 3690 * @type { number } 3691 * @syscap SystemCapability.Communication.Bluetooth.Core 3692 * @atomicservice 3693 * @since 12 3694 */ 3695 /** 3696 * The Id of the write request 3697 * 3698 * @type { number } 3699 * @syscap SystemCapability.Communication.Bluetooth.Core 3700 * @crossplatform 3701 * @atomicservice 3702 * @since 13 3703 */ 3704 transId: number; 3705 /** 3706 * Indicates the byte offset of the start position for writing characteristic value 3707 * 3708 * @type { number } 3709 * @syscap SystemCapability.Communication.Bluetooth.Core 3710 * @since 10 3711 */ 3712 /** 3713 * Indicates the byte offset of the start position for writing characteristic value 3714 * 3715 * @type { number } 3716 * @syscap SystemCapability.Communication.Bluetooth.Core 3717 * @atomicservice 3718 * @since 12 3719 */ 3720 offset: number; 3721 /** 3722 * Whether this request should be pending for later operation 3723 * 3724 * @type { boolean } 3725 * @syscap SystemCapability.Communication.Bluetooth.Core 3726 * @since 10 3727 */ 3728 /** 3729 * Whether this request should be pending for later operation 3730 * 3731 * @type { boolean } 3732 * @syscap SystemCapability.Communication.Bluetooth.Core 3733 * @atomicservice 3734 * @since 12 3735 */ 3736 isPrepared: boolean; 3737 /** 3738 * Whether the remote client need a response 3739 * 3740 * @type { boolean } 3741 * @syscap SystemCapability.Communication.Bluetooth.Core 3742 * @since 10 3743 */ 3744 /** 3745 * Whether the remote client need a response 3746 * 3747 * @type { boolean } 3748 * @syscap SystemCapability.Communication.Bluetooth.Core 3749 * @atomicservice 3750 * @since 12 3751 */ 3752 needRsp: boolean; 3753 /** 3754 * Indicates the value to be written 3755 * 3756 * @type { ArrayBuffer } 3757 * @syscap SystemCapability.Communication.Bluetooth.Core 3758 * @since 10 3759 */ 3760 /** 3761 * Indicates the value to be written 3762 * 3763 * @type { ArrayBuffer } 3764 * @syscap SystemCapability.Communication.Bluetooth.Core 3765 * @atomicservice 3766 * @since 12 3767 */ 3768 /** 3769 * Indicates the value to be written 3770 * 3771 * @type { ArrayBuffer } 3772 * @syscap SystemCapability.Communication.Bluetooth.Core 3773 * @crossplatform 3774 * @atomicservice 3775 * @since 13 3776 */ 3777 value: ArrayBuffer; 3778 /** 3779 * The UUID of a CharacteristicWriteRequest instance 3780 * 3781 * @type { string } 3782 * @syscap SystemCapability.Communication.Bluetooth.Core 3783 * @since 10 3784 */ 3785 /** 3786 * The UUID of a CharacteristicWriteRequest instance 3787 * 3788 * @type { string } 3789 * @syscap SystemCapability.Communication.Bluetooth.Core 3790 * @atomicservice 3791 * @since 12 3792 */ 3793 /** 3794 * The UUID of a CharacteristicWriteRequest instance 3795 * 3796 * @type { string } 3797 * @syscap SystemCapability.Communication.Bluetooth.Core 3798 * @crossplatform 3799 * @atomicservice 3800 * @since 13 3801 */ 3802 characteristicUuid: string; 3803 /** 3804 * The UUID of the service to which the characteristic belongs 3805 * 3806 * @type { string } 3807 * @syscap SystemCapability.Communication.Bluetooth.Core 3808 * @since 10 3809 */ 3810 /** 3811 * The UUID of the service to which the characteristic belongs 3812 * 3813 * @type { string } 3814 * @syscap SystemCapability.Communication.Bluetooth.Core 3815 * @atomicservice 3816 * @since 12 3817 */ 3818 /** 3819 * The UUID of the service to which the characteristic belongs 3820 * 3821 * @type { string } 3822 * @syscap SystemCapability.Communication.Bluetooth.Core 3823 * @crossplatform 3824 * @atomicservice 3825 * @since 13 3826 */ 3827 serviceUuid: string; 3828 } 3829 3830 /** 3831 * Describes the parameters of the Gatt client's descriptor read request. 3832 * 3833 * @typedef DescriptorReadRequest 3834 * @syscap SystemCapability.Communication.Bluetooth.Core 3835 * @since 10 3836 */ 3837 /** 3838 * Describes the parameters of the Gatt client's descriptor read request. 3839 * 3840 * @typedef DescriptorReadRequest 3841 * @syscap SystemCapability.Communication.Bluetooth.Core 3842 * @atomicservice 3843 * @since 12 3844 */ 3845 /** 3846 * Describes the parameters of the Gatt client's descriptor read request. 3847 * 3848 * @typedef DescriptorReadRequest 3849 * @syscap SystemCapability.Communication.Bluetooth.Core 3850 * @crossplatform 3851 * @atomicservice 3852 * @since 13 3853 */ 3854 interface DescriptorReadRequest { 3855 /** 3856 * Indicates the address of the client that initiates the read request 3857 * 3858 * @type { string } 3859 * @syscap SystemCapability.Communication.Bluetooth.Core 3860 * @since 10 3861 */ 3862 /** 3863 * Indicates the address of the client that initiates the read request 3864 * 3865 * @type { string } 3866 * @syscap SystemCapability.Communication.Bluetooth.Core 3867 * @atomicservice 3868 * @since 12 3869 */ 3870 /** 3871 * Indicates the address of the client that initiates the read request 3872 * 3873 * @type { string } 3874 * @syscap SystemCapability.Communication.Bluetooth.Core 3875 * @crossplatform 3876 * @atomicservice 3877 * @since 13 3878 */ 3879 deviceId: string; 3880 /** 3881 * The Id of the read request 3882 * 3883 * @type { number } 3884 * @syscap SystemCapability.Communication.Bluetooth.Core 3885 * @since 10 3886 */ 3887 /** 3888 * The Id of the read request 3889 * 3890 * @type { number } 3891 * @syscap SystemCapability.Communication.Bluetooth.Core 3892 * @atomicservice 3893 * @since 12 3894 */ 3895 /** 3896 * The Id of the read request 3897 * 3898 * @type { number } 3899 * @syscap SystemCapability.Communication.Bluetooth.Core 3900 * @crossplatform 3901 * @atomicservice 3902 * @since 13 3903 */ 3904 transId: number; 3905 /** 3906 * Indicates the byte offset of the start position for reading characteristic value 3907 * 3908 * @type { number } 3909 * @syscap SystemCapability.Communication.Bluetooth.Core 3910 * @since 10 3911 */ 3912 /** 3913 * Indicates the byte offset of the start position for reading characteristic value 3914 * 3915 * @type { number } 3916 * @syscap SystemCapability.Communication.Bluetooth.Core 3917 * @atomicservice 3918 * @since 12 3919 */ 3920 offset: number; 3921 /** 3922 * The UUID of a DescriptorReadRequest instance 3923 * 3924 * @type { string } 3925 * @syscap SystemCapability.Communication.Bluetooth.Core 3926 * @since 10 3927 */ 3928 /** 3929 * The UUID of a DescriptorReadRequest instance 3930 * 3931 * @type { string } 3932 * @syscap SystemCapability.Communication.Bluetooth.Core 3933 * @atomicservice 3934 * @since 12 3935 */ 3936 /** 3937 * The UUID of a DescriptorReadRequest instance 3938 * 3939 * @type { string } 3940 * @syscap SystemCapability.Communication.Bluetooth.Core 3941 * @crossplatform 3942 * @atomicservice 3943 * @since 13 3944 */ 3945 descriptorUuid: string; 3946 /** 3947 * The UUID of the characteristic to which the descriptor belongs 3948 * 3949 * @type { string } 3950 * @syscap SystemCapability.Communication.Bluetooth.Core 3951 * @since 10 3952 */ 3953 /** 3954 * The UUID of the characteristic to which the descriptor belongs 3955 * 3956 * @type { string } 3957 * @syscap SystemCapability.Communication.Bluetooth.Core 3958 * @atomicservice 3959 * @since 12 3960 */ 3961 /** 3962 * The UUID of the characteristic to which the descriptor belongs 3963 * 3964 * @type { string } 3965 * @syscap SystemCapability.Communication.Bluetooth.Core 3966 * @crossplatform 3967 * @atomicservice 3968 * @since 13 3969 */ 3970 characteristicUuid: string; 3971 /** 3972 * The UUID of the service to which the descriptor belongs 3973 * 3974 * @type { string } 3975 * @syscap SystemCapability.Communication.Bluetooth.Core 3976 * @since 10 3977 */ 3978 /** 3979 * The UUID of the service to which the descriptor belongs 3980 * 3981 * @type { string } 3982 * @syscap SystemCapability.Communication.Bluetooth.Core 3983 * @atomicservice 3984 * @since 12 3985 */ 3986 /** 3987 * The UUID of the service to which the descriptor belongs 3988 * 3989 * @type { string } 3990 * @syscap SystemCapability.Communication.Bluetooth.Core 3991 * @crossplatform 3992 * @atomicservice 3993 * @since 13 3994 */ 3995 serviceUuid: string; 3996 } 3997 3998 /** 3999 * Describes the parameters of the Gatt client's characteristic write request. 4000 * 4001 * @typedef DescriptorWriteRequest 4002 * @syscap SystemCapability.Communication.Bluetooth.Core 4003 * @since 10 4004 */ 4005 /** 4006 * Describes the parameters of the Gatt client's characteristic write request. 4007 * 4008 * @typedef DescriptorWriteRequest 4009 * @syscap SystemCapability.Communication.Bluetooth.Core 4010 * @atomicservice 4011 * @since 12 4012 */ 4013 /** 4014 * Describes the parameters of the Gatt client's characteristic write request. 4015 * 4016 * @typedef DescriptorWriteRequest 4017 * @syscap SystemCapability.Communication.Bluetooth.Core 4018 * @crossplatform 4019 * @atomicservice 4020 * @since 13 4021 */ 4022 interface DescriptorWriteRequest { 4023 /** 4024 * Indicates the address of the client that initiates the write request 4025 * 4026 * @type { string } 4027 * @syscap SystemCapability.Communication.Bluetooth.Core 4028 * @since 10 4029 */ 4030 /** 4031 * Indicates the address of the client that initiates the write request 4032 * 4033 * @type { string } 4034 * @syscap SystemCapability.Communication.Bluetooth.Core 4035 * @atomicservice 4036 * @since 12 4037 */ 4038 /** 4039 * Indicates the address of the client that initiates the write request 4040 * 4041 * @type { string } 4042 * @syscap SystemCapability.Communication.Bluetooth.Core 4043 * @crossplatform 4044 * @atomicservice 4045 * @since 13 4046 */ 4047 deviceId: string; 4048 /** 4049 * The Id of the write request 4050 * 4051 * @type { number } 4052 * @syscap SystemCapability.Communication.Bluetooth.Core 4053 * @since 10 4054 */ 4055 /** 4056 * The Id of the write request 4057 * 4058 * @type { number } 4059 * @syscap SystemCapability.Communication.Bluetooth.Core 4060 * @atomicservice 4061 * @since 12 4062 */ 4063 /** 4064 * The Id of the write request 4065 * 4066 * @type { number } 4067 * @syscap SystemCapability.Communication.Bluetooth.Core 4068 * @crossplatform 4069 * @atomicservice 4070 * @since 13 4071 */ 4072 transId: number; 4073 /** 4074 * Indicates the byte offset of the start position for writing characteristic value 4075 * 4076 * @type { number } 4077 * @syscap SystemCapability.Communication.Bluetooth.Core 4078 * @since 10 4079 */ 4080 /** 4081 * Indicates the byte offset of the start position for writing characteristic value 4082 * 4083 * @type { number } 4084 * @syscap SystemCapability.Communication.Bluetooth.Core 4085 * @atomicservice 4086 * @since 12 4087 */ 4088 offset: number; 4089 /** 4090 * Whether this request should be pending for later operation 4091 * 4092 * @type { boolean } 4093 * @syscap SystemCapability.Communication.Bluetooth.Core 4094 * @since 10 4095 */ 4096 /** 4097 * Whether this request should be pending for later operation 4098 * 4099 * @type { boolean } 4100 * @syscap SystemCapability.Communication.Bluetooth.Core 4101 * @atomicservice 4102 * @since 12 4103 */ 4104 isPrepared: boolean; 4105 /** 4106 * Whether the remote client need a response 4107 * 4108 * @type { boolean } 4109 * @syscap SystemCapability.Communication.Bluetooth.Core 4110 * @since 10 4111 */ 4112 /** 4113 * Whether the remote client need a response 4114 * 4115 * @type { boolean } 4116 * @syscap SystemCapability.Communication.Bluetooth.Core 4117 * @atomicservice 4118 * @since 12 4119 */ 4120 needRsp: boolean; 4121 /** 4122 * Indicates the value to be written 4123 * 4124 * @type { ArrayBuffer } 4125 * @syscap SystemCapability.Communication.Bluetooth.Core 4126 * @since 10 4127 */ 4128 /** 4129 * Indicates the value to be written 4130 * 4131 * @type { ArrayBuffer } 4132 * @syscap SystemCapability.Communication.Bluetooth.Core 4133 * @atomicservice 4134 * @since 12 4135 */ 4136 /** 4137 * Indicates the value to be written 4138 * 4139 * @type { ArrayBuffer } 4140 * @syscap SystemCapability.Communication.Bluetooth.Core 4141 * @crossplatform 4142 * @atomicservice 4143 * @since 13 4144 */ 4145 value: ArrayBuffer; 4146 /** 4147 * The UUID of a DescriptorWriteRequest instance 4148 * 4149 * @type { string } 4150 * @syscap SystemCapability.Communication.Bluetooth.Core 4151 * @since 10 4152 */ 4153 /** 4154 * The UUID of a DescriptorWriteRequest instance 4155 * 4156 * @type { string } 4157 * @syscap SystemCapability.Communication.Bluetooth.Core 4158 * @atomicservice 4159 * @since 12 4160 */ 4161 /** 4162 * The UUID of a DescriptorWriteRequest instance 4163 * 4164 * @type { string } 4165 * @syscap SystemCapability.Communication.Bluetooth.Core 4166 * @crossplatform 4167 * @atomicservice 4168 * @since 13 4169 */ 4170 descriptorUuid: string; 4171 /** 4172 * The UUID of the characteristic to which the descriptor belongs 4173 * 4174 * @type { string } 4175 * @syscap SystemCapability.Communication.Bluetooth.Core 4176 * @since 10 4177 */ 4178 /** 4179 * The UUID of the characteristic to which the descriptor belongs 4180 * 4181 * @type { string } 4182 * @syscap SystemCapability.Communication.Bluetooth.Core 4183 * @atomicservice 4184 * @since 12 4185 */ 4186 /** 4187 * The UUID of the characteristic to which the descriptor belongs 4188 * 4189 * @type { string } 4190 * @syscap SystemCapability.Communication.Bluetooth.Core 4191 * @crossplatform 4192 * @atomicservice 4193 * @since 13 4194 */ 4195 characteristicUuid: string; 4196 /** 4197 * The UUID of the service to which the descriptor belongs 4198 * 4199 * @type { string } 4200 * @syscap SystemCapability.Communication.Bluetooth.Core 4201 * @since 10 4202 */ 4203 /** 4204 * The UUID of the service to which the descriptor belongs 4205 * 4206 * @type { string } 4207 * @syscap SystemCapability.Communication.Bluetooth.Core 4208 * @atomicservice 4209 * @since 12 4210 */ 4211 /** 4212 * The UUID of the service to which the descriptor belongs 4213 * 4214 * @type { string } 4215 * @syscap SystemCapability.Communication.Bluetooth.Core 4216 * @crossplatform 4217 * @atomicservice 4218 * @since 13 4219 */ 4220 serviceUuid: string; 4221 } 4222 4223 /** 4224 * Describes the parameters of a response send by the server to a specified read or write request. 4225 * 4226 * @typedef ServerResponse 4227 * @syscap SystemCapability.Communication.Bluetooth.Core 4228 * @since 10 4229 */ 4230 /** 4231 * Describes the parameters of a response send by the server to a specified read or write request. 4232 * 4233 * @typedef ServerResponse 4234 * @syscap SystemCapability.Communication.Bluetooth.Core 4235 * @atomicservice 4236 * @since 12 4237 */ 4238 /** 4239 * Describes the parameters of a response send by the server to a specified read or write request. 4240 * 4241 * @typedef ServerResponse 4242 * @syscap SystemCapability.Communication.Bluetooth.Core 4243 * @crossplatform 4244 * @atomicservice 4245 * @since 13 4246 */ 4247 interface ServerResponse { 4248 /** 4249 * Indicates the address of the client to which to send the response 4250 * 4251 * @type { string } 4252 * @syscap SystemCapability.Communication.Bluetooth.Core 4253 * @since 10 4254 */ 4255 /** 4256 * Indicates the address of the client to which to send the response 4257 * 4258 * @type { string } 4259 * @syscap SystemCapability.Communication.Bluetooth.Core 4260 * @atomicservice 4261 * @since 12 4262 */ 4263 /** 4264 * Indicates the address of the client to which to send the response 4265 * 4266 * @type { string } 4267 * @syscap SystemCapability.Communication.Bluetooth.Core 4268 * @crossplatform 4269 * @atomicservice 4270 * @since 13 4271 */ 4272 deviceId: string; 4273 /** 4274 * The Id of the write request 4275 * 4276 * @type { number } 4277 * @syscap SystemCapability.Communication.Bluetooth.Core 4278 * @since 10 4279 */ 4280 /** 4281 * The Id of the write request 4282 * 4283 * @type { number } 4284 * @syscap SystemCapability.Communication.Bluetooth.Core 4285 * @atomicservice 4286 * @since 12 4287 */ 4288 /** 4289 * The Id of the write request 4290 * 4291 * @type { number } 4292 * @syscap SystemCapability.Communication.Bluetooth.Core 4293 * @crossplatform 4294 * @atomicservice 4295 * @since 13 4296 */ 4297 transId: number; 4298 /** 4299 * Indicates the status of the read or write request, set this parameter to '0' in normal cases 4300 * 4301 * @type { number } 4302 * @syscap SystemCapability.Communication.Bluetooth.Core 4303 * @since 10 4304 */ 4305 /** 4306 * Indicates the status of the read or write request, set this parameter to '0' in normal cases 4307 * 4308 * @type { number } 4309 * @syscap SystemCapability.Communication.Bluetooth.Core 4310 * @atomicservice 4311 * @since 12 4312 */ 4313 /** 4314 * Indicates the status of the read or write request, set this parameter to '0' in normal cases 4315 * 4316 * @type { number } 4317 * @syscap SystemCapability.Communication.Bluetooth.Core 4318 * @crossplatform 4319 * @atomicservice 4320 * @since 13 4321 */ 4322 status: number; 4323 /** 4324 * Indicates the byte offset of the start position for reading or writing operation 4325 * 4326 * @type { number } 4327 * @syscap SystemCapability.Communication.Bluetooth.Core 4328 * @since 10 4329 */ 4330 /** 4331 * Indicates the byte offset of the start position for reading or writing operation 4332 * 4333 * @type { number } 4334 * @syscap SystemCapability.Communication.Bluetooth.Core 4335 * @atomicservice 4336 * @since 12 4337 */ 4338 offset: number; 4339 /** 4340 * Indicates the value to be sent 4341 * 4342 * @type { ArrayBuffer } 4343 * @syscap SystemCapability.Communication.Bluetooth.Core 4344 * @since 10 4345 */ 4346 /** 4347 * Indicates the value to be sent 4348 * 4349 * @type { ArrayBuffer } 4350 * @syscap SystemCapability.Communication.Bluetooth.Core 4351 * @atomicservice 4352 * @since 12 4353 */ 4354 /** 4355 * Indicates the value to be sent 4356 * 4357 * @type { ArrayBuffer } 4358 * @syscap SystemCapability.Communication.Bluetooth.Core 4359 * @crossplatform 4360 * @atomicservice 4361 * @since 13 4362 */ 4363 value: ArrayBuffer; 4364 } 4365 4366 /** 4367 * Describes the Gatt profile connection state. 4368 * 4369 * @typedef BLEConnectionChangeState 4370 * @syscap SystemCapability.Communication.Bluetooth.Core 4371 * @since 10 4372 */ 4373 /** 4374 * Describes the Gatt profile connection state. 4375 * 4376 * @typedef BLEConnectionChangeState 4377 * @syscap SystemCapability.Communication.Bluetooth.Core 4378 * @atomicservice 4379 * @since 12 4380 */ 4381 /** 4382 * Describes the Gatt profile connection state. 4383 * 4384 * @typedef BLEConnectionChangeState 4385 * @syscap SystemCapability.Communication.Bluetooth.Core 4386 * @crossplatform 4387 * @atomicservice 4388 * @since 13 4389 */ 4390 interface BLEConnectionChangeState { 4391 /** 4392 * Indicates the peer device address 4393 * 4394 * @type { string } 4395 * @syscap SystemCapability.Communication.Bluetooth.Core 4396 * @since 10 4397 */ 4398 /** 4399 * Indicates the peer device address 4400 * 4401 * @type { string } 4402 * @syscap SystemCapability.Communication.Bluetooth.Core 4403 * @atomicservice 4404 * @since 12 4405 */ 4406 /** 4407 * Indicates the peer device address 4408 * 4409 * @type { string } 4410 * @syscap SystemCapability.Communication.Bluetooth.Core 4411 * @crossplatform 4412 * @atomicservice 4413 * @since 13 4414 */ 4415 deviceId: string; 4416 /** 4417 * Connection state of the Gatt profile 4418 * 4419 * @type { ProfileConnectionState } 4420 * @syscap SystemCapability.Communication.Bluetooth.Core 4421 * @since 10 4422 */ 4423 /** 4424 * Connection state of the Gatt profile 4425 * 4426 * @type { ProfileConnectionState } 4427 * @syscap SystemCapability.Communication.Bluetooth.Core 4428 * @atomicservice 4429 * @since 12 4430 */ 4431 /** 4432 * Connection state of the Gatt profile 4433 * 4434 * @type { ProfileConnectionState } 4435 * @syscap SystemCapability.Communication.Bluetooth.Core 4436 * @crossplatform 4437 * @atomicservice 4438 * @since 13 4439 */ 4440 state: ProfileConnectionState; 4441 } 4442 4443 /** 4444 * Describes the contents of the scan results. 4445 * 4446 * @typedef ScanResult 4447 * @syscap SystemCapability.Communication.Bluetooth.Core 4448 * @since 10 4449 */ 4450 /** 4451 * Describes the contents of the scan results. 4452 * 4453 * @typedef ScanResult 4454 * @syscap SystemCapability.Communication.Bluetooth.Core 4455 * @atomicservice 4456 * @since 12 4457 */ 4458 /** 4459 * Describes the contents of the scan results. 4460 * 4461 * @typedef ScanResult 4462 * @syscap SystemCapability.Communication.Bluetooth.Core 4463 * @crossplatform 4464 * @atomicservice 4465 * @since 13 4466 */ 4467 interface ScanResult { 4468 /** 4469 * Address of the scanned device 4470 * 4471 * @type { string } 4472 * @syscap SystemCapability.Communication.Bluetooth.Core 4473 * @since 10 4474 */ 4475 /** 4476 * Address of the scanned device 4477 * 4478 * @type { string } 4479 * @syscap SystemCapability.Communication.Bluetooth.Core 4480 * @atomicservice 4481 * @since 12 4482 */ 4483 /** 4484 * Address of the scanned device 4485 * 4486 * @type { string } 4487 * @syscap SystemCapability.Communication.Bluetooth.Core 4488 * @crossplatform 4489 * @atomicservice 4490 * @since 13 4491 */ 4492 deviceId: string; 4493 /** 4494 * RSSI of the remote device 4495 * 4496 * @type { number } 4497 * @syscap SystemCapability.Communication.Bluetooth.Core 4498 * @since 10 4499 */ 4500 /** 4501 * RSSI of the remote device 4502 * 4503 * @type { number } 4504 * @syscap SystemCapability.Communication.Bluetooth.Core 4505 * @atomicservice 4506 * @since 12 4507 */ 4508 /** 4509 * RSSI of the remote device 4510 * 4511 * @type { number } 4512 * @syscap SystemCapability.Communication.Bluetooth.Core 4513 * @crossplatform 4514 * @atomicservice 4515 * @since 13 4516 */ 4517 rssi: number; 4518 /** 4519 * The raw data of broadcast packet 4520 * 4521 * @type { ArrayBuffer } 4522 * @syscap SystemCapability.Communication.Bluetooth.Core 4523 * @since 10 4524 */ 4525 /** 4526 * The raw data of broadcast packet 4527 * 4528 * @type { ArrayBuffer } 4529 * @syscap SystemCapability.Communication.Bluetooth.Core 4530 * @atomicservice 4531 * @since 12 4532 */ 4533 /** 4534 * The raw data of broadcast packet 4535 * 4536 * @type { ArrayBuffer } 4537 * @syscap SystemCapability.Communication.Bluetooth.Core 4538 * @crossplatform 4539 * @atomicservice 4540 * @since 13 4541 */ 4542 data: ArrayBuffer; 4543 /** 4544 * The local name of the BLE device 4545 * 4546 * @type { string } 4547 * @syscap SystemCapability.Communication.Bluetooth.Core 4548 * @since 10 4549 */ 4550 /** 4551 * The local name of the BLE device 4552 * 4553 * @type { string } 4554 * @syscap SystemCapability.Communication.Bluetooth.Core 4555 * @atomicservice 4556 * @since 12 4557 */ 4558 /** 4559 * The local name of the BLE device 4560 * 4561 * @type { string } 4562 * @syscap SystemCapability.Communication.Bluetooth.Core 4563 * @crossplatform 4564 * @atomicservice 4565 * @since 13 4566 */ 4567 deviceName: string; 4568 /** 4569 * Connectable of the remote device 4570 * 4571 * @type { boolean } 4572 * @syscap SystemCapability.Communication.Bluetooth.Core 4573 * @since 10 4574 */ 4575 /** 4576 * Connectable of the remote device 4577 * 4578 * @type { boolean } 4579 * @syscap SystemCapability.Communication.Bluetooth.Core 4580 * @atomicservice 4581 * @since 12 4582 */ 4583 /** 4584 * Connectable of the remote device 4585 * 4586 * @type { boolean } 4587 * @syscap SystemCapability.Communication.Bluetooth.Core 4588 * @crossplatform 4589 * @atomicservice 4590 * @since 13 4591 */ 4592 connectable: boolean; 4593 } 4594 4595 /** 4596 * Describes the contents of the scan report. 4597 * 4598 * @typedef ScanReport 4599 * @syscap SystemCapability.Communication.Bluetooth.Core 4600 * @crossplatform 4601 * @atomicservice 4602 * @since 15 4603 */ 4604 interface ScanReport { 4605 /** 4606 * The type of scan report 4607 * 4608 * @type { ScanReportType } 4609 * @syscap SystemCapability.Communication.Bluetooth.Core 4610 * @crossplatform 4611 * @atomicservice 4612 * @since 15 4613 */ 4614 reportType: ScanReportType; 4615 /** 4616 * Describes the contents of the scan results. 4617 * 4618 * @type { Array<ScanResult> } 4619 * @syscap SystemCapability.Communication.Bluetooth.Core 4620 * @crossplatform 4621 * @atomicservice 4622 * @since 15 4623 */ 4624 scanResult: Array<ScanResult>; 4625 } 4626 4627 /** 4628 * Describes the settings for BLE advertising. 4629 * 4630 * @typedef AdvertiseSetting 4631 * @syscap SystemCapability.Communication.Bluetooth.Core 4632 * @since 10 4633 */ 4634 /** 4635 * Describes the settings for BLE advertising. 4636 * 4637 * @typedef AdvertiseSetting 4638 * @syscap SystemCapability.Communication.Bluetooth.Core 4639 * @atomicservice 4640 * @since 12 4641 */ 4642 /** 4643 * Describes the settings for BLE advertising. 4644 * 4645 * @typedef AdvertiseSetting 4646 * @syscap SystemCapability.Communication.Bluetooth.Core 4647 * @crossplatform 4648 * @atomicservice 4649 * @since 13 4650 */ 4651 interface AdvertiseSetting { 4652 /** 4653 * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) 4654 * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) 4655 * Default slot value for the advertising interval, which is {@code 1600} (1s) 4656 * 4657 * @type { ?number } 4658 * @syscap SystemCapability.Communication.Bluetooth.Core 4659 * @since 10 4660 */ 4661 /** 4662 * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) 4663 * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) 4664 * Default slot value for the advertising interval, which is {@code 1600} (1s) 4665 * 4666 * @type { ?number } 4667 * @syscap SystemCapability.Communication.Bluetooth.Core 4668 * @atomicservice 4669 * @since 12 4670 */ 4671 interval?: number; 4672 /** 4673 * Minimum transmission power level for advertising, which is {@code -127} 4674 * Maximum transmission power level for advertising, which is {@code 1} 4675 * Default transmission power level for advertising, which is {@code -7} 4676 * 4677 * @type { ?number } 4678 * @syscap SystemCapability.Communication.Bluetooth.Core 4679 * @since 10 4680 */ 4681 /** 4682 * Minimum transmission power level for advertising, which is {@code -127} 4683 * Maximum transmission power level for advertising, which is {@code 1} 4684 * Default transmission power level for advertising, which is {@code -7} 4685 * 4686 * @type { ?number } 4687 * @syscap SystemCapability.Communication.Bluetooth.Core 4688 * @atomicservice 4689 * @since 12 4690 */ 4691 txPower?: number; 4692 /** 4693 * Indicates whether the BLE is connectable, default is {@code true} 4694 * 4695 * @type { ?boolean } 4696 * @syscap SystemCapability.Communication.Bluetooth.Core 4697 * @since 10 4698 */ 4699 /** 4700 * Indicates whether the BLE is connectable, default is {@code true} 4701 * 4702 * @type { ?boolean } 4703 * @syscap SystemCapability.Communication.Bluetooth.Core 4704 * @atomicservice 4705 * @since 12 4706 */ 4707 /** 4708 * Indicates whether the BLE is connectable, default is {@code true} 4709 * 4710 * @type { ?boolean } 4711 * @syscap SystemCapability.Communication.Bluetooth.Core 4712 * @crossplatform 4713 * @atomicservice 4714 * @since 13 4715 */ 4716 connectable?: boolean; 4717 } 4718 4719 /** 4720 * Describes the advertising data. 4721 * 4722 * @typedef AdvertiseData 4723 * @syscap SystemCapability.Communication.Bluetooth.Core 4724 * @since 10 4725 */ 4726 /** 4727 * Describes the advertising data. 4728 * 4729 * @typedef AdvertiseData 4730 * @syscap SystemCapability.Communication.Bluetooth.Core 4731 * @atomicservice 4732 * @since 12 4733 */ 4734 /** 4735 * Describes the advertising data. 4736 * 4737 * @typedef AdvertiseData 4738 * @syscap SystemCapability.Communication.Bluetooth.Core 4739 * @crossplatform 4740 * @atomicservice 4741 * @since 13 4742 */ 4743 interface AdvertiseData { 4744 /** 4745 * The specified service UUID list to this advertisement 4746 * 4747 * @type { Array<string> } 4748 * @syscap SystemCapability.Communication.Bluetooth.Core 4749 * @since 10 4750 */ 4751 /** 4752 * The specified service UUID list to this advertisement 4753 * 4754 * @type { Array<string> } 4755 * @syscap SystemCapability.Communication.Bluetooth.Core 4756 * @atomicservice 4757 * @since 12 4758 */ 4759 /** 4760 * The specified service UUID list to this advertisement 4761 * 4762 * @type { Array<string> } 4763 * @syscap SystemCapability.Communication.Bluetooth.Core 4764 * @crossplatform 4765 * @atomicservice 4766 * @since 13 4767 */ 4768 serviceUuids: Array<string>; 4769 /** 4770 * The specified manufacturer data list to this advertisement 4771 * 4772 * @type { Array<ManufactureData> } 4773 * @syscap SystemCapability.Communication.Bluetooth.Core 4774 * @since 10 4775 */ 4776 /** 4777 * The specified manufacturer data list to this advertisement 4778 * 4779 * @type { Array<ManufactureData> } 4780 * @syscap SystemCapability.Communication.Bluetooth.Core 4781 * @atomicservice 4782 * @since 12 4783 */ 4784 /** 4785 * The specified manufacturer data list to this advertisement 4786 * 4787 * @type { Array<ManufactureData> } 4788 * @syscap SystemCapability.Communication.Bluetooth.Core 4789 * @crossplatform 4790 * @atomicservice 4791 * @since 13 4792 */ 4793 manufactureData: Array<ManufactureData>; 4794 /** 4795 * The specified service data list to this advertisement 4796 * 4797 * @type { Array<ServiceData> } 4798 * @syscap SystemCapability.Communication.Bluetooth.Core 4799 * @since 10 4800 */ 4801 /** 4802 * The specified service data list to this advertisement 4803 * 4804 * @type { Array<ServiceData> } 4805 * @syscap SystemCapability.Communication.Bluetooth.Core 4806 * @atomicservice 4807 * @since 12 4808 */ 4809 /** 4810 * The specified service data list to this advertisement 4811 * 4812 * @type { Array<ServiceData> } 4813 * @syscap SystemCapability.Communication.Bluetooth.Core 4814 * @crossplatform 4815 * @atomicservice 4816 * @since 13 4817 */ 4818 serviceData: Array<ServiceData>; 4819 /** 4820 * Indicates whether the device name will be included in the advertisement packet. 4821 * 4822 * @type { ?boolean } 4823 * @syscap SystemCapability.Communication.Bluetooth.Core 4824 * @since 10 4825 */ 4826 /** 4827 * Indicates whether the device name will be included in the advertisement packet. 4828 * 4829 * @type { ?boolean } 4830 * @syscap SystemCapability.Communication.Bluetooth.Core 4831 * @atomicservice 4832 * @since 12 4833 */ 4834 /** 4835 * Indicates whether the device name will be included in the advertisement packet. 4836 * 4837 * @type { ?boolean } 4838 * @syscap SystemCapability.Communication.Bluetooth.Core 4839 * @crossplatform 4840 * @atomicservice 4841 * @since 13 4842 */ 4843 includeDeviceName?: boolean; 4844 } 4845 4846 /** 4847 * Describes the advertising parameters. 4848 * 4849 * @typedef AdvertisingParams 4850 * @syscap SystemCapability.Communication.Bluetooth.Core 4851 * @since 11 4852 */ 4853 /** 4854 * Describes the advertising parameters. 4855 * 4856 * @typedef AdvertisingParams 4857 * @syscap SystemCapability.Communication.Bluetooth.Core 4858 * @crossplatform 4859 * @since 13 4860 */ 4861 interface AdvertisingParams { 4862 /** 4863 * Indicates the advertising settings. 4864 * 4865 * @type { AdvertiseSetting } 4866 * @syscap SystemCapability.Communication.Bluetooth.Core 4867 * @since 11 4868 */ 4869 /** 4870 * Indicates the advertising settings. 4871 * 4872 * @type { AdvertiseSetting } 4873 * @syscap SystemCapability.Communication.Bluetooth.Core 4874 * @crossplatform 4875 * @since 13 4876 */ 4877 advertisingSettings: AdvertiseSetting; 4878 /** 4879 * Indicates the advertising data. 4880 * 4881 * @type { AdvertiseData } 4882 * @syscap SystemCapability.Communication.Bluetooth.Core 4883 * @since 11 4884 */ 4885 /** 4886 * Indicates the advertising data. 4887 * 4888 * @type { AdvertiseData } 4889 * @syscap SystemCapability.Communication.Bluetooth.Core 4890 * @crossplatform 4891 * @since 13 4892 */ 4893 advertisingData: AdvertiseData; 4894 /** 4895 * Indicates the advertising response. 4896 * 4897 * @type { ?AdvertiseData } 4898 * @syscap SystemCapability.Communication.Bluetooth.Core 4899 * @since 11 4900 */ 4901 /** 4902 * Indicates the advertising response. 4903 * 4904 * @type { ?AdvertiseData } 4905 * @syscap SystemCapability.Communication.Bluetooth.Core 4906 * @crossplatform 4907 * @since 13 4908 */ 4909 advertisingResponse?: AdvertiseData; 4910 /** 4911 * Indicates the duration for advertising continuously. 4912 * The duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). 4913 * If this parameter is not specified or is set to 0, advertisement is continuously sent. 4914 * 4915 * @type { ?number } 4916 * @syscap SystemCapability.Communication.Bluetooth.Core 4917 * @since 11 4918 */ 4919 duration?: number; 4920 } 4921 4922 /** 4923 * Parameter for dynamically enable advertising. 4924 * 4925 * @typedef AdvertisingEnableParams 4926 * @syscap SystemCapability.Communication.Bluetooth.Core 4927 * @since 11 4928 */ 4929 interface AdvertisingEnableParams { 4930 /** 4931 * Indicates the ID of current advertising. 4932 * 4933 * @type { number } 4934 * @syscap SystemCapability.Communication.Bluetooth.Core 4935 * @since 11 4936 */ 4937 advertisingId: number; 4938 /** 4939 * Indicates the duration for advertising continuously. 4940 * The duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). 4941 * If this parameter is not specified or is set to 0, advertise is continuously sent. 4942 * 4943 * @type { ?number } 4944 * @syscap SystemCapability.Communication.Bluetooth.Core 4945 * @since 11 4946 */ 4947 duration?: number; 4948 } 4949 4950 /** 4951 * Parameter for dynamically disable advertising. 4952 * 4953 * @typedef AdvertisingDisableParams 4954 * @syscap SystemCapability.Communication.Bluetooth.Core 4955 * @since 11 4956 */ 4957 interface AdvertisingDisableParams { 4958 /** 4959 * Indicates the ID of current advertising. 4960 * 4961 * @type { number } 4962 * @syscap SystemCapability.Communication.Bluetooth.Core 4963 * @since 11 4964 */ 4965 advertisingId: number; 4966 } 4967 4968 /** 4969 * Advertising state change information. 4970 * 4971 * @typedef AdvertisingStateChangeInfo 4972 * @syscap SystemCapability.Communication.Bluetooth.Core 4973 * @since 11 4974 */ 4975 /** 4976 * Advertising state change information. 4977 * 4978 * @typedef AdvertisingStateChangeInfo 4979 * @syscap SystemCapability.Communication.Bluetooth.Core 4980 * @crossplatform 4981 * @since 13 4982 */ 4983 interface AdvertisingStateChangeInfo { 4984 /** 4985 * Indicates the ID of current advertising. 4986 * 4987 * @type { number } 4988 * @syscap SystemCapability.Communication.Bluetooth.Core 4989 * @since 11 4990 */ 4991 /** 4992 * Indicates the ID of current advertising. 4993 * 4994 * @type { number } 4995 * @syscap SystemCapability.Communication.Bluetooth.Core 4996 * @crossplatform 4997 * @since 13 4998 */ 4999 advertisingId: number; 5000 /** 5001 * Indicates the advertising state. 5002 * 5003 * @type { AdvertisingState } 5004 * @syscap SystemCapability.Communication.Bluetooth.Core 5005 * @since 11 5006 */ 5007 /** 5008 * Indicates the advertising state. 5009 * 5010 * @type { AdvertisingState } 5011 * @syscap SystemCapability.Communication.Bluetooth.Core 5012 * @crossplatform 5013 * @since 13 5014 */ 5015 state: AdvertisingState; 5016 } 5017 5018 /** 5019 * Describes the manufacturer data. 5020 * 5021 * @typedef ManufactureData 5022 * @syscap SystemCapability.Communication.Bluetooth.Core 5023 * @since 10 5024 */ 5025 /** 5026 * Describes the manufacturer data. 5027 * 5028 * @typedef ManufactureData 5029 * @syscap SystemCapability.Communication.Bluetooth.Core 5030 * @atomicservice 5031 * @since 12 5032 */ 5033 /** 5034 * Describes the manufacturer data. 5035 * 5036 * @typedef ManufactureData 5037 * @syscap SystemCapability.Communication.Bluetooth.Core 5038 * @crossplatform 5039 * @atomicservice 5040 * @since 13 5041 */ 5042 interface ManufactureData { 5043 /** 5044 * Indicates the manufacturer ID assigned by Bluetooth SIG 5045 * 5046 * @type { number } 5047 * @syscap SystemCapability.Communication.Bluetooth.Core 5048 * @since 10 5049 */ 5050 /** 5051 * Indicates the manufacturer ID assigned by Bluetooth SIG 5052 * 5053 * @type { number } 5054 * @syscap SystemCapability.Communication.Bluetooth.Core 5055 * @atomicservice 5056 * @since 12 5057 */ 5058 /** 5059 * Indicates the manufacturer ID assigned by Bluetooth SIG 5060 * 5061 * @type { number } 5062 * @syscap SystemCapability.Communication.Bluetooth.Core 5063 * @crossplatform 5064 * @atomicservice 5065 * @since 13 5066 */ 5067 manufactureId: number; 5068 /** 5069 * Indicates the manufacturer data to add 5070 * 5071 * @type { ArrayBuffer } 5072 * @syscap SystemCapability.Communication.Bluetooth.Core 5073 * @since 10 5074 */ 5075 /** 5076 * Indicates the manufacturer data to add 5077 * 5078 * @type { ArrayBuffer } 5079 * @syscap SystemCapability.Communication.Bluetooth.Core 5080 * @atomicservice 5081 * @since 12 5082 */ 5083 /** 5084 * Indicates the manufacturer data to add 5085 * 5086 * @type { ArrayBuffer } 5087 * @syscap SystemCapability.Communication.Bluetooth.Core 5088 * @crossplatform 5089 * @atomicservice 5090 * @since 13 5091 */ 5092 manufactureValue: ArrayBuffer; 5093 } 5094 5095 /** 5096 * Describes the service data. 5097 * 5098 * @typedef ServiceData 5099 * @syscap SystemCapability.Communication.Bluetooth.Core 5100 * @since 10 5101 */ 5102 /** 5103 * Describes the service data. 5104 * 5105 * @typedef ServiceData 5106 * @syscap SystemCapability.Communication.Bluetooth.Core 5107 * @atomicservice 5108 * @since 12 5109 */ 5110 /** 5111 * Describes the service data. 5112 * 5113 * @typedef ServiceData 5114 * @syscap SystemCapability.Communication.Bluetooth.Core 5115 * @crossplatform 5116 * @atomicservice 5117 * @since 13 5118 */ 5119 interface ServiceData { 5120 /** 5121 * Indicates the UUID of the service data to add 5122 * 5123 * @type { string } 5124 * @syscap SystemCapability.Communication.Bluetooth.Core 5125 * @since 10 5126 */ 5127 /** 5128 * Indicates the UUID of the service data to add 5129 * 5130 * @type { string } 5131 * @syscap SystemCapability.Communication.Bluetooth.Core 5132 * @atomicservice 5133 * @since 12 5134 */ 5135 /** 5136 * Indicates the UUID of the service data to add 5137 * 5138 * @type { string } 5139 * @syscap SystemCapability.Communication.Bluetooth.Core 5140 * @crossplatform 5141 * @atomicservice 5142 * @since 13 5143 */ 5144 serviceUuid: string; 5145 /** 5146 * Indicates the service data to add 5147 * 5148 * @type { ArrayBuffer } 5149 * @syscap SystemCapability.Communication.Bluetooth.Core 5150 * @since 10 5151 */ 5152 /** 5153 * Indicates the service data to add 5154 * 5155 * @type { ArrayBuffer } 5156 * @syscap SystemCapability.Communication.Bluetooth.Core 5157 * @atomicservice 5158 * @since 12 5159 */ 5160 /** 5161 * Indicates the service data to add 5162 * 5163 * @type { ArrayBuffer } 5164 * @syscap SystemCapability.Communication.Bluetooth.Core 5165 * @crossplatform 5166 * @atomicservice 5167 * @since 13 5168 */ 5169 serviceValue: ArrayBuffer; 5170 } 5171 5172 /** 5173 * Describes the criteria for filtering scanning results can be set. 5174 * 5175 * @typedef ScanFilter 5176 * @syscap SystemCapability.Communication.Bluetooth.Core 5177 * @since 10 5178 */ 5179 /** 5180 * Describes the criteria for filtering scanning results can be set. 5181 * 5182 * @typedef ScanFilter 5183 * @syscap SystemCapability.Communication.Bluetooth.Core 5184 * @atomicservice 5185 * @since 12 5186 */ 5187 /** 5188 * Describes the criteria for filtering scanning results can be set. 5189 * 5190 * @typedef ScanFilter 5191 * @syscap SystemCapability.Communication.Bluetooth.Core 5192 * @crossplatform 5193 * @atomicservice 5194 * @since 13 5195 */ 5196 interface ScanFilter { 5197 /** 5198 * The address of a BLE peripheral device 5199 * 5200 * @type { ?string } 5201 * @syscap SystemCapability.Communication.Bluetooth.Core 5202 * @since 10 5203 */ 5204 /** 5205 * The address of a BLE peripheral device 5206 * 5207 * @type { ?string } 5208 * @syscap SystemCapability.Communication.Bluetooth.Core 5209 * @atomicservice 5210 * @since 12 5211 */ 5212 /** 5213 * The address of a BLE peripheral device 5214 * 5215 * @type { ?string } 5216 * @syscap SystemCapability.Communication.Bluetooth.Core 5217 * @crossplatform 5218 * @atomicservice 5219 * @since 13 5220 */ 5221 deviceId?: string; 5222 5223 /** 5224 * The name of a BLE peripheral device 5225 * 5226 * @type { ?string } 5227 * @syscap SystemCapability.Communication.Bluetooth.Core 5228 * @since 10 5229 */ 5230 /** 5231 * The name of a BLE peripheral device 5232 * 5233 * @type { ?string } 5234 * @syscap SystemCapability.Communication.Bluetooth.Core 5235 * @atomicservice 5236 * @since 12 5237 */ 5238 /** 5239 * The name of a BLE peripheral device 5240 * 5241 * @type { ?string } 5242 * @syscap SystemCapability.Communication.Bluetooth.Core 5243 * @crossplatform 5244 * @atomicservice 5245 * @since 13 5246 */ 5247 name?: string; 5248 5249 /** 5250 * The service UUID of a BLE peripheral device 5251 * 5252 * @type { ?string } 5253 * @syscap SystemCapability.Communication.Bluetooth.Core 5254 * @since 10 5255 */ 5256 /** 5257 * The service UUID of a BLE peripheral device 5258 * 5259 * @type { ?string } 5260 * @syscap SystemCapability.Communication.Bluetooth.Core 5261 * @atomicservice 5262 * @since 12 5263 */ 5264 /** 5265 * The service UUID of a BLE peripheral device 5266 * 5267 * @type { ?string } 5268 * @syscap SystemCapability.Communication.Bluetooth.Core 5269 * @crossplatform 5270 * @atomicservice 5271 * @since 13 5272 */ 5273 serviceUuid?: string; 5274 5275 /** 5276 * Service UUID mask. 5277 * 5278 * @type { ?string } 5279 * @syscap SystemCapability.Communication.Bluetooth.Core 5280 * @since 10 5281 */ 5282 /** 5283 * Service UUID mask. 5284 * 5285 * @type { ?string } 5286 * @syscap SystemCapability.Communication.Bluetooth.Core 5287 * @atomicservice 5288 * @since 12 5289 */ 5290 /** 5291 * Service UUID mask. 5292 * 5293 * @type { ?string } 5294 * @syscap SystemCapability.Communication.Bluetooth.Core 5295 * @crossplatform 5296 * @atomicservice 5297 * @since 13 5298 */ 5299 serviceUuidMask?: string; 5300 5301 /** 5302 * Service solicitation UUID. 5303 * 5304 * @type { ?string } 5305 * @syscap SystemCapability.Communication.Bluetooth.Core 5306 * @since 10 5307 */ 5308 /** 5309 * Service solicitation UUID. 5310 * 5311 * @type { ?string } 5312 * @syscap SystemCapability.Communication.Bluetooth.Core 5313 * @atomicservice 5314 * @since 12 5315 */ 5316 /** 5317 * Service solicitation UUID. 5318 * 5319 * @type { ?string } 5320 * @syscap SystemCapability.Communication.Bluetooth.Core 5321 * @crossplatform 5322 * @atomicservice 5323 * @since 13 5324 */ 5325 serviceSolicitationUuid?: string; 5326 5327 /** 5328 * Service solicitation UUID mask. 5329 * 5330 * @type { ?string } 5331 * @syscap SystemCapability.Communication.Bluetooth.Core 5332 * @since 10 5333 */ 5334 /** 5335 * Service solicitation UUID mask. 5336 * 5337 * @type { ?string } 5338 * @syscap SystemCapability.Communication.Bluetooth.Core 5339 * @atomicservice 5340 * @since 12 5341 */ 5342 /** 5343 * Service solicitation UUID mask. 5344 * 5345 * @type { ?string } 5346 * @syscap SystemCapability.Communication.Bluetooth.Core 5347 * @crossplatform 5348 * @atomicservice 5349 * @since 13 5350 */ 5351 serviceSolicitationUuidMask?: string; 5352 5353 /** 5354 * Service data. 5355 * 5356 * @type { ?ArrayBuffer } 5357 * @syscap SystemCapability.Communication.Bluetooth.Core 5358 * @since 10 5359 */ 5360 /** 5361 * Service data. 5362 * 5363 * @type { ?ArrayBuffer } 5364 * @syscap SystemCapability.Communication.Bluetooth.Core 5365 * @atomicservice 5366 * @since 12 5367 */ 5368 /** 5369 * Service data. 5370 * 5371 * @type { ?ArrayBuffer } 5372 * @syscap SystemCapability.Communication.Bluetooth.Core 5373 * @crossplatform 5374 * @atomicservice 5375 * @since 13 5376 */ 5377 serviceData?: ArrayBuffer; 5378 5379 /** 5380 * Service data mask. 5381 * 5382 * @type { ?ArrayBuffer } 5383 * @syscap SystemCapability.Communication.Bluetooth.Core 5384 * @since 10 5385 */ 5386 /** 5387 * Service data mask. 5388 * 5389 * @type { ?ArrayBuffer } 5390 * @syscap SystemCapability.Communication.Bluetooth.Core 5391 * @atomicservice 5392 * @since 12 5393 */ 5394 /** 5395 * Service data mask. 5396 * 5397 * @type { ?ArrayBuffer } 5398 * @syscap SystemCapability.Communication.Bluetooth.Core 5399 * @crossplatform 5400 * @atomicservice 5401 * @since 13 5402 */ 5403 serviceDataMask?: ArrayBuffer; 5404 5405 /** 5406 * Manufacture id. 5407 * 5408 * @type { ?number } 5409 * @syscap SystemCapability.Communication.Bluetooth.Core 5410 * @since 10 5411 */ 5412 /** 5413 * Manufacture id. 5414 * 5415 * @type { ?number } 5416 * @syscap SystemCapability.Communication.Bluetooth.Core 5417 * @atomicservice 5418 * @since 12 5419 */ 5420 /** 5421 * Manufacture id. 5422 * 5423 * @type { ?number } 5424 * @syscap SystemCapability.Communication.Bluetooth.Core 5425 * @crossplatform 5426 * @atomicservice 5427 * @since 13 5428 */ 5429 manufactureId?: number; 5430 5431 /** 5432 * Manufacture data. 5433 * 5434 * @type { ?ArrayBuffer } 5435 * @syscap SystemCapability.Communication.Bluetooth.Core 5436 * @since 10 5437 */ 5438 /** 5439 * Manufacture data. 5440 * 5441 * @type { ?ArrayBuffer } 5442 * @syscap SystemCapability.Communication.Bluetooth.Core 5443 * @atomicservice 5444 * @since 12 5445 */ 5446 /** 5447 * Manufacture data. 5448 * 5449 * @type { ?ArrayBuffer } 5450 * @syscap SystemCapability.Communication.Bluetooth.Core 5451 * @crossplatform 5452 * @atomicservice 5453 * @since 13 5454 */ 5455 manufactureData?: ArrayBuffer; 5456 5457 /** 5458 * Manufacture data mask. 5459 * 5460 * @type { ?ArrayBuffer } 5461 * @syscap SystemCapability.Communication.Bluetooth.Core 5462 * @since 10 5463 */ 5464 /** 5465 * Manufacture data mask. 5466 * 5467 * @type { ?ArrayBuffer } 5468 * @syscap SystemCapability.Communication.Bluetooth.Core 5469 * @atomicservice 5470 * @since 12 5471 */ 5472 /** 5473 * Manufacture data mask. 5474 * 5475 * @type { ?ArrayBuffer } 5476 * @syscap SystemCapability.Communication.Bluetooth.Core 5477 * @crossplatform 5478 * @atomicservice 5479 * @since 13 5480 */ 5481 manufactureDataMask?: ArrayBuffer; 5482 } 5483 5484 /** 5485 * Describes the parameters for scan. 5486 * 5487 * @typedef ScanOptions 5488 * @syscap SystemCapability.Communication.Bluetooth.Core 5489 * @since 10 5490 */ 5491 /** 5492 * Describes the parameters for scan. 5493 * 5494 * @typedef ScanOptions 5495 * @syscap SystemCapability.Communication.Bluetooth.Core 5496 * @atomicservice 5497 * @since 12 5498 */ 5499 /** 5500 * Describes the parameters for scan. 5501 * 5502 * @typedef ScanOptions 5503 * @syscap SystemCapability.Communication.Bluetooth.Core 5504 * @crossplatform 5505 * @atomicservice 5506 * @since 13 5507 */ 5508 interface ScanOptions { 5509 /** 5510 * Time of delay for reporting the scan result 5511 * 5512 * @type { ?number } 5513 * @syscap SystemCapability.Communication.Bluetooth.Core 5514 * @since 10 5515 */ 5516 /** 5517 * Time of delay for reporting the scan result 5518 * 5519 * @type { ?number } 5520 * @syscap SystemCapability.Communication.Bluetooth.Core 5521 * @atomicservice 5522 * @since 12 5523 */ 5524 /** 5525 * Time of delay for reporting the scan result 5526 * 5527 * @type { ?number } 5528 * @syscap SystemCapability.Communication.Bluetooth.Core 5529 * @crossplatform 5530 * @atomicservice 5531 * @since 13 5532 */ 5533 interval?: number; 5534 /** 5535 * Bluetooth LE scan mode 5536 * 5537 * @type { ?ScanDuty } 5538 * @syscap SystemCapability.Communication.Bluetooth.Core 5539 * @since 10 5540 */ 5541 /** 5542 * Bluetooth LE scan mode 5543 * 5544 * @type { ?ScanDuty } 5545 * @syscap SystemCapability.Communication.Bluetooth.Core 5546 * @atomicservice 5547 * @since 12 5548 */ 5549 /** 5550 * Bluetooth LE scan mode 5551 * 5552 * @type { ?ScanDuty } 5553 * @syscap SystemCapability.Communication.Bluetooth.Core 5554 * @crossplatform 5555 * @atomicservice 5556 * @since 13 5557 */ 5558 dutyMode?: ScanDuty; 5559 /** 5560 * Match mode for Bluetooth LE scan filters hardware match 5561 * 5562 * @type { ?MatchMode } 5563 * @syscap SystemCapability.Communication.Bluetooth.Core 5564 * @since 10 5565 */ 5566 /** 5567 * Match mode for Bluetooth LE scan filters hardware match 5568 * 5569 * @type { ?MatchMode } 5570 * @syscap SystemCapability.Communication.Bluetooth.Core 5571 * @atomicservice 5572 * @since 12 5573 */ 5574 matchMode?: MatchMode; 5575 /** 5576 * Physical Layer used during scan. 5577 * 5578 * @type { ?PhyType } 5579 * @syscap SystemCapability.Communication.Bluetooth.Core 5580 * @atomicservice 5581 * @since 12 5582 */ 5583 /** 5584 * Physical Layer used during scan. 5585 * 5586 * @type { ?PhyType } 5587 * @syscap SystemCapability.Communication.Bluetooth.Core 5588 * @crossplatform 5589 * @atomicservice 5590 * @since 13 5591 */ 5592 phyType?: PhyType; 5593 /** 5594 * Report mode used during scan. 5595 * 5596 * @type { ?ScanReportMode } 5597 * @syscap SystemCapability.Communication.Bluetooth.Core 5598 * @crossplatform 5599 * @atomicservice 5600 * @since 15 5601 */ 5602 reportMode?: ScanReportMode; 5603 } 5604 5605 /** 5606 * Describes the properties of a gatt characteristic. 5607 * 5608 * @typedef GattProperties 5609 * @syscap SystemCapability.Communication.Bluetooth.Core 5610 * @since 10 5611 */ 5612 /** 5613 * Describes the properties of a gatt characteristic. 5614 * 5615 * @typedef GattProperties 5616 * @syscap SystemCapability.Communication.Bluetooth.Core 5617 * @atomicservice 5618 * @since 12 5619 */ 5620 /** 5621 * Describes the properties of a gatt characteristic. 5622 * 5623 * @typedef GattProperties 5624 * @syscap SystemCapability.Communication.Bluetooth.Core 5625 * @crossplatform 5626 * @atomicservice 5627 * @since 13 5628 */ 5629 interface GattProperties { 5630 /** 5631 * Support write property of the characteristic. 5632 * 5633 * @type { ?boolean } 5634 * @syscap SystemCapability.Communication.Bluetooth.Core 5635 * @since 10 5636 */ 5637 /** 5638 * Support write property of the characteristic. 5639 * 5640 * @type { ?boolean } 5641 * @syscap SystemCapability.Communication.Bluetooth.Core 5642 * @atomicservice 5643 * @since 12 5644 */ 5645 /** 5646 * Support write property of the characteristic. 5647 * 5648 * @type { ?boolean } 5649 * @syscap SystemCapability.Communication.Bluetooth.Core 5650 * @crossplatform 5651 * @atomicservice 5652 * @since 13 5653 */ 5654 write?: boolean; 5655 /** 5656 * Support write no response property of the characteristic. 5657 * 5658 * @type { ?boolean } 5659 * @syscap SystemCapability.Communication.Bluetooth.Core 5660 * @since 10 5661 */ 5662 /** 5663 * Support write no response property of the characteristic. 5664 * 5665 * @type { ?boolean } 5666 * @syscap SystemCapability.Communication.Bluetooth.Core 5667 * @atomicservice 5668 * @since 12 5669 */ 5670 /** 5671 * Support write no response property of the characteristic. 5672 * 5673 * @type { ?boolean } 5674 * @syscap SystemCapability.Communication.Bluetooth.Core 5675 * @crossplatform 5676 * @atomicservice 5677 * @since 13 5678 */ 5679 writeNoResponse?: boolean; 5680 /** 5681 * Support read property of the characteristic. 5682 * 5683 * @type { ?boolean } 5684 * @syscap SystemCapability.Communication.Bluetooth.Core 5685 * @since 10 5686 */ 5687 /** 5688 * Support read property of the characteristic. 5689 * 5690 * @type { ?boolean } 5691 * @syscap SystemCapability.Communication.Bluetooth.Core 5692 * @atomicservice 5693 * @since 12 5694 */ 5695 /** 5696 * Support read property of the characteristic. 5697 * 5698 * @type { ?boolean } 5699 * @syscap SystemCapability.Communication.Bluetooth.Core 5700 * @crossplatform 5701 * @atomicservice 5702 * @since 13 5703 */ 5704 read?: boolean; 5705 /** 5706 * Support notify property of the characteristic. 5707 * 5708 * @type { ?boolean } 5709 * @syscap SystemCapability.Communication.Bluetooth.Core 5710 * @since 10 5711 */ 5712 /** 5713 * Support notify property of the characteristic. 5714 * 5715 * @type { ?boolean } 5716 * @syscap SystemCapability.Communication.Bluetooth.Core 5717 * @atomicservice 5718 * @since 12 5719 */ 5720 /** 5721 * Support notify property of the characteristic. 5722 * 5723 * @type { ?boolean } 5724 * @syscap SystemCapability.Communication.Bluetooth.Core 5725 * @crossplatform 5726 * @atomicservice 5727 * @since 13 5728 */ 5729 notify?: boolean; 5730 /** 5731 * Support indicate property of the characteristic. 5732 * 5733 * @type { ?boolean } 5734 * @syscap SystemCapability.Communication.Bluetooth.Core 5735 * @since 10 5736 */ 5737 /** 5738 * Support indicate property of the characteristic. 5739 * 5740 * @type { ?boolean } 5741 * @syscap SystemCapability.Communication.Bluetooth.Core 5742 * @atomicservice 5743 * @since 12 5744 */ 5745 indicate?: boolean; 5746 } 5747 5748 /** 5749 * The enum of gatt characteristic write type 5750 * 5751 * @enum { number } 5752 * @syscap SystemCapability.Communication.Bluetooth.Core 5753 * @since 10 5754 */ 5755 /** 5756 * The enum of gatt characteristic write type 5757 * 5758 * @enum { number } 5759 * @syscap SystemCapability.Communication.Bluetooth.Core 5760 * @atomicservice 5761 * @since 12 5762 */ 5763 /** 5764 * The enum of gatt characteristic write type 5765 * 5766 * @enum { number } 5767 * @syscap SystemCapability.Communication.Bluetooth.Core 5768 * @crossplatform 5769 * @atomicservice 5770 * @since 13 5771 */ 5772 enum GattWriteType { 5773 /** 5774 * Write characteristic with response. 5775 * 5776 * @syscap SystemCapability.Communication.Bluetooth.Core 5777 * @since 10 5778 */ 5779 /** 5780 * Write characteristic with response. 5781 * 5782 * @syscap SystemCapability.Communication.Bluetooth.Core 5783 * @atomicservice 5784 * @since 12 5785 */ 5786 /** 5787 * Write characteristic with response. 5788 * 5789 * @syscap SystemCapability.Communication.Bluetooth.Core 5790 * @crossplatform 5791 * @atomicservice 5792 * @since 13 5793 */ 5794 WRITE = 1, 5795 /** 5796 * Write characteristic without response. 5797 * 5798 * @syscap SystemCapability.Communication.Bluetooth.Core 5799 * @since 10 5800 */ 5801 /** 5802 * Write characteristic without response. 5803 * 5804 * @syscap SystemCapability.Communication.Bluetooth.Core 5805 * @atomicservice 5806 * @since 12 5807 */ 5808 /** 5809 * Write characteristic without response. 5810 * 5811 * @syscap SystemCapability.Communication.Bluetooth.Core 5812 * @crossplatform 5813 * @atomicservice 5814 * @since 13 5815 */ 5816 WRITE_NO_RESPONSE = 2 5817 } 5818 5819 /** 5820 * The enum of scan duty. 5821 * 5822 * @enum { number } 5823 * @syscap SystemCapability.Communication.Bluetooth.Core 5824 * @since 10 5825 */ 5826 /** 5827 * The enum of scan duty. 5828 * 5829 * @enum { number } 5830 * @syscap SystemCapability.Communication.Bluetooth.Core 5831 * @atomicservice 5832 * @since 12 5833 */ 5834 /** 5835 * The enum of scan duty. 5836 * 5837 * @enum { number } 5838 * @syscap SystemCapability.Communication.Bluetooth.Core 5839 * @crossplatform 5840 * @atomicservice 5841 * @since 13 5842 */ 5843 enum ScanDuty { 5844 /** 5845 * low power mode 5846 * 5847 * @syscap SystemCapability.Communication.Bluetooth.Core 5848 * @since 10 5849 */ 5850 /** 5851 * low power mode 5852 * 5853 * @syscap SystemCapability.Communication.Bluetooth.Core 5854 * @atomicservice 5855 * @since 12 5856 */ 5857 /** 5858 * low power mode 5859 * 5860 * @syscap SystemCapability.Communication.Bluetooth.Core 5861 * @crossplatform 5862 * @atomicservice 5863 * @since 13 5864 */ 5865 SCAN_MODE_LOW_POWER = 0, 5866 /** 5867 * balanced power mode 5868 * 5869 * @syscap SystemCapability.Communication.Bluetooth.Core 5870 * @since 10 5871 */ 5872 /** 5873 * balanced power mode 5874 * 5875 * @syscap SystemCapability.Communication.Bluetooth.Core 5876 * @atomicservice 5877 * @since 12 5878 */ 5879 /** 5880 * balanced power mode 5881 * 5882 * @syscap SystemCapability.Communication.Bluetooth.Core 5883 * @crossplatform 5884 * @atomicservice 5885 * @since 13 5886 */ 5887 SCAN_MODE_BALANCED = 1, 5888 /** 5889 * Scan using highest duty cycle 5890 * 5891 * @syscap SystemCapability.Communication.Bluetooth.Core 5892 * @since 10 5893 */ 5894 /** 5895 * Scan using highest duty cycle 5896 * 5897 * @syscap SystemCapability.Communication.Bluetooth.Core 5898 * @atomicservice 5899 * @since 12 5900 */ 5901 /** 5902 * Scan using highest duty cycle 5903 * 5904 * @syscap SystemCapability.Communication.Bluetooth.Core 5905 * @crossplatform 5906 * @atomicservice 5907 * @since 13 5908 */ 5909 SCAN_MODE_LOW_LATENCY = 2 5910 } 5911 5912 /** 5913 * The enum of BLE match mode. 5914 * 5915 * @enum { number } 5916 * @syscap SystemCapability.Communication.Bluetooth.Core 5917 * @since 10 5918 */ 5919 /** 5920 * The enum of BLE match mode. 5921 * 5922 * @enum { number } 5923 * @syscap SystemCapability.Communication.Bluetooth.Core 5924 * @atomicservice 5925 * @since 12 5926 */ 5927 enum MatchMode { 5928 /** 5929 * aggressive mode 5930 * 5931 * @syscap SystemCapability.Communication.Bluetooth.Core 5932 * @since 10 5933 */ 5934 /** 5935 * aggressive mode 5936 * 5937 * @syscap SystemCapability.Communication.Bluetooth.Core 5938 * @atomicservice 5939 * @since 12 5940 */ 5941 MATCH_MODE_AGGRESSIVE = 1, 5942 /** 5943 * sticky mode 5944 * 5945 * @syscap SystemCapability.Communication.Bluetooth.Core 5946 * @since 10 5947 */ 5948 /** 5949 * sticky mode 5950 * 5951 * @syscap SystemCapability.Communication.Bluetooth.Core 5952 * @atomicservice 5953 * @since 12 5954 */ 5955 MATCH_MODE_STICKY = 2 5956 } 5957 5958 /** 5959 * The enum of BLE advertising state. 5960 * 5961 * @enum { number } 5962 * @syscap SystemCapability.Communication.Bluetooth.Core 5963 * @since 11 5964 */ 5965 /** 5966 * The enum of BLE advertising state. 5967 * 5968 * @enum { number } 5969 * @syscap SystemCapability.Communication.Bluetooth.Core 5970 * @crossplatform 5971 * @since 13 5972 */ 5973 enum AdvertisingState { 5974 /** 5975 * advertising started. 5976 * 5977 * @syscap SystemCapability.Communication.Bluetooth.Core 5978 * @since 11 5979 */ 5980 /** 5981 * advertising started. 5982 * 5983 * @syscap SystemCapability.Communication.Bluetooth.Core 5984 * @crossplatform 5985 * @since 13 5986 */ 5987 STARTED = 1, 5988 /** 5989 * advertising temporarily enabled. 5990 * 5991 * @syscap SystemCapability.Communication.Bluetooth.Core 5992 * @since 11 5993 */ 5994 ENABLED = 2, 5995 /** 5996 * advertising temporarily disabled. 5997 * 5998 * @syscap SystemCapability.Communication.Bluetooth.Core 5999 * @since 11 6000 */ 6001 DISABLED = 3, 6002 /** 6003 * advertising stopped. 6004 * 6005 * @syscap SystemCapability.Communication.Bluetooth.Core 6006 * @since 11 6007 */ 6008 /** 6009 * advertising stopped. 6010 * 6011 * @syscap SystemCapability.Communication.Bluetooth.Core 6012 * @crossplatform 6013 * @since 13 6014 */ 6015 STOPPED = 4 6016 } 6017 6018 /** 6019 * Phy type used during scan. 6020 * 6021 * @enum { number } 6022 * @syscap SystemCapability.Communication.Bluetooth.Core 6023 * @atomicservice 6024 * @since 12 6025 */ 6026 /** 6027 * Phy type used during scan. 6028 * 6029 * @enum { number } 6030 * @syscap SystemCapability.Communication.Bluetooth.Core 6031 * @crossplatform 6032 * @atomicservice 6033 * @since 13 6034 */ 6035 enum PhyType { 6036 /** 6037 * Use 1M phy for scanning. 6038 * 6039 * @syscap SystemCapability.Communication.Bluetooth.Core 6040 * @atomicservice 6041 * @since 12 6042 */ 6043 /** 6044 * Use 1M phy for scanning. 6045 * 6046 * @syscap SystemCapability.Communication.Bluetooth.Core 6047 * @crossplatform 6048 * @atomicservice 6049 * @since 13 6050 */ 6051 PHY_LE_1M = 1, 6052 /** 6053 * Use all supported Phys for scanning. 6054 * 6055 * @syscap SystemCapability.Communication.Bluetooth.Core 6056 * @atomicservice 6057 * @since 12 6058 */ 6059 /** 6060 * Use all supported Phys for scanning. 6061 * 6062 * @syscap SystemCapability.Communication.Bluetooth.Core 6063 * @crossplatform 6064 * @atomicservice 6065 * @since 13 6066 */ 6067 PHY_LE_ALL_SUPPORTED = 255 6068 } 6069 6070 /** 6071 * Report mode used during scan. 6072 * 6073 * @enum { number } 6074 * @syscap SystemCapability.Communication.Bluetooth.Core 6075 * @crossplatform 6076 * @atomicservice 6077 * @since 15 6078 */ 6079 enum ScanReportMode { 6080 /** 6081 * In normal mode, the advertisement packet is reported immediately after being scanned. 6082 * 6083 * @syscap SystemCapability.Communication.Bluetooth.Core 6084 * @crossplatform 6085 * @atomicservice 6086 * @since 15 6087 */ 6088 NORMAL = 1, 6089 } 6090 6091 /** 6092 * Scan report type used during scan. 6093 * 6094 * @enum { number } 6095 * @syscap SystemCapability.Communication.Bluetooth.Core 6096 * @crossplatform 6097 * @atomicservice 6098 * @since 15 6099 */ 6100 enum ScanReportType { 6101 /** 6102 * The found of advertisement packet. 6103 * 6104 * @syscap SystemCapability.Communication.Bluetooth.Core 6105 * @crossplatform 6106 * @atomicservice 6107 * @since 15 6108 */ 6109 ON_FOUND = 1, 6110 /** 6111 * The lost of advertisement packet. 6112 * 6113 * @syscap SystemCapability.Communication.Bluetooth.Core 6114 * @crossplatform 6115 * @atomicservice 6116 * @since 15 6117 */ 6118 ON_LOST = 2, 6119 } 6120} 6121 6122export default ble;