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

Improved Talkgroup Priority Logging #700

Merged
merged 10 commits into from
Sep 16, 2022
2 changes: 2 additions & 0 deletions docs/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ This file provides info on the different talkgroups in a trunking system. A lot

You may add an additional column that adds a priority for each talkgroup. The priority field specifies the number of recorders the system must have available to record a new call for the talkgroup. For example, a priority of 1, the highest means as long as at least a single recorder is available, the system will record the new call. If the priority is 2, the system would at least 2 free recorders to record the new call, and so on. If there is no priority set for a talkgroup entry, a prioity of 1 is assumed.

Talkgroups assigned a priority of -1 will never be recorded, regardless of the number of available recorders.

The Trunk Record program really only uses the priority information and the Dec Talkgroup ID. The Website uses the same file though to help display information about each talkgroup.

Here are the column headers and some sample data: NOTE: If you are adding the Priority to a RR csv, as well as changing order you must use a heading for the first column other than "Decimal" eg DEC for TR to detect you are supplying this layout.
Expand Down
8 changes: 4 additions & 4 deletions trunk-recorder/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,10 @@ bool start_recorder(Call *call, TrunkMessage message, System *sys) {
}
}
if (talkgroup->mode.compare("A") == 0) {
recorder = source->get_analog_recorder(talkgroup);
recorder = source->get_analog_recorder(talkgroup, priority, call);
call->set_is_analog(true);
} else {
recorder = source->get_digital_recorder(talkgroup, priority);
recorder = source->get_digital_recorder(talkgroup, priority, call);
}
} else {
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()) << "\tTG not in Talkgroup File ";
Expand All @@ -659,10 +659,10 @@ bool start_recorder(Call *call, TrunkMessage message, System *sys) {
// Use an analog recorder if this is a Type II trunk and defaultMode is analog.
// All other cases use a digital recorder.
if ((default_mode == "analog") && (sys->get_system_type() == "smartnet")) {
recorder = source->get_analog_recorder();
recorder = source->get_analog_recorder(call);
call->set_is_analog(true);
} else {
recorder = source->get_digital_recorder();
recorder = source->get_digital_recorder(call);
}
}
// int total_recorders = get_total_recorders();
Expand Down
37 changes: 23 additions & 14 deletions trunk-recorder/source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,23 @@ void Source::create_analog_recorders(gr::top_block_sptr tb, int r) {
}
}

Recorder *Source::get_analog_recorder(Talkgroup *talkgroup) {
Recorder *Source::get_analog_recorder(Talkgroup *talkgroup, int priority, Call *call) {
int num_available_recorders = get_num_available_analog_recorders();

if (talkgroup && talkgroup->get_priority() > num_available_recorders) { // a low priority is bad. You need atleast the number of availalbe recorders to your priority
BOOST_LOG_TRIVIAL(info) << "\t\tNot recording talkgroup " << talkgroup->number << " (" << talkgroup->alpha_tag << ")"
<< ", priority is " << talkgroup->get_priority() << " but only " << num_available_recorders << " recorders available";
if(talkgroup && (priority == -1)){
BOOST_LOG_TRIVIAL(info) << "[" << call->get_system()->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()) << "\tNot recording talkgroup. Priority is -1.";
return NULL;
}

return get_analog_recorder();
if (talkgroup && priority > num_available_recorders) { // a high priority is bad. You need at least the number of availalbe recorders to your priority
BOOST_LOG_TRIVIAL(error) << "[" << call->get_system()->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()) << "\tNot recording talkgroup. Priority is " << priority << " but only " << num_available_recorders << " recorders are available.";
return NULL;
}

return get_analog_recorder(call);
}

Recorder *Source::get_analog_recorder() {
Recorder *Source::get_analog_recorder(Call *call) {
for (std::vector<analog_recorder_sptr>::iterator it = analog_recorders.begin();
it != analog_recorders.end(); it++) {
analog_recorder_sptr rx = *it;
Expand All @@ -177,7 +181,7 @@ Recorder *Source::get_analog_recorder() {
break;
}
}
BOOST_LOG_TRIVIAL(info) << "[ " << device << " ] No Analog Recorders Available";
BOOST_LOG_TRIVIAL(error) << "[" << call->get_system()->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[ " << device << " ] No Analog Recorders Available.";
return NULL;
}

Expand Down Expand Up @@ -331,19 +335,23 @@ int Source::get_num_available_analog_recorders() {
return num_available_recorders;
}

Recorder *Source::get_digital_recorder(Talkgroup *talkgroup, int priority) {
Recorder *Source::get_digital_recorder(Talkgroup *talkgroup, int priority, Call *call) {
int num_available_recorders = get_num_available_digital_recorders();

if (talkgroup && priority > num_available_recorders) { // a low priority is bad. You need atleast the number of availalbe recorders to your priority
BOOST_LOG_TRIVIAL(info) << "\t\tNot recording talkgroup " << talkgroup->number << " (" << talkgroup->alpha_tag << ")"
<< ", priority is " << priority << " but only " << num_available_recorders << " recorders available";
if(talkgroup && (priority == -1)){
BOOST_LOG_TRIVIAL(info) << "[" << call->get_system()->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()) << "\tNot recording talkgroup. Priority is -1.";
return NULL;
}

return get_digital_recorder();
if (talkgroup && priority > num_available_recorders) { // a high priority is bad. You need at least the number of availalbe recorders to your priority
BOOST_LOG_TRIVIAL(error) << "[" << call->get_system()->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()) << "\tNot recording talkgroup. Priority is " << priority << " but only " << num_available_recorders << " recorders are available.";
return NULL;
}

return get_digital_recorder(call);
}

Recorder *Source::get_digital_recorder() {
Recorder *Source::get_digital_recorder(Call *call) {
for (std::vector<p25_recorder_sptr>::iterator it = digital_recorders.begin();
it != digital_recorders.end(); it++) {
p25_recorder_sptr rx = *it;
Expand All @@ -354,7 +362,8 @@ Recorder *Source::get_digital_recorder() {
break;
}
}
BOOST_LOG_TRIVIAL(info) << "[ " << device << " ] No Digital Recorders Available";

BOOST_LOG_TRIVIAL(error) << "[" << call->get_system()->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[ " << device << " ] No Digital Recorders Available.";

for (std::vector<p25_recorder_sptr>::iterator it = digital_recorders.begin();
it != digital_recorders.end(); it++) {
Expand Down
8 changes: 4 additions & 4 deletions trunk-recorder/source.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ class Source {
p25_recorder_sptr create_digital_conventional_recorder(gr::top_block_sptr tb);
dmr_recorder_sptr create_dmr_conventional_recorder(gr::top_block_sptr tb);

Recorder *get_digital_recorder();
Recorder *get_digital_recorder(Talkgroup *talkgroup, int priority);
Recorder *get_analog_recorder();
Recorder *get_analog_recorder(Talkgroup *talkgroup);
Recorder *get_digital_recorder(Call *call);
Recorder *get_digital_recorder(Talkgroup *talkgroup, int priority, Call *call);
Recorder *get_analog_recorder(Call *call);
Recorder *get_analog_recorder(Talkgroup *talkgroup, int priority, Call *call);
Recorder *get_debug_recorder();
Recorder *get_sigmf_recorder();

Expand Down