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);
66 void setDown(bool val){
70 void setLeft(bool val){
74 void setRight(bool val){
79 bool up(){return _up;}
80 bool down(){return _down;}
81 bool left(){return _left;}
82 bool right(){return _right;}
107 void error(QBluetoothSocket::SocketError errorCode);
109 void stickMoved(int x, int y);
110 void buttonsChanged(bool a, bool b, bool c, bool d);
112 void thresholdChanged(int val);
114 void upChanged(bool val);
115 void downChanged(bool val);
116 void leftChanged(bool val);
117 void rightChanged(bool val);
119 void aChanged(bool val);
120 void bChanged(bool val);
121 void cChanged(bool val);
122 void dChanged(bool val);
124 void xChanged(int val);
125 void yChanged(int val);
131 QBluetoothSocket *socket;
150 #endif // BTCONNECTOR_H