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 PAN(Personal Area Networking Profile)-related capabilities. 25 * 26 * @namespace pan 27 * @syscap SystemCapability.Communication.Bluetooth.Core 28 * @since 10 29 */ 30declare namespace pan { 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 pan profile. 42 * 43 * @returns { PanProfile } Returns the instance of pan 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 createPanProfile(): PanProfile; 51 52 /** 53 * Manager pan host profile. 54 * 55 * @extends BaseProfile 56 * @typedef PanProfile 57 * @syscap SystemCapability.Communication.Bluetooth.Core 58 * @since 10 59 */ 60 interface PanProfile extends BaseProfile { 61 /** 62 * Disconnect the PAN connection with the 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 disconnect(deviceId: string): void; 80 81 /** 82 * Enable bluetooth tethering. 83 * 84 * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 85 * @param { boolean } enable - Specifies whether to enable tethering. 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 setTethering(enable: boolean): void; 100 101 /** 102 * Obtains the tethering enable or disable. 103 * 104 * @permission ohos.permission.ACCESS_BLUETOOTH 105 * @returns { boolean } Returns the value {@code true} is tethering is on, returns {@code false} otherwise. 106 * @throws { BusinessError } 201 - Permission denied. 107 * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 108 * @throws { BusinessError } 801 - Capability not supported. 109 * @syscap SystemCapability.Communication.Bluetooth.Core 110 * @systemapi 111 * @since 10 112 */ 113 isTetheringOn(): boolean; 114 } 115} 116 117export default pan;