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

Add per-system configuration option for minimum transmission length. #654

Merged
merged 4 commits into from
Mar 26, 2022
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
3 changes: 2 additions & 1 deletion docs/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ Here is a map of the different sections of the *config.json* file:
| recordUnknown | | true | **true** / **false** | Record talkgroups if they are not listed in the Talkgroups File. |
| hideEncrypted | | false | **true** / **false** | Hide encrypted talkgroups log entries |
| hideUnknownTalkgroups | | false | **true** / **false** | Hide unknown talkgroups log entries |
| minDuration | | 0<br />(which is disabled) | number | The minimum call (transmission) duration in seconds (decimals allowed), calls below this number will have recordings deleted and will not be uploaded. |
| minDuration | | 0<br />(which is disabled) | number | The minimum call duration in seconds (decimals allowed), calls below this number will have recordings deleted and will not be uploaded. |
| minTransmissionDuration| | 0<br />(which is disabled) | number | The minimum transmission duration in seconds (decimals allowed), transmissions below this number will not be added to their corresponding call. |
| talkgroupDisplayFormat | | "id" | **"id" "id_tag"** or **"tag_id"** | The display format for talkgroups in the console and log file. (*id_tag* and *tag_id* is only valid if **talkgroupsFile** is specified) |
| bandplan | | "800_standard" | **"800_standard" "800_reband" "800_splinter"** or **"400_custom"** | [SmartNet only] this is the SmartNet bandplan that will be used. |
| bandplanBase | | | number | [SmartNet, 400_custom only] this is for the *400_custom* bandplan only. This is the base frequency, specified in Hz. |
Expand Down
1 change: 1 addition & 0 deletions lib/gr_blocks/nonstop_wavfile_sink_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ void nonstop_wavfile_sink_impl::end_transmission() {
strcpy(transmission.filename, current_filename); // Copy the filename
strcpy(transmission.base_filename, current_base_filename);
this->add_transmission(transmission);

d_sample_count = 0;
d_first_work = true;
} else {
Expand Down
15 changes: 15 additions & 0 deletions trunk-recorder/call_concluder/call_concluder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,21 @@ Call_Data_t Call_Concluder::create_call_data(Call *call, System *sys, Config con
for (std::vector<Transmission>::iterator it = call_info.transmission_list.begin(); it != call_info.transmission_list.end(); ++it) {
Transmission t = *it;
char formattedTalkgroup[62];

if(t.length < sys->get_min_tx_duration())
{
if (!call_info.transmission_archive) {

snprintf(formattedTalkgroup, 61, "%c[%dm%10ld%c[0m", 0x1B, 35, call_info.talkgroup, 0x1B);
std::string talkgroup_display = boost::lexical_cast<std::string>(formattedTalkgroup);
BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num<< "C\033[0m\tTG: " << talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\tRemoving transmission less than " << sys->get_min_tx_duration() <<" seconds. Actual length: " << t.length << "." << std::endl;

if (checkIfFile(t.filename)) {
remove(t.filename);
}
}
continue;
}
snprintf(formattedTalkgroup, 61, "%c[%dm%10ld%c[0m", 0x1B, 35, call_info.talkgroup, 0x1B);
std::string talkgroup_display = boost::lexical_cast<std::string>(formattedTalkgroup);
BOOST_LOG_TRIVIAL(info) << "[" << call_info.short_name << "]\t\033[0;34m" << call_info.call_num << "C\033[0m\tTG: " << talkgroup_display << "\tFreq: " << format_freq(call_info.freq) << "\t- Transmission src: " << t.source << " pos: " << total_length << " length: " << t.length;
Expand Down
2 changes: 2 additions & 0 deletions trunk-recorder/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ bool load_config(string config_file) {
BOOST_LOG_TRIVIAL(info) << "Minimum Call Duration (in seconds): " << system->get_min_duration();
system->set_max_duration(node.second.get<double>("maxDuration", 0));
BOOST_LOG_TRIVIAL(info) << "Maximum Call Duration (in seconds): " << system->get_max_duration();
system->set_min_tx_duration(node.second.get<double>("minTransmissionDuration", 0));
BOOST_LOG_TRIVIAL(info) << "Minimum Transmission Duration (in seconds): " << system->get_min_tx_duration();


if (!system->get_compress_wav()) {
Expand Down
8 changes: 8 additions & 0 deletions trunk-recorder/systems/system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ void System::set_max_duration(double duration) {
this->max_call_duration = duration;
}

double System::get_min_tx_duration() {
return this->min_transmission_duration;
}

void System::set_min_tx_duration(double duration) {
this->min_transmission_duration = duration;
}

System::System(int sys_num) {
this->sys_num = sys_num;
sys_id = 0;
Expand Down
3 changes: 3 additions & 0 deletions trunk-recorder/systems/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class System {
double filter_width;
double min_call_duration;
double max_call_duration;
double min_transmission_duration;
bool compress_wav;
bool conversation_mode;
bool qpsk_mod;
Expand Down Expand Up @@ -117,6 +118,8 @@ class System {
void set_min_duration(double duration);
double get_max_duration();
void set_max_duration(double duration);
double get_min_tx_duration();
void set_min_tx_duration(double duration);
bool get_audio_archive();
void set_audio_archive(bool);
bool get_transmission_archive();
Expand Down