Record Data
openDAQ™ provides an interface for Components which
record data to persistent storage media such as files. The BasicCsvRecorder
module provides a
simple reference implementation.
-
Cpp
// Create and configure a CSV recorder
auto recorder = instance.addFunctionBlock("BasicCsvRecorder");
recorder.setPropertyValue("Path", "/tmp");
// Connect signal AI0 to the recorder's first input
SignalPtr signal = device.getSignalsRecursive(daq::search::LocalId("AI0"))[0];
auto input1 = recorder.getInputPorts(daq::search::LocalId("Value1"))[0];
input1.connect(signal);
// Record 5 seconds of data
recorder.startRecording();
std::this_thread::sleep_for(5s);
recorder.stopRecording();
The reference implementation supports scalar signals of numeric type. No domain alignment is
performed, and a separate CSV file is generated for each signal. Custom implementations of
IRecorder
can be designed to support additional file formats or storage media, and to support
more complicated signal types.