-
Notifications
You must be signed in to change notification settings - Fork 2
[WIP] Add zmq xpub feature to camerad and add write_to_zmq function #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I see is that hexpose converts pixel data to a string and then publishes that string to a zmq socket if the zmq server is running; right? So the method of controlling whether or not hexpose data is published is to completely stop/start the server? (Seems fine, just asking.)
But, it might be relatively expensive to convert from int to string, concatenate commas, and publish the string. Since speed is an issue, what about publishing the binary data directly? Instead of building up a string, copying that string to a zmq_message, sending the message, convert the pixel data to a zmq message?
* @param state_in, string "TRUE, FALSE, 0, or 1" | ||
* @return ERROR or NO_ERROR | ||
* | ||
* NOTE: this assumes LVDS is module 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a misplaced comment, as there's no relationship between ZMQ and LVDS?
std::string function = "Archon::Interface::zmq"; | ||
std::stringstream message; | ||
long error = NO_ERROR; | ||
const std::string& endpoint = "tcp://*:5555"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make endpoint configurable rather than hard-coded?
state_out = ( this->is_zmq ? "true" : "false" ); | ||
|
||
if (error != NO_ERROR) { | ||
message.str(""); message << "setting autofetch state to " << state_in; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
autofetch state?
if (message.size() > 0) { | ||
std::string received_message(static_cast<char*>(message.data()), message.size()); | ||
// Process subscription messages | ||
std::cout << "Received ZMQ message: " << received_message << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens here? Maybe this puts data in a dequeue?
} | ||
// std::cout << "Image data: " << ss.str() << std::endl; | ||
this->write_to_zmq(ss.str()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if write_to_zmq( accepted *buf, bufsz ) and then did something like,
zmq::message_t msg(cbuf16s, sizeof(int) * section_size);
write_to_zmq(msg)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes will go into camera clean, closing this PR
Work in progress...