mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-19 20:27:26 -05:00
NXDN Multi-Key CSV Import; Example Updt;
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -3,5 +3,5 @@
|
|||||||
*.dylib
|
*.dylib
|
||||||
build
|
build
|
||||||
*.sh
|
*.sh
|
||||||
*.csv
|
|
||||||
examples
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ For Connect Plus, enumerate your list from 1 to the last channel and add the fre
|
|||||||
|
|
||||||
Currently uncoded/unknown DMR trunking systems include Hytera XPT.
|
Currently uncoded/unknown DMR trunking systems include Hytera XPT.
|
||||||
|
|
||||||
Trunking Note4: NXDN Trunking may also require a channel map file, depending on the system. If it uses a custom range (above 800), then channels will need to be mapped. If channels do not require mapping (have channels below 800) but you are not tuning properly, then please use a channel_map and please report the issue in the issues along with the channels you are tuning and the actual rf frequency so corrections can be made.
|
Trunking Note4: NXDN TRunking will require a channel map. Please see the example folder for an appropriate channel map. ~NXDN Trunking may also require a channel map file, depending on the system. If it uses a custom range (above 800), then channels will need to be mapped. If channels do not require mapping (have channels below 800) but you are not tuning properly, then please use a channel_map and please report the issue in the issues along with the channels you are tuning and the actual rf frequency so corrections can be made.~
|
||||||
|
|
||||||
Channel Map and Group CSV Note: Leave the top line of the channel_map.csv and group.csv as the label, do not delete the line, if no line is there, dsd_import skips the first line so it will not import the first channel or first group in those files if there is something there that isn't a label.
|
Channel Map and Group CSV Note: Leave the top line of the channel_map.csv and group.csv as the label, do not delete the line, if no line is there, dsd_import skips the first line so it will not import the first channel or first group in those files if there is something there that isn't a label.
|
||||||
|
|
||||||
|
|||||||
8
examples/nxdn_chan_map.csv
Normal file
8
examples/nxdn_chan_map.csv
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
channel(dec), freq(Hz)
|
||||||
|
141,423862500
|
||||||
|
142,424337500
|
||||||
|
143,424912500
|
||||||
|
203,424100000
|
||||||
|
204,424625000
|
||||||
|
271,422650000
|
||||||
|
302,423287500
|
||||||
|
5
examples/nxdn_sc_key.csv
Normal file
5
examples/nxdn_sc_key.csv
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
key(dec), value(dec), load any single keys as key 0
|
||||||
|
0,23466
|
||||||
|
1,12345
|
||||||
|
2,32700
|
||||||
|
63,32767
|
||||||
|
@@ -326,7 +326,8 @@ typedef struct
|
|||||||
//csv import filenames
|
//csv import filenames
|
||||||
char group_in_file[1024];
|
char group_in_file[1024];
|
||||||
char lcn_in_file[1024];
|
char lcn_in_file[1024];
|
||||||
char chan_in_file[1024];
|
char chan_in_file[1024];
|
||||||
|
char key_in_file[1024];
|
||||||
//end import filenames
|
//end import filenames
|
||||||
|
|
||||||
//reverse mute
|
//reverse mute
|
||||||
@@ -641,6 +642,9 @@ typedef struct
|
|||||||
uint32_t nxdn_location_sys_code;
|
uint32_t nxdn_location_sys_code;
|
||||||
uint16_t nxdn_location_site_code;
|
uint16_t nxdn_location_site_code;
|
||||||
|
|
||||||
|
//multi-key array for nxdn keys
|
||||||
|
unsigned long long int rkey_array[0x1FF];
|
||||||
|
|
||||||
//dmr late entry mi
|
//dmr late entry mi
|
||||||
uint64_t late_entry_mi_fragment[2][7][3];
|
uint64_t late_entry_mi_fragment[2][7][3];
|
||||||
|
|
||||||
@@ -1019,6 +1023,7 @@ unsigned long long int edacs_bch (unsigned long long int message);
|
|||||||
int csvGroupImport(dsd_opts * opts, dsd_state * state);
|
int csvGroupImport(dsd_opts * opts, dsd_state * state);
|
||||||
int csvLCNImport(dsd_opts * opts, dsd_state * state);
|
int csvLCNImport(dsd_opts * opts, dsd_state * state);
|
||||||
int csvChanImport(dsd_opts * opts, dsd_state * state);
|
int csvChanImport(dsd_opts * opts, dsd_state * state);
|
||||||
|
int csvKeyImport(dsd_opts * opts, dsd_state * state);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -145,3 +145,48 @@ int csvChanImport(dsd_opts * opts, dsd_state * state) //channel map import
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int csvKeyImport(dsd_opts * opts, dsd_state * state) //multi-key support for NXDN
|
||||||
|
{
|
||||||
|
char filename[1024] = "filename.csv";
|
||||||
|
sprintf (filename, "%s", opts->key_in_file);
|
||||||
|
|
||||||
|
char buffer[BSIZE];
|
||||||
|
FILE * fp;
|
||||||
|
fp = fopen(filename, "r");
|
||||||
|
if (fp == NULL) {
|
||||||
|
printf("Unable to open file '%s'\n", filename);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
int row_count = 0;
|
||||||
|
int field_count = 0;
|
||||||
|
unsigned long long int keynumber;
|
||||||
|
|
||||||
|
while (fgets(buffer, BSIZE, fp)) {
|
||||||
|
field_count = 0;
|
||||||
|
row_count++;
|
||||||
|
if (row_count == 1)
|
||||||
|
continue; //don't want labels
|
||||||
|
char * field = strtok(buffer, ","); //seperate by comma
|
||||||
|
while (field) {
|
||||||
|
|
||||||
|
if (field_count == 0)
|
||||||
|
{
|
||||||
|
sscanf (field, "%lld", &keynumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field_count == 1)
|
||||||
|
{
|
||||||
|
sscanf (field, "%lld", &state->rkey_array[keynumber]);
|
||||||
|
}
|
||||||
|
|
||||||
|
field = strtok(NULL, ",");
|
||||||
|
field_count++;
|
||||||
|
}
|
||||||
|
fprintf (stderr, "Key [%03lld] [%05lld]", keynumber, state->rkey_array[keynumber]);
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -392,6 +392,7 @@ initOpts (dsd_opts * opts)
|
|||||||
opts->group_in_file[0] = 0;
|
opts->group_in_file[0] = 0;
|
||||||
opts->lcn_in_file[0] = 0;
|
opts->lcn_in_file[0] = 0;
|
||||||
opts->chan_in_file[0] = 0;
|
opts->chan_in_file[0] = 0;
|
||||||
|
opts->key_in_file[0] = 0;
|
||||||
//end import filenames
|
//end import filenames
|
||||||
opts->szNumbers[0] = 0;
|
opts->szNumbers[0] = 0;
|
||||||
opts->symbol_out_f = NULL;
|
opts->symbol_out_f = NULL;
|
||||||
@@ -808,7 +809,10 @@ initState (dsd_state * state)
|
|||||||
//site/srv/cch info
|
//site/srv/cch info
|
||||||
state->nxdn_location_site_code = 0;
|
state->nxdn_location_site_code = 0;
|
||||||
state->nxdn_location_sys_code = 0;
|
state->nxdn_location_sys_code = 0;
|
||||||
sprintf (state->nxdn_location_category, "%s", " ");
|
sprintf (state->nxdn_location_category, "%s", " ");
|
||||||
|
|
||||||
|
//multi-key array
|
||||||
|
memset (state->rkey_array, 0, sizeof(state->rkey_array));
|
||||||
|
|
||||||
//Remus DMR End Call Alert Beep
|
//Remus DMR End Call Alert Beep
|
||||||
state->dmr_end_alert[0] = 0;
|
state->dmr_end_alert[0] = 0;
|
||||||
@@ -965,6 +969,7 @@ usage ()
|
|||||||
printf (" -H '20029736A5D91042 C923EB0697484433 005EFC58A1905195 E28E9C7836AA2DB8' \n");
|
printf (" -H '20029736A5D91042 C923EB0697484433 005EFC58A1905195 E28E9C7836AA2DB8' \n");
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
printf (" -R <dec> Manually Enter dPMR or NXDN EHR Scrambler Key Value (Decimal Value)\n");
|
printf (" -R <dec> Manually Enter dPMR or NXDN EHR Scrambler Key Value (Decimal Value)\n");
|
||||||
|
printf (" -k <file> Import NXDN Scrambler Key List from csv file.\n");
|
||||||
printf (" \n");
|
printf (" \n");
|
||||||
printf (" -4 Force DMR Privacy Key over FID and SVC bits \n");
|
printf (" -4 Force DMR Privacy Key over FID and SVC bits \n");
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
@@ -1199,7 +1204,7 @@ main (int argc, char **argv)
|
|||||||
exitflag = 0;
|
exitflag = 0;
|
||||||
// signal (SIGINT, sigfun);
|
// signal (SIGINT, sigfun);
|
||||||
|
|
||||||
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:E")) != -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:Y:K:H:X:NQ:WrlZTF01:2:345:6:7:89:Ek:")) != -1)
|
||||||
{
|
{
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
switch (c)
|
switch (c)
|
||||||
@@ -1211,12 +1216,18 @@ main (int argc, char **argv)
|
|||||||
opts.call_alert = 1;
|
opts.call_alert = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Free'd up switches include Q,Y,z
|
//Free'd up switches include Y,z
|
||||||
//make sure to put a colon : after each if they need an argument
|
//make sure to put a colon : after each if they need an argument
|
||||||
//or remove colon if no argument required
|
//or remove colon if no argument required
|
||||||
|
|
||||||
//Disabled the Serial Port Dev and Baud Rate, etc, If somebody uses that function, sorry...
|
//Disabled the Serial Port Dev and Baud Rate, etc, If somebody uses that function, sorry...
|
||||||
|
|
||||||
|
case 'k': //NXDN multi-key loader
|
||||||
|
strncpy(opts.key_in_file, optarg, 1023);
|
||||||
|
opts.key_in_file[1023] = '\0';
|
||||||
|
csvKeyImport(&opts, &state);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'Q': //'DSP' Structured Output file for OKDMRlib
|
case 'Q': //'DSP' Structured Output file for OKDMRlib
|
||||||
sprintf (wav_file_directory, "./DSP");
|
sprintf (wav_file_directory, "./DSP");
|
||||||
wav_file_directory[1023] = '\0';
|
wav_file_directory[1023] = '\0';
|
||||||
|
|||||||
@@ -667,6 +667,9 @@ void NXDN_decode_VCALL(dsd_opts * opts, dsd_state * state, uint8_t * Message)
|
|||||||
fprintf (stderr, "%s", KNRM);
|
fprintf (stderr, "%s", KNRM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check the rkey array for a scrambler key value
|
||||||
|
if (state->rkey_array[KeyID] != 0) state->R = state->rkey_array[KeyID];
|
||||||
|
|
||||||
if (state->nxdn_cipher_type == 0x01 && state->R > 0) //scrambler key value
|
if (state->nxdn_cipher_type == 0x01 && state->R > 0) //scrambler key value
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s", KYEL);
|
fprintf (stderr, "%s", KYEL);
|
||||||
|
|||||||
Reference in New Issue
Block a user