Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnitID alpha improvements and decode error display #785

Merged
merged 2 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions trunk-recorder/call_concluder/call_concluder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,21 @@ Call_Data_t Call_Concluder::create_call_data(Call *call, System *sys, Config con
continue;
}

BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\t- Transmission src: " << t.source << " pos: " << total_length << " length: " << t.length;
std::string tag = sys->find_unit_tag(t.source);
std::string display_tag = "";
if (tag != "") {
display_tag = " (\033[0;34m" + tag + "\033[0m)";
}

std::stringstream transmission_info;
transmission_info << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << call_info.talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\t- Transmission src: " << t.source << display_tag << " pos: " << format_time(total_length) << " length: " << format_time(t.length);

if (t.error_count < 1) {
BOOST_LOG_TRIVIAL(info) << transmission_info.str();
} else {
BOOST_LOG_TRIVIAL(error) << transmission_info.str() << "\033[0;31m errors: " << t.error_count << " spikes: " << t.spike_count << "\033[0m";
}

if (it == call_info.transmission_list.begin()) {
call_info.start_time = t.start_time;
snprintf(call_info.filename, 300, "%s-call_%lu.wav", t.base_filename, call_info.call_num);
Expand All @@ -288,7 +302,6 @@ Call_Data_t Call_Concluder::create_call_data(Call *call, System *sys, Config con
call_info.stop_time = t.stop_time;
}

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.transmission_source_list.push_back(call_source);
Expand Down
4 changes: 4 additions & 0 deletions trunk-recorder/formatter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ boost::format FormatSamplingRate(float f) {
return boost::format("%.0f") % f;
}

boost::format format_time(float f) {
return boost::format("%5.2f") % f;
}

std::string format_state(State state) {
if (statusAsString) {
if (state == MONITORING)
Expand Down
1 change: 1 addition & 0 deletions trunk-recorder/formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

extern boost::format format_freq(double f);
extern boost::format FormatSamplingRate(float f);
extern boost::format format_time(float f);
extern std::string format_state(State state);
extern std::string format_state(State state, MonitoringState monitoringState);
std::string get_frequency_format();
Expand Down
7 changes: 6 additions & 1 deletion trunk-recorder/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,12 @@ bool start_recorder(Call *call, TrunkMessage message, System *sys) {
call->set_state(MONITORING);
call->set_monitoring_state(ENCRYPTED);
if (sys->get_hideEncrypted() == false) {
BOOST_LOG_TRIVIAL(info) << "[" << sys->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\t\u001b[31mNot Recording: ENCRYPTED\u001b[0m ";
long unit_id = call->get_current_source_id();
std::string tag = sys->find_unit_tag(unit_id);
if (tag != "") {
tag = " (\033[0;34m" + tag + "\033[0m)";
}
BOOST_LOG_TRIVIAL(info) << "[" << sys->get_short_name() << "]\t\033[0;34m" << call->get_call_num() << "C\033[0m\tTG: " << call->get_talkgroup_display() << "\tFreq: " << format_freq(call->get_freq()) << "\t\u001b[31mNot Recording: ENCRYPTED\u001b[0m - src: " << unit_id << tag;
}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk-recorder/unit_tags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ std::string UnitTags::find_unit_tag(long tg_number) {
UnitTag *tg = (UnitTag *)*it;

if (regex_match(tg_num_str, tg->pattern)) {
tag = regex_replace(tg_num_str, tg->pattern, tg->tag, boost::regex_constants::format_no_copy);
tag = regex_replace(tg_num_str, tg->pattern, tg->tag, boost::regex_constants::format_no_copy | boost::regex_constants::format_all);
break;
}
}
Expand Down