161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (C) 2023 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 ConnectivityKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type baseProfile from './@ohos.bluetooth.baseProfile'; 2261847f8eSopenharmony_ciimport type constant from './@ohos.bluetooth.constant'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * Provides methods to accessing bluetooth MAP(Message Access Profile)-related capabilities. 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace map 2861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 2961847f8eSopenharmony_ci * @since 11 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace map { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * Base interface of profile. 3461847f8eSopenharmony_ci * 3561847f8eSopenharmony_ci * @typedef { baseProfile.BaseProfile } BaseProfile 3661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 3761847f8eSopenharmony_ci * @since 11 3861847f8eSopenharmony_ci */ 3961847f8eSopenharmony_ci type BaseProfile = baseProfile.BaseProfile; 4061847f8eSopenharmony_ci 4161847f8eSopenharmony_ci /** 4261847f8eSopenharmony_ci * Indicate the phone book access authorization. 4361847f8eSopenharmony_ci * 4461847f8eSopenharmony_ci * @typedef { constant.AccessAuthorization } AccessAuthorization 4561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 4661847f8eSopenharmony_ci * @systemapi 4761847f8eSopenharmony_ci * @since 11 4861847f8eSopenharmony_ci */ 4961847f8eSopenharmony_ci type AccessAuthorization = constant.AccessAuthorization; 5061847f8eSopenharmony_ci 5161847f8eSopenharmony_ci /** 5261847f8eSopenharmony_ci * create the instance of MAP MSE profile. 5361847f8eSopenharmony_ci * 5461847f8eSopenharmony_ci * @returns { MapMseProfile } Returns the instance of map mse profile. 5561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 5661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 5761847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 5861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 5961847f8eSopenharmony_ci * @since 11 6061847f8eSopenharmony_ci */ 6161847f8eSopenharmony_ci function createMapMseProfile(): MapMseProfile; 6261847f8eSopenharmony_ci 6361847f8eSopenharmony_ci /** 6461847f8eSopenharmony_ci * Manager MAP MSE profile. 6561847f8eSopenharmony_ci * 6661847f8eSopenharmony_ci * @typedef MapMseProfile 6761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 6861847f8eSopenharmony_ci * @since 11 6961847f8eSopenharmony_ci */ 7061847f8eSopenharmony_ci interface MapMseProfile extends BaseProfile { 7161847f8eSopenharmony_ci /** 7261847f8eSopenharmony_ci * Disconnect the map connection with the remote device. 7361847f8eSopenharmony_ci * 7461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH 7561847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 7661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 7761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 7861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 7961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 8061847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 8161847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 8261847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 8361847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 8461847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 8561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 8661847f8eSopenharmony_ci * @systemapi 8761847f8eSopenharmony_ci * @since 11 8861847f8eSopenharmony_ci */ 8961847f8eSopenharmony_ci disconnect(deviceId: string): void; 9061847f8eSopenharmony_ci 9161847f8eSopenharmony_ci /** 9261847f8eSopenharmony_ci * Set the message access authorization. 9361847f8eSopenharmony_ci * 9461847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 9561847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 9661847f8eSopenharmony_ci * @param { AccessAuthorization } authorization - Indicates the permission. 9761847f8eSopenharmony_ci * @returns { Promise<void> } Returns the promise object. 9861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 9961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 10061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 10161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 10261847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 10361847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 10461847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 10561847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 10661847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 10761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 10861847f8eSopenharmony_ci * @systemapi 10961847f8eSopenharmony_ci * @since 11 11061847f8eSopenharmony_ci */ 11161847f8eSopenharmony_ci setMessageAccessAuthorization(deviceId: string, authorization: AccessAuthorization): Promise<void>; 11261847f8eSopenharmony_ci 11361847f8eSopenharmony_ci /** 11461847f8eSopenharmony_ci * Get the message access authorization. 11561847f8eSopenharmony_ci * 11661847f8eSopenharmony_ci * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH 11761847f8eSopenharmony_ci * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". 11861847f8eSopenharmony_ci * @returns { Promise<AccessAuthorization> } Returns the promise object. 11961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 12061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. 12161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 12261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 12361847f8eSopenharmony_ci * @throws { BusinessError } 801 - Capability not supported. 12461847f8eSopenharmony_ci * @throws { BusinessError } 2900001 - Service stopped. 12561847f8eSopenharmony_ci * @throws { BusinessError } 2900003 - Bluetooth disabled. 12661847f8eSopenharmony_ci * @throws { BusinessError } 2900004 - Profile not supported. 12761847f8eSopenharmony_ci * @throws { BusinessError } 2900099 - Operation failed. 12861847f8eSopenharmony_ci * @syscap SystemCapability.Communication.Bluetooth.Core 12961847f8eSopenharmony_ci * @systemapi 13061847f8eSopenharmony_ci * @since 11 13161847f8eSopenharmony_ci */ 13261847f8eSopenharmony_ci getMessageAccessAuthorization(deviceId: string): Promise<AccessAuthorization>; 13361847f8eSopenharmony_ci } 13461847f8eSopenharmony_ci} 13561847f8eSopenharmony_ci 13661847f8eSopenharmony_ciexport default map;