Skip to content
Snippets Groups Projects
Commit c03c3035 authored by jsiegle's avatar jsiegle
Browse files

Merge branch 'master' of https://github.com/open-ephys/GUI

parents bf74dc2a 95b1d481
Branches
Tags
No related merge requests found
......@@ -106,3 +106,23 @@ void SerialInputEditor::comboBoxChanged(ComboBox* comboBox)
}
}
void SerialInputEditor::saveEditorParameters(XmlElement* xmlNode)
{
XmlElement* parameters = xmlNode->createNewChildElement("PARAMETERS");
parameters->setAttribute("device", deviceList->getText().toStdString());
parameters->setAttribute("baudrate", baudrateList->getSelectedId());
}
void SerialInputEditor::loadEditorParameters(XmlElement* xmlNode)
{
forEachXmlChildElement(*xmlNode, subNode)
{
if (subNode->hasTagName("PARAMETERS"))
{
deviceList->setText(subNode->getStringAttribute("device", ""));
baudrateList->setSelectedId(subNode->getIntAttribute("baudrate"));
}
}
}
......@@ -51,10 +51,12 @@ public:
/** Called by processor graph at the end of the acqusition, reenables editor completly. */
void stopAcquisition();
/** Called when configuration is saved. Adds editors config to xml. */
void saveEditorParameters(XmlElement* xml);
//void saveEditorParameters(XmlElement*);
//void loadEditorParameters(XmlElement*);
/** Called when configuration is loaded. Reads editors config from xml. */
void loadEditorParameters(XmlElement* xml);
private:
......
......@@ -28,12 +28,8 @@
const int SerialInput::BAUDRATES[12] = {300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, 230400};
SerialInput::SerialInput()
: GenericProcessor("Serial Port")
: GenericProcessor("Serial Port"), baudrate(0)
{
baudrate = 0;
// ToDo: One day, this should use the Parameter class, and it will look roughly like this:
//parameters.add(Parameter("device", varArray(getDevices()), 0, 0, true));
//parameters.add(Parameter("baudrate", varArray(getBaudrates()), 6, 1, true));
}
SerialInput::~SerialInput()
......@@ -75,12 +71,11 @@ bool SerialInput::isReady()
{
if(device == "" || baudrate == 0)
{
// ToDo: Properly warn about problem here!
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, "SerialInput connection error!", "Please set device and baudrate to use first!");
return false;
}
if(!serial.setup(device, baudrate)) {
// ToDo: Properly warn about problem here!
if(!serial.setup(device, baudrate))
{
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, "SerialInput connection error!", "Could not connect to specified serial device. Check log files for details.");
return false;
}
......@@ -94,9 +89,7 @@ bool SerialInput::disable()
}
void SerialInput::process(AudioSampleBuffer& buffer,
MidiBuffer& events,
int& nSamples)
void SerialInput::process(AudioSampleBuffer&, MidiBuffer& events, int&)
{
int bytesAvailable = serial.available();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment