• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 arkts {'1.1':'10','1.2':'20'}
29 * @arkts 1.1&1.2
30 */
31declare namespace hfp {
32  /**
33   * Base interface of profile.
34   *
35   * @typedef { baseProfile.BaseProfile } BaseProfile
36   * @syscap SystemCapability.Communication.Bluetooth.Core
37   * @since arkts {'1.1':'10','1.2':'20'}
38   * @arkts 1.1&1.2
39   */
40  type BaseProfile = baseProfile.BaseProfile;
41
42  /**
43   * create the instance of hfp profile.
44   *
45   * @returns { HandsFreeAudioGatewayProfile } Returns the instance of profile.
46   * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
47   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
48   * @throws { BusinessError } 801 - Capability not supported.
49   * @syscap SystemCapability.Communication.Bluetooth.Core
50   * @since arkts {'1.1':'10','1.2':'20'}
51   * @arkts 1.1&1.2
52   */
53  function createHfpAgProfile(): HandsFreeAudioGatewayProfile;
54
55  /**
56   * Manager hfp source profile.
57   *
58   * @extends BaseProfile
59   * @typedef HandsFreeAudioGatewayProfile
60   * @syscap SystemCapability.Communication.Bluetooth.Core
61   * @since arkts {'1.1':'10','1.2':'20'}
62   * @arkts 1.1&1.2
63   */
64  interface HandsFreeAudioGatewayProfile extends BaseProfile {
65    /**
66     * Initiate an HFP connection to a remote device.
67     *
68     * @permission ohos.permission.ACCESS_BLUETOOTH
69     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
70     * @throws { BusinessError } 201 - Permission denied.
71     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
72     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
73     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
74     * @throws { BusinessError } 801 - Capability not supported.
75     * @throws { BusinessError } 2900001 - Service stopped.
76     * @throws { BusinessError } 2900003 - Bluetooth disabled.
77     * @throws { BusinessError } 2900004 - Profile not supported.
78     * @throws { BusinessError } 2900099 - Operation failed.
79     * @syscap SystemCapability.Communication.Bluetooth.Core
80     * @systemapi
81     * @since 10
82     */
83    connect(deviceId: string): void;
84
85    /**
86     * Disconnect the HFP connection with the remote device.
87     *
88     * @permission ohos.permission.ACCESS_BLUETOOTH
89     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
90     * @throws { BusinessError } 201 - Permission denied.
91     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
92     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
93     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
94     * @throws { BusinessError } 801 - Capability not supported.
95     * @throws { BusinessError } 2900001 - Service stopped.
96     * @throws { BusinessError } 2900003 - Bluetooth disabled.
97     * @throws { BusinessError } 2900004 - Profile not supported.
98     * @throws { BusinessError } 2900099 - Operation failed.
99     * @syscap SystemCapability.Communication.Bluetooth.Core
100     * @systemapi
101     * @since 10
102     */
103    disconnect(deviceId: string): void;
104  }
105}
106
107export default hfp;