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 basic profile methods. 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace baseProfile 2861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 2961847f8eSopenharmony_ci * @since 10 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_ci/** 3261847f8eSopenharmony_ci * Provides basic profile methods. 3361847f8eSopenharmony_ci * 3461847f8eSopenharmony_ci * @namespace baseProfile 3561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 3661847f8eSopenharmony_ci * @crossplatform 3761847f8eSopenharmony_ci * @since 13 3861847f8eSopenharmony_ci */ 3961847f8eSopenharmony_cideclare namespace baseProfile { 4061847f8eSopenharmony_ci /** 4161847f8eSopenharmony_ci * Indicate the profile connection state. 4261847f8eSopenharmony_ci * 4361847f8eSopenharmony_ci * @typedef { constant.ProfileConnectionState } ProfileConnectionState 4461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 4561847f8eSopenharmony_ci * @since 10 4661847f8eSopenharmony_ci */ 4761847f8eSopenharmony_ci /** 4861847f8eSopenharmony_ci * Indicate the profile connection state. 4961847f8eSopenharmony_ci * 5061847f8eSopenharmony_ci * @typedef { constant.ProfileConnectionState } ProfileConnectionState 5161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 5261847f8eSopenharmony_ci * @crossplatform 5361847f8eSopenharmony_ci * @since 13 5461847f8eSopenharmony_ci */ 5561847f8eSopenharmony_ci type ProfileConnectionState = constant.ProfileConnectionState; 5661847f8eSopenharmony_ci 5761847f8eSopenharmony_ci /** 5861847f8eSopenharmony_ci * Enum for connection strategy of the profile 5961847f8eSopenharmony_ci * 6061847f8eSopenharmony_ci * @enum { number } 6161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 6261847f8eSopenharmony_ci * @systemapi 6361847f8eSopenharmony_ci * @since 10 6461847f8eSopenharmony_ci */ 6561847f8eSopenharmony_ci export enum ConnectionStrategy { 6661847f8eSopenharmony_ci /** 6761847f8eSopenharmony_ci * The value of connection strategy unsupported. 6861847f8eSopenharmony_ci * 6961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 7061847f8eSopenharmony_ci * @systemapi 7161847f8eSopenharmony_ci * @since 10 7261847f8eSopenharmony_ci */ 7361847f8eSopenharmony_ci CONNECTION_STRATEGY_UNSUPPORTED = 0, 7461847f8eSopenharmony_ci /** 7561847f8eSopenharmony_ci * The value of connection strategy allowed. 7661847f8eSopenharmony_ci * 7761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 7861847f8eSopenharmony_ci * @systemapi 7961847f8eSopenharmony_ci * @since 10 8061847f8eSopenharmony_ci */ 8161847f8eSopenharmony_ci CONNECTION_STRATEGY_ALLOWED = 1, 8261847f8eSopenharmony_ci /** 8361847f8eSopenharmony_ci * The value of connection strategy forbidden. 8461847f8eSopenharmony_ci * 8561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 8661847f8eSopenharmony_ci * @systemapi 8761847f8eSopenharmony_ci * @since 10 8861847f8eSopenharmony_ci */ 8961847f8eSopenharmony_ci CONNECTION_STRATEGY_FORBIDDEN = 2 9061847f8eSopenharmony_ci } 9161847f8eSopenharmony_ci 9261847f8eSopenharmony_ci /** 9361847f8eSopenharmony_ci * Enum for cause of disconnect. 9461847f8eSopenharmony_ci * 9561847f8eSopenharmony_ci * @enum { number } 9661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 9761847f8eSopenharmony_ci * @since 12 9861847f8eSopenharmony_ci */ 9961847f8eSopenharmony_ci /** 10061847f8eSopenharmony_ci * Enum for cause of disconnect. 10161847f8eSopenharmony_ci * 10261847f8eSopenharmony_ci * @enum { number } 10361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 10461847f8eSopenharmony_ci * @crossplatform 10561847f8eSopenharmony_ci * @since 13 10661847f8eSopenharmony_ci */ 10761847f8eSopenharmony_ci enum DisconnectCause { 10861847f8eSopenharmony_ci /** 10961847f8eSopenharmony_ci * User disconnect device. 11061847f8eSopenharmony_ci * 11161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 11261847f8eSopenharmony_ci * @since 12 11361847f8eSopenharmony_ci */ 11461847f8eSopenharmony_ci /** 11561847f8eSopenharmony_ci * User disconnect device. 11661847f8eSopenharmony_ci * 11761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 11861847f8eSopenharmony_ci * @crossplatform 11961847f8eSopenharmony_ci * @since 13 12061847f8eSopenharmony_ci */ 12161847f8eSopenharmony_ci USER_DISCONNECT = 0, 12261847f8eSopenharmony_ci /** 12361847f8eSopenharmony_ci * The connection needs to be initiated from the keyboard side. 12461847f8eSopenharmony_ci * 12561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 12661847f8eSopenharmony_ci * @since 12 12761847f8eSopenharmony_ci */ 12861847f8eSopenharmony_ci CONNECT_FROM_KEYBOARD = 1, 12961847f8eSopenharmony_ci /** 13061847f8eSopenharmony_ci * The connection needs to be initiated from the mouse side. 13161847f8eSopenharmony_ci * 13261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 13361847f8eSopenharmony_ci * @since 12 13461847f8eSopenharmony_ci */ 13561847f8eSopenharmony_ci CONNECT_FROM_MOUSE = 2, 13661847f8eSopenharmony_ci /** 13761847f8eSopenharmony_ci * The connection needs to be initiated from the car side. 13861847f8eSopenharmony_ci * 13961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 14061847f8eSopenharmony_ci * @since 12 14161847f8eSopenharmony_ci */ 14261847f8eSopenharmony_ci CONNECT_FROM_CAR = 3, 14361847f8eSopenharmony_ci /** 14461847f8eSopenharmony_ci * Too many devices are currently connected. 14561847f8eSopenharmony_ci * 14661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 14761847f8eSopenharmony_ci * @since 12 14861847f8eSopenharmony_ci */ 14961847f8eSopenharmony_ci TOO_MANY_CONNECTED_DEVICES = 4, 15061847f8eSopenharmony_ci /** 15161847f8eSopenharmony_ci * Connection failed due to an internal error. 15261847f8eSopenharmony_ci * 15361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 15461847f8eSopenharmony_ci * @since 12 15561847f8eSopenharmony_ci */ 15661847f8eSopenharmony_ci CONNECT_FAIL_INTERNAL = 5 15761847f8eSopenharmony_ci } 15861847f8eSopenharmony_ci 15961847f8eSopenharmony_ci /** 16061847f8eSopenharmony_ci * Profile state change parameters. 16161847f8eSopenharmony_ci * 16261847f8eSopenharmony_ci * @typedef StateChangeParam 16361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 16461847f8eSopenharmony_ci * @since 10 16561847f8eSopenharmony_ci */ 16661847f8eSopenharmony_ci /** 16761847f8eSopenharmony_ci * Profile state change parameters. 16861847f8eSopenharmony_ci * 16961847f8eSopenharmony_ci * @typedef StateChangeParam 17061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 17161847f8eSopenharmony_ci * @crossplatform 17261847f8eSopenharmony_ci * @since 13 17361847f8eSopenharmony_ci */ 17461847f8eSopenharmony_ci export interface StateChangeParam { 17561847f8eSopenharmony_ci /** 17661847f8eSopenharmony_ci * The address of device 17761847f8eSopenharmony_ci * 17861847f8eSopenharmony_ci * @type { string } 17961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 18061847f8eSopenharmony_ci * @since 10 18161847f8eSopenharmony_ci */ 18261847f8eSopenharmony_ci /** 18361847f8eSopenharmony_ci * The address of device 18461847f8eSopenharmony_ci * 18561847f8eSopenharmony_ci * @type { string } 18661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 18761847f8eSopenharmony_ci * @crossplatform 18861847f8eSopenharmony_ci * @since 13 18961847f8eSopenharmony_ci */ 19061847f8eSopenharmony_ci deviceId: string; 19161847f8eSopenharmony_ci 19261847f8eSopenharmony_ci /** 19361847f8eSopenharmony_ci * Profile state value 19461847f8eSopenharmony_ci * 19561847f8eSopenharmony_ci * @type { ProfileConnectionState } 19661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 19761847f8eSopenharmony_ci * @since 10 19861847f8eSopenharmony_ci */ 19961847f8eSopenharmony_ci /** 20061847f8eSopenharmony_ci * Profile state value 20161847f8eSopenharmony_ci * 20261847f8eSopenharmony_ci * @type { ProfileConnectionState } 20361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 20461847f8eSopenharmony_ci * @crossplatform 20561847f8eSopenharmony_ci * @since 13 20661847f8eSopenharmony_ci */ 20761847f8eSopenharmony_ci state: ProfileConnectionState; 20861847f8eSopenharmony_ci 20961847f8eSopenharmony_ci /** 21061847f8eSopenharmony_ci * Cause of disconnect 21161847f8eSopenharmony_ci * 21261847f8eSopenharmony_ci * @type { DisconnectCause } 21361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 21461847f8eSopenharmony_ci * @since 12 21561847f8eSopenharmony_ci */ 21661847f8eSopenharmony_ci /** 21761847f8eSopenharmony_ci * Cause of disconnect 21861847f8eSopenharmony_ci * 21961847f8eSopenharmony_ci * @type { DisconnectCause } 22061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 22161847f8eSopenharmony_ci * @crossplatform 22261847f8eSopenharmony_ci * @since 13 22361847f8eSopenharmony_ci */ 22461847f8eSopenharmony_ci cause: DisconnectCause; 22561847f8eSopenharmony_ci } 22661847f8eSopenharmony_ci 22761847f8eSopenharmony_ci /** 22861847f8eSopenharmony_ci * Base interface of profile. 22961847f8eSopenharmony_ci * 23061847f8eSopenharmony_ci * @typedef BaseProfile 23161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 23261847f8eSopenharmony_ci * @since 10 23361847f8eSopenharmony_ci */ 23461847f8eSopenharmony_ci /** 23561847f8eSopenharmony_ci * Base interface of profile. 23661847f8eSopenharmony_ci * 23761847f8eSopenharmony_ci * @typedef BaseProfile 23861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 23961847f8eSopenharmony_ci * @crossplatform 24061847f8eSopenharmony_ci * @since 13 24161847f8eSopenharmony_ci */ 24261847f8eSopenharmony_ci export interface BaseProfile { 24361847f8eSopenharmony_ci /** 24461847f8eSopenharmony_ci * Set connection strategy of this profile. 24561847f8eSopenharmony_ci * 24661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 24761847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 24861847f8eSopenharmony_ci * @param { ConnectionStrategy } strategy - the connection strategy of this profile. 24961847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 25061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 25161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 25261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 25361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 25461847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 25561847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 25661847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 25761847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 25861847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 25961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 26061847f8eSopenharmony_ci * @systemapi 26161847f8eSopenharmony_ci * @since 10 26261847f8eSopenharmony_ci */ 26361847f8eSopenharmony_ci setConnectionStrategy(deviceId: string, strategy: ConnectionStrategy): Promise<void>; 26461847f8eSopenharmony_ci 26561847f8eSopenharmony_ci /** 26661847f8eSopenharmony_ci * Set connection strategy of this profile. 26761847f8eSopenharmony_ci * 26861847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 26961847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 27061847f8eSopenharmony_ci * @param { ConnectionStrategy } strategy - the connection strategy of this profile. 27161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setConnectionStrategy. 27261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 27361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 27461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 27561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 27661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 27761847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 27861847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 27961847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 28061847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 28161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 28261847f8eSopenharmony_ci * @systemapi 28361847f8eSopenharmony_ci * @since 10 28461847f8eSopenharmony_ci */ 28561847f8eSopenharmony_ci setConnectionStrategy(deviceId: string, strategy: ConnectionStrategy, callback: AsyncCallback<void>): void; 28661847f8eSopenharmony_ci 28761847f8eSopenharmony_ci /** 28861847f8eSopenharmony_ci * Get connection strategy of this profile. 28961847f8eSopenharmony_ci * 29061847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 29161847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 29261847f8eSopenharmony_ci * @param { AsyncCallback<ConnectionStrategy> } callback - the callback of getConnectionStrategy. 29361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 29461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 29561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 29661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 29761847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 29861847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 29961847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 30061847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 30161847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 30261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 30361847f8eSopenharmony_ci * @systemapi 30461847f8eSopenharmony_ci * @since 10 30561847f8eSopenharmony_ci */ 30661847f8eSopenharmony_ci getConnectionStrategy(deviceId: string, callback: AsyncCallback<ConnectionStrategy>): void; 30761847f8eSopenharmony_ci 30861847f8eSopenharmony_ci /** 30961847f8eSopenharmony_ci * Get connection strategy of this profile. 31061847f8eSopenharmony_ci * 31161847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 31261847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 31361847f8eSopenharmony_ci * @returns { Promise<ConnectionStrategy> } Returns the promise object. 31461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 31561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 31661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 31761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 31861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 31961847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 32061847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 32161847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 32261847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 32361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 32461847f8eSopenharmony_ci * @systemapi 32561847f8eSopenharmony_ci * @since 10 32661847f8eSopenharmony_ci */ 32761847f8eSopenharmony_ci getConnectionStrategy(deviceId: string): Promise<ConnectionStrategy>; 32861847f8eSopenharmony_ci 32961847f8eSopenharmony_ci /** 33061847f8eSopenharmony_ci * Obtains the connected devices list of profile. 33161847f8eSopenharmony_ci * 33261847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 33361847f8eSopenharmony_ci * @returns { Array<string> } Returns the address of connected devices list. 33461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 33561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 33661847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 33761847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 33861847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 33961847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 34061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 34161847f8eSopenharmony_ci * @since 10 34261847f8eSopenharmony_ci */ 34361847f8eSopenharmony_ci /** 34461847f8eSopenharmony_ci * Obtains the connected devices list of profile. 34561847f8eSopenharmony_ci * 34661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 34761847f8eSopenharmony_ci * @returns { Array<string> } Returns the address of connected devices list. 34861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 34961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 35061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 35161847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 35261847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 35361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 35461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 35561847f8eSopenharmony_ci * @crossplatform 35661847f8eSopenharmony_ci * @since 13 35761847f8eSopenharmony_ci */ 35861847f8eSopenharmony_ci getConnectedDevices(): Array<string>; 35961847f8eSopenharmony_ci 36061847f8eSopenharmony_ci /** 36161847f8eSopenharmony_ci * Obtains the profile connection state. 36261847f8eSopenharmony_ci * 36361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 36461847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 36561847f8eSopenharmony_ci * @returns { ProfileConnectionState } Returns the connection state. 36661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 36761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 36861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 36961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 37061847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 37161847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 37261847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 37361847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 37461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 37561847f8eSopenharmony_ci * @since 10 37661847f8eSopenharmony_ci */ 37761847f8eSopenharmony_ci /** 37861847f8eSopenharmony_ci * Obtains the profile connection state. 37961847f8eSopenharmony_ci * 38061847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 38161847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 38261847f8eSopenharmony_ci * @returns { ProfileConnectionState } Returns the connection state. 38361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 38461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 38561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 38661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 38761847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 38861847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 38961847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 39061847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 39161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 39261847f8eSopenharmony_ci * @crossplatform 39361847f8eSopenharmony_ci * @since 13 39461847f8eSopenharmony_ci */ 39561847f8eSopenharmony_ci getConnectionState(deviceId: string): ProfileConnectionState; 39661847f8eSopenharmony_ci 39761847f8eSopenharmony_ci /** 39861847f8eSopenharmony_ci * Subscribe the event reported when the profile connection state changes . 39961847f8eSopenharmony_ci * 40061847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 40161847f8eSopenharmony_ci * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. 40261847f8eSopenharmony_ci * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 40361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 40461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 40561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 40661847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 40761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 40861847f8eSopenharmony_ci * @since 10 40961847f8eSopenharmony_ci */ 41061847f8eSopenharmony_ci /** 41161847f8eSopenharmony_ci * Subscribe the event reported when the profile connection state changes . 41261847f8eSopenharmony_ci * 41361847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 41461847f8eSopenharmony_ci * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. 41561847f8eSopenharmony_ci * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 41661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 41761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 41861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 41961847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 42061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 42161847f8eSopenharmony_ci * @crossplatform 42261847f8eSopenharmony_ci * @since 13 42361847f8eSopenharmony_ci */ 42461847f8eSopenharmony_ci on(type: 'connectionStateChange', callback: Callback<StateChangeParam>): void; 42561847f8eSopenharmony_ci 42661847f8eSopenharmony_ci /** 42761847f8eSopenharmony_ci * Unsubscribe the event reported when the profile connection state changes . 42861847f8eSopenharmony_ci * 42961847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 43061847f8eSopenharmony_ci * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. 43161847f8eSopenharmony_ci * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 43261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 43361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 43461847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 43561847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 43661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 43761847f8eSopenharmony_ci * @since 10 43861847f8eSopenharmony_ci */ 43961847f8eSopenharmony_ci /** 44061847f8eSopenharmony_ci * Unsubscribe the event reported when the profile connection state changes . 44161847f8eSopenharmony_ci * 44261847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 44361847f8eSopenharmony_ci * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. 44461847f8eSopenharmony_ci * @param { Callback<StateChangeParam> } callback - Callback used to listen for event. 44561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 44661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 44761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 44861847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 44961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 45061847f8eSopenharmony_ci * @crossplatform 45161847f8eSopenharmony_ci * @since 13 45261847f8eSopenharmony_ci */ 45361847f8eSopenharmony_ci off(type: 'connectionStateChange', callback?: Callback<StateChangeParam>): void; 45461847f8eSopenharmony_ci } 45561847f8eSopenharmony_ci} 45661847f8eSopenharmony_ci 45761847f8eSopenharmony_ciexport default baseProfile;