I just have learned that starting from version 3.10.0, a new feature has been added: allowing data streams to be sent from the client side to the server side.
We have a scenario where audio data (such as audio files) needs to be sent from the host computer to the device. Upon receiving this data, the device will play it in real-time (via a dedicated speaker).
Could you please provide guidance on where to find relevant examples or documentation for this functionality?
Currently, we don’t have any supporting content available for the “Streaming from Client to Server” functionality.
However, if the device has a Native Server, you need to create an input port on the device and connect the client signal to it—just as you would when setting it up directly on the device itself. Here’s an example:
// Server
using namespace daq;
auto instance = Instance();
auto fb = instance.addFunctionBlock("RefFBModuleScaling");
instance.addServer("openDAQ Native Streaming", nullptr);
// Client
auto client = Instance();
auto refDev = client.addDevice("daqref://device0");
auto dev = client.addDevice("daq.nd://127.0.0.1");
auto port = dev.getFunctionBlocks()[0].getInputPorts()[0];
port.connect(refDev.getSignalsRecursive()[0]);
while(true)
std::cout << fb.getSignals()[0].getLastValue() << std::endl;
However, I think this implementation is a bit weird because using FBScaling should cause some performance loss, especially in case there be a lot of data.
Additionally, is there a way to directly add a signal to the client side and use this signal to send data to the server, instead of using a signal from a third-party server?