JFJOchReader: Add ReadAllSpots option to handle reading just spot finding result

This commit is contained in:
2026-06-02 09:39:26 +02:00
parent 55b65381db
commit 527d239d53
9 changed files with 155 additions and 2 deletions
+28
View File
@@ -374,3 +374,31 @@ void JFJochHttpReader::UploadUserMask(const std::vector<uint32_t>& mask) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Server rejected user mask upload");
}
std::vector<SpotToSave> JFJochHttpReader::ReadSpots(int64_t image) const {
std::unique_lock ul(http_mutex);
if (image < 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Image number must be non-negative");
if (addr.empty())
return {};
httplib::Client cli_cmd(addr);
auto res = cli_cmd.Get("/image_buffer/image.cbor?id=" + std::to_string(image));
if (!res || res->status != httplib::StatusCode::OK_200 || res->body.empty())
return {};
try {
auto msg = CBORStream2Deserialize(res->body);
if (msg->msg_type != CBORImageType::IMAGE)
return {};
return msg->data_message->spots;
} catch (std::exception &e) {
return {};
}
}