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