• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 * @addtogroup HdiActivityRecognition
18 * @{
19 *
20 * @brief Provides APIs for subscribing to and obtaining user activities.
21 *
22 * The Multimodal Sensor Data Platform (MSDP) can obtain the object or proxy of the activity recognition driver,
23 * and call the APIs provided by the object or proxy to obtain activities supported by the device,
24 * the current activity event of the device, and activity events cached on the device,
25 * and subscribe to or unsubscribe from activity events.
26 *
27 * @since 3.2
28 * @version 1.0
29 */
30
31/**
32 * @file ActivityRecognitionTypes.idl
33 *
34 * @brief Declares the data types used by the activity recognition module.
35 *
36 * @since 3.2
37 * @version 1.0
38 */
39
40/**
41 * @brief Defines the package path of the activity recognition module APIs.
42 *
43 * @since 3.2
44 */
45package ohos.hdi.activity_recognition.v1_0;
46
47/**
48 * @brief Enumerates the activity event types.
49 *
50 * The following activities are supported: in the car, cycling, walking, running, still, fast walking,
51 * in the high-speed railway, unknown, in the elevator, relatively still, handheld walking, lying down,
52 * taking the plane, in the subway, and more.
53 *
54 * @since 3.2
55 */
56enum ActRecognitionEventType {
57    /** Entering an activity. */
58    ACT_RECOGNITION_EVENT_ENTER = 0x01,
59    /** Exiting an activity. */
60    ACT_RECOGNITION_EVENT_EXIT = 0x02,
61};
62
63/**
64 * @brief Enumerates the power consumption modes.
65 *
66 * @since 3.2
67 */
68enum ActRecognitionPowerMode {
69    /** Common mode, in which activity events are reported regardless of whether the primary core is in sleep mode. */
70    ACT_RECOGNITION_NORMAL_MODE = 0,
71    /** Low-power mode, in which no activity event is reported when the primary core is in sleep mode. */
72    ACT_RECOGNITION_LOW_POWER_MODE = 1,
73};
74
75/**
76 * @brief Defines the data structure of a reported activity event.
77 *
78 * @since 3.2
79 */
80struct ActRecognitionEvent {
81    /** Activity type. For details, see {@link ActRecognitionEventType}. */
82    int activity;
83    /** Activity event type. For details, see {@link ActRecognitionEventType}. */
84    int eventType;
85    /** Timestamp. */
86    long timestamp;
87    /** Confidence level. The value <b>100</> indicates the highest level, <b>0</b> indicates the lowest level,
88    and <b>-1</b> means that the activity does not support confidence level calculation. */
89    int confidence;
90};
91/** @} */