Skip to content

Commit 9d4d338

Browse files
committed
Merge branch 'development' of https://github.com/open-ephys/plugin-GUI into development
2 parents 2043baa + b428e3c commit 9d4d338

File tree

2 files changed

+111
-5
lines changed

2 files changed

+111
-5
lines changed

Source/Processors/RecordNode/RecordNode.cpp

Lines changed: 108 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,122 @@ void RecordNode::checkDiskSpace()
103103

104104
String RecordNode::handleConfigMessage(String msg)
105105
{
106+
/*
107+
Available messages:
108+
- engine=<engine_name> -- changes the record engine
109+
- SELECT <stream_index> NONE / ALL / <channels> -- selects which channels to record, e.g.:
110+
"SELECT 0 NONE" -- deselect all channels for stream 0
111+
"SELECT 1 1 2 3 4 5 6 7 8" -- select channels 1-8 for stream 1
112+
113+
*/
114+
115+
if (CoreServices::getAcquisitionStatus())
116+
{
117+
return "Cannot configure Record Node while acquisition is active.";
118+
}
106119

107120
const MessageManagerLock mml;
108121

109122
StringArray tokens;
110123
tokens.addTokens (msg, "=", "\"");
111124

112-
if (tokens.size() != 2) return "Invalid msg";
125+
LOGD(tokens[0]);
113126

114127
if (tokens[0] == "engine")
115-
static_cast<RecordNodeEditor*> (getEditor())->engineSelectCombo->setSelectedItemIndex(std::stoi(tokens[1].toStdString()), sendNotification);
116-
else
117-
LOGD("Record Node: invalid engine key");
128+
{
129+
if (tokens.size() == 2)
130+
{
131+
RecordNodeEditor* ed = static_cast<RecordNodeEditor*> (getEditor());
132+
133+
int engineIndex = tokens[1].getIntValue();
134+
135+
int numEngines = ed->engineSelectCombo->getNumItems();
136+
137+
if (engineIndex >= 0 && engineIndex < numEngines)
138+
{
139+
ed->engineSelectCombo->setSelectedItemIndex(engineIndex, sendNotification);
140+
return "Record Node: updated record engine to " + ed->engineSelectCombo->getText();
141+
}
142+
else {
143+
return "Record Node: invalid engine index (max = " + String(numEngines - 1) + ")";
144+
}
145+
146+
}
147+
else
148+
{
149+
return "Record Node: invalid engine key";
150+
}
151+
}
152+
153+
tokens.clear();
154+
tokens.addTokens(msg, " ", "");
155+
156+
LOGD(tokens[0]);
157+
158+
if (tokens[0] == "SELECT")
159+
{
160+
161+
if (tokens.size() >= 3)
162+
{
163+
164+
int streamIndex = tokens[1].getIntValue();
165+
uint16 streamId;
166+
std::vector<bool> channelStates;
167+
int channelCount;
168+
169+
if (streamIndex >= 0 && streamIndex < dataStreams.size())
170+
{
171+
streamId = dataStreams[streamIndex]->getStreamId();
172+
channelCount = dataStreams[streamIndex]->getChannelCount();
173+
}
174+
else {
175+
return "Record Node: Invalid stream index; max = " + String(dataStreams.size() - 1);
176+
}
177+
178+
if (tokens[2] == "NONE")
179+
{
180+
//select no channels
181+
for (int i = 0; i < channelCount; i++)
182+
{
183+
channelStates.push_back(false);
184+
}
185+
}
186+
else if (tokens[2] == "ALL")
187+
{
188+
//select all channels
189+
for (int i = 0; i < channelCount; i++)
190+
{
191+
channelStates.push_back(true);
192+
}
193+
}
194+
else
195+
{
196+
197+
Array<int> channels;
198+
199+
for (int i = 2; i < tokens.size(); i++)
200+
{
201+
int ch = tokens[i].getIntValue() - 1;
202+
channels.add(ch);
203+
}
204+
205+
//select some channels
206+
for (int i = 0; i < channelCount; i++)
207+
{
208+
if (channels.contains(i))
209+
channelStates.push_back(true);
210+
else
211+
channelStates.push_back(false);
212+
}
213+
}
214+
215+
updateChannelStates(streamId, channelStates);
216+
}
217+
else
218+
{
219+
LOGD("Record Node: invalid config message");
220+
}
221+
}
118222

119223
return "Record Node received config: " + msg;
120224
}

Source/UI/EditorViewport.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,8 @@ const String EditorViewport::loadStateFromXml(XmlElement* xml)
16771677
return "Failed To Open " + currentFile.getFileName();
16781678
}
16791679

1680+
/* commented out in version 0.6.6
1681+
16801682
if (!sameVersion)
16811683
{
16821684
String responseString = "Your configuration file was saved from a different version of the GUI than the one you're using. \n";
@@ -1702,7 +1704,7 @@ const String EditorViewport::loadStateFromXml(XmlElement* xml)
17021704
{
17031705
return "Failed To Open " + currentFile.getFileName();
17041706
}
1705-
}
1707+
}*/
17061708

17071709
MouseCursor::showWaitCursor();
17081710

0 commit comments

Comments
 (0)