|
1 /* |
|
2 * |
|
3 * Copyright 2013 Canonical Ltd. |
|
4 * |
|
5 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 * you may not use this file except in compliance with the License. |
|
7 * You may obtain a copy of the License at |
|
8 * |
|
9 * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 * |
|
11 * Unless required by applicable law or agreed to in writing, |
|
12 * software distributed under the License is distributed on an |
|
13 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
14 * KIND, either express or implied. See the License for the |
|
15 * specific language governing permissions and limitations |
|
16 * under the License. |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef _VIBRATION_H_SFAFKNVX3456 |
|
21 #define _VIBRATION_H_SFAFKNVX3456 |
|
22 |
|
23 #include <QtCore> |
|
24 #include <QFeedbackHapticsEffect> |
|
25 #include <cplugin.h> |
|
26 |
|
27 class Vibration: public CPlugin { |
|
28 Q_OBJECT |
|
29 public: |
|
30 explicit Vibration(Cordova *cordova): CPlugin(cordova) { |
|
31 } |
|
32 |
|
33 virtual const QString fullName() override { |
|
34 return Vibration::fullID(); |
|
35 } |
|
36 |
|
37 virtual const QString shortName() override { |
|
38 return "Vibration"; |
|
39 } |
|
40 |
|
41 static const QString fullID() { |
|
42 return "Vibration"; |
|
43 } |
|
44 public slots: |
|
45 void vibrate(int, int, int mills); |
|
46 void cancelVibration(int, int); |
|
47 void vibrateWithPattern(int, int, const QList<int> &pattern, int); |
|
48 |
|
49 private: |
|
50 QList<QSharedPointer<QFeedbackEffect>> _effects; |
|
51 QList<QSharedPointer<QTimer>> _timers; |
|
52 }; |
|
53 |
|
54 #endif |