##// END OF EJS Templates
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.

File last commit:

r0:081a6eb3cced default
r0:081a6eb3cced default
Show More
stardundee.cpp
55 lines | 1.8 KiB | text/x-c | CppLexer
#include "stardundee.h"
StarDundee::StarDundee(QWidget *parent) :
QWidget(parent)
{
connection_LAYOUT = new QGridLayout;
openCommunication_BUTTON = new QPushButton(tr("Open communication link"));
closeCommunication_BUTTON = new QPushButton(tr("Close communication link"));
usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
usbDeviceNumber_SPINBOX = new QSpinBox;
usbDeviceNumber_SPINBOX->setRange(0,32);
usbDeviceNumber_SPINBOX->setValue(0);
closeCommunication_BUTTON->setEnabled(false);
connection_LAYOUT->addWidget(openCommunication_BUTTON, 0, 0, 1, 2);
connection_LAYOUT->addWidget(closeCommunication_BUTTON, 1, 0, 1, 2);
connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 2, 0, 1, 1);
connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 2, 1, 1, 1);
this->setLayout(connection_LAYOUT);
connect(this->openCommunication_BUTTON, SIGNAL(clicked()), this, SLOT(OpenStarDundee()));
connect(this->closeCommunication_BUTTON, SIGNAL(clicked()), this, SLOT(CloseStarDundee()));
}
StarDundee::~StarDundee()
{
USBSpaceWire_Close(hDevice); // Close the device
}
unsigned int StarDundee::OpenStarDundee()
{
if (!USBSpaceWire_Open(&hDevice, 0)) // Open the first device
{
emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))");
return -1;
}
openCommunication_BUTTON->setEnabled(false);
closeCommunication_BUTTON->setEnabled(true);
emit sendMessage("stardundee *** Open *** USBSpaceWire_Open(&hDevice, 0)) successful");
return 1;
}
unsigned int StarDundee::CloseStarDundee()
{
USBSpaceWire_Close(hDevice); // Close the device
emit sendMessage("stardundee *** Close *** USBSpaceWire_Close(hDevice)");
openCommunication_BUTTON->setEnabled(true);
closeCommunication_BUTTON->setEnabled(false);
return 1;
}