5#include "qwt_dial_needle.h"
8#include "qpushbutton.h"
11#include <qwt_plot_curve.h>
12#include <qwt_plot_grid.h>
13#include <myOutputStruct.h>
33 for(
int i=0; i<32; i++){
34 permval.rgbButtons[i] = 0;
35 updateval.rgbButtons[i] = 0;
39 for(
int i=0; i<2; i++)
40 permval.rglSlider[i]=0;
42 for(
int i=0; i<4; i++)
45 for(
int i=0; i<3; i++){
53 void SetSocket(
int _fd )
58 void SetMSPanelID(
long long id)
63 void SetShipConsoleID(
long long id)
77 QwtDialSimpleNeedle *needle =
new QwtDialSimpleNeedle(QwtDialSimpleNeedle::Arrow,
true, Qt::red, QColor(Qt::gray).light(130));
78 Winch1->setRange(-1.0,1.0,0.01);
79 Winch1->setNeedle(needle);
81 Winch2->setRange(-1.0,1.0,0.01);
82 Winch2->setNeedle(needle);
84 Winch1->setScaleArc(-150.0, 150.0);
85 Winch2->setScaleArc(-150.0, 150.0);
87 Slider1->setRange(-1.0, 1.0, 0.01);
88 Slider2->setRange(-1.0, 1.0, 0.01);
90 WinchButton1->setCheckable(
true);
91 WinchButton2->setCheckable(
true);
95 WinchButton1->setChecked(
false);
96 WinchButton1->setStyleSheet(
"* { background-color: rgb(255,0,0) }");
97 WinchButton1->setText(
"Off");
99 WinchButton2->setChecked(
false);
100 WinchButton2->setStyleSheet(
"* { background-color: rgb(255,0,0) }");
101 WinchButton2->setText(
"Off");
106 void JoystickUpdated(
long long id,
joyData_t data);
111 Winch1->setValue(FHSimData.winch[0]);
112 Winch2->setValue(FHSimData.winch[1]);
121 Y1 = FHSimData.winch[2];
122 Y2 = FHSimData.winch[3];
127 leftGraph->appendData(X,Y1);
128 leftGraph2->appendData2(X,Y2);
138 std::map<long long,joyData_t>::iterator it;
139 UpdateInputState(this->winId());
142 for( it = Joysticks.begin(); it != Joysticks.end(); it++)
144 LPDIRECTINPUTDEVICE8 dev = it->second.dev;
146 emit JoystickUpdated(it->first,it->second);
156 void UpdateJoystickData(
long long id,
joyData_t data)
158 Slider1->setValue( data.data.posAxis[2]/1000. );
159 Slider2->setValue( data.data.rotAxis[0]/1000. );
170 if(
id == 2943300896){
171 permval.GuidData1 = data.data.GuidData1;
173 for(
int i=1; i<3; i++)
174 permval.rotAxis[i]= data.data.rotAxis[i];
176 if(WinchButton1->isChecked())
177 permval.rotAxis[0] = data.data.rotAxis[0] *(-1);
178 else permval.rotAxis[0] = 0.0;
180 for(
int i=0; i<2; i++)
181 permval.posAxis[i]= data.data.posAxis[i];
183 if(WinchButton2->isChecked())
184 permval.posAxis[2]= data.data.posAxis[2] *(-1);
185 else permval.posAxis[2]= 0.0;
188 for(
int i=0; i<2; i++)
189 permval.rglSlider[i] = data.data.rglSlider[i];
192 for(
int i=0; i<32; i++){
194 if(data.data.rgbButtons[i]){
195 permval.rgbButtons[i] = 128*(!permval.rgbButtons[i]);
203 send(sockfd,(
const char *) &permval,
sizeof(
myStruct), 0);
212 if(data.data.rgbButtons[0]/128 == 1){
214 if(WinchButton1->isChecked()){
215 WinchButton1->setChecked(
false);
216 WinchButton1->setStyleSheet(
"* { background-color: rgb(255,0,0) }");
217 WinchButton1->setText(
"Off");
220 WinchButton1->setChecked(
true);
221 WinchButton1->setStyleSheet(
"* { background-color: rgb(0,255,0) }");
222 WinchButton1->setText(
"On");
226 if(data.data.rgbButtons[1]/128 == 1){
228 if(WinchButton2->isChecked()){
229 WinchButton2->setChecked(
false);
230 WinchButton2->setStyleSheet(
"* { background-color: rgb(255,0,0) }");
231 WinchButton2->setText(
"Off");
234 WinchButton2->setChecked(
true);
235 WinchButton2->setStyleSheet(
"* { background-color: rgb(0,255,0) }");
236 WinchButton2->setText(
"On");
240 if(WinchButton1->isChecked())
241 Slider1->setValue(data.data.posAxis[2] *(-1) / 1000.0);
242 else Slider1->setValue(0.0);
244 if(WinchButton2->isChecked())
245 Slider2->setValue(data.data.rotAxis[0] *(-1) / 1000.0);
246 else Slider2->setValue(0.0);
251 long long ShipConsoleID;
ShipPanelChild(QWidget *Parent=0)
Definition: SPanel.h:30
Definition: Joystick.h:78
Definition: myOutputStruct.h:5