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