161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit MultimodalAwarenessKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type { Callback } from './@ohos.base'; 2261847f8eSopenharmony_ci 2361847f8eSopenharmony_ci/** 2461847f8eSopenharmony_ci * Declares a namespace that provides APIs to report the device status. 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * @namespace stationary 2761847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 2861847f8eSopenharmony_ci * @since 9 2961847f8eSopenharmony_ci */ 3061847f8eSopenharmony_cideclare namespace stationary { 3161847f8eSopenharmony_ci /** 3261847f8eSopenharmony_ci * Declares a response interface to receive the device status. 3361847f8eSopenharmony_ci * 3461847f8eSopenharmony_ci * @interface ActivityResponse 3561847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 3661847f8eSopenharmony_ci * @since 9 3761847f8eSopenharmony_ci */ 3861847f8eSopenharmony_ci interface ActivityResponse { 3961847f8eSopenharmony_ci /** 4061847f8eSopenharmony_ci * Declares a response interface to receive the device status. 4161847f8eSopenharmony_ci * 4261847f8eSopenharmony_ci * @type { ActivityState } 4361847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 4461847f8eSopenharmony_ci * @since 9 4561847f8eSopenharmony_ci */ 4661847f8eSopenharmony_ci state: ActivityState; 4761847f8eSopenharmony_ci } 4861847f8eSopenharmony_ci 4961847f8eSopenharmony_ci /** 5061847f8eSopenharmony_ci * Declares the device status type. 5161847f8eSopenharmony_ci * 5261847f8eSopenharmony_ci * @typedef { 'still' | 'relativeStill' } 5361847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 5461847f8eSopenharmony_ci * @since 9 5561847f8eSopenharmony_ci */ 5661847f8eSopenharmony_ci type ActivityType = 'still' | 'relativeStill'; 5761847f8eSopenharmony_ci 5861847f8eSopenharmony_ci /** 5961847f8eSopenharmony_ci * Enumerates the device status events. 6061847f8eSopenharmony_ci * 6161847f8eSopenharmony_ci * @enum {number} 6261847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 6361847f8eSopenharmony_ci * @since 9 6461847f8eSopenharmony_ci */ 6561847f8eSopenharmony_ci enum ActivityEvent { 6661847f8eSopenharmony_ci /** 6761847f8eSopenharmony_ci * Event indicating entering device status. 6861847f8eSopenharmony_ci * 6961847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 7061847f8eSopenharmony_ci * @since 9 7161847f8eSopenharmony_ci */ 7261847f8eSopenharmony_ci ENTER = 1, 7361847f8eSopenharmony_ci 7461847f8eSopenharmony_ci /** 7561847f8eSopenharmony_ci * Event indicating exiting device status. 7661847f8eSopenharmony_ci * 7761847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 7861847f8eSopenharmony_ci * @since 9 7961847f8eSopenharmony_ci */ 8061847f8eSopenharmony_ci EXIT = 2, 8161847f8eSopenharmony_ci 8261847f8eSopenharmony_ci /** 8361847f8eSopenharmony_ci * Event indicating entering and exiting device status. 8461847f8eSopenharmony_ci * 8561847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 8661847f8eSopenharmony_ci * @since 9 8761847f8eSopenharmony_ci */ 8861847f8eSopenharmony_ci ENTER_EXIT = 3 8961847f8eSopenharmony_ci } 9061847f8eSopenharmony_ci 9161847f8eSopenharmony_ci /** 9261847f8eSopenharmony_ci * Enumerates the device status state. 9361847f8eSopenharmony_ci * 9461847f8eSopenharmony_ci * @enum {number} 9561847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 9661847f8eSopenharmony_ci * @since 9 9761847f8eSopenharmony_ci */ 9861847f8eSopenharmony_ci enum ActivityState { 9961847f8eSopenharmony_ci /** 10061847f8eSopenharmony_ci * Entering device status. 10161847f8eSopenharmony_ci * 10261847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 10361847f8eSopenharmony_ci * @since 9 10461847f8eSopenharmony_ci */ 10561847f8eSopenharmony_ci ENTER = 1, 10661847f8eSopenharmony_ci 10761847f8eSopenharmony_ci /** 10861847f8eSopenharmony_ci * Exiting device status. 10961847f8eSopenharmony_ci * 11061847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 11161847f8eSopenharmony_ci * @since 9 11261847f8eSopenharmony_ci */ 11361847f8eSopenharmony_ci EXIT = 2 11461847f8eSopenharmony_ci } 11561847f8eSopenharmony_ci 11661847f8eSopenharmony_ci /** 11761847f8eSopenharmony_ci * Subscribes to the device status. 11861847f8eSopenharmony_ci * 11961847f8eSopenharmony_ci * @param { ActivityType } activity Indicates the device status type. For details, see {@code type: ActivityType}. 12061847f8eSopenharmony_ci * @param { ActivityEvent } event Indicates the device status event. 12161847f8eSopenharmony_ci * @param { number } reportLatencyNs Indicates the event reporting period. 12261847f8eSopenharmony_ci * @param { Callback<ActivityResponse> } callback Indicates the callback for receiving reported data. 12361847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 12461847f8eSopenharmony_ci * @since 9 12561847f8eSopenharmony_ci */ 12661847f8eSopenharmony_ci function on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callback: Callback<ActivityResponse>): void; 12761847f8eSopenharmony_ci 12861847f8eSopenharmony_ci /** 12961847f8eSopenharmony_ci * Obtains the device status. 13061847f8eSopenharmony_ci * 13161847f8eSopenharmony_ci * @param { ActivityType } activity Indicates the device status type. For details, see {@code type: ActivityType}. 13261847f8eSopenharmony_ci * @param { Callback<ActivityResponse> } callback Indicates the callback for receiving reported data. 13361847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 13461847f8eSopenharmony_ci * @since 9 13561847f8eSopenharmony_ci */ 13661847f8eSopenharmony_ci function once(activity: ActivityType, callback: Callback<ActivityResponse>): void; 13761847f8eSopenharmony_ci 13861847f8eSopenharmony_ci /** 13961847f8eSopenharmony_ci * Unsubscribes from the device status. 14061847f8eSopenharmony_ci * 14161847f8eSopenharmony_ci * @param { ActivityType } activity Indicates the device status type. For details, see {@code type: ActivityType}. 14261847f8eSopenharmony_ci * @param { ActivityEvent } event Indicates the device status event. 14361847f8eSopenharmony_ci * @param { Callback<ActivityResponse> } callback Indicates the callback for receiving reported data. 14461847f8eSopenharmony_ci * @syscap SystemCapability.Msdp.DeviceStatus.Stationary 14561847f8eSopenharmony_ci * @since 9 14661847f8eSopenharmony_ci */ 14761847f8eSopenharmony_ci function off(activity: ActivityType, event: ActivityEvent, callback?: Callback<ActivityResponse>): void; 14861847f8eSopenharmony_ci} 14961847f8eSopenharmony_ci 15061847f8eSopenharmony_ciexport default stationary; 151