Enable D-Star, Pulse Tweaks, NCurses Tweaks, Misc

Enable D-Star, Pulse Tweaks, NCurses Tweaks, Misc
This commit is contained in:
lwvmobile 2022-03-13 19:13:09 -04:00 committed by GitHub
parent 0fc9380b00
commit 184b8b6a39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 187 additions and 228 deletions

View File

@ -87,6 +87,8 @@ void ProcessDmrPIHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], u
CRCExtracted = CRCExtracted | (uint32_t)(DmrDataBit[i + 80] & 1); //80-96 for PI header
}
//Look into whether or not we need to run these CRC checks for this header information
//and see if its applied the same or differently
/* Apply the CRC mask (see DMR standard B.3.12 Data Type CRC Mask) */
//CRCExtracted = CRCExtracted ^ 0x969696; //does this mask get applied here though for PI?
//CRCExtracted = CRCExtracted ^ 0x6969;
@ -107,21 +109,15 @@ void ProcessDmrPIHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], u
DmrDataBit[j + 6] = (DmrDataByte[i] >> 1) & 0x01;
DmrDataBit[j + 7] = (DmrDataByte[i] >> 0) & 0x01;
}
//Placeholder, figure out which areas to grab
//state->payload_algid = DmrDataBit[1];
state->payload_algid = DmrDataByte[0]; //not really sure, just guessing on observation?
//state->payload_keyid = DmrDataBit[2];
state->payload_algid = DmrDataByte[0];
state->payload_keyid = DmrDataByte[2];
//state->payload_mi = ( (DmrDataBit[3] << 3) + (DmrDataBit[4] << 2) + (DmrDataBit[5] << 1) + DmrDataBit[6] );
state->payload_mi = ( ((DmrDataByte[3]) << 24) + ((DmrDataByte[4]) << 16) + ((DmrDataByte[5]) << 8) + (DmrDataByte[6]) );
//fprintf(stderr, "%s Slot(%d), CC(%x), PI HEADER: ALGID(%02x), KEYID(%02x), MI(%08x), DSTADDR(%06x)\n",
fprintf (stderr, "\n DMR PI Header ALG ID: 0x%02X KEY ID: 0x%02X MI: 0x%08X \n", state->payload_algid, state->payload_keyid, state->payload_mi);
fprintf (stderr, " Full PI Header Payload in Hex\n");
for(i = 0, j = 0; i < 12; i++)
if (opts->payload == 1)
{
//fprintf (stderr, " Byte [%02d] [%02X] [%02X]\n", i+1, DmrDataByte[i], DmrDataByte[i] ^ 0x69); //0x6969 PI header mask?
fprintf (stderr, "\n DMR PI Header ALG ID: 0x%02X KEY ID: 0x%02X MI: 0x%08X", state->payload_algid, state->payload_keyid, state->payload_mi);
}
//end Placeholder
}
void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t syncdata[48], uint8_t SlotType[20])

View File

