Skip to content

Commit 5028bfe

Browse files
committed
2 parents 7b4e988 + 310c3e6 commit 5028bfe

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

Resources/Python/record_control_example_client.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,43 @@ def run_client():
3737
socket.RCVTIMEO = int(timeout * 1000) # timeout in milliseconds
3838
socket.connect(url)
3939

40-
# Finally, start data acquisition
40+
# Start data acquisition
4141
socket.send('StartAcquisition')
42-
answer = socket.recv()
43-
print answer
42+
print socket.recv()
4443
time.sleep(5)
4544

45+
socket.send('IsAcquiring')
46+
print "IsAcquiring:", socket.recv()
47+
print ""
48+
4649
for start_cmd in commands:
4750

4851
for cmd in [start_cmd, stop_cmd]:
4952
socket.send(cmd)
50-
answer = socket.recv()
51-
print answer
53+
print socket.recv()
5254

5355
if 'StartRecord' in cmd:
5456
# Record data for 5 seconds
57+
socket.send('IsRecording')
58+
print "IsRecording:", socket.recv()
59+
60+
socket.send('GetRecordingPath')
61+
print "Recording path:", socket.recv()
62+
5563
time.sleep(5)
5664
else:
5765
# Stop for 1 second
66+
socket.send('IsRecording')
67+
print "IsRecording:", socket.recv()
5868
time.sleep(1)
5969

60-
# Finally, stop data acquisition; it might be a good idea to
70+
print ""
71+
72+
# Finally, stop data acquisition; it might be a good idea to
6173
# wait a little bit until all data have been written to hard drive
6274
time.sleep(0.5)
6375
socket.send('StopAcquisition')
64-
answer = socket.recv()
65-
print answer
76+
print socket.recv()
6677

6778

6879
if __name__ == '__main__':

Source/Plugins/NetworkEvents/NetworkEvents.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,22 @@ String NetworkEvents::handleSpecialMessages(StringTS msg)
479479
return String("StoppedRecording");
480480
}
481481
}
482+
else if (cmd.compareIgnoreCase("IsAcquiring") == 0)
483+
{
484+
String status = CoreServices::getAcquisitionStatus() ? String("1") : String("0");
485+
return status;
486+
}
487+
else if (cmd.compareIgnoreCase("IsRecording") == 0)
488+
{
489+
String status = CoreServices::getRecordingStatus() ? String("1") : String("0");
490+
return status;
491+
}
492+
else if (cmd.compareIgnoreCase("GetRecordingPath") == 0)
493+
{
494+
File file = CoreServices::RecordNode::getRecordingPath();
495+
String msg(file.getFullPathName());
496+
return msg;
497+
}
482498
else
483499
{
484500
return String("NotHandled");

0 commit comments

Comments
 (0)