1/* 2 * Copyright (c) 2023 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 16import common from '@ohos.app.ability.common'; 17 18export class GlobalThis { 19 private constructor() {} 20 private static instance: GlobalThis; 21 private _uiContexts = new Map<string, common.UIAbilityContext>(); 22 private value: string = ''; 23 24 public static getInstance(): GlobalThis{ 25 if (!GlobalThis.instance) { 26 GlobalThis.instance = new GlobalThis(); 27 } 28 return GlobalThis.instance; 29 } 30 getContext(key: string): common.UIAbilityContext | undefined { 31 return this._uiContexts.get(key); 32 } 33 setContext(key: string, value: common.UIAbilityContext): void { 34 this._uiContexts.set(key, value); 35 } 36 setValue(value: string) { 37 this.value = value; 38 } 39 getValue(): string { 40 return this.value; 41 } 42} 43 44export class Camera_ErrorCode { 45 static readonly CAMERA_OK = 0; 46 static readonly CAMERA_INVALID_ARGUMENT = 7400101; 47 static readonly CAMERA_OPERATION_NOT_ALLOWED = 7400102; 48 static readonly CAMERA_SESSION_NOT_CONFIG = 7400103; 49 static readonly CAMERA_SESSION_NOT_RUNNING = 7400104; 50 static readonly CAMERA_SESSION_CONFIG_LOCKED = 7400105; 51 static readonly CAMERA_DEVICE_SETTING_LOCKED = 7400106; 52 static readonly CAMERA_CONFLICT_CAMERA = 7400107; 53 static readonly CAMERA_DEVICE_DISABLED = 7400108; 54 static readonly CAMERA_DEVICE_PREEMPTED = 7400109; 55 static readonly CAMERA_SERVICE_FATAL_ERROR = 7400201; 56} 57 58export class Camera_ExposureMode { 59 static readonly EXPOSURE_MODE_LOCKED = 0; 60 static readonly EXPOSURE_MODE_AUTO = 1; 61 static readonly EXPOSURE_MODE_CONTINUOUS_AUTO = 2; 62} 63 64export class Camera_FlashMode { 65 static readonly FLASH_MODE_CLOSE = 0; 66 static readonly FLASH_MODE_OPEN = 1; 67 static readonly FLASH_MODE_AUTO = 2; 68 static readonly FLASH_MODE_ALWAYS_OPEN = 3; 69} 70 71export class Camera_FocusMode { 72 static readonly FOCUS_MODE_MANUAL = 0; 73 static readonly FOCUS_MODE_CONTINUOUS_AUTO = 1; 74 static readonly FOCUS_MODE_AUTO = 2; 75 static readonly FOCUS_MODE_LOCKED = 3; 76} 77 78export class Camera_VideoStabilizationMode { 79 static readonly STABILIZATION_MODE_OFF = 0; 80 static readonly STABILIZATION_MODE_LOW = 1; 81 static readonly STABILIZATION_MODE_MIDDLE = 2; 82 static readonly STABILIZATION_MODE_HIGH = 3; 83 static readonly STABILIZATION_MODE_AUTO = 4; 84} 85 86export class Camera_PreconfigType { 87 static readonly EXCEPTION_ENUMERATION_VALUE = -1; 88 static readonly PRECONFIG_720P = 0; 89 static readonly PRECONFIG_1080P = 1; 90 static readonly PRECONFIG_4K = 2; 91 static readonly PRECONFIG_HIGH_QUALITY = 3; 92} 93 94export class Camera_PreconfigRatio { 95 static readonly EXCEPTION_ENUMERATION_VALUE = -1; 96 static readonly PRECONFIG_RATIO_1 = 0; 97 static readonly PRECONFIG_RATIO_4 = 1; 98 static readonly PRECONFIG_RATIO_16 = 2; 99} 100 101export class Camera_MediaType { 102 static readonly IMAGE = 0; 103 static readonly VIDEO = 1; 104} 105 106export class Camera_SceneMode { 107 static readonly NORMAL_PHOTO = 0; 108 static readonly NORMAL_VIDEO = 1; 109 static readonly SECURE_PHOTO = 2; 110} 111 112export class Parameter_Setting { 113 static readonly ALL_PARAMETER_OK = 0; 114 static readonly FIRST_PARAMETER_ERROR = 1; 115 static readonly SECOND_PARAMETER_ERROR = 2; 116 static readonly THIRD_PARAMETER_ERROR = 3; 117 static readonly FOURTH_PARAMETER_ERROR = 4; 118 static readonly SET_CAMERA_FRONT_FOR_SECURE_PHOTO = 5; 119} 120 121export class Torch_Mode { 122 static readonly OFF = 0; 123 static readonly ON = 1; 124 static readonly AUTO = 2; 125} 126 127export class Camera_QualityPrioritization { 128 static readonly HIGH_QUALITY = 0; 129 static readonly POWER_BALANCE = 1; 130}