Newer
Older
GigAnon
committed
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "magiks.h"
#ifdef BLUETOOTH_USING_WINSOCK
#include "bluetoothproxy/bluetoothproxywinsock.h"
#else
#include "bluetoothproxy/bluetoothproxyqt5.h"
#endif
#include <QTabWidget>
#include <QVBoxLayout>
#include <QDebug>
#include "subwindows/bluetoothmanagementwidget.h"
#include "subwindows/odometriewindow.h"
#include "subwindows/asservwindow.h"
#include "subwindows/graphwindow.h"
#include "subwindows/watchwindow.h"
#include "subwindows/loggerwidget.h"
#include "subwindows/plotwidget.h"
#include "packetprocessor.h"
Magiks::Magiks(QWidget *parent): QWidget(parent)
{
setWindowTitle(tr("Magiks - Robot remote"));
#ifdef BLUETOOTH_USING_WINSOCK
m_bluetoothProxy = new BluetoothProxyWinsock(this);
#else
m_bluetoothProxy = new BluetoothProxyQt5(this);
#endif
m_bluetoothManagement = new BluetoothManagementWidget(m_bluetoothProxy);
m_odometrie = new OdometrieWindow(m_bluetoothProxy);
m_asserv = new AsservWindow(m_bluetoothProxy);
m_watches = new WatchWindow();
m_graphs = new GraphWindow();
m_logger = new LoggerWidget();
m_plots = new PlotWidget();
m_packetProcessor = new PacketProcessor(m_odometrie, m_graphs, m_watches, m_asserv, m_logger);
connect(m_bluetoothProxy, &BluetoothProxy::deviceDiscovered, this, &Magiks::deviceDiscovered);
connect(m_bluetoothProxy, &BluetoothProxy::connected, this, &Magiks::connected);
connect(m_bluetoothProxy, &BluetoothProxy::dataReceived, m_packetProcessor, &PacketProcessor::processData);
m_tabs = new QTabWidget(this);
m_tabs->addTab(m_bluetoothManagement, tr("Bluetooth"));
m_tabs->addTab(m_odometrie, tr("Odometrie"));
m_tabs->addTab(m_asserv, tr("Asservissement"));
m_tabs->addTab(m_watches, tr("Watches"));
m_tabs->addTab(m_graphs, tr("Graphes A"));
m_tabs->addTab(m_plots, tr("Graphes B"));
m_tabs->addTab(m_logger, tr("Logs"));
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_tabs);
}
void Magiks::connected()
{
qDebug() << "Connected to remote device!";
}
void Magiks::deviceDiscovered(const QString& name, const QString& address)
{
qDebug() << "Device found: " << name;
m_bluetoothProxy->connectToHost(address);
}