TCP: Allow to get written image count
This commit is contained in:
@@ -11,7 +11,6 @@ void HDF5FilePusher::StartDataCollection(StartMessage &message) {
|
||||
writer = std::make_unique<FileWriter>(message);
|
||||
writer_future = std::async(std::launch::async, &HDF5FilePusher::WriterThread, this);
|
||||
images_written = 0;
|
||||
images_err = 0;
|
||||
}
|
||||
|
||||
bool HDF5FilePusher::EndDataCollection(const EndMessage &message) {
|
||||
@@ -36,12 +35,8 @@ bool HDF5FilePusher::SendImage(const uint8_t *image_data, size_t image_size, int
|
||||
|
||||
auto deserialized = CBORStream2Deserialize(image_data, image_size);
|
||||
if (deserialized->data_message) {
|
||||
try {
|
||||
writer->Write(*deserialized->data_message);
|
||||
images_written++;
|
||||
} catch (const JFJochException &e) {
|
||||
images_err++;
|
||||
}
|
||||
writer->Write(*deserialized->data_message);
|
||||
images_written++;
|
||||
} else
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"HDF5FilePusher::SendImage accepts only data image");
|
||||
@@ -78,14 +73,6 @@ std::string HDF5FilePusher::PrintSetup() const {
|
||||
return "HDF5FilePusher: Images are written directly to file in base directory " + currentPath.string();
|
||||
}
|
||||
|
||||
std::optional<ImagePusherAckProgress> HDF5FilePusher::GetAckProgress() const {
|
||||
uint64_t ack_ok = images_written;
|
||||
uint64_t ack_bad = images_err;
|
||||
uint64_t ack_total = ack_ok + ack_bad;
|
||||
|
||||
return ImagePusherAckProgress{
|
||||
.data_acked_ok = ack_ok,
|
||||
.data_acked_bad = ack_bad,
|
||||
.data_acked_total = ack_total
|
||||
};
|
||||
std::optional<uint64_t> HDF5FilePusher::GetImagesWritten() const {
|
||||
return images_written;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user