Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed May 15, 2021
2 parents 85d5ec7 + 9b0c357 commit dc90ae4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
12 changes: 6 additions & 6 deletions trunk-recorder/call.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Call::~Call() {
void Call::restart_call() {
}


void Call::end_call() {
std::stringstream shell_command;
std::string shell_command_string;
Expand All @@ -121,9 +122,12 @@ void Call::end_call() {
BOOST_LOG_TRIVIAL(error) << "Call::end_call() State is recording, but no recorder assigned!";
}
BOOST_LOG_TRIVIAL(info) << "[" << sys->get_short_name() << "]\tTG: " << this->get_talkgroup_display() << "\tFreq: " << FormatFreq(get_freq()) << "\tEnding Recorded Call - Last Update: " << this->since_last_update() << "s\tCall Elapsed: " << this->elapsed();

final_length = recorder->get_current_length();




if (freq_count > 0) {
Rx_Status rx_status = recorder->get_rx_status();
freq_list[freq_count - 1].total_len = rx_status.total_len;
Expand All @@ -136,7 +140,7 @@ void Call::end_call() {
if (myfile.is_open()) {
myfile << "{\n";
myfile << "\"freq\": " << this->curr_freq << ",\n";
myfile << "\"start_time\": " << this->start_time << ",\n";
myfile << "\"start_time\": " << this->get_start_time() << ",\n";
myfile << "\"stop_time\": " << this->stop_time << ",\n";
myfile << "\"emergency\": " << this->emergency << ",\n";
myfile << "\"call_length\": " << this->final_length << ",\n";
Expand Down Expand Up @@ -480,10 +484,6 @@ long Call::get_stop_time() {
return stop_time;
}

long Call::get_start_time() {
return start_time;
}

char *Call::get_converted_filename() {
return converted_filename;
}
Expand Down
3 changes: 2 additions & 1 deletion trunk-recorder/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Call {
int since_last_update();
long stopping_elapsed();
long elapsed();
long get_start_time();

double get_current_length();
long get_stop_time();
void set_debug_recording(bool m);
Expand All @@ -96,6 +96,7 @@ class Call {
void set_tdma_slot(int s);
int get_tdma_slot();
const char *get_xor_mask();
virtual time_t get_start_time() {return start_time;}
virtual bool is_conventional() { return false; }
void set_encrypted(bool m);
bool get_encrypted();
Expand Down
5 changes: 5 additions & 0 deletions trunk-recorder/call_conventional.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ void Call_conventional::restart_call() {
recorder->start(this);
}

time_t Call_conventional::get_start_time() {
// Fixes https://github.com/robotastic/trunk-recorder/issues/103#issuecomment-284825841
return start_time = stop_time - final_length;
}

void Call_conventional::set_recorder(Recorder *r) {
recorder = r;
BOOST_LOG_TRIVIAL(info) << "[" << sys->get_short_name() << "]\tTG: " << this->get_talkgroup_display() << "\tFreq: " << FormatFreq(this->get_freq());
Expand Down
2 changes: 1 addition & 1 deletion trunk-recorder/call_conventional.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Call_conventional : public Call {
public:
Call_conventional(long t, double f, System *s, Config c);
~Call_conventional();

time_t get_start_time();
virtual bool is_conventional() { return true; }
void restart_call();
void set_recorder(Recorder *r);
Expand Down

0 comments on commit dc90ae4

Please sign in to comment.