@ -70,7 +70,7 @@ void processdPMRvoice (dsd_opts * opts, dsd_state * state)
if (opts->errorbars == 1)
{
fprintf(stderr, "VOICE e:");
//fprintf(stderr, "VOICE e:");
}
/* First CCH (Control CHannel) - 72 bit */
@ -131,7 +131,7 @@ void processdPMRvoice (dsd_opts * opts, dsd_state * state)
z++;
}
//processMbeFrame (opts, state, NULL, ambe_fr2, NULL); //HERE HERE
//processMbeFrame (opts, state, NULL, ambe_fr[j], NULL); //HERE HERE
#ifdef DPMR_DUMP
fprintf(stderr, " ");
@ -225,7 +225,7 @@ void processdPMRvoice (dsd_opts * opts, dsd_state * state)
y++;
z++;
}
//processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
//processMbeFrame (opts, state, NULL, ambe_fr[j], NULL);
#ifdef DPMR_DUMP
fprintf(stderr, " ");
@ -523,7 +523,7 @@ void processdPMRvoice (dsd_opts * opts, dsd_state * state)
//fprintf(stderr, "| TG=%s", CalledID);
if(state->dPMRVoiceFS2Frame.CalledIDOk)
{
fprintf(stderr, "| TG=%s", CalledID);
fprintf(stderr, "\n| TG=%s", CalledID);
//strcpy (state->dpmr_target_id, CalledID); //HERE HERE
state->dpmr_target_id = CalledID;
//fprintf(stderr, " (CRC OK) ");
@ -631,70 +631,25 @@ void processdPMRvoice (dsd_opts * opts, dsd_state * state)
if(VoiceFrameFlag)
{
/* There is 4 AMBE voice sample per voice frame (= 8 per superframe) */
//for(i = 0; i < (NB_OF_DPMR_VOICE_FRAME_TO_DECODE * 4); i++)
for(i = 0; i < (8); i++)
for(i = 0; i < (NB_OF_DPMR_VOICE_FRAME_TO_DECODE * 4); i++)
//for(i = 0; i < (8); i++)
{
/* Apply ECC 1 to the AMBE frames */
state->dPMRVoiceFS2Frame.errs1[i] = (unsigned int)mbe_eccAmbe3600x2450C0(ambe_fr[i]);
state->dPMRVoiceFS2Frame.errs2[i] = state->dPMRVoiceFS2Frame.errs1[i];
/* Demodulate the AMBE frames */
mbe_demodulateAmbe3600x2450Data(ambe_fr[i]);
//mbe_demodulateAmbe3600x2400Data(ambe_fr[i]);
//mbe_demodulateAmbe3600x2450Data(ambe_fr[i]);
mbe_demodulateAmbe3600x2400Data(ambe_fr[i]);
/* Apply ECC 2 to the AMBE frames and get the 49 bit of the voice sample */
state->dPMRVoiceFS2Frame.errs2[i] += (unsigned int)mbe_eccAmbe3600x2450Data(ambe_fr[i], (char *)state->dPMRVoiceFS2Frame.AmbeBit[i]);
//state->dPMRVoiceFS2Frame.errs2[i] += (unsigned int)mbe_eccAmbe3600x2450Data(ambe_fr[i], (char *)state->dPMRVoiceFS2Frame.AmbeBit[i]);
state->dPMRVoiceFS2Frame.errs2[i] += (unsigned int)mbe_eccAmbe3600x2400Data(ambe_fr[i], (char *)state->dPMRVoiceFS2Frame.AmbeBit[i]);
//processMbeFrame (opts, state, NULL, ambe_fr[i], NULL); //HERE HERE
//processMbeFrame (opts, state, NULL, state->dPMRVoiceFS2Frame.AmbeBit[i], NULL); //HERE HERE
}
} /* End if(VoiceFrameFlag && !AttachedDataFlag) */
//for 1 to 8 and then VoiceFrameFlag
/*
for(i = 0; i < (8); i++)
{
if(VoiceFrameFlag)
{
//processMbeFrame (opts, state, NULL, ambe_fr[i], NULL); //HERE HERE
//
errs = (uint32_t*)&(state->dPMRVoiceFS2Frame.errs1[i]);
errs2 = (uint32_t*)&(state->dPMRVoiceFS2Frame.errs2[i]);
state->errs = state->dPMRVoiceFS2Frame.errs1[i];
state->errs2 = state->dPMRVoiceFS2Frame.errs2[i];
//processMbeFrame (opts, state, NULL, (char *)state->dPMRVoiceFS2Frame.AmbeBit[i], NULL); //HERE HERE
mbe_processAmbe2450Dataf (state->audio_out_temp_buf, errs, errs2, state->err_str,
state->dPMRVoiceFS2Frame.AmbeBit[i],
state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
if (opts->mbe_out_f != NULL)
{
//saveAmbe2450Data (opts, state, (char *)state->dPMRVoiceFS2Frame.AmbeBit[i]);
}
if (opts->errorbars == 1)
{
fprintf(stderr, "%s", state->err_str);
}
state->debug_audio_errors += *errs2;
processAudio(opts, state);
if (opts->wav_out_f != NULL)
{
writeSynthesizedVoice (opts, state);
}
if (opts->audio_out == 1)
{
//Play the AMBE Frames
playSynthesizedVoice (opts, state);
}
}
}
*/
//Check if the voice frame to play is encrypted
if(opts->dPMR_curr_frame_is_encrypted)
{
@ -721,31 +676,29 @@ void processdPMRvoice (dsd_opts * opts, dsd_state * state)
for(i = 0; i < (NB_OF_DPMR_VOICE_FRAME_TO_DECODE * 4); i++) //is this backwards, shouldn't we run this first, and then voice frame after?
{
errs = (uint32_t*)&(state->dPMRVoiceFS2Frame.errs1[i]);
//errs = (uint32_t*)&(state->dPMRVoiceFS2Frame.errs1[i]);
errs2 = (uint32_t*)&(state->dPMRVoiceFS2Frame.errs2[i]);
errs = 0;
//errs2 = 0;
state->errs = state->dPMRVoiceFS2Frame.errs1[i];
state->errs2 = state->dPMRVoiceFS2Frame.errs2[i];
//
//processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
//sounds like choppy shit, but .amb file playback is acceptable, so investigate why this doesn't work properly
mbe_processAmbe2450Dataf (state->audio_out_temp_buf, errs, errs2, state->err_str,
state->dPMRVoiceFS2Frame.AmbeBit[i],
//could be related to err states not properly done or something?
mbe_processAmbe2450Dataf (state->audio_out_temp_buf, (int *)errs, (int *)errs2, state->err_str,
(char *)state->dPMRVoiceFS2Frame.AmbeBit[i],
state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
//mbe_processAmbe2450Dataf (state->audio_out_temp_buf_p, (int *)errs, (int *)errs2, state->err_str,
// (char *)state->dPMRVoiceFS2Frame.AmbeBit[i],
// state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
if (opts->mbe_out_f != NULL)
{
saveAmbe2450Data (opts, state, (char *)state->dPMRVoiceFS2Frame.AmbeBit[i]);
}
if (opts->errorbars == 1)
{
fprintf(stderr, "%s", state->err_str);
//fprintf(stderr, "%s", state->err_str);
}
state->debug_audio_errors += *errs2;
//state->debug_audio_errors += *errs2;
processAudio(opts, state);
@ -756,7 +709,7 @@ void processdPMRvoice (dsd_opts * opts, dsd_state * state)
if (opts->audio_out == 1)
{
//Play the AMBE Frames
//Play the AMBE Frames
playSynthesizedVoice (opts, state);
}
} //End for(i = 0; i < (NB_OF_DPMR_VOICE_FRAME_TO_DECODE * 4); i++)

View File

@ -609,7 +609,8 @@ processFrame (dsd_opts * opts, dsd_state * state)
if (opts->errorbars == 1)
{
printFrameInfo (opts, state);
fprintf (stderr," duid:%s *Unknown DUID*\n", duid);
//fprintf (stderr," duid:%s *Unknown DUID*\n", duid); //prints on dPMR frame 3
fprintf (stderr, "\n"); //prints on dPMR frame 3
}
}
}

View File

@ -425,7 +425,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
sprintf (state->ftype, "P25 Phase 1");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +P25p1 ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+P25p1 ", synctest_pos + 1, modulation);
}
state->lastsynctype = 0;
return (0);
@ -440,7 +440,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
sprintf (state->ftype, "P25 Phase 1");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -P25p1 ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-P25p1 ", synctest_pos + 1, modulation);
}
state->lastsynctype = 1;
return (1);
@ -461,7 +461,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
sprintf (state->ftype, "X2-TDMA");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +X2-TDMA ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+X2-TDMA ", synctest_pos + 1, modulation);
}
state->lastsynctype = 2;
return (2);
@ -472,7 +472,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
sprintf (state->ftype, "X2-TDMA");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -X2-TDMA ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-X2-TDMA ", synctest_pos + 1, modulation);
}
if (state->lastsynctype != 3)
{
@ -495,7 +495,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
sprintf (state->ftype, "X2-TDMA");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +X2-TDMA ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+X2-TDMA ", synctest_pos + 1, modulation);
}
if (state->lastsynctype != 4)
{
@ -510,7 +510,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
sprintf (state->ftype, "X2-TDMA");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -X2-TDMA ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-X2-TDMA ", synctest_pos + 1, modulation);
}
state->lastsynctype = 5;
return (5);
@ -606,17 +606,17 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
//fprintf(stderr, "DPMR_FRAME_SYNC_1\n"); // TODO : To be removed
//if ((state->lastsynctype == 20) || (state->lastsynctype == 21) ||
// (state->lastsynctype == 22) || (state->lastsynctype == 23))
//{
if ((state->lastsynctype == 20) || (state->lastsynctype == 21) ||
(state->lastsynctype == 22) || (state->lastsynctype == 23))
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf(state->ftype, " dPMR ");
sprintf(state->ftype, "dPMR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +dPMR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+dPMR ", synctest_pos + 1, modulation);
}
/* The next part of the superframe will normally be the first part */
@ -624,11 +624,11 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->lastsynctype = 20;
return (20);
//}
//else
//{
// state->lastsynctype = 20;
//}
}
else
{
state->lastsynctype = 20;
}
} /* End if (opts->inverted_dpmr == 0) */
}
else if(strcmp(synctest12, DPMR_FRAME_SYNC_2) == 0)
@ -638,28 +638,28 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
//fprintf(stderr, "DPMR_FRAME_SYNC_2\n"); // TODO : To be removed
// TODO : Modif 2019-01-04
//if ((state->lastsynctype == 20) || (state->lastsynctype == 21) ||
// (state->lastsynctype == 22) || (state->lastsynctype == 23))
//{
if ((state->lastsynctype == 20) || (state->lastsynctype == 21) ||
(state->lastsynctype == 22) || (state->lastsynctype == 23))
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf(state->ftype, " dPMR ");
sprintf(state->ftype, "dPMR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +dPMR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+dPMR ", synctest_pos + 1, modulation);
}
state->lastsynctype = 21;
return (21);
// TODO : Modif 2019-01-04
//}
//else
//{
// state->lastsynctype = 21;
//}
}
else
{
state->lastsynctype = 21;
}
}
}
else if(strcmp(synctest12, DPMR_FRAME_SYNC_3) == 0)
@ -668,17 +668,17 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
//fprintf(stderr, "DPMR_FRAME_SYNC_3\n"); // TODO : To be removed
//if ((state->lastsynctype == 20) || (state->lastsynctype == 21) ||
// (state->lastsynctype == 22) || (state->lastsynctype == 23))
//{
if ((state->lastsynctype == 20) || (state->lastsynctype == 21) ||
(state->lastsynctype == 22) || (state->lastsynctype == 23))
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf(state->ftype, " dPMR ");
sprintf(state->ftype, "dPMR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +dPMR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+dPMR ", synctest_pos + 1, modulation);
}
/* The next part of the superframe will normally be the first part */
@ -686,11 +686,11 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->lastsynctype = 22;
return (22);
//}
//else
//{
// state->lastsynctype = 22;
//}
}
else
{
state->lastsynctype = 22;
}
}
}
if(strcmp(synctest, DPMR_FRAME_SYNC_4) == 0)
@ -699,17 +699,17 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
//fprintf(stderr, "DPMR_FRAME_SYNC_4\n"); // TODO : To be removed
//if ((state->lastsynctype == 20) || (state->lastsynctype == 21) ||
// (state->lastsynctype == 22) || (state->lastsynctype == 23))
//{
if ((state->lastsynctype == 20) || (state->lastsynctype == 21) ||
(state->lastsynctype == 22) || (state->lastsynctype == 23))
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf(state->ftype, " dPMR ");
sprintf(state->ftype, "dPMR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +dPMR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+dPMR ", synctest_pos + 1, modulation);
}
/* The next part of the superframe will normally be the first part */
@ -717,11 +717,11 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->lastsynctype = 23;
return (23);
//}
//else
//{
// state->lastsynctype = 23;
//}
}
else
{
state->lastsynctype = 23;
}
}
}
else if(strcmp(synctest, INV_DPMR_FRAME_SYNC_1) == 0)
@ -729,25 +729,25 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
if (opts->inverted_dpmr)
{
//fprintf(stderr, "INV_DPMR_FRAME_SYNC_1\n"); // TODO : To be removed
//if ((state->lastsynctype == 24) || (state->lastsynctype == 25) ||
// (state->lastsynctype == 26) || (state->lastsynctype == 27))
//{
if ((state->lastsynctype == 24) || (state->lastsynctype == 25) ||
(state->lastsynctype == 26) || (state->lastsynctype == 27))
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf(state->ftype, " dPMR ");
sprintf(state->ftype, "dPMR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -dPMR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-dPMR ", synctest_pos + 1, modulation);
}
state->lastsynctype = 24;
return (24);
//}
//else
//{
// state->lastsynctype = 24;
//}
}
else
{
state->lastsynctype = 24;
}
}
}
else if(strcmp(synctest12, INV_DPMR_FRAME_SYNC_2) == 0)
@ -756,25 +756,25 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
//fprintf(stderr, "DPMR_FRAME_SYNC_2\n"); // TODO : To be removed
//if ((state->lastsynctype == 24) || (state->lastsynctype == 25) ||
// (state->lastsynctype == 26) || (state->lastsynctype == 27))
//{
if ((state->lastsynctype == 24) || (state->lastsynctype == 25) ||
(state->lastsynctype == 26) || (state->lastsynctype == 27))
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf(state->ftype, " dPMR ");
sprintf(state->ftype, "dPMR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -dPMR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-dPMR ", synctest_pos + 1, modulation);
}
state->lastsynctype = 25;
return (25);
//}
//else
//{
// state->lastsynctype = 25;
//}
}
else
{
state->lastsynctype = 25;
}
}
}
else if(strcmp(synctest12, INV_DPMR_FRAME_SYNC_3) == 0)
@ -783,25 +783,25 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
//fprintf(stderr, "INV_DPMR_FRAME_SYNC_3\n"); // TODO : To be removed
//if ((state->lastsynctype == 24) || (state->lastsynctype == 25) ||
// (state->lastsynctype == 26) || (state->lastsynctype == 27))
//{
if ((state->lastsynctype == 24) || (state->lastsynctype == 25) ||
(state->lastsynctype == 26) || (state->lastsynctype == 27))
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf(state->ftype, " dPMR ");
sprintf(state->ftype, "dPMR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -dPMR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-dPMR ", synctest_pos + 1, modulation);
}
state->lastsynctype = 26;
return (26);
//}
//else
//{
// state->lastsynctype = 26;
//}
}
else
{
state->lastsynctype = 26;
}
}
}
if(strcmp(synctest, INV_DPMR_FRAME_SYNC_4) == 0)
@ -810,25 +810,25 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
//fprintf(stderr, "INV_DPMR_FRAME_SYNC_4\n"); // TODO : To be removed
//if ((state->lastsynctype == 24) || (state->lastsynctype == 25) ||
// (state->lastsynctype == 26) || (state->lastsynctype == 27))
//{
if ((state->lastsynctype == 24) || (state->lastsynctype == 25) ||
(state->lastsynctype == 26) || (state->lastsynctype == 27))
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf(state->ftype, " dPMR ");
sprintf(state->ftype, "dPMR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -dPMR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-dPMR ", synctest_pos + 1, modulation);
}
state->lastsynctype = 27;
return (27);
//}
//else
//{
// state->lastsynctype = 27;
//}
}
else
{
state->lastsynctype = 27;
}
}
}
else
@ -1331,11 +1331,11 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, "ProVoice");
sprintf (state->ftype, "ProVoice ");
if (opts->errorbars == 1)
//if (opts->errorbars == 1 && (time(NULL) - now) > 2 )
{
printFrameSync (opts, state, " -ProVoice ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-ProVoice ", synctest_pos + 1, modulation);
}
state->lastsynctype = 14;
if (opts->use_ncurses_terminal == 1)
@ -1351,10 +1351,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, "ProVoice");
sprintf (state->ftype, "ProVoice ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -ProVoice ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-ProVoice ", synctest_pos + 1, modulation);
}
state->lastsynctype = 15;
if (opts->use_ncurses_terminal == 1)
@ -1384,11 +1384,11 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
if (state->samplesPerSymbol == 20)
{
//sprintf (state->ftype, " NXDN48 ");
sprintf (state->ftype, "NXDN48"); //get rid of spaces
sprintf (state->ftype, "NXDN48 "); //get rid of spaces
if (opts->errorbars == 1)
{
//printFrameSync (opts, state, " +NXDN48 ", synctest_pos + 1, modulation);
printFrameSync (opts, state, " +NXDN48", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+NXDN48 ", synctest_pos + 1, modulation);
}
}
else
@ -1427,7 +1427,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
if (state->samplesPerSymbol == 20)
{
//sprintf (state->ftype, " NXDN48 ");
sprintf (state->ftype, "NXDN48");
sprintf (state->ftype, "NXDN48 ");
if (opts->errorbars == 1)
{
//printFrameSync (opts, state, " -NXDN48 ", synctest_pos + 1, modulation);
@ -1436,10 +1436,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
}
else
{
sprintf (state->ftype, "NXDN96");
sprintf (state->ftype, "NXDN96 ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -NXDN96 ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-NXDN96 ", synctest_pos + 1, modulation);
}
}
state->lastsynctype = 9;
@ -1468,19 +1468,19 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
if (state->samplesPerSymbol == 20)
{
//sprintf (state->ftype, " NXDN48 ");
sprintf (state->ftype, "NXDN48");
sprintf (state->ftype, " NXDN48");
if (opts->errorbars == 1)
{
//printFrameSync (opts, state, " +NXDN48 ", synctest_pos + 1, modulation);
printFrameSync (opts, state, " +NXDN48", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+NXDN48 ", synctest_pos + 1, modulation);
}
}
else
{
sprintf (state->ftype, "NXDN96");
sprintf (state->ftype, "NXDN96 ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +NXDN96 ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+NXDN96 ", synctest_pos + 1, modulation);
}
}
state->lastsynctype = 16;
@ -1507,22 +1507,22 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
//sprintf (state->ftype, " NXDN ");
sprintf (state->ftype, "NXDN");
sprintf (state->ftype, "NXDN ");
if (state->samplesPerSymbol == 20)
{
sprintf (state->ftype, "NXDN48");
sprintf (state->ftype, "NXDN48 ");
//sprintf (state->ftype, "NXDN48");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -NXDN48 ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-NXDN48 ", synctest_pos + 1, modulation);
}
}
else
{
sprintf (state->ftype, "NXDN96");
sprintf (state->ftype, "NXDN96 ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -NXDN96 ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-NXDN96 ", synctest_pos + 1, modulation);
}
}
state->lastsynctype = 17;
@ -1549,10 +1549,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, "D-STAR");
sprintf (state->ftype, "D-STAR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +D-STAR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+D-STAR ", synctest_pos + 1, modulation);
}
state->lastsynctype = 6;
if (opts->use_ncurses_terminal == 1)
@ -1568,10 +1568,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, "D-STAR");
sprintf (state->ftype, "D-STAR ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -D-STAR ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-D-STAR ", synctest_pos + 1, modulation);
}
state->lastsynctype = 7;
if (opts->use_ncurses_terminal == 1)
@ -1587,10 +1587,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, "D-STAR_HD");
sprintf (state->ftype, "D-STAR_HD ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " +D-STAR_HD ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "+D-STAR_HD ", synctest_pos + 1, modulation);
}
state->lastsynctype = 18;
if (opts->use_ncurses_terminal == 1)
@ -1606,10 +1606,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, "D-STAR_HD");
sprintf (state->ftype, " D-STAR_HD");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, " -D-STAR_HD ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "-D-STAR_HD ", synctest_pos + 1, modulation);
}
state->lastsynctype = 19;
if (opts->use_ncurses_terminal == 1)
@ -1629,10 +1629,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + (lmax)) / 2;
state->min = ((state->min) + (lmin)) / 2;
sprintf (state->ftype, "(P25 Phase 1)");
sprintf (state->ftype, "(P25 Phase 1) ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, "(+P25p1) ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "(+P25p1) ", synctest_pos + 1, modulation);
}
state->lastsynctype = -1;
//do we want ncursesPrinter here??
@ -1648,10 +1648,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, "(P25 Phase 1)");
sprintf (state->ftype, "(P25 Phase 1) ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, "(-P25p1) ", synctest_pos + 1, modulation);
printFrameSync (opts, state, "(-P25p1) ", synctest_pos + 1, modulation);
}
state->lastsynctype = -1;
if (opts->use_ncurses_terminal == 1)
@ -1666,7 +1666,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, "(X2-TDMA) ");
sprintf (state->ftype, "(X2-TDMA) ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, "(-X2-TDMA) ", synctest_pos + 1, modulation);
@ -1702,10 +1702,10 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
sprintf (state->ftype, "(DMR)");
sprintf (state->ftype, "(DMR) ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, "(-DMR)", synctest_pos + 1, modulation);
printFrameSync (opts, state, "(-DMR) ", synctest_pos + 1, modulation);
}
state->lastsynctype = -1;
if (opts->use_ncurses_terminal == 1)
@ -1723,7 +1723,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
sprintf (state->ftype, "(DMR) ");
if (opts->errorbars == 1)
{
printFrameSync (opts, state, "(+DMR)", synctest_pos + 1, modulation);
printFrameSync (opts, state, "(+DMR) ", synctest_pos + 1, modulation);
}
state->lastsynctype = -1;
if (opts->use_ncurses_terminal == 1)

View File

@ -163,7 +163,7 @@ initOpts (dsd_opts * opts)
opts->serial_baud = 115200;
sprintf (opts->serial_dev, "/dev/ttyUSB0");
opts->resume = 0;
opts->frame_dstar = 0;
opts->frame_dstar = 1; //was disabled for some reason, make sure there are no false positives
opts->frame_x2tdma = 1;
opts->frame_p25p1 = 1;
opts->frame_nxdn48 = 0;
@ -193,16 +193,16 @@ initOpts (dsd_opts * opts)
opts->pulse_raw_rate_in = 48000;
opts->pulse_raw_rate_out = 48000; //doing tests with 2 channels at 24000 for 48000 audio default in pulse
opts->pulse_digi_rate_in = 48000;
opts->pulse_digi_rate_out = 24000; //need to copy this to rtl type in and change rate out to 8000
opts->pulse_digi_rate_out = 48000; //need to copy this to rtl type in and change rate out to 8000
opts->pulse_raw_in_channels = 1;
opts->pulse_raw_out_channels = 1;
opts->pulse_digi_in_channels = 1; //2
opts->pulse_digi_out_channels = 2; //2
//opts->output_name = "DSD-FME";
sprintf (opts->output_name, " ");
opts->pulse_digi_out_channels = 1; //2
sprintf (opts->output_name, "Auto Detect");
opts->pulse_flush = 1; //set 0 to flush, 1 for flushed
opts->use_ncurses_terminal = 0; //ncurses terminal disabled by default, call with -N
opts->payload = 0; //initialize with 0 so can pass == 0 arguments
opts->use_ncurses_terminal = 0;
opts->payload = 0;
opts->EncryptionMode = MODE_UNENCRYPTED;
opts->inverted_dpmr = 0;
@ -720,8 +720,8 @@ main (int argc, char **argv)
sscanf (optarg, "%d", &opts.verbose);
break;
case 'K':
sscanf (optarg, "%d", &state.K);
case 'K':
sscanf (optarg, "%lld", &state.K);
state.K = ( ((state.K & 0xFF0F) << 32 ) + (state.K << 16) + state.K );
break;

View File

@ -253,7 +253,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
if (opts->audio_in_type == 3)
{
printw ("| RTL2838 Device #[%d]", opts->rtl_dev_index);
printw ("| RTL2838UHIDIR Device #[%d]", opts->rtl_dev_index);
printw (" Gain [%i] dB -", opts->rtl_gain_value);
printw (" Squelch [%i]", opts->rtl_squelch_level);
printw (" VFO [%i] kHz\n", opts->rtl_bandwidth);
@ -409,8 +409,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
{
//printw("| TID:[%i] | RID:[%i] \n", tg, rd);
//printw("| NAC: [0x%X] \n", nc);
printw("| TID:[%08i] RID:[%08i] ", tg, rd);
printw("NAC: [0x%03X] \n", nc);
printw("| TID:[%8i] RID:[%8i] ", tg, rd);
printw("NAC: [0x%3X] \n", nc);
printw("| ALG: [0x%02X] ", state->payload_algid);
printw("KEY: [0x%04X] ", state->payload_keyid);
//printw("MFG: [0x%X] ", state->payload_mfid); //no way of knowing if this is accurate info yet
@ -429,7 +429,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
{
//printw ("| DCC: [%i] FID: [%02X]\n", dcc, state->dmr_fid);
//attron(COLOR_PAIR(3));
printw ("| DCC: [%02i] FID: [%02X] SOP: [%02X] ", dcc, state->dmr_fid, state->dmr_so);
printw ("| DCC: [%2i] FID: [%02X] SOP: [%02X] ", dcc, state->dmr_fid, state->dmr_so);
if(state->payload_mi == 0 && state->dmr_so & 0x40)
{
attron(COLOR_PAIR(5));
@ -441,7 +441,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if(state->payload_keyid > 0 && state->dmr_so & 0x40)
{
attron(COLOR_PAIR(5));
printw (" ALG: [0x%02X] KEY [0x%02X] MI 0x[%08X]", state->payload_algid, state->payload_keyid, state->payload_mi);
printw (" ALG: [0x%02X] KEY [0x%02X] MI [0x%08X]", state->payload_algid, state->payload_keyid, state->payload_mi);
//printw ("0x%X", state->payload_algid);
attroff(COLOR_PAIR(5));
attron(COLOR_PAIR(3));
@ -455,7 +455,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
printw("\n");
printw ("| TID: [%08i] RID: [%08i]", tg, rd);
printw ("| TID: [%8i] RID: [%8i]", tg, rd);
if(state->dmr_so & 0x80) //1000 0000
{
attron(COLOR_PAIR(2));
@ -510,8 +510,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (lls == 10 || lls == 11 ) //DMR Data Types
{
//printw ("| DCC: [%i]\n", dcc);
printw ("| DCC: [%02i] FID: [%02X] SOP: [%02X] \n", dcc, state->dmr_fid, state->dmr_so);
printw ("| TID: [%08i] RID: [%08i]", tg, rd);
printw ("| DCC: [%2i] FID: [%02X] SOP: [%02X] \n", dcc, state->dmr_fid, state->dmr_so);
printw ("| TID: [%8i] RID: [%8i]", tg, rd);
//does this need to be in DATA type?
/*
if(state->dmr_so & 0x80)
@ -598,23 +598,31 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw ("| #%d %s ", j, SyncTypes[call_matrix[9-j][0]]);
if (lls == 8 || lls == 9 || lls == 16 || lls == 17)
{
printw ("RAN [%02d] ", call_matrix[9-j][1]);
printw ("TG [%04d] ", call_matrix[9-j][4]);
printw ("RAN [%2d] ", call_matrix[9-j][1]);
printw ("TG [%4d] ", call_matrix[9-j][4]);
printw ("RID [%4d] ", call_matrix[9-j][2]);
}
if (lls == 0 || lls == 1 || lls == 12 || lls == 13 || lls == 10 || lls == 11 ) //P25 P1 and DMR
{
printw ("TID [%08d] ", call_matrix[9-j][1]);
printw ("TID [%8d] ", call_matrix[9-j][1]);
printw ("RID [%8d] ", call_matrix[9-j][2]);
}
if (lls == 20 || lls == 21 || lls == 22 || lls == 23 ||lls == 24 || lls == 25 || lls == 26 || lls == 27) //dPMR
{
printw ("TID [%8d] ", call_matrix[9-j][1]);
printw ("RID [%8d] ", call_matrix[9-j][2]);
printw ("DCC [%2d] ", call_matrix[9-j][4]);
}
printw ("RID [%08d] ", call_matrix[9-j][2]);
//printw ("RID [%08d] ", call_matrix[9-j][2]);
//printw ("S %d - ", call_matrix[j][3]);
if (call_matrix[9-j][0] == 0 || call_matrix[9-j][0] == 1) //P25P1 Voice
{
printw ("NAC [0x%03X] ", call_matrix[9-j][4]);
printw ("NAC [0x%3X] ", call_matrix[9-j][4]);
}
if (call_matrix[9-j][0] == 12 || call_matrix[9-j][0] == 13 || call_matrix[9-j][0] == 10 || call_matrix[9-j][0] == 11 ) //DMR Voice Types
{
printw ("DCC [%02d] ", call_matrix[9-j][4]);
printw ("DCC [%2d] ", call_matrix[9-j][4]);
}
printw ("%d secs ago\n", time(NULL) - call_matrix[9-j][5]);
}

View File

@ -65,6 +65,7 @@ void dstar_header_decode(int radioheaderbuffer[660]) {
radioheader[28], radioheader[29], radioheader[30], radioheader[31],
radioheader[32], radioheader[33], radioheader[34], radioheader[35],
radioheader[36], radioheader[37], radioheader[38]);
//FCSinheader = ((radioheader[39] << 8) | radioheader[40]) & 0xFFFF;
//FCScalculated = calc_fcs((unsigned char*) radioheader, 39);
//fprintf (stderr, "Check sum = %04X ", FCSinheader);

View File

@ -735,7 +735,7 @@ void NXDN_decode_VCALL(dsd_opts * opts, dsd_state * state, uint8_t * Message)
/* Print the "Call Type" */
//fprintf(stderr, "%s - ", NXDN_Call_Type_To_Str(CallType));
fprintf(stderr, "\n\t %s - ", NXDN_Call_Type_To_Str(CallType)); //line break 1 tab, 2 spaces start this string
fprintf(stderr, "\n %s - ", NXDN_Call_Type_To_Str(CallType)); //line break and 1 space
sprintf (state->nxdn_call_type, NXDN_Call_Type_To_Str(CallType)); //fix warning below
//warning: format not a string literal and no format arguments [-Wformat-security]

View File

@ -467,11 +467,11 @@ processHDU(dsd_opts* opts, dsd_state* state)
mihex3 = (unsigned long long int)ConvertBitIntoBytes(&mi[64], 8);
}
//if (opts->payload == 0)
//if (state->errs == 0 && algidhex != 0x80)
if (opts->payload == 1 && state->errs == 0)
{
//fprintf (stderr, "HDU ALG ID: 0x%X KEY ID: 0x%X MI: %s \n", algidhex, kidhex, mi);
fprintf (stderr, "HDU ALG ID: 0x%X KEY ID: 0x%X MI: 0x%08llX%08llX%02llX\n", algidhex, kidhex, mihex1, mihex2, mihex3);
//fprintf (stderr, " HDU ALG ID: 0x%X KEY ID: 0x%X MI: %s \n", algidhex, kidhex, mi);
fprintf (stderr, " HDU ALG ID: 0x%X KEY ID: 0x%X MI: 0x%08llX%08llX%02llX\n", algidhex, kidhex, mihex1, mihex2, mihex3);
}
if (opts->p25enc == 1 && opts->payload == 0)

View File

@ -375,11 +375,11 @@ processLDU2 (dsd_opts * opts, dsd_state * state)
mihex3 = (unsigned long long int)ConvertBitIntoBytes(&mi[64], 8);
}
//if (opts->payload == 0)
//if (state->errs == 0 && algidhex != 0x80)
if (opts->payload == 1 && state->errs == 0)
{
//fprintf (stderr, "LDU2 ALG ID: 0x%X KEY ID: 0x%X MI: %s \n", algidhex, kidhex, mi);
fprintf (stderr, "LDU2 ALG ID: 0x%X KEY ID: 0x%X MI: 0x%08llX%08llX%02llX\n", algidhex, kidhex, mihex1, mihex2, mihex3);
//fprintf (stderr, " LDU2 ALG ID: 0x%X KEY ID: 0x%X MI: %s \n", algidhex, kidhex, mi);
fprintf (stderr, " LDU2 ALG ID: 0x%X KEY ID: 0x%X MI: 0x%08llX%08llX%02llX\n", algidhex, kidhex, mihex1, mihex2, mihex3);
}
//if (opts->p25enc == 1 && opts->payload == 0)
if (opts->payload == 0)