diff --git a/api/@ohos.deviceInfo.d.ts b/api/@ohos.deviceInfo.d.ts index 8e91729a901cf1b776dfa7611728b7a507c71410..e5ff2135b48ffdc89b4c10d21d0ba9f4580225c1 100644 --- a/api/@ohos.deviceInfo.d.ts +++ b/api/@ohos.deviceInfo.d.ts @@ -24,105 +24,105 @@ declare namespace deviceInfo { * Obtains the device type represented by a string, * which can be {@code phone} (or {@code default} for phones), {@code wearable}, {@code liteWearable}, * {@code tablet}, {@code tv}, {@code car}, or {@code smartVision}. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const deviceType: string; /** * Obtains the device manufacturer represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const manufacture: string; /** * Obtains the device brand represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const brand: string; /** * Obtains the external product series represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const marketName: string; /** * Obtains the product series represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const productSeries: string; /** * Obtains the product model represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const productModel: string; /** * Obtains the software model represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const softwareModel: string; /** * Obtains the hardware model represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const hardwareModel: string; /** * Obtains the hardware profile represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const hardwareProfile: string; /** * Obtains the device serial number represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const serial: string; /** * Obtains the bootloader version number represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const bootloaderVersion: string; /** * Obtains the application binary interface (Abi) list represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const abiList: string; /** * Obtains the security patch level represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const securityPatchTag: string; /** * Obtains the product version represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const displayVersion: string; /** * Obtains the incremental version represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const incrementalVersion: string; @@ -132,14 +132,14 @@ declare namespace deviceInfo { * *
The OS release category can be {@code Release}, {@code Beta}, or {@code Canary}. * The specific release type may be {@code Release}, {@code Beta1}, or others alike. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const osReleaseType: string; /** * Obtains the OS version represented by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const osFullName: string; @@ -147,7 +147,7 @@ declare namespace deviceInfo { /** * Obtains the major (M) version number, which increases with any updates to the overall architecture. *
The M version number monotonically increases from 1 to 99. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const majorVersion: number; @@ -156,7 +156,7 @@ declare namespace deviceInfo { * Obtains the senior (S) version number, which increases with any updates to the partial * architecture or major features. *
The S version number monotonically increases from 0 to 99. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const seniorVersion: number; @@ -164,7 +164,7 @@ declare namespace deviceInfo { /** * Obtains the feature (F) version number, which increases with any planned new features. *
The F version number monotonically increases from 0 or 1 to 99. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const featureVersion: number; @@ -172,69 +172,69 @@ declare namespace deviceInfo { /** * Obtains the build (B) version number, which increases with each new development build. *
The B version number monotonically increases from 0 or 1 to 999. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const buildVersion: number; /** * Obtains the SDK API version number. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const sdkApiVersion: number; /** * Obtains the first API version number. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const firstApiVersion: number; /** * Obtains the version ID by a string. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const versionId: string; /** * Obtains the build types of the same baseline code. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const buildType: string; /** * Obtains the different build user of the same baseline code. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const buildUser: string; /** * Obtains the different build host of the same baseline code. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const buildHost: string; /** * Obtains the build time. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const buildTime: string; /** * Obtains the version hash. - * + * @syscap SystemCapability.Startup.SysInfo * @since 6 */ const buildRootHash: string; /** * Obtains the device udid. - * + * @syscap SystemCapability.Startup.SysInfo * @since 7 */ const udid: string; diff --git a/api/common/@system.device.d.ts b/api/common/@system.device.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0704196daeadba15523c3e8a232dc4d1b0afbec5 --- /dev/null +++ b/api/common/@system.device.d.ts @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @syscap SystemCapability.Startup.SysInfo + */ +export interface DeviceResponse { + /** + * Brand. + * @syscap SystemCapability.Startup.SysInfo + * @since 3 + */ + brand: string; + + /** + * Manufacturer. + * @syscap SystemCapability.Startup.SysInfo + * @since 3 + */ + manufacturer: string; + + /** + * Model. + * @syscap SystemCapability.Startup.SysInfo + * @since 3 + */ + model: string; + + /** + * Product number. + * @syscap SystemCapability.Startup.SysInfo + * @since 3 + */ + product: string; + + /** + * System language. + * @syscap SystemCapability.Startup.SysInfo + * @since 4 + */ + language: string; + + /** + * System region. + * @syscap SystemCapability.Startup.SysInfo + * @since 4 + */ + region: string; + + /** + * Window width. + * @syscap SystemCapability.Startup.SysInfo + * @since 3 + */ + windowWidth: number; + + /** + * Window Height. + * @syscap SystemCapability.Startup.SysInfo + * @since 3 + */ + windowHeight: number; + + /** + * Screen density. + * @syscap SystemCapability.Startup.SysInfo + * @since 4 + */ + screenDensity: number; + + /** + * Screen shape. The options are as follows: + * rect: Rectangle screen. + * circle: Circle screen. + * @syscap SystemCapability.Startup.SysInfo + * @since 4 + */ + screenShape: "rect" | "circle"; + + /** + * API version. + * @syscap SystemCapability.Startup.SysInfo + * @since 4 + */ + apiVersion: number; + + /** + * Device type. The options are as follows: + * phone: smartphone + * tablet: tablet + * tv: smart TV + * wearable: wearable + * liteWearable: lite wearable + * ar: AR + * vr: virtual reality + * earphones: headset + * pc: personal computer + * speaker: speaker + * smartVision: smart visual device + * linkIoT: connection module + * @syscap SystemCapability.Startup.SysInfo + * @since 4 + */ + deviceType: string; +} + +export interface GetDeviceOptions { + /** + * Called when the device information is obtained. + * @syscap SystemCapability.Startup.SysInfo + * @since 3 + */ + success?: (data: DeviceResponse) => void; + + /** + * Called when the device information fails to be obtained. + * @syscap SystemCapability.Startup.SysInfo + * @since 3 + */ + fail?: (data: any, code: number) => void; + + /** + * Called when the execution is completed. + * @syscap SystemCapability.Startup.SysInfo + * @since 3 + */ + complete?: () => void; +} + +/** + * getInfo interface + */ +export default class Device { + /** + * Obtains the device information. + * @syscap SystemCapability.Startup.SysInfo + * @param options Options. + */ + static getInfo(options?: GetDeviceOptions): void; +}