161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022-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 { AsyncCallback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport type Want from './@ohos.app.ability.Want'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * This module provides the capability to manage the device info of the enterprise devices. 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace deviceInfo 2861847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 2961847f8eSopenharmony_ci * @since 10 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace deviceInfo { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * Gets the device serial. 3461847f8eSopenharmony_ci * This function can be called by a super administrator. 3561847f8eSopenharmony_ci * 3661847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO 3761847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 3861847f8eSopenharmony_ci * The admin must have the corresponding permission. 3961847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback - the callback of getDeviceSerial. 4061847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 4161847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 4261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 4361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 4461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4561847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 4661847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 4761847f8eSopenharmony_ci * @systemapi 4861847f8eSopenharmony_ci * @StageModelOnly 4961847f8eSopenharmony_ci * @since 10 5061847f8eSopenharmony_ci */ 5161847f8eSopenharmony_ci function getDeviceSerial(admin: Want, callback: AsyncCallback<string>): void; 5261847f8eSopenharmony_ci 5361847f8eSopenharmony_ci /** 5461847f8eSopenharmony_ci * Gets the device serial. 5561847f8eSopenharmony_ci * This function can be called by a super administrator. 5661847f8eSopenharmony_ci * 5761847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO 5861847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 5961847f8eSopenharmony_ci * The admin must have the corresponding permission. 6061847f8eSopenharmony_ci * @returns { Promise<string> } the promise returned by the getDeviceSerial. 6161847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 6261847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 6361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 6461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 6561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6661847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 6761847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 6861847f8eSopenharmony_ci * @systemapi 6961847f8eSopenharmony_ci * @StageModelOnly 7061847f8eSopenharmony_ci * @since 10 7161847f8eSopenharmony_ci */ 7261847f8eSopenharmony_ci function getDeviceSerial(admin: Want): Promise<string>; 7361847f8eSopenharmony_ci 7461847f8eSopenharmony_ci /** 7561847f8eSopenharmony_ci * Gets the display version. 7661847f8eSopenharmony_ci * This function can be called by a super administrator. 7761847f8eSopenharmony_ci * 7861847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO 7961847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 8061847f8eSopenharmony_ci * The admin must have the corresponding permission. 8161847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback - the callback of getDisplayVersion. 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 } 202 - Permission verification failed. A non-system application calls a system API. 8661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 8761847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 8861847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 8961847f8eSopenharmony_ci * @systemapi 9061847f8eSopenharmony_ci * @StageModelOnly 9161847f8eSopenharmony_ci * @since 10 9261847f8eSopenharmony_ci */ 9361847f8eSopenharmony_ci function getDisplayVersion(admin: Want, callback: AsyncCallback<string>): void; 9461847f8eSopenharmony_ci 9561847f8eSopenharmony_ci /** 9661847f8eSopenharmony_ci * Gets the display version. 9761847f8eSopenharmony_ci * This function can be called by a super administrator. 9861847f8eSopenharmony_ci * 9961847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO 10061847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 10161847f8eSopenharmony_ci * The admin must have the corresponding permission. 10261847f8eSopenharmony_ci * @returns { Promise<string> } the promise returned by the getDisplayVersion. 10361847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 10461847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 10561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 10661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 10761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 10861847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 10961847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 11061847f8eSopenharmony_ci * @systemapi 11161847f8eSopenharmony_ci * @StageModelOnly 11261847f8eSopenharmony_ci * @since 10 11361847f8eSopenharmony_ci */ 11461847f8eSopenharmony_ci function getDisplayVersion(admin: Want): Promise<string>; 11561847f8eSopenharmony_ci 11661847f8eSopenharmony_ci /** 11761847f8eSopenharmony_ci * Gets the device name. 11861847f8eSopenharmony_ci * This function can be called by a super administrator. 11961847f8eSopenharmony_ci * 12061847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO 12161847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 12261847f8eSopenharmony_ci * The admin must have the corresponding permission. 12361847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback - the callback of getDeviceName. 12461847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 12561847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 12661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 12761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 12861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 12961847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 13061847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 13161847f8eSopenharmony_ci * @systemapi 13261847f8eSopenharmony_ci * @StageModelOnly 13361847f8eSopenharmony_ci * @since 10 13461847f8eSopenharmony_ci */ 13561847f8eSopenharmony_ci function getDeviceName(admin: Want, callback: AsyncCallback<string>): void; 13661847f8eSopenharmony_ci 13761847f8eSopenharmony_ci /** 13861847f8eSopenharmony_ci * Gets the device name. 13961847f8eSopenharmony_ci * This function can be called by a super administrator. 14061847f8eSopenharmony_ci * 14161847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO 14261847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 14361847f8eSopenharmony_ci * The admin must have the corresponding permission. 14461847f8eSopenharmony_ci * @returns { Promise<string> } the promise returned by the getDeviceName. 14561847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 14661847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 14761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 14861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 14961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 15061847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 15161847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 15261847f8eSopenharmony_ci * @systemapi 15361847f8eSopenharmony_ci * @StageModelOnly 15461847f8eSopenharmony_ci * @since 10 15561847f8eSopenharmony_ci */ 15661847f8eSopenharmony_ci function getDeviceName(admin: Want): Promise<string>; 15761847f8eSopenharmony_ci 15861847f8eSopenharmony_ci /** 15961847f8eSopenharmony_ci * Gets the device information. 16061847f8eSopenharmony_ci * This function can be called by a super administrator. 16161847f8eSopenharmony_ci * 16261847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO 16361847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 16461847f8eSopenharmony_ci * The admin must have the corresponding permission. 16561847f8eSopenharmony_ci * @param { string } label - label indicates the specific information that needs to be queried, 16661847f8eSopenharmony_ci * the supported device information include deviceName, deviceSerial and simInfo. 16761847f8eSopenharmony_ci * @returns { string } the specific information of device. 16861847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 16961847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 17061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 17161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 17261847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 17361847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 17461847f8eSopenharmony_ci * @StageModelOnly 17561847f8eSopenharmony_ci * @since 12 17661847f8eSopenharmony_ci */ 17761847f8eSopenharmony_ci function getDeviceInfo(admin: Want, label: string): string; 17861847f8eSopenharmony_ci} 17961847f8eSopenharmony_ci 18061847f8eSopenharmony_ciexport default deviceInfo; 181