1/* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ConnectivityKit 19 */ 20 21import type baseProfile from './@ohos.bluetooth.baseProfile'; 22 23/** 24 * Provides methods to accessing bluetooth call-related capabilities. 25 * 26 * @namespace hfp 27 * @syscap SystemCapability.Communication.Bluetooth.Core 28 * @since 10 29 */ 30declare namespace hfp { 31 /** 32 * Base interface of profile. 33 * 34 * @typedef { baseProfile.BaseProfile } BaseProfile 35 * @syscap SystemCapability.Communication.Bluetooth.Core 36 * @since 10 37 */ 38 type BaseProfile = baseProfile.BaseProfile; 39 40 /** 41 * create the instance of hfp profile. 42 * 43 * @returns { HandsFreeAudioGatewayProfile } Returns the instance of profile. 44 * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 45 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 46 * @throws { BusinessError } 801 - Capability not supported. 47 * @syscap SystemCapability.Communication.Bluetooth.Core 48 * @since 10 49 */ 50 function createHfpAgProfile(): HandsFreeAudioGatewayProfile; 51 52 /** 53 * Manager hfp source profile. 54 * 55 * @extends BaseProfile 56 * @typedef HandsFreeAudioGatewayProfile 57 * @syscap SystemCapability.Communication.Bluetooth.Core 58 * @since 10 59 */ 60 interface HandsFreeAudioGatewayProfile extends BaseProfile { 61 /** 62 * Initiate an HFP connection to a remote device. 63 * 64 * @permission ohos.permission.ACCESS_BLUETOOTH 65 * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 66 * @throws { BusinessError } 201 - Permission denied. 67 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 68 * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 69 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 70 * @throws { BusinessError } 801 - Capability not supported. 71 * @throws { BusinessError } 2900001 - Service stopped. 72 * @throws { BusinessError } 2900003 - Bluetooth disabled. 73 * @throws { BusinessError } 2900004 - Profile not supported. 74 * @throws { BusinessError } 2900099 - Operation failed. 75 * @syscap SystemCapability.Communication.Bluetooth.Core 76 * @systemapi 77 * @since 10 78 */ 79 connect(deviceId: string): void; 80 81 /** 82 * Disconnect the HFP connection with the remote device. 83 * 84 * @permission ohos.permission.ACCESS_BLUETOOTH 85 * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 86 * @throws { BusinessError } 201 - Permission denied. 87 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 88 * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 89 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 90 * @throws { BusinessError } 801 - Capability not supported. 91 * @throws { BusinessError } 2900001 - Service stopped. 92 * @throws { BusinessError } 2900003 - Bluetooth disabled. 93 * @throws { BusinessError } 2900004 - Profile not supported. 94 * @throws { BusinessError } 2900099 - Operation failed. 95 * @syscap SystemCapability.Communication.Bluetooth.Core 96 * @systemapi 97 * @since 10 98 */ 99 disconnect(deviceId: string): void; 100 } 101} 102 103export default hfp;