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