From 6f538fd166109eaba9d9cc81c5b40429500e6f88 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Tue, 2 May 2023 18:19:41 -0400 Subject: [PATCH] Active Channel Display NXDN Setup and Misc; #120 --- include/dsd.h | 1 + src/dsd_main.c | 10 ++++++++-- src/nxdn_element.c | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/dsd.h b/include/dsd.h index d5b6544..53532d1 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -560,6 +560,7 @@ typedef struct char dmr_lrrp_gps[2][200]; //2 slots by 99 char string for string lrrp gps char dmr_site_parms[200]; //string for site/net info depending on type of DMR system (TIII or Con+) char call_string[2][200]; //string for call information + char active_channel[31][200]; //string for storing and displaying active trunking channels dPMRVoiceFS2Frame_t dPMRVoiceFS2Frame; diff --git a/src/dsd_main.c b/src/dsd_main.c index 07ba7d6..bae9144 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -157,6 +157,8 @@ noCarrier (dsd_opts * opts, dsd_state * state) state->p25_vc_freq[0] = 0; state->p25_vc_freq[1] = 0; + memset(state->active_channel, 0, sizeof(state->active_channel)); + state->is_con_plus = 0; //flag off } @@ -373,11 +375,13 @@ noCarrier (dsd_opts * opts, dsd_state * state) memset(state->dmr_embedded_gps, 0, sizeof(state->dmr_embedded_gps)); memset(state->dmr_lrrp_gps, 0, sizeof(state->dmr_lrrp_gps)); + // memset(state->active_channel, 0, sizeof(state->active_channel)); + //REMUS! multi-purpose call_string sprintf (state->call_string[0], "%s", " "); //21 spaces sprintf (state->call_string[1], "%s", " "); //21 spaces - if (time(NULL) - state->last_cc_sync_time > 30) //thirty seconds of no carrier + if (time(NULL) - state->last_cc_sync_time > 10) //ten seconds of no carrier { state->dmr_rest_channel = -1; state->p25_vc_freq[0] = 0; @@ -387,6 +391,7 @@ noCarrier (dsd_opts * opts, dsd_state * state) sprintf(state->dmr_branding, "%s", ""); sprintf (state->dmr_site_parms, "%s", ""); opts->p25_is_tuned = 0; + memset(state->active_channel, 0, sizeof(state->active_channel)); } opts->dPMR_next_part_of_superframe = 0; @@ -534,7 +539,7 @@ initOpts (dsd_opts * opts) //rigctl options opts->use_rigctl = 0; opts->rigctl_sockfd = 0; - opts->rigctlportno = 7356; //TCP Port Number; GQRX - 7356; SDR++ - 4532 + opts->rigctlportno = 4532; //TCP Port Number; GQRX - 7356; SDR++ - 4532 sprintf (opts->rigctlhostname, "%s", "localhost"); //udp input options @@ -911,6 +916,7 @@ initState (dsd_state * state) memset(state->dmr_alias_block_segment, 0, sizeof(state->dmr_alias_block_segment)); memset(state->dmr_embedded_gps, 0, sizeof(state->dmr_embedded_gps)); memset(state->dmr_lrrp_gps, 0, sizeof(state->dmr_lrrp_gps)); + memset(state->active_channel, 0, sizeof(state->active_channel)); //REMUS! multi-purpose call_string sprintf (state->call_string[0], "%s", " "); //21 spaces diff --git a/src/nxdn_element.c b/src/nxdn_element.c index 47a0f1a..ea062cd 100644 --- a/src/nxdn_element.c +++ b/src/nxdn_element.c @@ -134,6 +134,7 @@ void NXDN_Elements_Content_decode(dsd_opts * opts, dsd_state * state, //extra safeguards due to sync issues with NXDN memset (state->nxdn_sacch_frame_segment, 1, sizeof(state->nxdn_sacch_frame_segment)); memset (state->nxdn_sacch_frame_segcrc, 1, sizeof(state->nxdn_sacch_frame_segcrc)); + memset(state->active_channel, 0, sizeof(state->active_channel)); opts->p25_is_tuned = 0; if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw); SetFreq(opts->rigctl_sockfd, state->p25_cc_freq); @@ -145,6 +146,7 @@ void NXDN_Elements_Content_decode(dsd_opts * opts, dsd_state * state, //extra safeguards due to sync issues with NXDN memset (state->nxdn_sacch_frame_segment, 1, sizeof(state->nxdn_sacch_frame_segment)); memset (state->nxdn_sacch_frame_segcrc, 1, sizeof(state->nxdn_sacch_frame_segcrc)); + memset(state->active_channel, 0, sizeof(state->active_channel)); opts->p25_is_tuned = 0; rtl_udp_tune (opts, state, state->p25_cc_freq); } @@ -453,6 +455,12 @@ void NXDN_decode_VCALL_ASSGN(dsd_opts * opts, dsd_state * state, uint8_t * Messa } } + //assign active call to string (might place inside of tune decision to get multiple ones?) + if (state->nxdn_rcn == 0) + sprintf (state->active_channel[0], "Active Ch: %d TG: %d; ", Channel, DestinationID); + if (state->nxdn_rcn == 1) + sprintf (state->active_channel[0], "Active Ch: %d TG: %d; ", OFN, DestinationID); + //Add support for tuning data and group/private calls on trunking systems uint8_t tune = 0; @@ -1315,6 +1323,15 @@ void NXDN_decode_scch(dsd_opts * opts, dsd_state * state, uint8_t * Message, uin if (rep1 == 31) fprintf (stderr, "Termination "); + //add current active to display string -- may need tweaking on if to use rep1 (active ch), or rep2 (home prefix) + if (rep1 != 0 && rep1 != 31) + { + if (gu == 0) sprintf (state->active_channel[rep1], "Active Ch: %d TG: %d-%d; ", rep1, rep2, id); //Group TG + else sprintf (state->active_channel[rep1], "Active Ch: %d TGT: %d-%d; ", rep1, rep2, id); //Private TGT + } + //may not be needed -- DISC also zips the entire thing (all channels) + else if (rep1 == 31) sprintf (state->active_channel[rep1], "%s", ""); //zip it + //start tuning section here uint8_t tune = 0; //use this to check to see if okay to tune