1/* 2 * Copyright (c) 2022 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 MultimodalAwarenessKit 19 */ 20 21import type { Callback } from './@ohos.base'; 22 23/** 24 * Declares a namespace that provides APIs to report the device status. 25 * 26 * @namespace stationary 27 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 28 * @since 9 29 */ 30declare namespace stationary { 31 /** 32 * Declares a response interface to receive the device status. 33 * 34 * @interface ActivityResponse 35 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 36 * @since 9 37 */ 38 interface ActivityResponse { 39 /** 40 * Declares a response interface to receive the device status. 41 * 42 * @type { ActivityState } 43 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 44 * @since 9 45 */ 46 state: ActivityState; 47 } 48 49 /** 50 * Declares the device status type. 51 * 52 * @typedef { 'still' | 'relativeStill' } 53 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 54 * @since 9 55 */ 56 type ActivityType = 'still' | 'relativeStill'; 57 58 /** 59 * Enumerates the device status events. 60 * 61 * @enum {number} 62 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 63 * @since 9 64 */ 65 enum ActivityEvent { 66 /** 67 * Event indicating entering device status. 68 * 69 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 70 * @since 9 71 */ 72 ENTER = 1, 73 74 /** 75 * Event indicating exiting device status. 76 * 77 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 78 * @since 9 79 */ 80 EXIT = 2, 81 82 /** 83 * Event indicating entering and exiting device status. 84 * 85 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 86 * @since 9 87 */ 88 ENTER_EXIT = 3 89 } 90 91 /** 92 * Enumerates the device status state. 93 * 94 * @enum {number} 95 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 96 * @since 9 97 */ 98 enum ActivityState { 99 /** 100 * Entering device status. 101 * 102 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 103 * @since 9 104 */ 105 ENTER = 1, 106 107 /** 108 * Exiting device status. 109 * 110 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 111 * @since 9 112 */ 113 EXIT = 2 114 } 115 116 /** 117 * Subscribes to the device status. 118 * 119 * @param { ActivityType } activity Indicates the device status type. For details, see {@code type: ActivityType}. 120 * @param { ActivityEvent } event Indicates the device status event. 121 * @param { number } reportLatencyNs Indicates the event reporting period. 122 * @param { Callback<ActivityResponse> } callback Indicates the callback for receiving reported data. 123 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 124 * @since 9 125 */ 126 function on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callback: Callback<ActivityResponse>): void; 127 128 /** 129 * Obtains the device status. 130 * 131 * @param { ActivityType } activity Indicates the device status type. For details, see {@code type: ActivityType}. 132 * @param { Callback<ActivityResponse> } callback Indicates the callback for receiving reported data. 133 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 134 * @since 9 135 */ 136 function once(activity: ActivityType, callback: Callback<ActivityResponse>): void; 137 138 /** 139 * Unsubscribes from the device status. 140 * 141 * @param { ActivityType } activity Indicates the device status type. For details, see {@code type: ActivityType}. 142 * @param { ActivityEvent } event Indicates the device status event. 143 * @param { Callback<ActivityResponse> } callback Indicates the callback for receiving reported data. 144 * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 145 * @since 9 146 */ 147 function off(activity: ActivityType, event: ActivityEvent, callback?: Callback<ActivityResponse>): void; 148} 149 150export default stationary; 151