1/* 2 * Copyright (c) 2022-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 commonEvent from '@ohos.commonEventManager'; 17 18export class EventData { 19 "usual.event.wifi.POWER_STATE": number; 20 "usual.event.SCREEN_OFF": number; 21 "usual.event.SCREEN_ON": number; 22 "usual.event.SCREEN_LOCKED": number; 23 "usual.event.SCREEN_UNLOCKED": number; 24} 25 26export default class SurveillanceEventsManager { 27 constructor() { 28 } 29 30 static getSurveillanceEventStates(): EventData { 31 return { 32 "usual.event.wifi.POWER_STATE": globalThis.settings.get(commonEvent.Support.COMMON_EVENT_WIFI_POWER_STATE), 33 "usual.event.SCREEN_OFF": globalThis.settings.get(commonEvent.Support.COMMON_EVENT_SCREEN_OFF), 34 "usual.event.SCREEN_ON": globalThis.settings.get(commonEvent.Support.COMMON_EVENT_SCREEN_ON), 35 "usual.event.SCREEN_LOCKED": globalThis.settings.get(commonEvent.Support.COMMON_EVENT_SCREEN_LOCKED), 36 "usual.event.SCREEN_UNLOCKED": globalThis.settings.get(commonEvent.Support.COMMON_EVENT_SCREEN_UNLOCKED) 37 } 38 } 39 40 static surveillanceEvents: Array<string> = [ 41 commonEvent.Support.COMMON_EVENT_WIFI_POWER_STATE, 42 commonEvent.Support.COMMON_EVENT_SCREEN_OFF, 43 commonEvent.Support.COMMON_EVENT_SCREEN_ON, 44 commonEvent.Support.COMMON_EVENT_SCREEN_LOCKED, 45 commonEvent.Support.COMMON_EVENT_SCREEN_UNLOCKED, 46 ] 47}