Skip to content

Commit

Permalink
Merge branch 'master' into updated-config
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic authored Nov 11, 2023
2 parents de54733 + 606c2ed commit 5f2077e
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ By default, Trunk Recorder just dumps a lot of recorded files into a directory.
* [MQTT Statistics](https://github.com/robotastic/trunk-recorder-mqtt-statistics): Publishes statistics about a Trunk Recorder instance over MQTT
* [Decode rates logger](https://github.com/rosecitytransit/trunk-recorder-decode-rate): Logs trunking control channel decode rates to a CSV file, and includes a PHP file that outputs an SVG graph
* [Daily call log and live Web page](https://github.com/rosecitytransit/trunk-recorder-daily-log): Creates a daily log of calls (instead of just individual JSON files) and includes an updating PHP Web page w/audio player
* [Prometheus exporter](https://github.com/USA-RedDragon/trunk-recorder-prometheus): Publishes statistics to a metrics endpoint via HTTP

### Troubleshooting

Expand Down
10 changes: 9 additions & 1 deletion trunk-recorder/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ unsigned GCD(unsigned u, unsigned v) {
return u;
}


int get_total_recorders() {
int total_recorders = 0;

Expand Down Expand Up @@ -420,6 +419,14 @@ void current_system_status(TrunkMessage message, System *sys) {
}
}

void current_system_sysid(TrunkMessage message, System *sys) {
if ((sys->get_system_type() == "p25") || (sys->get_system_type() == "conventionalP25")) {
if (sys->update_sysid(message)) {
plugman_setup_system(sys);
}
}
}

void unit_registration(System *sys, long source_id) {
plugman_unit_registration(sys, source_id);
}
Expand Down Expand Up @@ -669,6 +676,7 @@ void handle_message(std::vector<TrunkMessage> messages, System *sys) {
break;

case SYSID:
current_system_sysid(message, sys);
break;

case STATUS:
Expand Down
4 changes: 4 additions & 0 deletions trunk-recorder/systems/p25_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ std::vector<TrunkMessage> P25Parser::decode_mbt_data(unsigned long opcode, boost
// unsigned long f2 = channel_id_to_frequency(ch2, sys_num);
message.message_type = SYSID;
message.sys_id = syid;
message.sys_rfss = rfid;
message.sys_site_id = stid;
os << "mbt3a rfss status: syid: " << syid << " rfid " << rfid << " stid " << stid << " ch1 " << ch1 << "(" << channel_id_to_string(ch1, sys_num) << ")";
message.meta = os.str();
BOOST_LOG_TRIVIAL(debug) << os.str();
Expand Down Expand Up @@ -856,6 +858,8 @@ std::vector<TrunkMessage> P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk,
unsigned long chan = bitset_shift_mask(tsbk, 24, 0xffff);
message.message_type = SYSID;
message.sys_id = syid;
message.sys_rfss = rfid;
message.sys_site_id = stid;
os << "tsbk3a rfss status: syid: " << syid << " rfid " << rfid << " stid " << stid << " ch1 " << chan << "(" << channel_id_to_string(chan, sys_num) << ")";
message.meta = os.str();
BOOST_LOG_TRIVIAL(debug) << os.str();
Expand Down
2 changes: 2 additions & 0 deletions trunk-recorder/systems/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct TrunkMessage {
long source;
int sys_num;
unsigned long sys_id;
int sys_rfss;
int sys_site_id;
unsigned long nac;
unsigned long wacn;
PatchData patch_data;
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 @@ -98,9 +98,12 @@ class System {
virtual unsigned long get_sys_id() = 0;
virtual unsigned long get_wacn() = 0;
virtual unsigned long get_nac() = 0;
virtual int get_sys_rfss() = 0;
virtual int get_sys_site_id() = 0;
virtual void set_xor_mask(unsigned long sys_id, unsigned long wacn, unsigned long nac) = 0;
virtual const char *get_xor_mask() = 0;
virtual bool update_status(TrunkMessage message) = 0;
virtual bool update_sysid(TrunkMessage message) = 0;
virtual int get_sys_num() = 0;
virtual void set_system_type(std::string) = 0;
virtual std::string get_talkgroups_file() = 0;
Expand Down
23 changes: 23 additions & 0 deletions trunk-recorder/systems/system_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ System_impl::System_impl(int sys_num) {
sys_id = 0;
wacn = 0;
nac = 0;
sys_rfss = 0;
sys_site_id = 0;
current_control_channel = 0;
xor_mask_len = 0;
xor_mask = NULL;
Expand Down Expand Up @@ -141,6 +143,19 @@ bool System_impl::update_status(TrunkMessage message) {
return false;
}

bool System_impl::update_sysid(TrunkMessage message) {
if (!sys_rfss || !sys_site_id) {
sys_rfss = message.sys_rfss;
sys_site_id = message.sys_site_id;
BOOST_LOG_TRIVIAL(error) << "[" << short_name << "]\tDecoding System Site"
<< " RFSS: " << std::setw(3) << std::setfill('0') << message.sys_rfss
<< " SITE ID: " << std::setw(3) << std::setfill('0') << message.sys_site_id
<< " (" << std::setw(3) << std::setfill('0') << message.sys_rfss << "-" << std::setw(3) << std::setfill('0') << message.sys_site_id << ")";
return true;
}
return false;
}

gr::msg_queue::sptr System_impl::get_msg_queue() {
return msg_queue;
}
Expand All @@ -165,6 +180,14 @@ unsigned long System_impl::get_wacn() {
return this->wacn;
}

int System_impl::get_sys_rfss(){
return this->sys_rfss;
}

int System_impl::get_sys_site_id(){
return this->sys_site_id;
}

bool System_impl::get_call_log() {
return this->call_log;
}
Expand Down
5 changes: 5 additions & 0 deletions trunk-recorder/systems/system_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class System_impl : public System {
unsigned long sys_id;
unsigned long wacn;
unsigned long nac;
int sys_rfss;
int sys_site_id;

public:
Talkgroups *talkgroups;
Expand Down Expand Up @@ -156,9 +158,12 @@ class System_impl : public System {
unsigned long get_sys_id();
unsigned long get_wacn();
unsigned long get_nac();
int get_sys_rfss();
int get_sys_site_id();
void set_xor_mask(unsigned long sys_id, unsigned long wacn, unsigned long nac);
const char *get_xor_mask();
bool update_status(TrunkMessage message);
bool update_sysid(TrunkMessage message);
int get_sys_num();
void set_system_type(std::string);
std::string get_talkgroups_file();
Expand Down

0 comments on commit 5f2077e

Please sign in to comment.