Skip to content

Commit

Permalink
Merge pull request #660 from taclane/rdio-scanner-error-spike
Browse files Browse the repository at this point in the history
Report Errors/Spikes to Rdio Scanner
  • Loading branch information
robotastic committed Apr 3, 2022
2 parents 0f87f21 + 6b73a0f commit a2ce88a
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion plugins/rdioscanner_uploader/rdioscanner_uploader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,28 @@ class Rdio_Scanner_Uploader : public Plugin_Api {
patch_list << "]";
}


std::ostringstream freq_list;
std::string freq_list_string;
freq_list << std::fixed << std::setprecision(2);
freq_list << "[";

if (call_info.transmission_error_list.size() != 0) {
for (std::size_t i = 0; i < call_info.transmission_error_list.size(); i++) {
freq_list << "{\"freq\": " << std::fixed << std::setprecision(0) << call_info.freq << ", \"time\": " << call_info.transmission_error_list[i].time << ", \"pos\": " << std::fixed << std::setprecision(2) << call_info.transmission_error_list[i].position << ", \"len\": " << call_info.transmission_error_list[i].total_len << ", \"errorCount\": " << std::setprecision(0) <<call_info.transmission_error_list[i].error_count << ", \"spikeCount\": " << call_info.transmission_error_list[i].spike_count << "}";

if (i < (call_info.transmission_error_list.size() - 1)) {
freq_list << ", ";
} else {
freq_list << "]";
}
}
}else {
freq_list << "]";
}



//BOOST_LOG_TRIVIAL(error) << "Got source list: " << source_list.str();
CURL *curl;
CURLMcode res;
Expand All @@ -131,6 +153,7 @@ class Rdio_Scanner_Uploader : public Plugin_Api {
freq_string = freq.str();

source_list_string = source_list.str();
freq_list_string = freq_list.str();
call_length_string = call_length.str();
patch_list_string = patch_list.str();

Expand Down Expand Up @@ -168,7 +191,7 @@ class Rdio_Scanner_Uploader : public Plugin_Api {
curl_formadd(&formpost,
&lastptr,
CURLFORM_COPYNAME, "frequencies",
CURLFORM_COPYCONTENTS, "[]",
CURLFORM_COPYCONTENTS, freq_list_string.c_str(),
CURLFORM_END);

curl_formadd(&formpost,
Expand Down

0 comments on commit a2ce88a

Please sign in to comment.