2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef WRTDEVICEAPIS_HAPTICS_IMOTOR_H_
17 #define WRTDEVICEAPIS_HAPTICS_IMOTOR_H_
19 #include <dpl/shared_ptr.h>
20 #include "HapticPattern.h"
21 #include "EventStartMotor.h"
22 #include "EventPlayBeep.h"
24 namespace WrtDeviceApis {
30 virtual ~IMotor() = 0;
33 * Runs this haptic motor.
34 * Result of this operation might be different for different motor types,
35 * e.g. it may cause phone to vibrate.
36 * @param duration Number of miliseconds action should last.
37 * @throw PlatformException If platform error occurs.
39 virtual void run(unsigned long duration) = 0;
42 * Runs vibration pattern on this haptic motor.
43 * Result of this operation might be different for different motor types,
44 * e.g. it may cause phone to vibrate.
45 * @param pattern sequence of haptic actions.
46 * @throw PlatformException If platform error occurs.
48 virtual void run(const HapticPatternPtr& pattern) = 0;
51 * Runs vibration with event.
52 * Result of this operation might be different for different motor types,
53 * e.g. it may cause phone to vibrate.
54 * @param The event argument is event included duration & pattern.
55 * @throw PlatformException If platform error occurs.
57 virtual void run(const EventStartMotorPtr& event) = 0;
60 * Stops this haptic motor.
61 * @throw PlatformException If platform error occurs.
63 virtual void stopMotor() = 0;
66 * Cancel this haptic motor.
67 * @throw PlatformException If platform error occurs.
69 virtual void stopVibration() = 0;
73 e.g. it may cause phone to beep.
75 @duration duration Number of miliseconds action should last.
77 virtual int playBeep(unsigned long duration,
82 e.g. it may cause phone to beep.
85 virtual void playBeep(const EventPlayBeepPtr& event) = 0;
89 e.g. it may cause phone to stop beep.
91 virtual void stopBeep() = 0;
94 typedef DPL::SharedPtr<IMotor> IMotorPtr;
99 #endif /* WRTDEVICEAPIS_HAPTICS_IMOTOR_H_ */