/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @addtogroup Motion
* @{
*
* @brief Provides common APIs for hardware services to access the motion driver module.
*
* A service can obtain a motion driver object or agent and then call APIs provided by this object or agent to
* enable or disable motion and subscribe to or unsubscribe from motion data.
*
* @since 3.2
*/
/**
* @file IMotionInterface.idl
*
* @brief Defines the APIs for enabling or disabling motion and subscribing to or unsubscribing from motion data.
*
* The APIs defined here can be called to implement various motion features, such as pickup, flipping, shaking, and screen rotation.
*
* @since 3.2
* @version 1.0
*/
/**
* @brief Defines the package path of the motion driver module APIs.
*
* @since 3.2
*/
package ohos.hdi.motion.v1_0;
import ohos.hdi.motion.v1_0.MotionTypes;
import ohos.hdi.motion.v1_0.IMotionCallback;
/**
* @brief Defines the APIs for performing basic operations on motion devices.
*
* The APIs can be used to enable or disable motion and subscribe to or unsubscribe from motion data.
*/
interface IMotionInterface {
/**
* @brief Enables motion.
*
* @param motionType Motion type. For details, see {@link HdfMotionTypeTag}.
*
* @return Returns 0 if the operation is successful.
* @return Returns a negative value if the operation fails.
*
* @since 3.2
* @version 1.0
*/
EnableMotion([in] int motionType);
/**
* @brief Disables motion.
*
* @param motionType Motion type. For details, see {@link HdfMotionTypeTag}.
*
* @return Returns 0 if the operation is successful.
* @return Returns a negative value if the operation fails.
*
* @since 3.2
* @version 1.0
*/
DisableMotion([in] int motionType);
/**
* @brief Registers the callback for motion data.
*
* If the registration is successful, the system reports the obtained motion data to the subscriber.
*
* @param callbackObj Callback to register, which only needs to be registered only once. For details, see {@link IMotionCallback}.
*
* @return Returns 0 if the operation is successful.
* @return Returns a negative value if the operation fails.
*
* @since 3.2
* @version 1.0
*/
Register([in] IMotionCallback callbackObj);
/**
* @brief Unregisters the callback for motion data.
*
* @param callbackObj Callback to unregister, which only needs to be unregistered only once. For details, see {@link IMotionCallback}.
*
* @return Returns 0 if the operation is successful.
* @return Returns a negative value if the operation fails.
*
* @since 3.2
* @version 1.0
*/
Unregister([in] IMotionCallback callbackObj);
}
/** @} */