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;}
81 void error(QBluetoothSocket::SocketError errorCode);
83 void stickMoved(int x, int y);
84 void buttonsChanged(bool a, bool b, bool c, bool d);
86 void thresholdChanged(int val);
88 void upChanged(bool val);
89 void downChanged(bool val);
90 void leftChanged(bool val);
91 void rightChanged(bool val);
93 void aChanged(bool val);
94 void bChanged(bool val);
95 void cChanged(bool val);
96 void dChanged(bool val);
98 void xChanged(int val);
99 void yChanged(int val);
105 QBluetoothSocket *socket;
150 void setUp(bool val){
154 void setDown(bool val){
158 void setLeft(bool val){
162 void setRight(bool val){
164 rightChanged(_right);
169 #endif // BTCONNECTOR_H