-
Notifications
You must be signed in to change notification settings - Fork 0
/
signalmanager.cpp
49 lines (41 loc) · 1.33 KB
/
signalmanager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "signalmanager.h"
#include <QDebug>
SignalManager::SignalManager(QWidget *parent) :
QTabWidget(parent), rotationSensor(new QRotationSensor(this)), btManager(new BluetoothManager(DEVICE_NAME))
{
qDebug() << "Starting rotation sensor";
rotationSensor->start();
if (!rotationSensor->isActive()) {
qWarning() << "RotationSensor didn't start!";
}
connect(rotationSensor, SIGNAL(readingChanged()), this, SLOT(updateReading()));
connect(btManager, SIGNAL(status(QString)), this, SLOT(changeBluetoothStatus(QString)));
connect(btManager, SIGNAL(busy(bool)), this, SLOT(enableScan(bool)));
}
void SignalManager::rotationDialMoved(int value)
{
qDebug() << "Dial moved:" << value;
}
void SignalManager::verticalMovementSliderMoved(int value)
{
qDebug() << "Vertical slider moved:" << value;
}
void SignalManager::updateReading()
{
// qDebug() << "Rotation changed";
emit xRotationChanged(rotationSensor->reading()->x());
emit yRotationChanged(rotationSensor->reading()->y());
emit zRotationChanged(rotationSensor->reading()->z());
}
void SignalManager::scanForBluetoothDevice()
{
btManager->startScan();
}
void SignalManager::changeBluetoothStatus(QString status)
{
emit bluetoothStatusChanged(status);
}
void SignalManager::enableScan(bool busy)
{
emit scanEnabled(!busy);
}