Skip to content

[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

Closed
wants to merge 2 commits into from

Conversation

mikelangmayr
Copy link
Contributor

Work in progress...

  • ZMQ xpub server
  • add command for zmq server
  • write_to_zmq(message)

@prkrtg prkrtg requested a review from astronomerdave March 19, 2025 00:08
Copy link
Collaborator

@astronomerdave astronomerdave left a 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
Copy link
Collaborator

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";
Copy link
Collaborator

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;
Copy link
Collaborator

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;
Copy link
Collaborator

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());

Copy link
Collaborator

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)

Copy link
Contributor Author

@mikelangmayr mikelangmayr left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants