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 HID(Human Interface Device)-related capabilities. 25 * 26 * @namespace hid 27 * @syscap SystemCapability.Communication.Bluetooth.Core 28 * @since arkts {'1.1':'10','1.2':'20'} 29 * @arkts 1.1&1.2 30 */ 31declare namespace hid { 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 hid profile. 44 * 45 * @returns { HidHostProfile } Returns the instance of hid 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 createHidHostProfile(): HidHostProfile; 54 55 /** 56 * Manager hid host profile. 57 * 58 * @extends BaseProfile 59 * @typedef HidHostProfile 60 * @syscap SystemCapability.Communication.Bluetooth.Core 61 * @since arkts {'1.1':'10','1.2':'20'} 62 * @arkts 1.1&1.2 63 */ 64 interface HidHostProfile extends BaseProfile { 65 /** 66 * Initiate an HID connection to a remote device. 67 * 68 * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_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 HID connection with the remote device. 87 * 88 * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_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 hid;