161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (C) 2023-2024 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ConnectivityKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type { AsyncCallback, Callback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport type constant from './@ohos.bluetooth.constant'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * Provides methods to operate or manage Bluetooth. 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace connection 2861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 2961847f8eSopenharmony_ci * @since 10 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_ci/** 3261847f8eSopenharmony_ci * Provides methods to operate or manage Bluetooth. 3361847f8eSopenharmony_ci * 3461847f8eSopenharmony_ci * @namespace connection 3561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 3661847f8eSopenharmony_ci * @atomicservice 3761847f8eSopenharmony_ci * @since 12 3861847f8eSopenharmony_ci */ 3961847f8eSopenharmony_ci/** 4061847f8eSopenharmony_ci * Provides methods to operate or manage Bluetooth. 4161847f8eSopenharmony_ci * 4261847f8eSopenharmony_ci * @namespace connection 4361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 4461847f8eSopenharmony_ci * @crossplatform 4561847f8eSopenharmony_ci * @atomicservice 4661847f8eSopenharmony_ci * @since 13 4761847f8eSopenharmony_ci */ 4861847f8eSopenharmony_cideclare namespace connection { 4961847f8eSopenharmony_ci /** 5061847f8eSopenharmony_ci * Indicate the profile connection state. 5161847f8eSopenharmony_ci * 5261847f8eSopenharmony_ci * @typedef { constant.ProfileConnectionState } ProfileConnectionState 5361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 5461847f8eSopenharmony_ci * @since 10 5561847f8eSopenharmony_ci */ 5661847f8eSopenharmony_ci /** 5761847f8eSopenharmony_ci * Indicate the profile connection state. 5861847f8eSopenharmony_ci * 5961847f8eSopenharmony_ci * @typedef { constant.ProfileConnectionState } ProfileConnectionState 6061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 6161847f8eSopenharmony_ci * @crossplatform 6261847f8eSopenharmony_ci * @since 13 6361847f8eSopenharmony_ci */ 6461847f8eSopenharmony_ci type ProfileConnectionState = constant.ProfileConnectionState; 6561847f8eSopenharmony_ci 6661847f8eSopenharmony_ci /** 6761847f8eSopenharmony_ci * Indicate the profile id. 6861847f8eSopenharmony_ci * 6961847f8eSopenharmony_ci * @typedef { constant.ProfileId } ProfileId 7061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 7161847f8eSopenharmony_ci * @since 10 7261847f8eSopenharmony_ci */ 7361847f8eSopenharmony_ci /** 7461847f8eSopenharmony_ci * Indicate the profile id. 7561847f8eSopenharmony_ci * 7661847f8eSopenharmony_ci * @typedef { constant.ProfileId } ProfileId 7761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 7861847f8eSopenharmony_ci * @crossplatform 7961847f8eSopenharmony_ci * @since 13 8061847f8eSopenharmony_ci */ 8161847f8eSopenharmony_ci type ProfileId = constant.ProfileId; 8261847f8eSopenharmony_ci 8361847f8eSopenharmony_ci /** 8461847f8eSopenharmony_ci * Indicate the profile uuid. 8561847f8eSopenharmony_ci * 8661847f8eSopenharmony_ci * @typedef { constant.ProfileUuids } ProfileUuids 8761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 8861847f8eSopenharmony_ci * @systemapi 8961847f8eSopenharmony_ci * @since 10 9061847f8eSopenharmony_ci */ 9161847f8eSopenharmony_ci /** 9261847f8eSopenharmony_ci * Indicate the profile uuid. 9361847f8eSopenharmony_ci * 9461847f8eSopenharmony_ci * @typedef { constant.ProfileUuids } ProfileUuids 9561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 9661847f8eSopenharmony_ci * @since 12 9761847f8eSopenharmony_ci */ 9861847f8eSopenharmony_ci /** 9961847f8eSopenharmony_ci * Indicate the profile uuid. 10061847f8eSopenharmony_ci * 10161847f8eSopenharmony_ci * @typedef { constant.ProfileUuids } ProfileUuids 10261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 10361847f8eSopenharmony_ci * @crossplatform 10461847f8eSopenharmony_ci * @since 13 10561847f8eSopenharmony_ci */ 10661847f8eSopenharmony_ci type ProfileUuids = constant.ProfileUuids; 10761847f8eSopenharmony_ci 10861847f8eSopenharmony_ci /** 10961847f8eSopenharmony_ci * Indicate the major class of a bluetooth device. 11061847f8eSopenharmony_ci * 11161847f8eSopenharmony_ci * @typedef { constant.MajorClass } MajorClass 11261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 11361847f8eSopenharmony_ci * @since 10 11461847f8eSopenharmony_ci */ 11561847f8eSopenharmony_ci /** 11661847f8eSopenharmony_ci * Indicate the major class of a bluetooth device. 11761847f8eSopenharmony_ci * 11861847f8eSopenharmony_ci * @typedef { constant.MajorClass } MajorClass 11961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 12061847f8eSopenharmony_ci * @crossplatform 12161847f8eSopenharmony_ci * @since 13 12261847f8eSopenharmony_ci */ 12361847f8eSopenharmony_ci type MajorClass = constant.MajorClass; 12461847f8eSopenharmony_ci 12561847f8eSopenharmony_ci /** 12661847f8eSopenharmony_ci * Indicate the major minor class of a bluetooth device. 12761847f8eSopenharmony_ci * 12861847f8eSopenharmony_ci * @typedef { constant.MajorMinorClass } MajorMinorClass 12961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 13061847f8eSopenharmony_ci * @since 10 13161847f8eSopenharmony_ci */ 13261847f8eSopenharmony_ci /** 13361847f8eSopenharmony_ci * Indicate the major minor class of a bluetooth device. 13461847f8eSopenharmony_ci * 13561847f8eSopenharmony_ci * @typedef { constant.MajorMinorClass } MajorMinorClass 13661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 13761847f8eSopenharmony_ci * @crossplatform 13861847f8eSopenharmony_ci * @since 13 13961847f8eSopenharmony_ci */ 14061847f8eSopenharmony_ci type MajorMinorClass = constant.MajorMinorClass; 14161847f8eSopenharmony_ci 14261847f8eSopenharmony_ci /** 14361847f8eSopenharmony_ci * Get the profile connection state of the current device. 14461847f8eSopenharmony_ci * 14561847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 14661847f8eSopenharmony_ci * @param { ProfileId } [profileId] - Indicate the profile id. This is an optional parameter. 14761847f8eSopenharmony_ci * With profileId, returns the current connection state of this profile, {@link ProfileConnectionState}. 14861847f8eSopenharmony_ci * Without profileId, if any profile is connected, {@link ProfileConnectionState#STATE_CONNECTED} is returned. 14961847f8eSopenharmony_ci * Otherwise, {@link ProfileConnectionState#STATE_DISCONNECTED} is returned. 15061847f8eSopenharmony_ci * @returns { ProfileConnectionState } Returns the connection state. 15161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 15261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Incorrect parameter types. 15361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 15461847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 15561847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 15661847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 15761847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 15861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 15961847f8eSopenharmony_ci * @since 10 16061847f8eSopenharmony_ci */ 16161847f8eSopenharmony_ci /** 16261847f8eSopenharmony_ci * Get the profile connection state of the current device. 16361847f8eSopenharmony_ci * 16461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 16561847f8eSopenharmony_ci * @param { ProfileId } [profileId] - Indicate the profile id. This is an optional parameter. 16661847f8eSopenharmony_ci * With profileId, returns the current connection state of this profile, {@link ProfileConnectionState}. 16761847f8eSopenharmony_ci * Without profileId, if any profile is connected, {@link ProfileConnectionState#STATE_CONNECTED} is returned. 16861847f8eSopenharmony_ci * Otherwise, {@link ProfileConnectionState#STATE_DISCONNECTED} is returned. 16961847f8eSopenharmony_ci * @returns { ProfileConnectionState } Returns the connection state. 17061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 17161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Incorrect parameter types. 17261847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 17361847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 17461847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 17561847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 17661847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 17761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 17861847f8eSopenharmony_ci * @crossplatform 17961847f8eSopenharmony_ci * @since 13 18061847f8eSopenharmony_ci */ 18161847f8eSopenharmony_ci function getProfileConnectionState(profileId?: ProfileId): ProfileConnectionState; 18261847f8eSopenharmony_ci 18361847f8eSopenharmony_ci /** 18461847f8eSopenharmony_ci * Starts pairing with a remote Bluetooth device. 18561847f8eSopenharmony_ci * 18661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 18761847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 18861847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of pairDevice. 18961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 19061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 19161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 19261847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 19361847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 19461847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 19561847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 19661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 19761847f8eSopenharmony_ci * @since 10 19861847f8eSopenharmony_ci */ 19961847f8eSopenharmony_ci /** 20061847f8eSopenharmony_ci * Starts pairing with a remote Bluetooth device. 20161847f8eSopenharmony_ci * 20261847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 20361847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 20461847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of pairDevice. 20561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 20661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 20761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 20861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 20961847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 21061847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 21161847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 21261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 21361847f8eSopenharmony_ci * @atomicservice 21461847f8eSopenharmony_ci * @since 12 21561847f8eSopenharmony_ci */ 21661847f8eSopenharmony_ci /** 21761847f8eSopenharmony_ci * Starts pairing with a remote Bluetooth device. 21861847f8eSopenharmony_ci * 21961847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 22061847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 22161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of pairDevice. 22261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 22361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 22461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 22561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 22661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 22761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 22861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 22961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 23061847f8eSopenharmony_ci * @crossplatform 23161847f8eSopenharmony_ci * @atomicservice 23261847f8eSopenharmony_ci * @since 13 23361847f8eSopenharmony_ci */ 23461847f8eSopenharmony_ci function pairDevice(deviceId: string, callback: AsyncCallback<void>): void; 23561847f8eSopenharmony_ci 23661847f8eSopenharmony_ci /** 23761847f8eSopenharmony_ci * Starts pairing with a remote Bluetooth device. 23861847f8eSopenharmony_ci * 23961847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 24061847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 24161847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 24261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 24361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 24461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 24561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 24661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 24761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 24861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 24961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 25061847f8eSopenharmony_ci * @since 10 25161847f8eSopenharmony_ci */ 25261847f8eSopenharmony_ci /** 25361847f8eSopenharmony_ci * Starts pairing with a remote Bluetooth device. 25461847f8eSopenharmony_ci * 25561847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 25661847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 25761847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 25861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 25961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 26061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 26161847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 26261847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 26361847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 26461847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 26561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 26661847f8eSopenharmony_ci * @atomicservice 26761847f8eSopenharmony_ci * @since 12 26861847f8eSopenharmony_ci */ 26961847f8eSopenharmony_ci /** 27061847f8eSopenharmony_ci * Starts pairing with a remote Bluetooth device. 27161847f8eSopenharmony_ci * 27261847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 27361847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 27461847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 27561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 27661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 27761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 27861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 27961847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 28061847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 28161847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 28261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 28361847f8eSopenharmony_ci * @crossplatform 28461847f8eSopenharmony_ci * @atomicservice 28561847f8eSopenharmony_ci * @since 13 28661847f8eSopenharmony_ci */ 28761847f8eSopenharmony_ci function pairDevice(deviceId: string): Promise<void>; 28861847f8eSopenharmony_ci 28961847f8eSopenharmony_ci /** 29061847f8eSopenharmony_ci * Starts pairing with a credible remote Bluetooth device with transport. 29161847f8eSopenharmony_ci * This interface does not trigger a dialog box and does not require user authorization. 29261847f8eSopenharmony_ci * Only specific system application can use this function. 29361847f8eSopenharmony_ci * 29461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 29561847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 29661847f8eSopenharmony_ci * @param { BluetoothTransport } transport - the transport of the remote device to pair. 29761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of pairCredibleDevice. 29861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 29961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 30061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 30161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 30261847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 30361847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 30461847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 30561847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 30661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 30761847f8eSopenharmony_ci * @systemapi 30861847f8eSopenharmony_ci * @since 10 30961847f8eSopenharmony_ci */ 31061847f8eSopenharmony_ci function pairCredibleDevice(deviceId: string, transport: BluetoothTransport, callback: AsyncCallback<void>): void; 31161847f8eSopenharmony_ci 31261847f8eSopenharmony_ci /** 31361847f8eSopenharmony_ci * Starts pairing with a credible remote Bluetooth device with transport. 31461847f8eSopenharmony_ci * This interface does not trigger a dialog box and does not require user authorization. 31561847f8eSopenharmony_ci * Only specific system application can use this function. 31661847f8eSopenharmony_ci * 31761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 31861847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 31961847f8eSopenharmony_ci * @param { BluetoothTransport } transport - the transport of the remote device to pair. 32061847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 32161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 32261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 32361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 32461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 32561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 32661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 32761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 32861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 32961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 33061847f8eSopenharmony_ci * @systemapi 33161847f8eSopenharmony_ci * @since 10 33261847f8eSopenharmony_ci */ 33361847f8eSopenharmony_ci function pairCredibleDevice(deviceId: string, transport: BluetoothTransport): Promise<void>; 33461847f8eSopenharmony_ci 33561847f8eSopenharmony_ci /** 33661847f8eSopenharmony_ci * Remove a paired remote device. 33761847f8eSopenharmony_ci * 33861847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 33961847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 34061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of cancelPairedDevice. 34161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 34261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 34361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 34461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 34561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 34661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 34761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 34861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 34961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 35061847f8eSopenharmony_ci * @systemapi 35161847f8eSopenharmony_ci * @since 10 35261847f8eSopenharmony_ci */ 35361847f8eSopenharmony_ci function cancelPairedDevice(deviceId: string, callback: AsyncCallback<void>): void; 35461847f8eSopenharmony_ci 35561847f8eSopenharmony_ci /** 35661847f8eSopenharmony_ci * Remove a paired remote device. 35761847f8eSopenharmony_ci * 35861847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 35961847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 36061847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 36161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 36261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 36361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 36461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 36561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 36661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 36761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 36861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 36961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 37061847f8eSopenharmony_ci * @systemapi 37161847f8eSopenharmony_ci * @since 10 37261847f8eSopenharmony_ci */ 37361847f8eSopenharmony_ci function cancelPairedDevice(deviceId: string): Promise<void>; 37461847f8eSopenharmony_ci 37561847f8eSopenharmony_ci /** 37661847f8eSopenharmony_ci * Remove a pairing remote device. 37761847f8eSopenharmony_ci * 37861847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 37961847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 38061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of cancelPairingDevice. 38161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 38261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 38361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 38461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 38561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 38661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 38761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 38861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 38961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 39061847f8eSopenharmony_ci * @systemapi 39161847f8eSopenharmony_ci * @since 10 39261847f8eSopenharmony_ci */ 39361847f8eSopenharmony_ci function cancelPairingDevice(deviceId: string, callback: AsyncCallback<void>): void; 39461847f8eSopenharmony_ci 39561847f8eSopenharmony_ci /** 39661847f8eSopenharmony_ci * Remove a pairing remote device. 39761847f8eSopenharmony_ci * 39861847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 39961847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 40061847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 40161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 40261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 40361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 40461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 40561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 40661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 40761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 40861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 40961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 41061847f8eSopenharmony_ci * @systemapi 41161847f8eSopenharmony_ci * @since 10 41261847f8eSopenharmony_ci */ 41361847f8eSopenharmony_ci function cancelPairingDevice(deviceId: string): Promise<void>; 41461847f8eSopenharmony_ci 41561847f8eSopenharmony_ci /** 41661847f8eSopenharmony_ci * Obtains the name of a peer Bluetooth device. 41761847f8eSopenharmony_ci * 41861847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 41961847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 42061847f8eSopenharmony_ci * @returns { string } Returns the device name in character string format. 42161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 42261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 42361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 42461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 42561847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 42661847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 42761847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 42861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 42961847f8eSopenharmony_ci * @since 10 43061847f8eSopenharmony_ci */ 43161847f8eSopenharmony_ci /** 43261847f8eSopenharmony_ci * Obtains the name of a peer Bluetooth device. 43361847f8eSopenharmony_ci * 43461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 43561847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 43661847f8eSopenharmony_ci * @returns { string } Returns the device name in character string format. 43761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 43861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 43961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 44061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 44161847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 44261847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 44361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 44461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 44561847f8eSopenharmony_ci * @atomicservice 44661847f8eSopenharmony_ci * @since 12 44761847f8eSopenharmony_ci */ 44861847f8eSopenharmony_ci /** 44961847f8eSopenharmony_ci * Obtains the name of a peer Bluetooth device. 45061847f8eSopenharmony_ci * 45161847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 45261847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 45361847f8eSopenharmony_ci * @returns { string } Returns the device name in character string format. 45461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 45561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 45661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 45761847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 45861847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 45961847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 46061847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 46161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 46261847f8eSopenharmony_ci * @crossplatform 46361847f8eSopenharmony_ci * @atomicservice 46461847f8eSopenharmony_ci * @since 13 46561847f8eSopenharmony_ci */ 46661847f8eSopenharmony_ci function getRemoteDeviceName(deviceId: string): string; 46761847f8eSopenharmony_ci 46861847f8eSopenharmony_ci /** 46961847f8eSopenharmony_ci * Obtains the class of a peer Bluetooth device. 47061847f8eSopenharmony_ci * 47161847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 47261847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 47361847f8eSopenharmony_ci * @returns { DeviceClass } The class of the remote device. 47461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 47561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 47661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 47761847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 47861847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 47961847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 48061847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 48161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 48261847f8eSopenharmony_ci * @since 10 48361847f8eSopenharmony_ci */ 48461847f8eSopenharmony_ci /** 48561847f8eSopenharmony_ci * Obtains the class of a peer Bluetooth device. 48661847f8eSopenharmony_ci * 48761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 48861847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 48961847f8eSopenharmony_ci * @returns { DeviceClass } The class of the remote device. 49061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 49161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 49261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 49361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 49461847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 49561847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 49661847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 49761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 49861847f8eSopenharmony_ci * @crossplatform 49961847f8eSopenharmony_ci * @since 13 50061847f8eSopenharmony_ci */ 50161847f8eSopenharmony_ci function getRemoteDeviceClass(deviceId: string): DeviceClass; 50261847f8eSopenharmony_ci 50361847f8eSopenharmony_ci /** 50461847f8eSopenharmony_ci * Obtains the Bluetooth local name of a device. 50561847f8eSopenharmony_ci * 50661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 50761847f8eSopenharmony_ci * @returns { string } Returns the name the device. 50861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 50961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 51061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 51161847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 51261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 51361847f8eSopenharmony_ci * @since 10 51461847f8eSopenharmony_ci */ 51561847f8eSopenharmony_ci /** 51661847f8eSopenharmony_ci * Obtains the Bluetooth local name of a device. 51761847f8eSopenharmony_ci * 51861847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 51961847f8eSopenharmony_ci * @returns { string } Returns the name the device. 52061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 52161847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 52261847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 52361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 52461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 52561847f8eSopenharmony_ci * @crossplatform 52661847f8eSopenharmony_ci * @since 13 52761847f8eSopenharmony_ci */ 52861847f8eSopenharmony_ci function getLocalName(): string; 52961847f8eSopenharmony_ci 53061847f8eSopenharmony_ci /** 53161847f8eSopenharmony_ci * Obtains the list of Bluetooth devices that have been paired with the current device. 53261847f8eSopenharmony_ci * 53361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 53461847f8eSopenharmony_ci * @returns { Array<string> } Returns a list of paired Bluetooth devices's address. 53561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 53661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 53761847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 53861847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 53961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 54061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 54161847f8eSopenharmony_ci * @since 10 54261847f8eSopenharmony_ci */ 54361847f8eSopenharmony_ci /** 54461847f8eSopenharmony_ci * Obtains the list of Bluetooth devices that have been paired with the current device. 54561847f8eSopenharmony_ci * 54661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 54761847f8eSopenharmony_ci * @returns { Array<string> } Returns a list of paired Bluetooth devices's address. 54861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 54961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 55061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 55161847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 55261847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 55361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 55461847f8eSopenharmony_ci * @atomicservice 55561847f8eSopenharmony_ci * @since 12 55661847f8eSopenharmony_ci */ 55761847f8eSopenharmony_ci /** 55861847f8eSopenharmony_ci * Obtains the list of Bluetooth devices that have been paired with the current device. 55961847f8eSopenharmony_ci * 56061847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 56161847f8eSopenharmony_ci * @returns { Array<string> } Returns a list of paired Bluetooth devices's address. 56261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 56361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 56461847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 56561847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 56661847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 56761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 56861847f8eSopenharmony_ci * @crossplatform 56961847f8eSopenharmony_ci * @atomicservice 57061847f8eSopenharmony_ci * @since 13 57161847f8eSopenharmony_ci */ 57261847f8eSopenharmony_ci function getPairedDevices(): Array<string>; 57361847f8eSopenharmony_ci 57461847f8eSopenharmony_ci /** 57561847f8eSopenharmony_ci * Obtains the pair state of a specified device. 57661847f8eSopenharmony_ci * 57761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 57861847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 57961847f8eSopenharmony_ci * @returns { BondState } Returns the pair state. 58061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 58161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 58261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 58361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 58461847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 58561847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 58661847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 58761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 58861847f8eSopenharmony_ci * @since 11 58961847f8eSopenharmony_ci */ 59061847f8eSopenharmony_ci /** 59161847f8eSopenharmony_ci * Obtains the pair state of a specified device. 59261847f8eSopenharmony_ci * 59361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 59461847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 59561847f8eSopenharmony_ci * @returns { BondState } Returns the pair state. 59661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 59761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 59861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 59961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 60061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 60161847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 60261847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 60361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 60461847f8eSopenharmony_ci * @atomicservice 60561847f8eSopenharmony_ci * @since 12 60661847f8eSopenharmony_ci */ 60761847f8eSopenharmony_ci /** 60861847f8eSopenharmony_ci * Obtains the pair state of a specified device. 60961847f8eSopenharmony_ci * 61061847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 61161847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 61261847f8eSopenharmony_ci * @returns { BondState } Returns the pair state. 61361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 61461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 61561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 61661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 61761847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 61861847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 61961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 62061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 62161847f8eSopenharmony_ci * @crossplatform 62261847f8eSopenharmony_ci * @atomicservice 62361847f8eSopenharmony_ci * @since 13 62461847f8eSopenharmony_ci */ 62561847f8eSopenharmony_ci function getPairState(deviceId: string): BondState; 62661847f8eSopenharmony_ci 62761847f8eSopenharmony_ci /** 62861847f8eSopenharmony_ci * Sets the confirmation of pairing with a certain device. 62961847f8eSopenharmony_ci * 63061847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 63161847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 63261847f8eSopenharmony_ci * @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise. 63361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 63461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 63561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 63661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 63761847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 63861847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 63961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 64061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 64161847f8eSopenharmony_ci * @since 10 64261847f8eSopenharmony_ci */ 64361847f8eSopenharmony_ci function setDevicePairingConfirmation(deviceId: string, accept: boolean): void; 64461847f8eSopenharmony_ci 64561847f8eSopenharmony_ci /** 64661847f8eSopenharmony_ci * Set the pin during pairing when the pin type is PIN_TYPE_ENTER_PIN_CODE. 64761847f8eSopenharmony_ci * 64861847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 64961847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 65061847f8eSopenharmony_ci * @param { string } code - The pin code entered by the user. 65161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setDevicePinCode. 65261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 65361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 65461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 65561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 65661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 65761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 65861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 65961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 66061847f8eSopenharmony_ci * @since 10 66161847f8eSopenharmony_ci */ 66261847f8eSopenharmony_ci function setDevicePinCode(deviceId: string, code: string, callback: AsyncCallback<void>): void; 66361847f8eSopenharmony_ci 66461847f8eSopenharmony_ci /** 66561847f8eSopenharmony_ci * Set the pin during pairing when the pin type is PIN_TYPE_ENTER_PIN_CODE. 66661847f8eSopenharmony_ci * 66761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 66861847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 66961847f8eSopenharmony_ci * @param { string } code - The pin code entered by the user. 67061847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 67161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 67261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 67361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 67461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 67561847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 67661847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 67761847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 67861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 67961847f8eSopenharmony_ci * @since 10 68061847f8eSopenharmony_ci */ 68161847f8eSopenharmony_ci function setDevicePinCode(deviceId: string, code: string): Promise<void>; 68261847f8eSopenharmony_ci 68361847f8eSopenharmony_ci /** 68461847f8eSopenharmony_ci * Sets the Bluetooth friendly name of a device. It is used only by system applications for security. 68561847f8eSopenharmony_ci * If a non-system application invokes the interface, exception 801 is thrown. 68661847f8eSopenharmony_ci * 68761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 68861847f8eSopenharmony_ci * @param { string } name - Indicates a valid Bluetooth name. 68961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 69061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 69161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 69261847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 69361847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 69461847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 69561847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 69661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 69761847f8eSopenharmony_ci * @since 10 69861847f8eSopenharmony_ci * @deprecated since 12 69961847f8eSopenharmony_ci */ 70061847f8eSopenharmony_ci function setLocalName(name: string): void; 70161847f8eSopenharmony_ci 70261847f8eSopenharmony_ci /** 70361847f8eSopenharmony_ci * Sets the Bluetooth scan mode for a device. 70461847f8eSopenharmony_ci * 70561847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 70661847f8eSopenharmony_ci * @param { ScanMode } mode - Indicates the Bluetooth scan mode to set. 70761847f8eSopenharmony_ci * @param { number } duration - Indicates the duration in seconds, in which the host is discoverable. 70861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 70961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 71061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 71161847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 71261847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 71361847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 71461847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 71561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 71661847f8eSopenharmony_ci * @since 10 71761847f8eSopenharmony_ci */ 71861847f8eSopenharmony_ci function setBluetoothScanMode(mode: ScanMode, duration: number): void; 71961847f8eSopenharmony_ci 72061847f8eSopenharmony_ci /** 72161847f8eSopenharmony_ci * Obtains the Bluetooth scanning mode of a device. 72261847f8eSopenharmony_ci * 72361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 72461847f8eSopenharmony_ci * @returns { ScanMode } Returns the Bluetooth scanning mode. 72561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 72661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 72761847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 72861847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 72961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 73061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 73161847f8eSopenharmony_ci * @since 10 73261847f8eSopenharmony_ci */ 73361847f8eSopenharmony_ci /** 73461847f8eSopenharmony_ci * Obtains the Bluetooth scanning mode of a device. 73561847f8eSopenharmony_ci * 73661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 73761847f8eSopenharmony_ci * @returns { ScanMode } Returns the Bluetooth scanning mode. 73861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 73961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 74061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 74161847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 74261847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 74361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 74461847f8eSopenharmony_ci * @crossplatform 74561847f8eSopenharmony_ci * @since 13 74661847f8eSopenharmony_ci */ 74761847f8eSopenharmony_ci function getBluetoothScanMode(): ScanMode; 74861847f8eSopenharmony_ci 74961847f8eSopenharmony_ci /** 75061847f8eSopenharmony_ci * Starts scanning Bluetooth devices. 75161847f8eSopenharmony_ci * 75261847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 75361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 75461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 75561847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 75661847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 75761847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 75861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 75961847f8eSopenharmony_ci * @since 10 76061847f8eSopenharmony_ci */ 76161847f8eSopenharmony_ci /** 76261847f8eSopenharmony_ci * Starts scanning Bluetooth devices. 76361847f8eSopenharmony_ci * 76461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 76561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 76661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 76761847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 76861847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 76961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 77061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 77161847f8eSopenharmony_ci * @atomicservice 77261847f8eSopenharmony_ci * @since 12 77361847f8eSopenharmony_ci */ 77461847f8eSopenharmony_ci /** 77561847f8eSopenharmony_ci * Starts scanning Bluetooth devices. 77661847f8eSopenharmony_ci * 77761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 77861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 77961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 78061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 78161847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 78261847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 78361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 78461847f8eSopenharmony_ci * @crossplatform 78561847f8eSopenharmony_ci * @atomicservice 78661847f8eSopenharmony_ci * @since 13 78761847f8eSopenharmony_ci */ 78861847f8eSopenharmony_ci function startBluetoothDiscovery(): void; 78961847f8eSopenharmony_ci 79061847f8eSopenharmony_ci /** 79161847f8eSopenharmony_ci * Stops Bluetooth device scanning. 79261847f8eSopenharmony_ci * 79361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 79461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 79561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 79661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 79761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 79861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 79961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 80061847f8eSopenharmony_ci * @since 10 80161847f8eSopenharmony_ci */ 80261847f8eSopenharmony_ci /** 80361847f8eSopenharmony_ci * Stops Bluetooth device scanning. 80461847f8eSopenharmony_ci * 80561847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 80661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 80761847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 80861847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 80961847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 81061847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 81161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 81261847f8eSopenharmony_ci * @atomicservice 81361847f8eSopenharmony_ci * @since 12 81461847f8eSopenharmony_ci */ 81561847f8eSopenharmony_ci /** 81661847f8eSopenharmony_ci * Stops Bluetooth device scanning. 81761847f8eSopenharmony_ci * 81861847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 81961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 82061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 82161847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 82261847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 82361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 82461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 82561847f8eSopenharmony_ci * @crossplatform 82661847f8eSopenharmony_ci * @atomicservice 82761847f8eSopenharmony_ci * @since 13 82861847f8eSopenharmony_ci */ 82961847f8eSopenharmony_ci function stopBluetoothDiscovery(): void; 83061847f8eSopenharmony_ci 83161847f8eSopenharmony_ci /** 83261847f8eSopenharmony_ci * Check if bluetooth is discovering. 83361847f8eSopenharmony_ci * 83461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 83561847f8eSopenharmony_ci * @returns { boolean } Returns {@code true} if the local device is discovering; returns {@code false} otherwise. 83661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 83761847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 83861847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 83961847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 84061847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 84161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 84261847f8eSopenharmony_ci * @since 11 84361847f8eSopenharmony_ci */ 84461847f8eSopenharmony_ci /** 84561847f8eSopenharmony_ci * Check if bluetooth is discovering. 84661847f8eSopenharmony_ci * 84761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 84861847f8eSopenharmony_ci * @returns { boolean } Returns {@code true} if the local device is discovering; returns {@code false} otherwise. 84961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 85061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 85161847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 85261847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 85361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 85461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 85561847f8eSopenharmony_ci * @crossplatform 85661847f8eSopenharmony_ci * @since 13 85761847f8eSopenharmony_ci */ 85861847f8eSopenharmony_ci function isBluetoothDiscovering(): boolean; 85961847f8eSopenharmony_ci 86061847f8eSopenharmony_ci /** 86161847f8eSopenharmony_ci * Obtains the profile UUIDs supported by the local device. 86261847f8eSopenharmony_ci * 86361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 86461847f8eSopenharmony_ci * @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getLocalProfileUuids. 86561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 86661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 86761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 86861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 86961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 87061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 87161847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 87261847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 87361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 87461847f8eSopenharmony_ci * @systemapi 87561847f8eSopenharmony_ci * @since 10 87661847f8eSopenharmony_ci */ 87761847f8eSopenharmony_ci function getLocalProfileUuids(callback: AsyncCallback<Array<ProfileUuids>>): void; 87861847f8eSopenharmony_ci 87961847f8eSopenharmony_ci /** 88061847f8eSopenharmony_ci * Obtains the profile UUIDs supported by the local device. 88161847f8eSopenharmony_ci * 88261847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 88361847f8eSopenharmony_ci * @returns { Promise<Array<ProfileUuids>> } Returns the promise object. 88461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 88561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 88661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 88761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 88861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 88961847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 89061847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 89161847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 89261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 89361847f8eSopenharmony_ci * @systemapi 89461847f8eSopenharmony_ci * @since 10 89561847f8eSopenharmony_ci */ 89661847f8eSopenharmony_ci function getLocalProfileUuids(): Promise<Array<ProfileUuids>>; 89761847f8eSopenharmony_ci 89861847f8eSopenharmony_ci /** 89961847f8eSopenharmony_ci * Obtains the profile UUIDs supported by the remote device. 90061847f8eSopenharmony_ci * 90161847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 90261847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 90361847f8eSopenharmony_ci * @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getRemoteProfileUuids. 90461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 90561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 90661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 90761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 90861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 90961847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 91061847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 91161847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 91261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 91361847f8eSopenharmony_ci * @systemapi 91461847f8eSopenharmony_ci * @since 10 91561847f8eSopenharmony_ci */ 91661847f8eSopenharmony_ci /** 91761847f8eSopenharmony_ci * Obtains the profile UUIDs supported by the remote device. 91861847f8eSopenharmony_ci * 91961847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 92061847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 92161847f8eSopenharmony_ci * @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getRemoteProfileUuids. 92261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 92361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. 92461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 92561847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 92661847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 92761847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 92861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 92961847f8eSopenharmony_ci * @since 12 93061847f8eSopenharmony_ci */ 93161847f8eSopenharmony_ci /** 93261847f8eSopenharmony_ci * Obtains the profile UUIDs supported by the remote device. 93361847f8eSopenharmony_ci * 93461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 93561847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 93661847f8eSopenharmony_ci * @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getRemoteProfileUuids. 93761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 93861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. 93961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 94061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 94161847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 94261847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 94361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 94461847f8eSopenharmony_ci * @crossplatform 94561847f8eSopenharmony_ci * @since 13 94661847f8eSopenharmony_ci */ 94761847f8eSopenharmony_ci function getRemoteProfileUuids(deviceId: string, callback: AsyncCallback<Array<ProfileUuids>>): void; 94861847f8eSopenharmony_ci 94961847f8eSopenharmony_ci /** 95061847f8eSopenharmony_ci * Obtains the profile UUIDs supported by the remote device. 95161847f8eSopenharmony_ci * 95261847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 95361847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 95461847f8eSopenharmony_ci * @returns { Promise<Array<ProfileUuids>> } Returns the promise object. 95561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 95661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 95761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 95861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 95961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 96061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 96161847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 96261847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 96361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 96461847f8eSopenharmony_ci * @systemapi 96561847f8eSopenharmony_ci * @since 10 96661847f8eSopenharmony_ci */ 96761847f8eSopenharmony_ci /** 96861847f8eSopenharmony_ci * Obtains the profile UUIDs supported by the remote device. 96961847f8eSopenharmony_ci * 97061847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 97161847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 97261847f8eSopenharmony_ci * @returns { Promise<Array<ProfileUuids>> } Returns the promise object. 97361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 97461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. 97561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 97661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 97761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 97861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 97961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 98061847f8eSopenharmony_ci * @since 12 98161847f8eSopenharmony_ci */ 98261847f8eSopenharmony_ci /** 98361847f8eSopenharmony_ci * Obtains the profile UUIDs supported by the remote device. 98461847f8eSopenharmony_ci * 98561847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 98661847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 98761847f8eSopenharmony_ci * @returns { Promise<Array<ProfileUuids>> } Returns the promise object. 98861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 98961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. 99061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 99161847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 99261847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 99361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 99461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 99561847f8eSopenharmony_ci * @crossplatform 99661847f8eSopenharmony_ci * @since 13 99761847f8eSopenharmony_ci */ 99861847f8eSopenharmony_ci function getRemoteProfileUuids(deviceId: string): Promise<Array<ProfileUuids>>; 99961847f8eSopenharmony_ci 100061847f8eSopenharmony_ci /** 100161847f8eSopenharmony_ci * Connects all allowed bluetooth profiles between the local and remote device. 100261847f8eSopenharmony_ci * 100361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 100461847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 100561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback result. 100661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 100761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 100861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 100961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 101061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 101161847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 101261847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 101361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 101461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 101561847f8eSopenharmony_ci * @systemapi 101661847f8eSopenharmony_ci * @since 11 101761847f8eSopenharmony_ci */ 101861847f8eSopenharmony_ci function connectAllowedProfiles(deviceId: string, callback: AsyncCallback<void>): void; 101961847f8eSopenharmony_ci 102061847f8eSopenharmony_ci /** 102161847f8eSopenharmony_ci * Connects all allowed bluetooth profiles between the local and remote device. 102261847f8eSopenharmony_ci * 102361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 102461847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 102561847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 102661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 102761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 102861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 102961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 103061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 103161847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 103261847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 103361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 103461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 103561847f8eSopenharmony_ci * @systemapi 103661847f8eSopenharmony_ci * @since 11 103761847f8eSopenharmony_ci */ 103861847f8eSopenharmony_ci function connectAllowedProfiles(deviceId: string): Promise<void>; 103961847f8eSopenharmony_ci 104061847f8eSopenharmony_ci /** 104161847f8eSopenharmony_ci * Disconnects all allowed bluetooth profiles between the local and remote device. 104261847f8eSopenharmony_ci * 104361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 104461847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 104561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback result. 104661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 104761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 104861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 104961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 105061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 105161847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 105261847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 105361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 105461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 105561847f8eSopenharmony_ci * @systemapi 105661847f8eSopenharmony_ci * @since 11 105761847f8eSopenharmony_ci */ 105861847f8eSopenharmony_ci function disconnectAllowedProfiles(deviceId: string, callback: AsyncCallback<void>): void; 105961847f8eSopenharmony_ci 106061847f8eSopenharmony_ci /** 106161847f8eSopenharmony_ci * Get remote device battery information. 106261847f8eSopenharmony_ci * 106361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 106461847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 106561847f8eSopenharmony_ci * @returns { Promise<BatteryInfo> } Returns battery info. 106661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 106761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 106861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 106961847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 107061847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 107161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 107261847f8eSopenharmony_ci * @since 12 107361847f8eSopenharmony_ci */ 107461847f8eSopenharmony_ci function getRemoteDeviceBatteryInfo(deviceId: string): Promise<BatteryInfo>; 107561847f8eSopenharmony_ci 107661847f8eSopenharmony_ci /** 107761847f8eSopenharmony_ci * Obtains the product ID of a remote device. 107861847f8eSopenharmony_ci * 107961847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 108061847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 108161847f8eSopenharmony_ci * @returns { string } Returns the remote device's product ID. 108261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 108361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 108461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 108561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 108661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 108761847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 108861847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 108961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 109061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 109161847f8eSopenharmony_ci * @systemapi 109261847f8eSopenharmony_ci * @since 11 109361847f8eSopenharmony_ci */ 109461847f8eSopenharmony_ci function getRemoteProductId(deviceId: string): string; 109561847f8eSopenharmony_ci 109661847f8eSopenharmony_ci /** 109761847f8eSopenharmony_ci * Disconnects all allowed bluetooth profiles between the local and remote device. 109861847f8eSopenharmony_ci * 109961847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 110061847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 110161847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 110261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 110361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 110461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 110561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 110661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 110761847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 110861847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 110961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 111061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 111161847f8eSopenharmony_ci * @systemapi 111261847f8eSopenharmony_ci * @since 11 111361847f8eSopenharmony_ci */ 111461847f8eSopenharmony_ci function disconnectAllowedProfiles(deviceId: string): Promise<void>; 111561847f8eSopenharmony_ci 111661847f8eSopenharmony_ci /** 111761847f8eSopenharmony_ci * Modify remote device name. 111861847f8eSopenharmony_ci * 111961847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 112061847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 112161847f8eSopenharmony_ci * @param { string } name - New device name. Max length is 64 bytes. 112261847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 112361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 112461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 112561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 112661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 112761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 112861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 112961847f8eSopenharmony_ci * @atomicservice 113061847f8eSopenharmony_ci * @since 12 113161847f8eSopenharmony_ci */ 113261847f8eSopenharmony_ci function setRemoteDeviceName(deviceId: string, name: string): Promise<void>; 113361847f8eSopenharmony_ci 113461847f8eSopenharmony_ci /** 113561847f8eSopenharmony_ci * Set remote device custom type. 113661847f8eSopenharmony_ci * 113761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 113861847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 113961847f8eSopenharmony_ci * @param { DeviceType } type - Indicates device type. 114061847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 114161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 114261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 114361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 114461847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 114561847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 114661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 114761847f8eSopenharmony_ci * @systemapi 114861847f8eSopenharmony_ci * @since 12 114961847f8eSopenharmony_ci */ 115061847f8eSopenharmony_ci function setRemoteDeviceType(deviceId: string, type: DeviceType): Promise<void>; 115161847f8eSopenharmony_ci 115261847f8eSopenharmony_ci /** 115361847f8eSopenharmony_ci * Get remote device custom type. 115461847f8eSopenharmony_ci * 115561847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 115661847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 115761847f8eSopenharmony_ci * @returns { Promise<DeviceType> } Returns the device type. 115861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 115961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 116061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 116161847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 116261847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 116361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 116461847f8eSopenharmony_ci * @systemapi 116561847f8eSopenharmony_ci * @since 12 116661847f8eSopenharmony_ci */ 116761847f8eSopenharmony_ci function getRemoteDeviceType(deviceId: string): Promise<DeviceType>; 116861847f8eSopenharmony_ci 116961847f8eSopenharmony_ci /** 117061847f8eSopenharmony_ci * Subscribe the event reported when a remote Bluetooth device is discovered. 117161847f8eSopenharmony_ci * 117261847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 117361847f8eSopenharmony_ci * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 117461847f8eSopenharmony_ci * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 117561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 117661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 117761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 117861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 117961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 118061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 118161847f8eSopenharmony_ci * @since 10 118261847f8eSopenharmony_ci */ 118361847f8eSopenharmony_ci /** 118461847f8eSopenharmony_ci * Subscribe the event reported when a remote Bluetooth device is discovered. 118561847f8eSopenharmony_ci * 118661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 118761847f8eSopenharmony_ci * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 118861847f8eSopenharmony_ci * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 118961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 119061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 119161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 119261847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 119361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 119461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 119561847f8eSopenharmony_ci * @atomicservice 119661847f8eSopenharmony_ci * @since 12 119761847f8eSopenharmony_ci */ 119861847f8eSopenharmony_ci /** 119961847f8eSopenharmony_ci * Subscribe the event reported when a remote Bluetooth device is discovered. 120061847f8eSopenharmony_ci * 120161847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 120261847f8eSopenharmony_ci * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 120361847f8eSopenharmony_ci * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 120461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 120561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 120661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 120761847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 120861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 120961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 121061847f8eSopenharmony_ci * @crossplatform 121161847f8eSopenharmony_ci * @atomicservice 121261847f8eSopenharmony_ci * @since 13 121361847f8eSopenharmony_ci */ 121461847f8eSopenharmony_ci function on(type: 'bluetoothDeviceFind', callback: Callback<Array<string>>): void; 121561847f8eSopenharmony_ci 121661847f8eSopenharmony_ci /** 121761847f8eSopenharmony_ci * Unsubscribe the event reported when a remote Bluetooth device is discovered. 121861847f8eSopenharmony_ci * 121961847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 122061847f8eSopenharmony_ci * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 122161847f8eSopenharmony_ci * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 122261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 122361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 122461847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 122561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 122661847f8eSopenharmony_ci * @since 10 122761847f8eSopenharmony_ci */ 122861847f8eSopenharmony_ci /** 122961847f8eSopenharmony_ci * Unsubscribe the event reported when a remote Bluetooth device is discovered. 123061847f8eSopenharmony_ci * 123161847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 123261847f8eSopenharmony_ci * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 123361847f8eSopenharmony_ci * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 123461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 123561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 123661847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 123761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 123861847f8eSopenharmony_ci * @atomicservice 123961847f8eSopenharmony_ci * @since 12 124061847f8eSopenharmony_ci */ 124161847f8eSopenharmony_ci /** 124261847f8eSopenharmony_ci * Unsubscribe the event reported when a remote Bluetooth device is discovered. 124361847f8eSopenharmony_ci * 124461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 124561847f8eSopenharmony_ci * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. 124661847f8eSopenharmony_ci * @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event. 124761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 124861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 124961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 125061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 125161847f8eSopenharmony_ci * @crossplatform 125261847f8eSopenharmony_ci * @atomicservice 125361847f8eSopenharmony_ci * @since 13 125461847f8eSopenharmony_ci */ 125561847f8eSopenharmony_ci function off(type: 'bluetoothDeviceFind', callback?: Callback<Array<string>>): void; 125661847f8eSopenharmony_ci 125761847f8eSopenharmony_ci /** 125861847f8eSopenharmony_ci * Subscribe the event reported when a remote Bluetooth device is discovered. 125961847f8eSopenharmony_ci * 126061847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.GET_BLUETOOTH_PEERS_MAC 126161847f8eSopenharmony_ci * @param { 'discoveryResult' } type - Type of the discovering event to listen for. 126261847f8eSopenharmony_ci * @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event. 126361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 126461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 126561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 126661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 126761847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 126861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 126961847f8eSopenharmony_ci * @systemapi 127061847f8eSopenharmony_ci * @since 12 127161847f8eSopenharmony_ci */ 127261847f8eSopenharmony_ci function on(type: 'discoveryResult', callback: Callback<Array<DiscoveryResult>>): void; 127361847f8eSopenharmony_ci 127461847f8eSopenharmony_ci /** 127561847f8eSopenharmony_ci * Unsubscribe the event reported when a remote Bluetooth device is discovered. 127661847f8eSopenharmony_ci * 127761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.GET_BLUETOOTH_PEERS_MAC 127861847f8eSopenharmony_ci * @param { 'discoveryResult' } type - Type of the discovering event to listen for. 127961847f8eSopenharmony_ci * @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event. 128061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 128161847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 128261847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 128361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 128461847f8eSopenharmony_ci * @systemapi 128561847f8eSopenharmony_ci * @since 12 128661847f8eSopenharmony_ci */ 128761847f8eSopenharmony_ci function off(type: 'discoveryResult', callback?: Callback<Array<DiscoveryResult>>): void; 128861847f8eSopenharmony_ci 128961847f8eSopenharmony_ci /** 129061847f8eSopenharmony_ci * Subscribe the event reported when a remote Bluetooth device is bonded. 129161847f8eSopenharmony_ci * 129261847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 129361847f8eSopenharmony_ci * @param { 'bondStateChange' } type - Type of the bond state event to listen for. 129461847f8eSopenharmony_ci * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event. 129561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 129661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 129761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 129861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 129961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 130061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 130161847f8eSopenharmony_ci * @since 10 130261847f8eSopenharmony_ci */ 130361847f8eSopenharmony_ci /** 130461847f8eSopenharmony_ci * Subscribe the event reported when a remote Bluetooth device is bonded. 130561847f8eSopenharmony_ci * 130661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 130761847f8eSopenharmony_ci * @param { 'bondStateChange' } type - Type of the bond state event to listen for. 130861847f8eSopenharmony_ci * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event. 130961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 131061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 131161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 131261847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 131361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 131461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 131561847f8eSopenharmony_ci * @crossplatform 131661847f8eSopenharmony_ci * @since 13 131761847f8eSopenharmony_ci */ 131861847f8eSopenharmony_ci function on(type: 'bondStateChange', callback: Callback<BondStateParam>): void; 131961847f8eSopenharmony_ci 132061847f8eSopenharmony_ci /** 132161847f8eSopenharmony_ci * Unsubscribe the event reported when a remote Bluetooth device is bonded. 132261847f8eSopenharmony_ci * 132361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 132461847f8eSopenharmony_ci * @param { 'bondStateChange' } type - Type of the bond state event to listen for. 132561847f8eSopenharmony_ci * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event. 132661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 132761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 132861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 132961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 133061847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 133161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 133261847f8eSopenharmony_ci * @since 10 133361847f8eSopenharmony_ci */ 133461847f8eSopenharmony_ci /** 133561847f8eSopenharmony_ci * Unsubscribe the event reported when a remote Bluetooth device is bonded. 133661847f8eSopenharmony_ci * 133761847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 133861847f8eSopenharmony_ci * @param { 'bondStateChange' } type - Type of the bond state event to listen for. 133961847f8eSopenharmony_ci * @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event. 134061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 134161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 134261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 134361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 134461847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 134561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 134661847f8eSopenharmony_ci * @crossplatform 134761847f8eSopenharmony_ci * @since 13 134861847f8eSopenharmony_ci */ 134961847f8eSopenharmony_ci function off(type: 'bondStateChange', callback?: Callback<BondStateParam>): void; 135061847f8eSopenharmony_ci 135161847f8eSopenharmony_ci /** 135261847f8eSopenharmony_ci * Subscribe the event of a pairing request from a remote Bluetooth device. 135361847f8eSopenharmony_ci * 135461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 135561847f8eSopenharmony_ci * @param { 'pinRequired' } type - Type of the pairing request event to listen for. 135661847f8eSopenharmony_ci * @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event. 135761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 135861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 135961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 136061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 136161847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 136261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 136361847f8eSopenharmony_ci * @since 10 136461847f8eSopenharmony_ci */ 136561847f8eSopenharmony_ci function on(type: 'pinRequired', callback: Callback<PinRequiredParam>): void; 136661847f8eSopenharmony_ci 136761847f8eSopenharmony_ci /** 136861847f8eSopenharmony_ci * Unsubscribe the event of a pairing request from a remote Bluetooth device. 136961847f8eSopenharmony_ci * 137061847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 137161847f8eSopenharmony_ci * @param { 'pinRequired' } type - Type of the pairing request event to listen for. 137261847f8eSopenharmony_ci * @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event. 137361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 137461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 137561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 137661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 137761847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 137861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 137961847f8eSopenharmony_ci * @since 10 138061847f8eSopenharmony_ci */ 138161847f8eSopenharmony_ci function off(type: 'pinRequired', callback?: Callback<PinRequiredParam>): void; 138261847f8eSopenharmony_ci 138361847f8eSopenharmony_ci /** 138461847f8eSopenharmony_ci * Subscribe the event of battery state changed from a remote device. 138561847f8eSopenharmony_ci * 138661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 138761847f8eSopenharmony_ci * @param { 'batteryChange' } type - Type of the battery event to listen for. 138861847f8eSopenharmony_ci * @param { Callback<BatteryInfo> } callback - Callback used to listen. 138961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 139061847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 139161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 139261847f8eSopenharmony_ci * @since 12 139361847f8eSopenharmony_ci */ 139461847f8eSopenharmony_ci function on(type: 'batteryChange', callback: Callback<BatteryInfo>): void; 139561847f8eSopenharmony_ci 139661847f8eSopenharmony_ci /** 139761847f8eSopenharmony_ci * Unsubscribe the event of battery state changed from a remote device. 139861847f8eSopenharmony_ci * 139961847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 140061847f8eSopenharmony_ci * @param { 'batteryChange' } type - Type of the battery event to listen for. 140161847f8eSopenharmony_ci * @param { Callback<BatteryInfo> } callback - Callback used to listen. 140261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 140361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 140461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 140561847f8eSopenharmony_ci * @since 12 140661847f8eSopenharmony_ci */ 140761847f8eSopenharmony_ci function off(type: 'batteryChange', callback?: Callback<BatteryInfo>): void; 140861847f8eSopenharmony_ci 140961847f8eSopenharmony_ci /** 141061847f8eSopenharmony_ci * Describes the class of a bluetooth device. 141161847f8eSopenharmony_ci * 141261847f8eSopenharmony_ci * @typedef BondStateParam 141361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 141461847f8eSopenharmony_ci * @since 10 141561847f8eSopenharmony_ci */ 141661847f8eSopenharmony_ci /** 141761847f8eSopenharmony_ci * Describes the class of a bluetooth device. 141861847f8eSopenharmony_ci * 141961847f8eSopenharmony_ci * @typedef BondStateParam 142061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 142161847f8eSopenharmony_ci * @crossplatform 142261847f8eSopenharmony_ci * @since 13 142361847f8eSopenharmony_ci */ 142461847f8eSopenharmony_ci interface BondStateParam { 142561847f8eSopenharmony_ci /** 142661847f8eSopenharmony_ci * Address of a Bluetooth device. 142761847f8eSopenharmony_ci * 142861847f8eSopenharmony_ci * @type { string } 142961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 143061847f8eSopenharmony_ci * @since 10 143161847f8eSopenharmony_ci */ 143261847f8eSopenharmony_ci /** 143361847f8eSopenharmony_ci * Address of a Bluetooth device. 143461847f8eSopenharmony_ci * 143561847f8eSopenharmony_ci * @type { string } 143661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 143761847f8eSopenharmony_ci * @crossplatform 143861847f8eSopenharmony_ci * @since 13 143961847f8eSopenharmony_ci */ 144061847f8eSopenharmony_ci deviceId: string; 144161847f8eSopenharmony_ci /** 144261847f8eSopenharmony_ci * Profile connection state of the device. 144361847f8eSopenharmony_ci * 144461847f8eSopenharmony_ci * @type { BondState } 144561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 144661847f8eSopenharmony_ci * @since 10 144761847f8eSopenharmony_ci */ 144861847f8eSopenharmony_ci /** 144961847f8eSopenharmony_ci * Profile connection state of the device. 145061847f8eSopenharmony_ci * 145161847f8eSopenharmony_ci * @type { BondState } 145261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 145361847f8eSopenharmony_ci * @crossplatform 145461847f8eSopenharmony_ci * @since 13 145561847f8eSopenharmony_ci */ 145661847f8eSopenharmony_ci state: BondState; 145761847f8eSopenharmony_ci /** 145861847f8eSopenharmony_ci * Cause of unbond. 145961847f8eSopenharmony_ci * 146061847f8eSopenharmony_ci * @type { UnbondCause } 146161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 146261847f8eSopenharmony_ci * @since 12 146361847f8eSopenharmony_ci */ 146461847f8eSopenharmony_ci /** 146561847f8eSopenharmony_ci * Cause of unbond. 146661847f8eSopenharmony_ci * 146761847f8eSopenharmony_ci * @type { UnbondCause } 146861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 146961847f8eSopenharmony_ci * @crossplatform 147061847f8eSopenharmony_ci * @since 13 147161847f8eSopenharmony_ci */ 147261847f8eSopenharmony_ci cause: UnbondCause; 147361847f8eSopenharmony_ci } 147461847f8eSopenharmony_ci 147561847f8eSopenharmony_ci /** 147661847f8eSopenharmony_ci * Describes the bond key param. 147761847f8eSopenharmony_ci * 147861847f8eSopenharmony_ci * @typedef PinRequiredParam 147961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 148061847f8eSopenharmony_ci * @since 10 148161847f8eSopenharmony_ci */ 148261847f8eSopenharmony_ci interface PinRequiredParam { 148361847f8eSopenharmony_ci /** 148461847f8eSopenharmony_ci * ID of the device to pair. 148561847f8eSopenharmony_ci * 148661847f8eSopenharmony_ci * @type { string } 148761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 148861847f8eSopenharmony_ci * @since 10 148961847f8eSopenharmony_ci */ 149061847f8eSopenharmony_ci deviceId: string; 149161847f8eSopenharmony_ci /** 149261847f8eSopenharmony_ci * Key for the device pairing. 149361847f8eSopenharmony_ci * 149461847f8eSopenharmony_ci * @type { string } 149561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 149661847f8eSopenharmony_ci * @since 10 149761847f8eSopenharmony_ci */ 149861847f8eSopenharmony_ci pinCode: string; 149961847f8eSopenharmony_ci /** 150061847f8eSopenharmony_ci * Indicates the pairing type to a peer device. 150161847f8eSopenharmony_ci * 150261847f8eSopenharmony_ci * @type { PinType } 150361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 150461847f8eSopenharmony_ci * @systemapi 150561847f8eSopenharmony_ci * @since 10 150661847f8eSopenharmony_ci */ 150761847f8eSopenharmony_ci pinType: PinType; 150861847f8eSopenharmony_ci } 150961847f8eSopenharmony_ci 151061847f8eSopenharmony_ci /** 151161847f8eSopenharmony_ci * Describes the class of a bluetooth device. 151261847f8eSopenharmony_ci * 151361847f8eSopenharmony_ci * @typedef DeviceClass 151461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 151561847f8eSopenharmony_ci * @since 10 151661847f8eSopenharmony_ci */ 151761847f8eSopenharmony_ci /** 151861847f8eSopenharmony_ci * Describes the class of a bluetooth device. 151961847f8eSopenharmony_ci * 152061847f8eSopenharmony_ci * @typedef DeviceClass 152161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 152261847f8eSopenharmony_ci * @crossplatform 152361847f8eSopenharmony_ci * @since 13 152461847f8eSopenharmony_ci */ 152561847f8eSopenharmony_ci interface DeviceClass { 152661847f8eSopenharmony_ci /** 152761847f8eSopenharmony_ci * Major classes of Bluetooth devices. 152861847f8eSopenharmony_ci * 152961847f8eSopenharmony_ci * @type { MajorClass } 153061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 153161847f8eSopenharmony_ci * @since 10 153261847f8eSopenharmony_ci */ 153361847f8eSopenharmony_ci /** 153461847f8eSopenharmony_ci * Major classes of Bluetooth devices. 153561847f8eSopenharmony_ci * 153661847f8eSopenharmony_ci * @type { MajorClass } 153761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 153861847f8eSopenharmony_ci * @crossplatform 153961847f8eSopenharmony_ci * @since 13 154061847f8eSopenharmony_ci */ 154161847f8eSopenharmony_ci majorClass: MajorClass; 154261847f8eSopenharmony_ci /** 154361847f8eSopenharmony_ci * Major and minor classes of Bluetooth devices. 154461847f8eSopenharmony_ci * 154561847f8eSopenharmony_ci * @type { MajorMinorClass } 154661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 154761847f8eSopenharmony_ci * @since 10 154861847f8eSopenharmony_ci */ 154961847f8eSopenharmony_ci /** 155061847f8eSopenharmony_ci * Major and minor classes of Bluetooth devices. 155161847f8eSopenharmony_ci * 155261847f8eSopenharmony_ci * @type { MajorMinorClass } 155361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 155461847f8eSopenharmony_ci * @crossplatform 155561847f8eSopenharmony_ci * @since 13 155661847f8eSopenharmony_ci */ 155761847f8eSopenharmony_ci majorMinorClass: MajorMinorClass; 155861847f8eSopenharmony_ci /** 155961847f8eSopenharmony_ci * Class of the device. 156061847f8eSopenharmony_ci * 156161847f8eSopenharmony_ci * @type { number } 156261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 156361847f8eSopenharmony_ci * @since 10 156461847f8eSopenharmony_ci */ 156561847f8eSopenharmony_ci /** 156661847f8eSopenharmony_ci * Class of the device. 156761847f8eSopenharmony_ci * 156861847f8eSopenharmony_ci * @type { number } 156961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 157061847f8eSopenharmony_ci * @crossplatform 157161847f8eSopenharmony_ci * @since 13 157261847f8eSopenharmony_ci */ 157361847f8eSopenharmony_ci classOfDevice: number; 157461847f8eSopenharmony_ci } 157561847f8eSopenharmony_ci 157661847f8eSopenharmony_ci /** 157761847f8eSopenharmony_ci * Enum for the transport of a remote device 157861847f8eSopenharmony_ci * 157961847f8eSopenharmony_ci * @enum { number } 158061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 158161847f8eSopenharmony_ci * @since 10 158261847f8eSopenharmony_ci */ 158361847f8eSopenharmony_ci enum BluetoothTransport { 158461847f8eSopenharmony_ci /** 158561847f8eSopenharmony_ci * The value of bluetooth transport BR/EDR. 158661847f8eSopenharmony_ci * 158761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 158861847f8eSopenharmony_ci * @since 10 158961847f8eSopenharmony_ci */ 159061847f8eSopenharmony_ci TRANSPORT_BR_EDR = 0, 159161847f8eSopenharmony_ci /** 159261847f8eSopenharmony_ci * The value of bluetooth transport LE. 159361847f8eSopenharmony_ci * 159461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 159561847f8eSopenharmony_ci * @since 10 159661847f8eSopenharmony_ci */ 159761847f8eSopenharmony_ci TRANSPORT_LE = 1 159861847f8eSopenharmony_ci } 159961847f8eSopenharmony_ci 160061847f8eSopenharmony_ci /** 160161847f8eSopenharmony_ci * The enum of BR scan mode. 160261847f8eSopenharmony_ci * 160361847f8eSopenharmony_ci * @enum { number } 160461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 160561847f8eSopenharmony_ci * @since 10 160661847f8eSopenharmony_ci */ 160761847f8eSopenharmony_ci /** 160861847f8eSopenharmony_ci * The enum of BR scan mode. 160961847f8eSopenharmony_ci * 161061847f8eSopenharmony_ci * @enum { number } 161161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 161261847f8eSopenharmony_ci * @crossplatform 161361847f8eSopenharmony_ci * @since 13 161461847f8eSopenharmony_ci */ 161561847f8eSopenharmony_ci enum ScanMode { 161661847f8eSopenharmony_ci /** 161761847f8eSopenharmony_ci * Indicates the scan mode is none 161861847f8eSopenharmony_ci * 161961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 162061847f8eSopenharmony_ci * @since 10 162161847f8eSopenharmony_ci */ 162261847f8eSopenharmony_ci /** 162361847f8eSopenharmony_ci * Indicates the scan mode is none 162461847f8eSopenharmony_ci * 162561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 162661847f8eSopenharmony_ci * @crossplatform 162761847f8eSopenharmony_ci * @since 13 162861847f8eSopenharmony_ci */ 162961847f8eSopenharmony_ci SCAN_MODE_NONE = 0, 163061847f8eSopenharmony_ci /** 163161847f8eSopenharmony_ci * Indicates the scan mode is connectable 163261847f8eSopenharmony_ci * 163361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 163461847f8eSopenharmony_ci * @since 10 163561847f8eSopenharmony_ci */ 163661847f8eSopenharmony_ci /** 163761847f8eSopenharmony_ci * Indicates the scan mode is connectable 163861847f8eSopenharmony_ci * 163961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 164061847f8eSopenharmony_ci * @crossplatform 164161847f8eSopenharmony_ci * @since 13 164261847f8eSopenharmony_ci */ 164361847f8eSopenharmony_ci SCAN_MODE_CONNECTABLE = 1, 164461847f8eSopenharmony_ci /** 164561847f8eSopenharmony_ci * Indicates the scan mode is general discoverable 164661847f8eSopenharmony_ci * 164761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 164861847f8eSopenharmony_ci * @since 10 164961847f8eSopenharmony_ci */ 165061847f8eSopenharmony_ci SCAN_MODE_GENERAL_DISCOVERABLE = 2, 165161847f8eSopenharmony_ci /** 165261847f8eSopenharmony_ci * Indicates the scan mode is limited discoverable 165361847f8eSopenharmony_ci * 165461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 165561847f8eSopenharmony_ci * @since 10 165661847f8eSopenharmony_ci */ 165761847f8eSopenharmony_ci SCAN_MODE_LIMITED_DISCOVERABLE = 3, 165861847f8eSopenharmony_ci /** 165961847f8eSopenharmony_ci * Indicates the scan mode is connectable and general discoverable 166061847f8eSopenharmony_ci * 166161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 166261847f8eSopenharmony_ci * @since 10 166361847f8eSopenharmony_ci */ 166461847f8eSopenharmony_ci /** 166561847f8eSopenharmony_ci * Indicates the scan mode is connectable and general discoverable 166661847f8eSopenharmony_ci * 166761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 166861847f8eSopenharmony_ci * @crossplatform 166961847f8eSopenharmony_ci * @since 13 167061847f8eSopenharmony_ci */ 167161847f8eSopenharmony_ci SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4, 167261847f8eSopenharmony_ci /** 167361847f8eSopenharmony_ci * Indicates the scan mode is connectable and limited discoverable 167461847f8eSopenharmony_ci * 167561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 167661847f8eSopenharmony_ci * @since 10 167761847f8eSopenharmony_ci */ 167861847f8eSopenharmony_ci SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5 167961847f8eSopenharmony_ci } 168061847f8eSopenharmony_ci 168161847f8eSopenharmony_ci /** 168261847f8eSopenharmony_ci * The enum of bond state. 168361847f8eSopenharmony_ci * 168461847f8eSopenharmony_ci * @enum { number } 168561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 168661847f8eSopenharmony_ci * @since 10 168761847f8eSopenharmony_ci */ 168861847f8eSopenharmony_ci /** 168961847f8eSopenharmony_ci * The enum of bond state. 169061847f8eSopenharmony_ci * 169161847f8eSopenharmony_ci * @enum { number } 169261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 169361847f8eSopenharmony_ci * @atomicservice 169461847f8eSopenharmony_ci * @since 12 169561847f8eSopenharmony_ci */ 169661847f8eSopenharmony_ci /** 169761847f8eSopenharmony_ci * The enum of bond state. 169861847f8eSopenharmony_ci * 169961847f8eSopenharmony_ci * @enum { number } 170061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 170161847f8eSopenharmony_ci * @crossplatform 170261847f8eSopenharmony_ci * @atomicservice 170361847f8eSopenharmony_ci * @since 13 170461847f8eSopenharmony_ci */ 170561847f8eSopenharmony_ci enum BondState { 170661847f8eSopenharmony_ci /** 170761847f8eSopenharmony_ci * Indicate the bond state is invalid 170861847f8eSopenharmony_ci * 170961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 171061847f8eSopenharmony_ci * @since 10 171161847f8eSopenharmony_ci */ 171261847f8eSopenharmony_ci /** 171361847f8eSopenharmony_ci * Indicate the bond state is invalid 171461847f8eSopenharmony_ci * 171561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 171661847f8eSopenharmony_ci * @atomicservice 171761847f8eSopenharmony_ci * @since 12 171861847f8eSopenharmony_ci */ 171961847f8eSopenharmony_ci /** 172061847f8eSopenharmony_ci * Indicate the bond state is invalid 172161847f8eSopenharmony_ci * 172261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 172361847f8eSopenharmony_ci * @crossplatform 172461847f8eSopenharmony_ci * @atomicservice 172561847f8eSopenharmony_ci * @since 13 172661847f8eSopenharmony_ci */ 172761847f8eSopenharmony_ci BOND_STATE_INVALID = 0, 172861847f8eSopenharmony_ci /** 172961847f8eSopenharmony_ci * Indicate the bond state is bonding 173061847f8eSopenharmony_ci * 173161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 173261847f8eSopenharmony_ci * @since 10 173361847f8eSopenharmony_ci */ 173461847f8eSopenharmony_ci /** 173561847f8eSopenharmony_ci * Indicate the bond state is bonding 173661847f8eSopenharmony_ci * 173761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 173861847f8eSopenharmony_ci * @atomicservice 173961847f8eSopenharmony_ci * @since 12 174061847f8eSopenharmony_ci */ 174161847f8eSopenharmony_ci /** 174261847f8eSopenharmony_ci * Indicate the bond state is bonding 174361847f8eSopenharmony_ci * 174461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 174561847f8eSopenharmony_ci * @crossplatform 174661847f8eSopenharmony_ci * @atomicservice 174761847f8eSopenharmony_ci * @since 13 174861847f8eSopenharmony_ci */ 174961847f8eSopenharmony_ci BOND_STATE_BONDING = 1, 175061847f8eSopenharmony_ci /** 175161847f8eSopenharmony_ci * Indicate the bond state is bonded 175261847f8eSopenharmony_ci * 175361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 175461847f8eSopenharmony_ci * @since 10 175561847f8eSopenharmony_ci */ 175661847f8eSopenharmony_ci /** 175761847f8eSopenharmony_ci * Indicate the bond state is bonded 175861847f8eSopenharmony_ci * 175961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 176061847f8eSopenharmony_ci * @atomicservice 176161847f8eSopenharmony_ci * @since 12 176261847f8eSopenharmony_ci */ 176361847f8eSopenharmony_ci /** 176461847f8eSopenharmony_ci * Indicate the bond state is bonded 176561847f8eSopenharmony_ci * 176661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 176761847f8eSopenharmony_ci * @crossplatform 176861847f8eSopenharmony_ci * @atomicservice 176961847f8eSopenharmony_ci * @since 13 177061847f8eSopenharmony_ci */ 177161847f8eSopenharmony_ci BOND_STATE_BONDED = 2 177261847f8eSopenharmony_ci } 177361847f8eSopenharmony_ci 177461847f8eSopenharmony_ci /** 177561847f8eSopenharmony_ci * Enum for the type of pairing to a remote device 177661847f8eSopenharmony_ci * 177761847f8eSopenharmony_ci * @enum { number } 177861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 177961847f8eSopenharmony_ci * @systemapi 178061847f8eSopenharmony_ci * @since 10 178161847f8eSopenharmony_ci */ 178261847f8eSopenharmony_ci enum PinType { 178361847f8eSopenharmony_ci /** 178461847f8eSopenharmony_ci * The user needs to enter the pin code displayed on the peer device. 178561847f8eSopenharmony_ci * 178661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 178761847f8eSopenharmony_ci * @systemapi 178861847f8eSopenharmony_ci * @since 10 178961847f8eSopenharmony_ci */ 179061847f8eSopenharmony_ci PIN_TYPE_ENTER_PIN_CODE = 0, 179161847f8eSopenharmony_ci /** 179261847f8eSopenharmony_ci * The user needs to enter the passkey displayed on the peer device. 179361847f8eSopenharmony_ci * 179461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 179561847f8eSopenharmony_ci * @systemapi 179661847f8eSopenharmony_ci * @since 10 179761847f8eSopenharmony_ci */ 179861847f8eSopenharmony_ci PIN_TYPE_ENTER_PASSKEY = 1, 179961847f8eSopenharmony_ci /** 180061847f8eSopenharmony_ci * The user needs to confirm the passkey displayed on the local device. 180161847f8eSopenharmony_ci * 180261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 180361847f8eSopenharmony_ci * @systemapi 180461847f8eSopenharmony_ci * @since 10 180561847f8eSopenharmony_ci */ 180661847f8eSopenharmony_ci PIN_TYPE_CONFIRM_PASSKEY = 2, 180761847f8eSopenharmony_ci /** 180861847f8eSopenharmony_ci * The user needs to accept or deny the pairing request. 180961847f8eSopenharmony_ci * 181061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 181161847f8eSopenharmony_ci * @systemapi 181261847f8eSopenharmony_ci * @since 10 181361847f8eSopenharmony_ci */ 181461847f8eSopenharmony_ci PIN_TYPE_NO_PASSKEY_CONSENT = 3, 181561847f8eSopenharmony_ci /** 181661847f8eSopenharmony_ci * The user needs to enter the passkey displayed on the local device on the peer device. 181761847f8eSopenharmony_ci * 181861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 181961847f8eSopenharmony_ci * @systemapi 182061847f8eSopenharmony_ci * @since 10 182161847f8eSopenharmony_ci */ 182261847f8eSopenharmony_ci PIN_TYPE_NOTIFY_PASSKEY = 4, 182361847f8eSopenharmony_ci /** 182461847f8eSopenharmony_ci * The user needs to enter the pin code displayed on the peer device, used for bluetooth 2.0. 182561847f8eSopenharmony_ci * 182661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 182761847f8eSopenharmony_ci * @systemapi 182861847f8eSopenharmony_ci * @since 10 182961847f8eSopenharmony_ci */ 183061847f8eSopenharmony_ci PIN_TYPE_DISPLAY_PIN_CODE = 5, 183161847f8eSopenharmony_ci /** 183261847f8eSopenharmony_ci * The user needs to accept or deny the OOB pairing request. 183361847f8eSopenharmony_ci * 183461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 183561847f8eSopenharmony_ci * @systemapi 183661847f8eSopenharmony_ci * @since 10 183761847f8eSopenharmony_ci */ 183861847f8eSopenharmony_ci PIN_TYPE_OOB_CONSENT = 6, 183961847f8eSopenharmony_ci /** 184061847f8eSopenharmony_ci * The user needs to enter the 16-digit pin code displayed on the peer device. 184161847f8eSopenharmony_ci * 184261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 184361847f8eSopenharmony_ci * @systemapi 184461847f8eSopenharmony_ci * @since 10 184561847f8eSopenharmony_ci */ 184661847f8eSopenharmony_ci PIN_TYPE_PIN_16_DIGITS = 7 184761847f8eSopenharmony_ci } 184861847f8eSopenharmony_ci 184961847f8eSopenharmony_ci /** 185061847f8eSopenharmony_ci * Describes the contents of the discovery results 185161847f8eSopenharmony_ci * 185261847f8eSopenharmony_ci * @typedef DiscoveryResult 185361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 185461847f8eSopenharmony_ci * @systemapi 185561847f8eSopenharmony_ci * @since 12 185661847f8eSopenharmony_ci */ 185761847f8eSopenharmony_ci interface DiscoveryResult { 185861847f8eSopenharmony_ci /** 185961847f8eSopenharmony_ci * Identify of the discovery device 186061847f8eSopenharmony_ci * 186161847f8eSopenharmony_ci * @type { string } 186261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 186361847f8eSopenharmony_ci * @systemapi 186461847f8eSopenharmony_ci * @since 12 186561847f8eSopenharmony_ci */ 186661847f8eSopenharmony_ci deviceId: string; 186761847f8eSopenharmony_ci /** 186861847f8eSopenharmony_ci * RSSI of the remote device 186961847f8eSopenharmony_ci * 187061847f8eSopenharmony_ci * @type { number } 187161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 187261847f8eSopenharmony_ci * @systemapi 187361847f8eSopenharmony_ci * @since 12 187461847f8eSopenharmony_ci */ 187561847f8eSopenharmony_ci rssi: number; 187661847f8eSopenharmony_ci /** 187761847f8eSopenharmony_ci * The local name of the device 187861847f8eSopenharmony_ci * 187961847f8eSopenharmony_ci * @type { string } 188061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 188161847f8eSopenharmony_ci * @systemapi 188261847f8eSopenharmony_ci * @since 12 188361847f8eSopenharmony_ci */ 188461847f8eSopenharmony_ci deviceName: string; 188561847f8eSopenharmony_ci /** 188661847f8eSopenharmony_ci * The class of the device 188761847f8eSopenharmony_ci * 188861847f8eSopenharmony_ci * @type { DeviceClass } 188961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 189061847f8eSopenharmony_ci * @systemapi 189161847f8eSopenharmony_ci * @since 12 189261847f8eSopenharmony_ci */ 189361847f8eSopenharmony_ci deviceClass: DeviceClass; 189461847f8eSopenharmony_ci } 189561847f8eSopenharmony_ci 189661847f8eSopenharmony_ci /** 189761847f8eSopenharmony_ci * Describes the contents of the battery information. 189861847f8eSopenharmony_ci * 189961847f8eSopenharmony_ci * @typedef BatteryInfo 190061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 190161847f8eSopenharmony_ci * @since 12 190261847f8eSopenharmony_ci */ 190361847f8eSopenharmony_ci interface BatteryInfo { 190461847f8eSopenharmony_ci /** 190561847f8eSopenharmony_ci * Identify of the discovery device. 190661847f8eSopenharmony_ci * 190761847f8eSopenharmony_ci * @type { string } 190861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 190961847f8eSopenharmony_ci * @systemapi 191061847f8eSopenharmony_ci * @since 12 191161847f8eSopenharmony_ci */ 191261847f8eSopenharmony_ci deviceId: string; 191361847f8eSopenharmony_ci /** 191461847f8eSopenharmony_ci * Electricity value of the general device. {@code -1} means no power information. 191561847f8eSopenharmony_ci * 191661847f8eSopenharmony_ci * @type { number } 191761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 191861847f8eSopenharmony_ci * @since 12 191961847f8eSopenharmony_ci */ 192061847f8eSopenharmony_ci batteryLevel: number; 192161847f8eSopenharmony_ci /** 192261847f8eSopenharmony_ci * Electricity value of the left ear. {@code -1} means no power information. 192361847f8eSopenharmony_ci * 192461847f8eSopenharmony_ci * @type { number } 192561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 192661847f8eSopenharmony_ci * @since 12 192761847f8eSopenharmony_ci */ 192861847f8eSopenharmony_ci leftEarBatteryLevel: number; 192961847f8eSopenharmony_ci /** 193061847f8eSopenharmony_ci * The charge state of the left ear. 193161847f8eSopenharmony_ci * 193261847f8eSopenharmony_ci * @type { DeviceChargeState } 193361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 193461847f8eSopenharmony_ci * @since 12 193561847f8eSopenharmony_ci */ 193661847f8eSopenharmony_ci leftEarChargeState: DeviceChargeState; 193761847f8eSopenharmony_ci /** 193861847f8eSopenharmony_ci * Electricity value of the right ear. {@code -1} means no power information. 193961847f8eSopenharmony_ci * 194061847f8eSopenharmony_ci * @type { number } 194161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 194261847f8eSopenharmony_ci * @since 12 194361847f8eSopenharmony_ci */ 194461847f8eSopenharmony_ci rightEarBatteryLevel: number; 194561847f8eSopenharmony_ci /** 194661847f8eSopenharmony_ci * The charge state of the right ear. 194761847f8eSopenharmony_ci * 194861847f8eSopenharmony_ci * @type { DeviceChargeState } 194961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 195061847f8eSopenharmony_ci * @since 12 195161847f8eSopenharmony_ci */ 195261847f8eSopenharmony_ci rightEarChargeState: DeviceChargeState; 195361847f8eSopenharmony_ci /** 195461847f8eSopenharmony_ci * Electricity value of the box. {@code -1} means no power information. 195561847f8eSopenharmony_ci * 195661847f8eSopenharmony_ci * @type { number } 195761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 195861847f8eSopenharmony_ci * @since 12 195961847f8eSopenharmony_ci */ 196061847f8eSopenharmony_ci boxBatteryLevel: number; 196161847f8eSopenharmony_ci /** 196261847f8eSopenharmony_ci * The charge state of the box. 196361847f8eSopenharmony_ci * 196461847f8eSopenharmony_ci * @type { DeviceChargeState } 196561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 196661847f8eSopenharmony_ci * @since 12 196761847f8eSopenharmony_ci */ 196861847f8eSopenharmony_ci boxChargeState: DeviceChargeState; 196961847f8eSopenharmony_ci } 197061847f8eSopenharmony_ci 197161847f8eSopenharmony_ci /** 197261847f8eSopenharmony_ci * Enum for the charge state. 197361847f8eSopenharmony_ci * 197461847f8eSopenharmony_ci * @enum { number } 197561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 197661847f8eSopenharmony_ci * @since 12 197761847f8eSopenharmony_ci */ 197861847f8eSopenharmony_ci enum DeviceChargeState { 197961847f8eSopenharmony_ci /** 198061847f8eSopenharmony_ci * Not support super charge, and not charged. 198161847f8eSopenharmony_ci * 198261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 198361847f8eSopenharmony_ci * @since 12 198461847f8eSopenharmony_ci */ 198561847f8eSopenharmony_ci DEVICE_NORMAL_CHARGE_NOT_CHARGED = 0, 198661847f8eSopenharmony_ci /** 198761847f8eSopenharmony_ci * Not support super charge, and in charging. 198861847f8eSopenharmony_ci * 198961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 199061847f8eSopenharmony_ci * @since 12 199161847f8eSopenharmony_ci */ 199261847f8eSopenharmony_ci DEVICE_NORMAL_CHARGE_IN_CHARGING = 1, 199361847f8eSopenharmony_ci /** 199461847f8eSopenharmony_ci * Support super charge, and not charged. 199561847f8eSopenharmony_ci * 199661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 199761847f8eSopenharmony_ci * @since 12 199861847f8eSopenharmony_ci */ 199961847f8eSopenharmony_ci DEVICE_SUPER_CHARGE_NOT_CHARGED = 2, 200061847f8eSopenharmony_ci /** 200161847f8eSopenharmony_ci * Support super charge, and in charging. 200261847f8eSopenharmony_ci * 200361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 200461847f8eSopenharmony_ci * @since 12 200561847f8eSopenharmony_ci */ 200661847f8eSopenharmony_ci DEVICE_SUPER_CHARGE_IN_CHARGING = 3 200761847f8eSopenharmony_ci } 200861847f8eSopenharmony_ci 200961847f8eSopenharmony_ci /** 201061847f8eSopenharmony_ci * Enum for the custom type of remote device. 201161847f8eSopenharmony_ci * 201261847f8eSopenharmony_ci * @enum { number } 201361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 201461847f8eSopenharmony_ci * @systemapi 201561847f8eSopenharmony_ci * @since 12 201661847f8eSopenharmony_ci */ 201761847f8eSopenharmony_ci enum DeviceType { 201861847f8eSopenharmony_ci /** 201961847f8eSopenharmony_ci * Default type, the type is consistent with COD. 202061847f8eSopenharmony_ci * 202161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 202261847f8eSopenharmony_ci * @systemapi 202361847f8eSopenharmony_ci * @since 12 202461847f8eSopenharmony_ci */ 202561847f8eSopenharmony_ci DEVICE_TYPE_DEFAULT = 0, 202661847f8eSopenharmony_ci /** 202761847f8eSopenharmony_ci * Car bluetooth. 202861847f8eSopenharmony_ci * 202961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 203061847f8eSopenharmony_ci * @systemapi 203161847f8eSopenharmony_ci * @since 12 203261847f8eSopenharmony_ci */ 203361847f8eSopenharmony_ci DEVICE_TYPE_CAR = 1, 203461847f8eSopenharmony_ci /** 203561847f8eSopenharmony_ci * Headset bluetooth. 203661847f8eSopenharmony_ci * 203761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 203861847f8eSopenharmony_ci * @systemapi 203961847f8eSopenharmony_ci * @since 12 204061847f8eSopenharmony_ci */ 204161847f8eSopenharmony_ci DEVICE_TYPE_HEADSET = 2, 204261847f8eSopenharmony_ci /** 204361847f8eSopenharmony_ci * Hearing Aid. 204461847f8eSopenharmony_ci * 204561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 204661847f8eSopenharmony_ci * @systemapi 204761847f8eSopenharmony_ci * @since 12 204861847f8eSopenharmony_ci */ 204961847f8eSopenharmony_ci DEVICE_TYPE_HEARING = 3, 205061847f8eSopenharmony_ci /** 205161847f8eSopenharmony_ci * Glasses device. 205261847f8eSopenharmony_ci * 205361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 205461847f8eSopenharmony_ci * @systemapi 205561847f8eSopenharmony_ci * @since 12 205661847f8eSopenharmony_ci */ 205761847f8eSopenharmony_ci DEVICE_TYPE_GLASSES = 4, 205861847f8eSopenharmony_ci /** 205961847f8eSopenharmony_ci * Watch device. 206061847f8eSopenharmony_ci * 206161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 206261847f8eSopenharmony_ci * @systemapi 206361847f8eSopenharmony_ci * @since 12 206461847f8eSopenharmony_ci */ 206561847f8eSopenharmony_ci DEVICE_TYPE_WATCH = 5, 206661847f8eSopenharmony_ci /** 206761847f8eSopenharmony_ci * Speaker device. 206861847f8eSopenharmony_ci * 206961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 207061847f8eSopenharmony_ci * @systemapi 207161847f8eSopenharmony_ci * @since 12 207261847f8eSopenharmony_ci */ 207361847f8eSopenharmony_ci DEVICE_TYPE_SPEAKER = 6, 207461847f8eSopenharmony_ci /** 207561847f8eSopenharmony_ci * Others bluetooth. 207661847f8eSopenharmony_ci * 207761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 207861847f8eSopenharmony_ci * @systemapi 207961847f8eSopenharmony_ci * @since 12 208061847f8eSopenharmony_ci */ 208161847f8eSopenharmony_ci DEVICE_TYPE_OTHERS = 7 208261847f8eSopenharmony_ci } 208361847f8eSopenharmony_ci 208461847f8eSopenharmony_ci /** 208561847f8eSopenharmony_ci * Enum for cause of unbond. 208661847f8eSopenharmony_ci * 208761847f8eSopenharmony_ci * @enum { number } 208861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 208961847f8eSopenharmony_ci * @since 12 209061847f8eSopenharmony_ci */ 209161847f8eSopenharmony_ci /** 209261847f8eSopenharmony_ci * Enum for cause of unbond. 209361847f8eSopenharmony_ci * 209461847f8eSopenharmony_ci * @enum { number } 209561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 209661847f8eSopenharmony_ci * @crossplatform 209761847f8eSopenharmony_ci * @since 13 209861847f8eSopenharmony_ci */ 209961847f8eSopenharmony_ci enum UnbondCause { 210061847f8eSopenharmony_ci /** 210161847f8eSopenharmony_ci * User proactively removed device. 210261847f8eSopenharmony_ci * 210361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 210461847f8eSopenharmony_ci * @since 12 210561847f8eSopenharmony_ci */ 210661847f8eSopenharmony_ci /** 210761847f8eSopenharmony_ci * User proactively removed device. 210861847f8eSopenharmony_ci * 210961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 211061847f8eSopenharmony_ci * @crossplatform 211161847f8eSopenharmony_ci * @since 13 211261847f8eSopenharmony_ci */ 211361847f8eSopenharmony_ci USER_REMOVED = 0, 211461847f8eSopenharmony_ci /** 211561847f8eSopenharmony_ci * Remote device shut down. 211661847f8eSopenharmony_ci * 211761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 211861847f8eSopenharmony_ci * @since 12 211961847f8eSopenharmony_ci */ 212061847f8eSopenharmony_ci REMOTE_DEVICE_DOWN = 1, 212161847f8eSopenharmony_ci /** 212261847f8eSopenharmony_ci * Wrong PIN code. 212361847f8eSopenharmony_ci * 212461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 212561847f8eSopenharmony_ci * @since 12 212661847f8eSopenharmony_ci */ 212761847f8eSopenharmony_ci AUTH_FAILURE = 2, 212861847f8eSopenharmony_ci /** 212961847f8eSopenharmony_ci * Remote device rejected. 213061847f8eSopenharmony_ci * 213161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 213261847f8eSopenharmony_ci * @since 12 213361847f8eSopenharmony_ci */ 213461847f8eSopenharmony_ci AUTH_REJECTED = 3, 213561847f8eSopenharmony_ci /** 213661847f8eSopenharmony_ci * Internal error. 213761847f8eSopenharmony_ci * 213861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 213961847f8eSopenharmony_ci * @since 12 214061847f8eSopenharmony_ci */ 214161847f8eSopenharmony_ci INTERNAL_ERROR = 4 214261847f8eSopenharmony_ci } 214361847f8eSopenharmony_ci} 214461847f8eSopenharmony_ciexport default connection;