2 * Copyright 2012 Ruediger Gad
4 * This file is part of QZeeControl.
6 * QZeeControl is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * QZeeControl is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with QZeeControl. If not, see <http://www.gnu.org/licenses/>.
24 #include <QtConnectivity/QBluetoothAddress>
25 #include <QtConnectivity/QBluetoothSocket>
28 class BtConnector : public QObject
32 Q_PROPERTY(int threshold READ threshold NOTIFY thresholdChanged WRITE setThreshold)
34 Q_PROPERTY(bool up READ up NOTIFY upChanged)
35 Q_PROPERTY(bool down READ down NOTIFY downChanged)
36 Q_PROPERTY(bool left READ left NOTIFY leftChanged)
37 Q_PROPERTY(bool right READ right NOTIFY rightChanged)
39 Q_PROPERTY(bool a READ a NOTIFY aChanged)
40 Q_PROPERTY(bool b READ b NOTIFY bChanged)
41 Q_PROPERTY(bool c READ c NOTIFY cChanged)
42 Q_PROPERTY(bool d READ d NOTIFY dChanged)
44 Q_PROPERTY(int x READ x NOTIFY xChanged)
45 Q_PROPERTY(int y READ y NOTIFY yChanged)
47 explicit BtConnector(QObject *parent = 0);
54 Q_INVOKABLE void connect(QString address, int port);
56 int threshold(void){return _threshold;}
57 void setThreshold(int val){
59 thresholdChanged(_threshold);
62 bool up(){return _up;}
63 bool down(){return _down;}
64 bool left(){return _left;}
65 bool right(){return _right;}
90 void error(QBluetoothSocket::SocketError errorCode);
92 void stickMoved(int x, int y);
93 void buttonsChanged(bool a, bool b, bool c, bool d);
95 void thresholdChanged(int val);
97 void upChanged(bool val);
98 void downChanged(bool val);
99 void leftChanged(bool val);
100 void rightChanged(bool val);
102 void aChanged(bool val);
103 void bChanged(bool val);
104 void cChanged(bool val);
105 void dChanged(bool val);
107 void xChanged(int val);
108 void yChanged(int val);
114 QBluetoothSocket *socket;
159 void setUp(bool val){
163 void setDown(bool val){
167 void setLeft(bool val){
171 void setRight(bool val){
173 rightChanged(_right);
178 #endif // BTCONNECTOR_H