1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/Touchgui/plugins/org.apache.cordova.vibration/src/ubuntu/vibration.h Thu Jun 04 14:50:33 2015 +0200 1.3 @@ -0,0 +1,54 @@ 1.4 +/* 1.5 + * 1.6 + * Copyright 2013 Canonical Ltd. 1.7 + * 1.8 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.9 + * you may not use this file except in compliance with the License. 1.10 + * You may obtain a copy of the License at 1.11 + * 1.12 + * http://www.apache.org/licenses/LICENSE-2.0 1.13 + * 1.14 + * Unless required by applicable law or agreed to in writing, 1.15 + * software distributed under the License is distributed on an 1.16 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1.17 + * KIND, either express or implied. See the License for the 1.18 + * specific language governing permissions and limitations 1.19 + * under the License. 1.20 + * 1.21 +*/ 1.22 + 1.23 +#ifndef _VIBRATION_H_SFAFKNVX3456 1.24 +#define _VIBRATION_H_SFAFKNVX3456 1.25 + 1.26 +#include <QtCore> 1.27 +#include <QFeedbackHapticsEffect> 1.28 +#include <cplugin.h> 1.29 + 1.30 +class Vibration: public CPlugin { 1.31 + Q_OBJECT 1.32 +public: 1.33 + explicit Vibration(Cordova *cordova): CPlugin(cordova) { 1.34 + } 1.35 + 1.36 + virtual const QString fullName() override { 1.37 + return Vibration::fullID(); 1.38 + } 1.39 + 1.40 + virtual const QString shortName() override { 1.41 + return "Vibration"; 1.42 + } 1.43 + 1.44 + static const QString fullID() { 1.45 + return "Vibration"; 1.46 + } 1.47 +public slots: 1.48 + void vibrate(int, int, int mills); 1.49 + void cancelVibration(int, int); 1.50 + void vibrateWithPattern(int, int, const QList<int> &pattern, int); 1.51 + 1.52 +private: 1.53 + QList<QSharedPointer<QFeedbackEffect>> _effects; 1.54 + QList<QSharedPointer<QTimer>> _timers; 1.55 +}; 1.56 + 1.57 +#endif