Skip to content

Commit

Permalink
Change TTL command options to match the docs
Browse files Browse the repository at this point in the history
 - Channel->Line
 - On->State
  • Loading branch information
anjaldoshi committed Sep 16, 2022
1 parent 955cb76 commit f064e04
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions Source/NetworkEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,28 +295,28 @@ String NetworkEvents::handleSpecialMessages(const String& s)
}
else if (cmd.compareIgnoreCase ("TTL") == 0)
{
// Default to channel 0 and off (if no optional info sent)
int channel = 0;
// Default to line 1 and off (if no optional info sent)
int line = 0;
bool onOff = 0;

for (int i = 0; i < keys.size(); ++i)
{
String key = keys[i];
int value = dict[key].getIntValue();

if (key.compareIgnoreCase("Channel") == 0)
if (key.compareIgnoreCase("Line") == 0)
{
// Make sure in range
if (value <= 256 && value >= 1)
{
channel = value - 1;
line = value - 1;
}
else
{
return "InvalidChannel";
}
}
else if (key.compareIgnoreCase("on") == 0)
else if (key.compareIgnoreCase("State") == 0)
{
onOff = value;
}
Expand All @@ -325,13 +325,13 @@ String NetworkEvents::handleSpecialMessages(const String& s)
ScopedLock TTLlock(TTLqueueLock);
if (CoreServices::getAcquisitionStatus())
{
TTLQueue.push({ onOff, channel });
TTLQueue.push({ onOff, line });
}
}



return "TTLHandled: Channel=" + String(channel + 1) + " on=" + String(int(onOff));
return "TTLHandled: Line=" + String(line + 1) + " State=" + String(int(onOff));
}

return String ("NotHandled");
Expand All @@ -344,7 +344,7 @@ void NetworkEvents::triggerTTLEvent(StringTTL TTLmsg, juce::int64 sampleNum)
TTLEventPtr event =
TTLEvent::createTTLEvent(ttlChannel,
sampleNum,
TTLmsg.eventChannel,
TTLmsg.eventLine,
TTLmsg.onOff);
addEvent(event, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/NetworkEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class NetworkEvents : public GenericProcessor
struct StringTTL
{
bool onOff;
int eventChannel;
int eventLine;
};

class ZMQContext
Expand Down
2 changes: 1 addition & 1 deletion Source/OpenEphysLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern "C" EXPORT void getLibInfo(Plugin::LibraryInfo* info)
{
info->apiVersion = PLUGIN_API_VER;
info->name = "Network Events";
info->libVersion = "0.2.0";
info->libVersion = "0.2.1";
info->numPlugins = NUM_PLUGINS;
}

Expand Down

0 comments on commit f064e04

Please sign in to comment.