diff --git a/sf-buffer/src/sf_replay.cpp b/sf-buffer/src/sf_replay.cpp index aa249c7..1b21020 100644 --- a/sf-buffer/src/sf_replay.cpp +++ b/sf-buffer/src/sf_replay.cpp @@ -103,17 +103,30 @@ int main (int argc, char *argv[]) { input_file.close(); - zmq_send(socket, - metadata_buffer.get(), - sizeof(FileBufferMetadata), - ZMQ_SNDMORE); + for (size_t i_frame=0; i_framepulse_id[i_frame], + metadata_buffer->frame_index[i_frame], + metadata_buffer->daq_rec[i_frame], + metadata_buffer->n_received_packets[i_frame], + module_id + }; - zmq_send(socket, - image_buffer.get(), - BufferUtils::FILE_MOD * 512 * 1024 * 2, - 0); + zmq_send(socket, + &module_frame, + sizeof(ModuleFrame), + ZMQ_SNDMORE); - this_thread::sleep_for(chrono::milliseconds(1000)); + zmq_send(socket, + metadata_buffer.get(), + sizeof(FileBufferMetadata), + ZMQ_SNDMORE); + + zmq_send(socket, + (char*) (image_buffer.get() + (i_frame * 512 * 1024)), + 512 * 1024 * 2, + 0); + } } zmq_close(socket); diff --git a/sf-writer/sf_h5_writer.cpp b/sf-writer/sf_h5_writer.cpp index 2c14af9..7229967 100644 --- a/sf-writer/sf_h5_writer.cpp +++ b/sf-writer/sf_h5_writer.cpp @@ -5,6 +5,7 @@ #include #include #include +#include using namespace std; @@ -45,34 +46,33 @@ int main (int argc, char *argv[]) throw runtime_error(strerror (errno)); } - auto metadata_buffer = make_unique(); + auto metadata_buffer = make_unique(); - auto image_buffer = make_unique( - BufferUtils::FILE_MOD * 512 * 1024); + auto image_buffer = make_unique(512 * 1024); while (true) { auto n_bytes_metadata = zmq_recv( socket, metadata_buffer.get(), - sizeof(FileBufferMetadata), + sizeof(ModuleFrame), 0); - if (n_bytes_metadata != sizeof(FileBufferMetadata)) { + if (n_bytes_metadata != sizeof(ModuleFrame)) { throw runtime_error("Unexpected number of bytes in metadata."); } auto n_bytes_image = zmq_recv( socket, image_buffer.get(), - BufferUtils::FILE_MOD * 512 * 1024 * 2, + 512 * 1024 * 2, 0); - if (n_bytes_image != BufferUtils::FILE_MOD * 512 * 1024 * 2) { + if (n_bytes_image != 512 * 1024 * 2) { throw runtime_error("Unexpected number of bytes in image."); } - cout << "Received " << metadata_buffer->start_pulse_id; - cout << " to " << metadata_buffer->stop_pulse_id; + cout << "Received " << metadata_buffer->pulse_id; + cout << " from " << metadata_buffer->module_id; cout << endl; }