mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-12 16:57:23 -05:00
WIP: YSF Decoding; #143
This commit is contained in:
@@ -705,6 +705,20 @@ typedef struct
|
||||
//Upsampled Audio Smoothing
|
||||
uint8_t audio_smoothing;
|
||||
|
||||
//YSF Fusion Call Strings and Info
|
||||
uint8_t ysf_dt; //data type -- VD1, VD2, Full Rate, etc.
|
||||
uint8_t ysf_fi; //frame information -- HC, CC, TC
|
||||
uint8_t ysf_cm; //group or private call
|
||||
char ysf_tgt[11];
|
||||
char ysf_src[11];
|
||||
char ysf_upl[11];
|
||||
char ysf_dnl[11];
|
||||
char ysf_rm1[6];
|
||||
char ysf_rm2[6];
|
||||
char ysf_rm3[6];
|
||||
char ysf_rm4[6];
|
||||
char ysf_txt[21][21]; //text storage blocks
|
||||
|
||||
} dsd_state;
|
||||
|
||||
/*
|
||||
|
||||
@@ -264,18 +264,18 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol)
|
||||
}
|
||||
|
||||
else if ((state->synctype == 1) || (state->synctype == 3) || (state->synctype == 5) ||
|
||||
(state->synctype == 9) || (state->synctype == 11) || (state->synctype == 13) ||
|
||||
(state->synctype == 31) || (state->synctype == 11) || (state->synctype == 13) ||
|
||||
(state->synctype == 17) || (state->synctype == 29) || (state->synctype == 36) )
|
||||
|
||||
{
|
||||
// 1 -P25p1
|
||||
// 3 -X2-TDMA (inverted signal voice frame)
|
||||
// 5 -X2-TDMA (inverted signal data frame)
|
||||
// 9 -NXDN (inverted voice frame)
|
||||
// 11 -DMR (inverted signal voice frame)
|
||||
// 13 -DMR (inverted signal data frame)
|
||||
// 17 -NXDN (inverted data frame)
|
||||
// 29 -NXDN (inverted FSW)
|
||||
// 31 -YSF
|
||||
// 36 -P25p2
|
||||
|
||||
int valid;
|
||||
@@ -340,6 +340,7 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol)
|
||||
// 12 +DMR (non inverted signal voice frame)
|
||||
// 16 +NXDN (non inverted data frame)
|
||||
// 28 +NXND (FSW)
|
||||
// 30 +YSF
|
||||
// 35 +p25p2
|
||||
|
||||
int valid;
|
||||
|
||||
@@ -290,13 +290,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
|
||||
//ysf
|
||||
else if ((state->synctype == 30) || (state->synctype == 31))
|
||||
{
|
||||
//Do stuff
|
||||
//fprintf(stderr, "YSF Sync! \n");
|
||||
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
|
||||
{
|
||||
//openMbeOutFile (opts, state);
|
||||
}
|
||||
//sprintf(state->fsubtype, " VOICE ");
|
||||
//relocate MBEout to inside frame handling -- Not Working Currently for YSF
|
||||
processYSF(opts, state);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -228,13 +228,17 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
t_max = 10;
|
||||
}
|
||||
//else if dPMR
|
||||
//dPMR
|
||||
else if (opts->frame_dpmr == 1)
|
||||
{
|
||||
t_max = 12; //based on Frame_Sync_2 pattern
|
||||
}
|
||||
//if Phase 2 (or YSF in future), then only 19
|
||||
else if (state->lastsynctype == 35 || state->lastsynctype == 36) //P2
|
||||
else if (opts->frame_ysf == 1)
|
||||
{
|
||||
t_max = 20; //20 on YSF
|
||||
}
|
||||
//if Phase 2, then only 19
|
||||
else if (state->lastsynctype == 35 || state->lastsynctype == 36 )
|
||||
{
|
||||
t_max = 19; //Phase 2 S-ISCH is only 19
|
||||
}
|
||||
@@ -573,24 +577,20 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
||||
}
|
||||
}
|
||||
//YSF sync
|
||||
strncpy(synctest20, (synctest_p - 19), 20); //double check make sure this is right
|
||||
strncpy(synctest20, (synctest_p - 19), 20);
|
||||
if(opts->frame_ysf == 1) //(opts->frame_ysf == 1
|
||||
{
|
||||
if (0 == 0) //opts->inverted_ysf == 0
|
||||
{
|
||||
if (strcmp(synctest20, FUSION_SYNC) == 0)
|
||||
{
|
||||
printFrameSync (opts, state, "+YSF ", synctest_pos + 1, modulation);
|
||||
state->carrier = 1;
|
||||
state->offset = synctest_pos;
|
||||
state->max = ((state->max) + lmax) / 2;
|
||||
state->min = ((state->min) + lmin) / 2;
|
||||
fprintf (stderr, "\nYSF FUSION SYNC \n");
|
||||
opts->inverted_ysf = 0; //should we set this here?
|
||||
opts->inverted_ysf = 0;
|
||||
state->lastsynctype = 30;
|
||||
if ( opts->monitor_input_audio == 1)
|
||||
{
|
||||
pa_simple_flush(opts->pulse_raw_dev_out, NULL);
|
||||
}
|
||||
return (30);
|
||||
}
|
||||
}
|
||||
@@ -601,17 +601,13 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
if (strcmp(synctest20, INV_FUSION_SYNC) == 0)
|
||||
{
|
||||
printFrameSync (opts, state, "-YSF ", synctest_pos + 1, modulation);
|
||||
state->carrier = 1;
|
||||
state->offset = synctest_pos;
|
||||
state->max = ((state->max) + lmax) / 2;
|
||||
state->min = ((state->min) + lmin) / 2;
|
||||
fprintf (stderr, "\nINVERTED YSF FUSION SYNC \n");
|
||||
opts->inverted_ysf = 1; //should we set this here?
|
||||
opts->inverted_ysf = 1;
|
||||
state->lastsynctype = 31;
|
||||
if ( opts->monitor_input_audio == 1)
|
||||
{
|
||||
pa_simple_flush(opts->pulse_raw_dev_out, NULL);
|
||||
}
|
||||
return (31);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,6 +447,20 @@ noCarrier (dsd_opts * opts, dsd_state * state)
|
||||
sprintf (state->dpmr_caller_id, "%s", " ");
|
||||
sprintf (state->dpmr_target_id, "%s", " ");
|
||||
|
||||
//YSF Fusion Call Strings
|
||||
sprintf (state->ysf_tgt, "%s", " "); //10 spaces
|
||||
sprintf (state->ysf_src, "%s", " "); //10 spaces
|
||||
sprintf (state->ysf_upl, "%s", " "); //10 spaces
|
||||
sprintf (state->ysf_dnl, "%s", " "); //10 spaces
|
||||
sprintf (state->ysf_rm1, "%s", " "); //5 spaces
|
||||
sprintf (state->ysf_rm2, "%s", " "); //5 spaces
|
||||
sprintf (state->ysf_rm3, "%s", " "); //5 spaces
|
||||
sprintf (state->ysf_rm4, "%s", " "); //5 spaces
|
||||
memset (state->ysf_txt, 0, sizeof(state->ysf_txt));
|
||||
state->ysf_dt = 9;
|
||||
state->ysf_fi = 9;
|
||||
state->ysf_cm = 9;
|
||||
|
||||
} //nocarrier
|
||||
|
||||
void
|
||||
@@ -1012,6 +1026,21 @@ initState (dsd_state * state)
|
||||
sprintf (state->dpmr_caller_id, "%s", " ");
|
||||
sprintf (state->dpmr_target_id, "%s", " ");
|
||||
|
||||
//YSF Fusion Call Strings
|
||||
sprintf (state->ysf_tgt, "%s", " "); //10 spaces
|
||||
sprintf (state->ysf_src, "%s", " "); //10 spaces
|
||||
sprintf (state->ysf_upl, "%s", " "); //10 spaces
|
||||
sprintf (state->ysf_dnl, "%s", " "); //10 spaces
|
||||
sprintf (state->ysf_rm1, "%s", " "); //5 spaces
|
||||
sprintf (state->ysf_rm2, "%s", " "); //5 spaces
|
||||
sprintf (state->ysf_rm3, "%s", " "); //5 spaces
|
||||
sprintf (state->ysf_rm4, "%s", " "); //5 spaces
|
||||
memset (state->ysf_txt, 0, sizeof(state->ysf_txt));
|
||||
state->ysf_dt = 9;
|
||||
state->ysf_fi = 9;
|
||||
state->ysf_cm = 9;
|
||||
|
||||
|
||||
} //init_state
|
||||
|
||||
void
|
||||
@@ -1100,6 +1129,7 @@ usage ()
|
||||
printf (" -fn Decode only NXDN96* (12.5 kHz)\n");
|
||||
printf (" -fp Decode only EDACS/ProVoice*\n");
|
||||
printf (" -fm Decode only dPMR*\n");
|
||||
printf (" -fy Decode only YSF*\n");
|
||||
printf (" -l Disable DMR, dPMR, and NXDN input filtering\n");
|
||||
printf (" -u <num> Unvoiced speech quality (default=3)\n");
|
||||
printf (" -xx Expect non-inverted X2-TDMA signal\n");
|
||||
@@ -1890,8 +1920,6 @@ main (int argc, char **argv)
|
||||
opts.frame_dpmr = 0;
|
||||
opts.frame_provoice = 0;
|
||||
opts.frame_ysf = 1;
|
||||
state.samplesPerSymbol = 20; //10
|
||||
state.symbolCenter = 10;
|
||||
opts.mod_c4fm = 1;
|
||||
opts.mod_qpsk = 0;
|
||||
opts.mod_gfsk = 0;
|
||||
@@ -1902,8 +1930,7 @@ main (int argc, char **argv)
|
||||
state.dmr_stereo = 0;
|
||||
opts.dmr_mono = 0;
|
||||
sprintf (opts.output_name, "YSF");
|
||||
fprintf (stderr,"Setting symbol rate to 2400 / second\n");
|
||||
fprintf (stderr,"Decoding only YSF frames.\nNot working yet!\n");
|
||||
fprintf (stderr,"Decoding only YSF frames. \n");
|
||||
}
|
||||
else if (optarg[0] == '2')
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ char * SyncTypes[44] = {
|
||||
"NXDN",
|
||||
"NXDN",
|
||||
"YSF", //30
|
||||
"YSF",
|
||||
"YSF", //31
|
||||
"DMR",
|
||||
"DMR",
|
||||
"DMR",
|
||||
@@ -338,7 +338,8 @@ char *choices[] = {
|
||||
"Decode dPMR",
|
||||
"Decode NXDN48",
|
||||
"Decode NXDN96",
|
||||
"Decode DMR Stereo", //was X2-TDMA*
|
||||
"Decode DMR TDMA",
|
||||
"Decode YSF FUSION",
|
||||
"Toggle Signal Inversion",
|
||||
"Key Entry",
|
||||
"Reset Call History",
|
||||
@@ -557,7 +558,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
||||
}
|
||||
|
||||
//Input Output Options
|
||||
if (choice == 17)
|
||||
if (choice == 18)
|
||||
{
|
||||
//test making a new window while other window is open
|
||||
test_win = newwin(HEIGHT-1, WIDTH+9, starty+5, startx+5);
|
||||
@@ -1075,7 +1076,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
||||
}
|
||||
|
||||
//Privacy Key Entry
|
||||
if (choice == 13)
|
||||
if (choice == 14)
|
||||
{
|
||||
state->payload_keyid = 0;
|
||||
state->payload_keyidR = 0;
|
||||
@@ -1528,6 +1529,32 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
||||
//opts->unmute_encrypted_p25 = 0;
|
||||
}
|
||||
if (choice == 12)
|
||||
{
|
||||
//Decode YSF Fusion
|
||||
// resetState (state); //use sparingly, may cause memory leak
|
||||
state->samplesPerSymbol = 10;
|
||||
state->symbolCenter = 4;
|
||||
sprintf (opts->output_name, "YSF");
|
||||
opts->dmr_mono = 0;
|
||||
opts->dmr_stereo = 0; //this value is the end user option
|
||||
state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling
|
||||
opts->pulse_digi_rate_out = 48000;
|
||||
opts->pulse_digi_out_channels = 1;
|
||||
opts->frame_dstar = 0;
|
||||
opts->frame_x2tdma = 0;
|
||||
opts->frame_p25p1 = 0;
|
||||
opts->frame_nxdn48 = 0;
|
||||
opts->frame_nxdn96 = 0;
|
||||
opts->frame_dmr = 0;
|
||||
opts->frame_dpmr = 0;
|
||||
opts->frame_provoice = 0;
|
||||
opts->frame_ysf = 1;
|
||||
opts->mod_c4fm = 1;
|
||||
opts->mod_qpsk = 0;
|
||||
opts->mod_gfsk = 0;
|
||||
state->rf_mod = 0;
|
||||
}
|
||||
if (choice == 13)
|
||||
{
|
||||
//Set all signal for inversion or uninversion
|
||||
if (opts->inverted_dmr == 0)
|
||||
@@ -1546,7 +1573,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
||||
}
|
||||
|
||||
}
|
||||
if (choice == 14) //reset call history (usually if janky output when switching modes)
|
||||
if (choice == 15) //reset call history (usually if janky output when switching modes)
|
||||
{
|
||||
for (short int k = 0; k <= 9; k++)
|
||||
{
|
||||
@@ -1571,7 +1598,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
||||
state->lasttgR = 0;
|
||||
}
|
||||
|
||||
if (choice == 15) //toggle payload printing
|
||||
if (choice == 16) //toggle payload printing
|
||||
{
|
||||
if (opts->payload == 0)
|
||||
{
|
||||
@@ -1584,7 +1611,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
||||
fprintf(stderr, "Payload Off\n");
|
||||
}
|
||||
}
|
||||
if (choice == 16)
|
||||
if (choice == 17)
|
||||
{
|
||||
//hardset P2 WACN, SYSID, and NAC
|
||||
entry_win = newwin(6, WIDTH+16, starty+10, startx+10);
|
||||
@@ -1637,7 +1664,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
||||
|
||||
|
||||
}
|
||||
if (choice == 18)
|
||||
if (choice == 19)
|
||||
{
|
||||
short int lrrpchoice = 0;
|
||||
entry_win = newwin(10, WIDTH+16, starty+10, startx+10);
|
||||
@@ -1703,7 +1730,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
||||
opts->lrrp_out_file[0] = 0;
|
||||
}
|
||||
}
|
||||
if (choice == 19)
|
||||
if (choice == 20)
|
||||
{
|
||||
ncursesClose();
|
||||
//cleanup_rtlsdr_stream();
|
||||
@@ -2398,6 +2425,66 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
||||
}
|
||||
}
|
||||
|
||||
//YSF
|
||||
if (lls == 30 || lls == 31)
|
||||
{
|
||||
// printw ("\n");
|
||||
printw ("| ");
|
||||
printw ("Yaesu Fusion - ");
|
||||
//insert data type and frame information
|
||||
if (state->ysf_dt == 0) printw("Voice/Data T1 ");
|
||||
if (state->ysf_dt == 1) printw("Data Full Rate");
|
||||
if (state->ysf_dt == 2) printw("Voice/Data T2 ");
|
||||
if (state->ysf_dt == 3) printw("V/W Full Rate");
|
||||
printw (" ");
|
||||
if (state->ysf_cm == 0) printw("Group/CQ ");
|
||||
if (state->ysf_cm == 3) printw("Private ");
|
||||
if (state->ysf_cm == 1) printw("Reserved ");
|
||||
if (state->ysf_cm == 2) printw("Reserved ");
|
||||
|
||||
if (state->ysf_fi == 0) printw("HC ");
|
||||
if (state->ysf_fi == 1) printw("CC ");
|
||||
if (state->ysf_fi == 2) printw("TC ");
|
||||
if (state->ysf_fi == 3) printw("XX ");
|
||||
|
||||
printw ("\n");
|
||||
printw ("| ");
|
||||
printw ("TGT: %s ", state->ysf_tgt);
|
||||
printw ("SRC: %s ", state->ysf_src);
|
||||
printw ("\n");
|
||||
printw ("| ");
|
||||
printw ("UPL: %s ", state->ysf_upl);
|
||||
printw ("DNL: %s ", state->ysf_dnl);
|
||||
printw ("\n");
|
||||
printw ("| ");
|
||||
printw ("RM1: %s ", state->ysf_rm1);
|
||||
printw ("RM2: %s ", state->ysf_rm2);
|
||||
printw ("\n");
|
||||
printw ("| ");
|
||||
printw ("RM3: %s ", state->ysf_rm3);
|
||||
printw ("RM4: %s ", state->ysf_rm4);
|
||||
|
||||
//these texts can get pretty long and out of sorts, and lots of 0x20 spaces
|
||||
//just going to leave these to only be in the console output
|
||||
|
||||
// printw ("\n");
|
||||
// printw ("| ");
|
||||
// printw ("TXT: ");
|
||||
// for (i = 4; i < 8; i++)
|
||||
// {
|
||||
// for (int j = 0; j < 20; j++)
|
||||
// {
|
||||
// //no spaces and no asterisks
|
||||
// if (state->ysf_txt[i][j] != 0x2A)
|
||||
// printw ("%c", state->ysf_txt[i][j]);
|
||||
// }
|
||||
// // printw (" "); //just a single space between each 'block'
|
||||
// }
|
||||
|
||||
printw ("\n");
|
||||
|
||||
}
|
||||
|
||||
//NXDN
|
||||
if (lls == 28 || lls == 29)
|
||||
{
|
||||
|
||||
@@ -277,7 +277,8 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
|
||||
|
||||
if (opts->use_cosine_filter)
|
||||
{
|
||||
if ( (state->lastsynctype >= 10 && state->lastsynctype <= 13) || state->lastsynctype == 32 || state->lastsynctype == 33 || state->lastsynctype == 34)
|
||||
if ( (state->lastsynctype >= 10 && state->lastsynctype <= 13) || state->lastsynctype == 32 || state->lastsynctype == 33
|
||||
|| state->lastsynctype == 34 || state->lastsynctype == 30 || state->lastsynctype == 31)
|
||||
{
|
||||
sample = dmr_filter(sample);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user