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 MDMKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport type Want from './@ohos.app.ability.Want';
2261847f8eSopenharmony_ciimport type constant from './@ohos.bluetooth.constant';
2361847f8eSopenharmony_ciimport type access from './@ohos.bluetooth.access';
2461847f8eSopenharmony_ci
2561847f8eSopenharmony_ci/**
2661847f8eSopenharmony_ci * This module provides the capability to manage the bluetooth of the enterprise devices.
2761847f8eSopenharmony_ci *
2861847f8eSopenharmony_ci * @namespace bluetoothManager
2961847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager
3061847f8eSopenharmony_ci * @stagemodelonly
3161847f8eSopenharmony_ci * @since 11
3261847f8eSopenharmony_ci */
3361847f8eSopenharmony_cideclare namespace bluetoothManager {
3461847f8eSopenharmony_ci  /**
3561847f8eSopenharmony_ci   * The information of device bluetooth.
3661847f8eSopenharmony_ci   *
3761847f8eSopenharmony_ci   * @typedef BluetoothInfo
3861847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
3961847f8eSopenharmony_ci   * @stagemodelonly
4061847f8eSopenharmony_ci   * @since 12
4161847f8eSopenharmony_ci   */
4261847f8eSopenharmony_ci  export interface BluetoothInfo {
4361847f8eSopenharmony_ci    /**
4461847f8eSopenharmony_ci     * The name of bluetooth.
4561847f8eSopenharmony_ci     *
4661847f8eSopenharmony_ci     * @type { string }
4761847f8eSopenharmony_ci     * @syscap SystemCapability.Customization.EnterpriseDeviceManager
4861847f8eSopenharmony_ci     * @stagemodelonly
4961847f8eSopenharmony_ci     * @since 12
5061847f8eSopenharmony_ci     */
5161847f8eSopenharmony_ci    name: string;
5261847f8eSopenharmony_ci
5361847f8eSopenharmony_ci    /**
5461847f8eSopenharmony_ci     * The state of bluetooth.
5561847f8eSopenharmony_ci     *
5661847f8eSopenharmony_ci     * @type { access.BluetoothState }
5761847f8eSopenharmony_ci     * @syscap SystemCapability.Customization.EnterpriseDeviceManager
5861847f8eSopenharmony_ci     * @stagemodelonly
5961847f8eSopenharmony_ci     * @since 12
6061847f8eSopenharmony_ci     */
6161847f8eSopenharmony_ci    state: access.BluetoothState;
6261847f8eSopenharmony_ci
6361847f8eSopenharmony_ci    /**
6461847f8eSopenharmony_ci     * The state of bluetooth connection
6561847f8eSopenharmony_ci     *
6661847f8eSopenharmony_ci     * @type { constant.ProfileConnectionState }
6761847f8eSopenharmony_ci     * @syscap SystemCapability.Customization.EnterpriseDeviceManager
6861847f8eSopenharmony_ci     * @stagemodelonly
6961847f8eSopenharmony_ci     * @since 12
7061847f8eSopenharmony_ci     */
7161847f8eSopenharmony_ci    connectionState: constant.ProfileConnectionState;
7261847f8eSopenharmony_ci  }
7361847f8eSopenharmony_ci
7461847f8eSopenharmony_ci  /**
7561847f8eSopenharmony_ci   * Gets bluetooth information.
7661847f8eSopenharmony_ci   * This function can be called by a super administrator.
7761847f8eSopenharmony_ci   *
7861847f8eSopenharmony_ci   * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH
7961847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
8061847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
8161847f8eSopenharmony_ci   * @returns { BluetoothInfo } the bluetooth information.
8261847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
8361847f8eSopenharmony_ci   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
8461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
8561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
8661847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
8761847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
8861847f8eSopenharmony_ci   * @stagemodelonly
8961847f8eSopenharmony_ci   * @since 12
9061847f8eSopenharmony_ci   */
9161847f8eSopenharmony_ci  function getBluetoothInfo(admin: Want): BluetoothInfo;
9261847f8eSopenharmony_ci
9361847f8eSopenharmony_ci  /**
9461847f8eSopenharmony_ci   * Disables the bluetooth.
9561847f8eSopenharmony_ci   * This function can be called by a super administrator.
9661847f8eSopenharmony_ci   *
9761847f8eSopenharmony_ci   * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH
9861847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
9961847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
10061847f8eSopenharmony_ci   * @param { boolean } disabled - true if disable the bluetooth, otherwise false.
10161847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
10261847f8eSopenharmony_ci   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
10361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
10461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
10561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
10661847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
10761847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
10861847f8eSopenharmony_ci   * @systemapi
10961847f8eSopenharmony_ci   * @stagemodelonly
11061847f8eSopenharmony_ci   * @since 11
11161847f8eSopenharmony_ci   */
11261847f8eSopenharmony_ci  function setBluetoothDisabled(admin: Want, disabled: boolean): void;
11361847f8eSopenharmony_ci
11461847f8eSopenharmony_ci  /**
11561847f8eSopenharmony_ci   * Gets state of whether the bluetooth is disabled.
11661847f8eSopenharmony_ci   * This function can be called by a super administrator.
11761847f8eSopenharmony_ci   *
11861847f8eSopenharmony_ci   * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH
11961847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
12061847f8eSopenharmony_ci   *                         If the admin is not empty, it must have the corresponding permission.
12161847f8eSopenharmony_ci   * @returns { boolean } true if the bluetooth is disabled, otherwise false.
12261847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
12361847f8eSopenharmony_ci   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
12461847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
12561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
12661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
12761847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
12861847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
12961847f8eSopenharmony_ci   * @systemapi
13061847f8eSopenharmony_ci   * @stagemodelonly
13161847f8eSopenharmony_ci   * @since 11
13261847f8eSopenharmony_ci   */
13361847f8eSopenharmony_ci  function isBluetoothDisabled(admin: Want): boolean;
13461847f8eSopenharmony_ci
13561847f8eSopenharmony_ci  /**
13661847f8eSopenharmony_ci   * Adds devices to the list of bluetooth devices that are allowed to be connected.
13761847f8eSopenharmony_ci   * This function can be called by a super administrator.
13861847f8eSopenharmony_ci   *
13961847f8eSopenharmony_ci   * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH
14061847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
14161847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
14261847f8eSopenharmony_ci   * @param { Array<string> } deviceIds - IDs of the bluetooth devices to be added to the list.
14361847f8eSopenharmony_ci   *                                      The size of the array after setting cannot be greater than 1000.
14461847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
14561847f8eSopenharmony_ci   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
14661847f8eSopenharmony_ci   * @throws { BusinessError } 9200010 - A conflict policy has been configured.
14761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
14861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
14961847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
15061847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
15161847f8eSopenharmony_ci   * @stagemodelonly
15261847f8eSopenharmony_ci   * @since 12
15361847f8eSopenharmony_ci   */
15461847f8eSopenharmony_ci  function addAllowedBluetoothDevices(admin: Want, deviceIds: Array<string>): void;
15561847f8eSopenharmony_ci
15661847f8eSopenharmony_ci  /**
15761847f8eSopenharmony_ci   * Removes devices from the list of bluetooth devices that are allowed to be connected.
15861847f8eSopenharmony_ci   * This function can be called by a super administrator.
15961847f8eSopenharmony_ci   *
16061847f8eSopenharmony_ci   * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH
16161847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
16261847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
16361847f8eSopenharmony_ci   * @param { Array<string> } deviceIds - IDs of the bluetooth devices to be removed from the list.
16461847f8eSopenharmony_ci   *                                      The size of the array after setting cannot be greater than 1000.
16561847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
16661847f8eSopenharmony_ci   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
16761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
16861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
16961847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
17061847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
17161847f8eSopenharmony_ci   * @stagemodelonly
17261847f8eSopenharmony_ci   * @since 12
17361847f8eSopenharmony_ci   */
17461847f8eSopenharmony_ci  function removeAllowedBluetoothDevices(admin: Want, deviceIds: Array<string>): void;
17561847f8eSopenharmony_ci
17661847f8eSopenharmony_ci  /**
17761847f8eSopenharmony_ci   * Gets the devices in the list of bluetooth devices that are allowed to be connected.
17861847f8eSopenharmony_ci   * This function can be called by a super administrator.
17961847f8eSopenharmony_ci   *
18061847f8eSopenharmony_ci   * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH
18161847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
18261847f8eSopenharmony_ci   *                         If the admin is not empty, it must have the corresponding permission.
18361847f8eSopenharmony_ci   * @returns { Array<string> } IDs of the bluetooth devices in the list.
18461847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
18561847f8eSopenharmony_ci   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
18661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
18761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
18861847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
18961847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
19061847f8eSopenharmony_ci   * @stagemodelonly
19161847f8eSopenharmony_ci   * @since 12
19261847f8eSopenharmony_ci   */
19361847f8eSopenharmony_ci  function getAllowedBluetoothDevices(admin: Want): Array<string>;
19461847f8eSopenharmony_ci}
19561847f8eSopenharmony_ci
19661847f8eSopenharmony_ciexport default bluetoothManager;
197