5 deviceName(_deviceName),
6 deviceSource(_deviceSource),
28 enableAcquisition =
true;
29 acquisitionThread = std::thread(&_RemoteGrabberImpl::acquisition,
this);
33 enableAcquisition =
false;
34 if (acquisitionThread.joinable()) {
35 std::cout <<
"wait for remote grabber thread to join" << std::endl;
36 acquisitionThread.join();
41 endpoints.push_back(_endpoint);
44 void _RemoteGrabberImpl::acquisition() {
46 zmq::socket_t subSocket(ctx, ZMQ_SUB);
47 zmq::socket_t pubSocket(ctx, ZMQ_PUB);
48 subSocket.connect(deviceSource);
49 subSocket.setsockopt(ZMQ_SUBSCRIBE,
"", 0);
50 for (
const auto & ep : endpoints) {
51 pubSocket.bind(ep.c_str());
53 while (enableAcquisition) {
58 size_t more_size =
sizeof(more);
59 subSocket.getsockopt(ZMQ_RCVMORE, &more, &more_size);
60 pubSocket.send(msg, more?ZMQ_SNDMORE:0);
void addEndpoint(const std::string &_endpoint)
_RemoteGrabberImpl(const std::string &_deviceName, const std::string &_deviceSource, zmq::context_t &_ctx)