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 Motion
18 * @{
19 *
20 * @brief Provides common APIs for hardware services to access the motion driver module.
21 *
22 * A service can obtain a motion driver object or agent and then call APIs provided by this object or agent to
23 * enable or disable motion and subscribe to or unsubscribe from motion data.
24 *
25 * @since 3.2
26 */
27
28/**
29 * @file IMotionInterface.idl
30 *
31 * @brief Defines the APIs for enabling or disabling motion and subscribing to or unsubscribing from motion data.
32 *
33 * The APIs defined here can be called to implement various motion features, such as pickup, flipping, shaking, and screen rotation.
34 *
35 * @since 3.2
36 * @version 1.0
37 */
38
39/**
40 * @brief Defines the package path of the motion driver module APIs.
41 *
42 * @since 3.2
43 */
44package ohos.hdi.motion.v1_0;
45
46import ohos.hdi.motion.v1_0.MotionTypes;
47import ohos.hdi.motion.v1_0.IMotionCallback;
48
49/**
50 * @brief Defines the APIs for performing basic operations on motion devices.
51 *
52 * The APIs can be used to enable or disable motion and subscribe to or unsubscribe from motion data.
53 */
54interface IMotionInterface {
55    /**
56     * @brief Enables motion.
57     *
58     * @param motionType Motion type. For details, see {@link HdfMotionTypeTag}.
59     *
60     * @return Returns <b>0</b> if the operation is successful.
61     * @return Returns a negative value if the operation fails.
62     *
63     * @since 3.2
64     * @version 1.0
65     */
66    EnableMotion([in] int motionType);
67
68    /**
69     * @brief Disables motion.
70     *
71     * @param motionType Motion type. For details, see {@link HdfMotionTypeTag}.
72     *
73     * @return Returns <b>0</b> if the operation is successful.
74     * @return Returns a negative value if the operation fails.
75     *
76     * @since 3.2
77     * @version 1.0
78     */
79    DisableMotion([in] int motionType);
80
81    /**
82     * @brief Registers the callback for motion data.
83     *
84     * If the registration is successful, the system reports the obtained motion data to the subscriber.
85     *
86     * @param callbackObj Callback to register, which only needs to be registered only once. For details, see {@link IMotionCallback}.
87     *
88     * @return Returns <b>0</b> if the operation is successful.
89     * @return Returns a negative value if the operation fails.
90     *
91     * @since 3.2
92     * @version 1.0
93     */
94    Register([in] IMotionCallback callbackObj);
95
96    /**
97     * @brief Unregisters the callback for motion data.
98     *
99     * @param callbackObj Callback to unregister, which only needs to be unregistered only once. For details, see {@link IMotionCallback}.
100     *
101     * @return Returns <b>0</b> if the operation is successful.
102     * @return Returns a negative value if the operation fails.
103     *
104     * @since 3.2
105     * @version 1.0
106     */
107    Unregister([in] IMotionCallback callbackObj);
108}
109/** @} */
110