-
Notifications
You must be signed in to change notification settings - Fork 15
/
SenderController.cpp
144 lines (116 loc) · 2.82 KB
/
SenderController.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/***************************************************************************
* *
* Copyright (C) 2017 by University of Illinois *
* *
* http://illinois.edu *
* *
***************************************************************************/
/**
* @file SenderController.cpp
*
* A Sender object reads Vicon data from a Station object, processes the data
* with Kalman filtering and computes a GPS MAVLink data pack, sends MAVLink
* messages to a robot via UDP.
*
* This is the Controller of the
* Model(Sender)-View(SenderWindow)-Controller(SenderController) pattern.
*
* @author Bo Liu <[email protected]>
*
*/
#include "SenderController.h"
SenderController::SenderController(std::unique_ptr<Sender> &sender, QObject *parent) :
QObject(parent),
sender {sender}
{
setupConnections();
initialize();
}
QHostAddress SenderController::getRemoteAddress() const
{
return sender->getRemoteAddress();
}
quint16 SenderController::getRemotePort() const
{
return sender->getRemotePort();
}
uint8_t SenderController::getSysID() const
{
return sender->getSysID();
}
uint8_t SenderController::getCompID() const
{
return sender->getCompID();
}
bool SenderController::getUseGps() const
{
return sender->getUseGps();
}
bool SenderController::getUseLocPos() const
{
return sender->getUseLocPos();
}
bool SenderController::getUseVicon() const
{
return sender->getUseVicon();
}
uint8_t SenderController::getRate() const
{
return sender->getRate();
}
void SenderController::initialize()
{
connect(sender.get(), &Sender::measUpdated,
this, &SenderController::updateMeasDisplay);
}
void SenderController::setupConnections()
{
return;
}
void SenderController::startSender()
{
sender->start();
}
void SenderController::stopSender()
{
sender->stop();
}
void SenderController::setRate(uint8_t rate)
{
sender->setRate(rate);
}
void SenderController::setUseGps(bool use)
{
sender->setUseGps(use);
}
void SenderController::setUseVicon(bool use)
{
sender->setUseVicon(use);
}
void SenderController::setUseLocPos(bool use)
{
sender->setUseLocPos(use);
}
void SenderController::setSysID(uint8_t id)
{
sender->setSysID(id);
}
void SenderController::setCompID(uint8_t id)
{
sender->setCompID(id);
}
void SenderController::setRemoteAddress(const QString &ip)
{
sender->setRemoteAddress(ip);
}
void SenderController::setRemotePort(quint16 port)
{
sender->setRemotePort(port);
}
void SenderController::timerHandler()
{
sender->timerHandler();
}
void SenderController::updateMeasDisplay()
{
}