• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2024 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 MDMKit
19 */
20
21import type { AsyncCallback } from './@ohos.base';
22import type Want from './@ohos.app.ability.Want';
23
24/**
25 * This module provides the capability to manage the device info of the enterprise devices.
26 *
27 * @namespace deviceInfo
28 * @syscap SystemCapability.Customization.EnterpriseDeviceManager
29 * @since 10
30 */
31declare namespace deviceInfo {
32  /**
33   * Gets the device serial.
34   * This function can be called by a super administrator.
35   *
36   * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO
37   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
38   *                         The admin must have the corresponding permission.
39   * @param { AsyncCallback<string> } callback - the callback of getDeviceSerial.
40   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
41   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
42   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
43   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
44   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
45   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
46   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
47   * @systemapi
48   * @StageModelOnly
49   * @since 10
50   */
51  function getDeviceSerial(admin: Want, callback: AsyncCallback<string>): void;
52
53  /**
54   * Gets the device serial.
55   * This function can be called by a super administrator.
56   *
57   * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO
58   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
59   *                         The admin must have the corresponding permission.
60   * @returns { Promise<string> } the promise returned by the getDeviceSerial.
61   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
62   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
63   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
64   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
65   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
66   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
67   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
68   * @systemapi
69   * @StageModelOnly
70   * @since 10
71   */
72  function getDeviceSerial(admin: Want): Promise<string>;
73
74  /**
75   * Gets the display version.
76   * This function can be called by a super administrator.
77   *
78   * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO
79   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
80   *                         The admin must have the corresponding permission.
81   * @param { AsyncCallback<string> } callback - the callback of getDisplayVersion.
82   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
83   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
84   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
85   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
86   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
87   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
88   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
89   * @systemapi
90   * @StageModelOnly
91   * @since 10
92   */
93  function getDisplayVersion(admin: Want, callback: AsyncCallback<string>): void;
94
95  /**
96   * Gets the display version.
97   * This function can be called by a super administrator.
98   *
99   * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO
100   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
101   *                         The admin must have the corresponding permission.
102   * @returns { Promise<string> } the promise returned by the getDisplayVersion.
103   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
104   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
105   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
106   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
107   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
108   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
109   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
110   * @systemapi
111   * @StageModelOnly
112   * @since 10
113   */
114  function getDisplayVersion(admin: Want): Promise<string>;
115
116  /**
117   * Gets the device name.
118   * This function can be called by a super administrator.
119   *
120   * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO
121   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
122   *                         The admin must have the corresponding permission.
123   * @param { AsyncCallback<string> } callback - the callback of getDeviceName.
124   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
125   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
126   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
127   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
128   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
129   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
130   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
131   * @systemapi
132   * @StageModelOnly
133   * @since 10
134   */
135  function getDeviceName(admin: Want, callback: AsyncCallback<string>): void;
136
137  /**
138   * Gets the device name.
139   * This function can be called by a super administrator.
140   *
141   * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO
142   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
143   *                         The admin must have the corresponding permission.
144   * @returns { Promise<string> } the promise returned by the getDeviceName.
145   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
146   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
147   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
148   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
149   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
150   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
151   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
152   * @systemapi
153   * @StageModelOnly
154   * @since 10
155   */
156  function getDeviceName(admin: Want): Promise<string>;
157
158  /**
159   * Gets the device information.
160   * This function can be called by a super administrator.
161   *
162   * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO
163   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
164   *                         The admin must have the corresponding permission.
165   * @param { string } label - label indicates the specific information that needs to be queried,
166   *                           the supported device information include deviceName, deviceSerial and simInfo.
167   * @returns { string } the specific information of device.
168   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
169   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
170   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
171   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
172   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
173   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
174   * @StageModelOnly
175   * @since 12
176   */
177  function getDeviceInfo(admin: Want, label: string): string;
178}
179
180export default deviceInfo;
181