From ed9a96fdc8752390c5ef961adbf4e00e7ed1bbf8 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Wed, 1 Mar 2023 17:56:10 -0500 Subject: [PATCH] Experimental -- Fast Scanner Feature; --- include/dsd.h | 2 ++ src/dsd_main.c | 49 ++++++++++++++++++++++++++++++++++++++++++++--- src/dsd_ncurses.c | 33 +++++++++++++++++++++---------- 3 files changed, 71 insertions(+), 13 deletions(-) diff --git a/include/dsd.h b/include/dsd.h index 7b7c2a3..28634ad 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -327,6 +327,8 @@ typedef struct int p25_is_tuned; //set to 1 if currently on VC, set back to 0 if on CC int trunk_hangtime; //hangtime in seconds before tuning back to CC + int scanner_mode; //experimental -- use the channel map as a conventional scanner, quicker tuning, but no CC + //csv import filenames char group_in_file[1024]; char lcn_in_file[1024]; diff --git a/src/dsd_main.c b/src/dsd_main.c index 8cb70e8..d4f8d70 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -52,7 +52,7 @@ char * FM_banner[9] = { " ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ", " ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗", " ╚═════╝ ╚═════╝ ╚═════╝    ╚═╝ ╚═╝ ╚═╝╚══════╝", - " 'Lite' Edition v2.0.0-46-g4ab16b5 Windows 32-bit RC4a" + " 'Lite' Edition v2.0.0-47-g6badf92 Windows 32-bit RC4b" }; int comp (const void *a, const void *b) @@ -77,6 +77,36 @@ void noCarrier (dsd_opts * opts, dsd_state * state) { + //experimental conventional frequency scanner mode + if (opts->scanner_mode == 1) + { + + if (state->lcn_freq_roll >= state->lcn_freq_count) + { + state->lcn_freq_roll = 0; //reset to zero + } + //check that we have a non zero value first, then tune next frequency + if (state->trunk_lcn_freq[state->lcn_freq_roll] != 0) + { + //rigctl + if (opts->use_rigctl == 1) + { + if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw); + SetFreq(opts->rigctl_sockfd, state->trunk_lcn_freq[state->lcn_freq_roll]); + } + //rtludp + if (opts->audio_in_type == 3) + { + rtl_udp_tune (opts, state, state->trunk_lcn_freq[state->lcn_freq_roll]); + } + + if (state->lastsynctype != -1) fprintf (stderr, "Resume Scanning Mode\n"); + + } + state->lcn_freq_roll++; + } + //end experimental conventional frequency scanner mode + //tune back to last known CC when using trunking after x second hangtime if (opts->p25_trunk == 1 && opts->p25_is_tuned == 1 && ( (time(NULL) - state->last_cc_sync_time) > opts->trunk_hangtime) ) { @@ -503,6 +533,8 @@ initOpts (dsd_opts * opts) opts->p25_is_tuned = 0; //set to 1 if currently on VC, set back to 0 on carrier drop opts->trunk_hangtime = 1; //1 second hangtime by default before tuning back to CC + opts->scanner_mode = 0; //0 disabled, 1 is enabled + //reverse mute opts->reverse_mute = 0; @@ -979,6 +1011,8 @@ usage () printf (" Use this feature to allow MAC_SIGNAL even if CRC errors.\n"); printf (" -F Relax DMR RAS/CRC CSBK/DATA Pass/Fail\n"); printf (" Enabling on some systems could lead to bad voice/data decoding if bad or marginal signal\n"); + printf (" -F Relax NXDN SACCH/FACCH/CAC/F2U CRC Pass/Fail\n"); + printf (" Not recommended on NXDN, but can be bypassed if desired.\n"); printf ("\n"); printf (" -K Manually Enter Basic Privacy Key (Decimal Value of Key Number)\n"); printf ("\n"); @@ -1002,6 +1036,9 @@ usage () printf (" -G Import Group List Allow/Block and Label from csv file.\n"); printf (" (See group.csv for example)\n"); printf (" -T Enable Trunking Features (NXDN/P25/EDACS/DMR) with RIGCTL/TCP or RTL Input\n"); + printf (" -Y Enable Fast Scanning Mode with RIGCTL/TCP or RTL Input (Lower z) \n"); + printf (" Experimental -- Can only scan for sync with enabled decoders, don't mix NXDN and DMR/P25!\n"); + printf (" This is not a Trunking Feature, just scans through conventional frequencies fast!\n"); printf (" -W Use Imported Group List as a Trunking Allow/White List -- Only Tune with Mode A\n"); printf (" -p Disable Tune to Private Calls (DMR TIII and P25)\n"); printf (" -E Disable Tune to Group Calls (DMR TIII, Con+, Cap+ and P25)\n"); @@ -1212,7 +1249,7 @@ main (int argc, char **argv) exitflag = 0; - while ((c = getopt (argc, argv, "haepPqs:t:v:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:VU:Y:K:H:X:NQ:WrlZTF01:2:345:6:7:89:Ek:")) != -1) + while ((c = getopt (argc, argv, "haepPqs:t:v:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:VU:YK:H:X:NQ:WrlZTF01:2:345:6:7:89:Ek:")) != -1) { opterr = 0; switch (c) @@ -1224,10 +1261,14 @@ main (int argc, char **argv) opts.call_alert = 1; break; - //Free'd up switches include Q,Y,z + //Free'd up switches include //make sure to put a colon : after each if they need an argument //or remove colon if no argument required + case 'Y': //conventional scanner mode + opts.scanner_mode = 1; //enable scanner + opts.p25_trunk = 0; //turn off trunking mode if user enabled it + break; case 'k': //NXDN multi-key loader strncpy(opts.key_in_file, optarg, 1023); @@ -1315,6 +1356,7 @@ main (int argc, char **argv) case 'T': //new letter assignment for trunking, flow down to allow temp numbers case '3': opts.p25_trunk = 1; + opts.scanner_mode = 0; //turn off scanner mode if user enabled it break; case 'U': //New letter assignment for RIGCTL TCP port, flow down to allow temp numbers @@ -1465,6 +1507,7 @@ main (int argc, char **argv) //fprintf (stderr,"DMR Stereo Aggressive Resync Disabled!\n"); fprintf (stderr, "Relax P25 Phase 2 MAC_SIGNAL CRC Checksum Pass/Fail\n"); fprintf (stderr, "Relax DMR RAS/CRC CSBK/DATA Pass/Fail\n"); + fprintf (stderr, "Relax NXDN SACCH/FACCH/CAC/F2U CRC Pass/Fail\n"); fprintf (stderr, "%s", KNRM); break; diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index c08e136..7b40178 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -2061,7 +2061,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (opts->ncurses_compact == 1) { printw ("------------------------------------------------------------------------------\n"); - printw ("| Digital Speech Decoder: Florida Man Edition - Win32 %s \n", "v2.0.0-46-g4ab16b5 RC4a"); + printw ("| Digital Speech Decoder: Florida Man Edition - Win32 %s \n", "v2.0.0-47-g6badf92 RC4b"); } if (opts->ncurses_compact == 0) { @@ -2072,8 +2072,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (i == 1) printw (" ESC to Menu"); if (i == 2) printw (" 'q' to Quit "); if (i == 4) printw (" MBElib %s", versionstr); - if (i == 5) printw (" %s ", "Win32 RC4a"); //printw (" %s \n", GIT_TAG); - if (i == 6) printw (" %s \n", "v2.0.0-46-g4ab16b5"); //printw (" %s \n", GIT_TAG); + if (i == 5) printw (" %s ", "Win32 RC4b"); //printw (" %s \n", GIT_TAG); + if (i == 6) printw (" %s \n", "v2.0.0-47-g6badf92"); //printw (" %s \n", GIT_TAG); else printw ("\n"); } attroff(COLOR_PAIR(6)); //6 @@ -2179,6 +2179,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) printw ("| Reverse Mute - Muting Unencrypted Voice\n"); } if (opts->aggressive_framesync == 0) printw ("| Selective CRC ERR Bypass Enabled (RAS) \n"); + if (state->M == 1) printw ("| Forcing Key Priority -- Key: %lld \n", state->R); + if (opts->scanner_mode == 1) + { + printw ("| Fast Scan Mode Enabled "); + printw (" - Frequency: [%.06lf] Mhz \n", (double)state->trunk_lcn_freq[state->lcn_freq_roll]/1000000); + } printw ("------------------------------------------------------------------------------\n"); attroff(COLOR_PAIR(4)); @@ -2278,8 +2284,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) printw ("\n"); printw ("| "); - printw ("TGT: [%4d] ", tgn); - printw ("SRC: [%4d] ", src); + printw ("TGT: [%05d] ", tgn); + printw ("SRC: [%05d] ", src); if (state->nxdn_alias_block_segment[0][0] > 0) { printw ("ALIAS: ["); @@ -2317,7 +2323,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } if (state->nxdn_cipher_type == 0x2 && state->carrier == 1) { - printw ("IV: [%016llX]", state->payload_miN); + printw ("IV: [%016llX] ", state->payload_miN); attron(COLOR_PAIR(2)); printw ("DES-OFB "); attroff(COLOR_PAIR(2)); @@ -2325,7 +2331,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) } if (state->nxdn_cipher_type == 0x3 && state->carrier == 1) { - printw ("IV: [%016llX]", state->payload_miN); + printw ("IV: [%016llX] ", state->payload_miN); attron(COLOR_PAIR(2)); printw ("AES-256 "); attroff(COLOR_PAIR(2)); @@ -2922,9 +2928,9 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) printw ("| %s ", SyncTypes[call_matrix[9-j][0]]); if (lls == 28 || lls == 29) { - printw ("RAN [%2lld] ", call_matrix[9-j][1]); - printw ("TG [%4lld] ", call_matrix[9-j][4]); - printw ("RID [%4lld] ", call_matrix[9-j][2]); + printw ("RAN [%02lld] ", call_matrix[9-j][1]); + printw ("TG [%05lld] ", call_matrix[9-j][4]); + printw ("RID [%05lld] ", call_matrix[9-j][2]); } //dPMR if (lls == 20 || lls == 21 || lls == 22 || lls == 23 ||lls == 24 || lls == 25 || lls == 26 || lls == 27) @@ -3007,6 +3013,13 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) else opts->p25_trunk = 1; } + if (c == 121) //'y' key, toggle scanner mode + { + if (opts->scanner_mode == 1) opts->scanner_mode = 0; + else opts->scanner_mode = 1; + opts->p25_trunk = 0; //turn off trunking mode + } + if (c == 97) //'a' key, toggle call alert beep { if (opts->call_alert == 1) opts->call_alert = 0;