diff options
author | Luke Berndt <lukekb@gmail.com> | 2023-04-06 11:13:33 -0400 |
---|---|---|
committer | Luke Berndt <lukekb@gmail.com> | 2023-04-06 11:13:33 -0400 |
commit | 570c7612cdbbd9be3a28f574143e9fcddd70592b (patch) | |
tree | 6dfe26d7cae1ce86db067a2bd7e7c95c0f140aca | |
parent | 592113f509750e71cbe4b0d290a7525cecfc5016 (diff) |
goodbye freq-list for uploader
-rw-r--r-- | plugins/openmhz_uploader/openmhz_uploader.cc | 52 | ||||
-rw-r--r-- | trunk-recorder/call_concluder/call_concluder.cc | 4 |
2 files changed, 28 insertions, 28 deletions
diff --git a/plugins/openmhz_uploader/openmhz_uploader.cc b/plugins/openmhz_uploader/openmhz_uploader.cc index f4400a8e..eb969115 100644 --- a/plugins/openmhz_uploader/openmhz_uploader.cc +++ b/plugins/openmhz_uploader/openmhz_uploader.cc @@ -52,6 +52,16 @@ public: freq << std::fixed << std::setprecision(0); freq << call_info.freq; + std::ostringstream error_count; + std::string error_count_string; + error_count << std::fixed << std::setprecision(0); + error_count << call_info.error_count; + + std::ostringstream spike_count; + std::string spike_count_string; + spike_count << std::fixed << std::setprecision(0); + spike_count << call_info.spike_count; + std::ostringstream call_length; std::string call_length_string; call_length << std::fixed << std::setprecision(0); @@ -77,28 +87,6 @@ public: source_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 << ", \"error_count\": \"" << std::setprecision(0) <<call_info.transmission_error_list[i].error_count << "\", \"spike_count\": \"" << 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 << "]"; - } - - - char formattedTalkgroup[62]; snprintf(formattedTalkgroup, 61, "%c[%dm%10ld%c[0m", 0x1B, 35, call_info.talkgroup, 0x1B); std::string talkgroup_display = boost::lexical_cast<std::string>(formattedTalkgroup); @@ -108,9 +96,10 @@ public: int still_running = 0; std::string response_buffer; freq_string = freq.str(); + error_count_string = error_count.str(); + spike_count_string = spike_count.str(); source_list_string = source_list.str(); - freq_list_string = freq_list.str(); call_length_string = call_length.str(); struct curl_httppost *formpost = NULL; @@ -134,6 +123,18 @@ public: curl_formadd(&formpost, &lastptr, + CURLFORM_COPYNAME, "error_count", + CURLFORM_COPYCONTENTS, error_count_string.c_str(), + CURLFORM_END); + + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, "spike_count", + CURLFORM_COPYCONTENTS, spike_count_string.c_str(), + CURLFORM_END); + + curl_formadd(&formpost, + &lastptr, CURLFORM_COPYNAME, "start_time", CURLFORM_COPYCONTENTS, boost::lexical_cast<std::string>(call_info.start_time).c_str(), CURLFORM_END); @@ -173,11 +174,6 @@ public: CURLFORM_COPYNAME, "source_list", CURLFORM_COPYCONTENTS, source_list_string.c_str(), CURLFORM_END); - curl_formadd(&formpost, - &lastptr, - CURLFORM_COPYNAME, "freq_list", - CURLFORM_COPYCONTENTS, freq_list_string.c_str(), - CURLFORM_END); curl = curl_easy_init(); multi_handle = curl_multi_init(); diff --git a/trunk-recorder/call_concluder/call_concluder.cc b/trunk-recorder/call_concluder/call_concluder.cc index aa440c64..bdba0f3e 100644 --- a/trunk-recorder/call_concluder/call_concluder.cc +++ b/trunk-recorder/call_concluder/call_concluder.cc @@ -216,6 +216,8 @@ Call_Data_t Call_Concluder::create_call_data(Call *call, System *sys, Config con call_info.status = INITIAL; call_info.process_call_time = time(0); call_info.retry_attempt = 0; + call_info.error_count = 0; + call_info.spike_count = 0; call_info.freq = call->get_freq(); call_info.encrypted = call->get_encrypted(); call_info.emergency = call->get_emergency(); @@ -291,6 +293,8 @@ Call_Data_t Call_Concluder::create_call_data(Call *call, System *sys, Config con std::string tag = sys->find_unit_tag(t.source); Call_Source call_source = {t.source, t.start_time, total_length, false, "", tag}; Call_Error call_error = {t.start_time, total_length, t.length, t.error_count, t.spike_count}; + call_info.error_count = call_info.error_count + t.error_count; + call_info.spike_count = call_info.spike_count + t.spike_count; call_info.transmission_source_list.push_back(call_source); call_info.transmission_error_list.push_back(call_error); |