diff --git a/include/dsd.h b/include/dsd.h index bbfff54..2f24a67 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -478,6 +478,7 @@ typedef struct int payload_lsfr; int payload_lsfrR; unsigned long long int K; + int M; unsigned int debug_audio_errors; unsigned int debug_audio_errorsR; @@ -541,6 +542,7 @@ typedef struct uint8_t dmr_12_rate_sf[2][60]; //going five frames deep by 12 bytes //[slot][value] uint8_t dmr_34_rate_sf[2][64]; //going four frames deep by 16 bytes //[slot][value] int dmr_stereo_payload[144]; //load up 144 dibit buffer for every single DMR TDMA frame + //uint8_t dmr_stereo_payload[144]; //load up 144 dibit buffer for every single DMR TDMA frame dPMRVoiceFS2Frame_t dPMRVoiceFS2Frame; diff --git a/src/dmr_bs.c b/src/dmr_bs.c index 493951c..b8a4ecc 100644 --- a/src/dmr_bs.c +++ b/src/dmr_bs.c @@ -46,10 +46,6 @@ void dmrBS (dsd_opts * opts, dsd_state * state) return curr; } - //Init the superframe buffers - //memset(&state->TS1SuperFrame, 0, sizeof(TimeSlotVoiceSuperFrame_t)); - //memset(&state->TS2SuperFrame, 0, sizeof(TimeSlotVoiceSuperFrame_t)); - //Init slot lights sprintf (state->slot1light, " slot1 "); sprintf (state->slot2light, " slot2 "); @@ -73,6 +69,8 @@ void dmrBS (dsd_opts * opts, dsd_state * state) dibit = getDibit(opts, state); cachdata[i] = dibit; state->dmr_stereo_payload[i] = dibit; + //fprintf (stderr, "D%X ", dibit); + //fprintf (stderr, "P%X ", state->dmr_stereo_payload[i]); if(i == 2) { state->currentslot = (1 & (dibit >> 1)); @@ -173,15 +171,6 @@ void dmrBS (dsd_opts * opts, dsd_state * state) } sync[24] = 0; - if (internalslot == 0 && vc1 == 6) - { - //fprintf (stderr, "\nVC6 Burst = %X\n", syncdata); - - } - if (internalslot == 1 && vc2 == 6) - { - //fprintf (stderr, "\nVC6 Burst = %X\n", syncdata); - } EmbeddedSignallingOk = -1; if(QR_16_7_6_decode(EmbeddedSignalling)) @@ -335,7 +324,7 @@ void dmrBS (dsd_opts * opts, dsd_state * state) fprintf(stderr, " BPK %lld", state->K); fprintf (stderr, "%s", KNRM); } - if (vc1 == 1 && state->payload_keyid != 0 && opts->payload == 1) + if (vc1 == 1 && state->payload_algid != 0 && opts->payload == 1) { LFSR(state); } @@ -350,7 +339,7 @@ void dmrBS (dsd_opts * opts, dsd_state * state) fprintf(stderr, " BPK %lld", state->K); fprintf (stderr, "%s", KNRM); } - if (vc1 == 1 && state->payload_keyid != 0 && opts->payload == 1) + if (vc1 == 1 && state->payload_algid != 0 && opts->payload == 1) { LFSR(state); } @@ -370,7 +359,7 @@ void dmrBS (dsd_opts * opts, dsd_state * state) fprintf(stderr, " BPK %lld", state->K); fprintf (stderr, "%s", KNRM); } - if (vc2 == 1 && state->payload_keyidR != 0 && opts->payload == 1) + if (vc2 == 1 && state->payload_algidR != 0 && opts->payload == 1) { LFSR(state); } @@ -385,7 +374,7 @@ void dmrBS (dsd_opts * opts, dsd_state * state) fprintf(stderr, " BPK %lld", state->K); fprintf (stderr, "%s", KNRM); } - if (vc2 == 1 && state->payload_keyidR != 0 && opts->payload == 1) + if (vc2 == 1 && state->payload_algidR != 0 && opts->payload == 1) { LFSR(state); } @@ -404,9 +393,100 @@ void dmrBS (dsd_opts * opts, dsd_state * state) ProcessVoiceBurstSync(opts, state); fprintf (stderr, "\n"); } + + //test printing ambe_fr values + /* + if (1 == 1) + { + fprintf (stderr, "\nAMBE_FR1 = "); + for (j = 0; j < 4; j++) + { + fprintf (stderr, " - "); + for (k = 0; k < 12;) + { + int b = 0; + int c = 0; + int d = 0; + int e = 0; + b = ambe_fr[j][k]; + c = ambe_fr[j][k+1]; + d = ambe_fr[j][k+2]; + e = ambe_fr[j][k+3]; + //fprintf (stderr, "%X", (((uint8_t)ambe_fr[k] << 2) + ambe_fr[k+1]) ); + fprintf (stderr, "%01X", ( (b << 3) + (c << 2) + (d << 1) + e ) ); + k = k + 4; + } + } + fprintf (stderr, "\nAMBE_FR2 = "); + for (j = 0; j < 4; j++) + { + fprintf (stderr, " - "); + for (k = 0; k < 12;) + { + int b = 0; + int c = 0; + int d = 0; + int e = 0; + b = ambe_fr2[j][k]; + c = ambe_fr2[j][k+1]; + d = ambe_fr2[j][k+2]; + e = ambe_fr2[j][k+3]; + //fprintf (stderr, "%X", (((uint8_t)ambe_fr[k] << 2) + ambe_fr[k+1]) ); + fprintf (stderr, "%01X", ( (b << 3) + (c << 2) + (d << 1) + e ) ); + k = k + 4; + } + } + fprintf (stderr, "\nAMBE_FR3 = "); + for (j = 0; j < 4; j++) + { + fprintf (stderr, " - "); + for (k = 0; k < 12;) + { + int b = 0; + int c = 0; + int d = 0; + int e = 0; + b = ambe_fr3[j][k]; + c = ambe_fr3[j][k+1]; + d = ambe_fr3[j][k+2]; + e = ambe_fr3[j][k+3]; + //fprintf (stderr, "%X", (((uint8_t)ambe_fr[k] << 2) + ambe_fr[k+1]) ); + fprintf (stderr, "%01X", ( (b << 3) + (c << 2) + (d << 1) + e ) ); + k = k + 4; + } + } + + fprintf (stderr, "\n"); + + } + */ + //end testing fr values processMbeFrame (opts, state, NULL, ambe_fr, NULL); processMbeFrame (opts, state, NULL, ambe_fr2, NULL); processMbeFrame (opts, state, NULL, ambe_fr3, NULL); + /* + if (internalslot == 0 ) //&& vc1 == 6 + { + fprintf (stderr, "\nVC%d Full = ", vc1); + for (k = 0; k < 144;) + { + fprintf (stderr, "%X", ((state->dmr_stereo_payload[k] << 2) + state->dmr_stereo_payload[k+1]) ); + k = k + 2; + } + fprintf (stderr, "\n"); + } + if (internalslot == 1 ) //&& vc2 == 6 + { + fprintf (stderr, "\nVC%d Full = ", vc2); + for (k = 0; k < 144;) + { + //fprintf (stderr, " L%X R%X ", state->dmr_stereo_payload[k], state->dmr_stereo_payload[k+1]); + fprintf (stderr, "%01X", ((state->dmr_stereo_payload[k] << 2) + state->dmr_stereo_payload[k+1]) ); + k = k + 2; + } + fprintf (stderr, "\n"); + } + */ if (internalslot == 0) { vc1++; diff --git a/src/dmr_ms.c b/src/dmr_ms.c index b4bb8ec..bdb5609 100644 --- a/src/dmr_ms.c +++ b/src/dmr_ms.c @@ -390,7 +390,7 @@ void dmrMS (dsd_opts * opts, dsd_state * state) fprintf(stderr, " BPK %lld", state->K); fprintf (stderr, "%s", KNRM); } - if (vc1 == 6 && state->payload_keyid != 0 && opts->payload == 1) + if (vc1 == 6 && state->payload_algid != 0 && opts->payload == 1) { LFSR(state); } @@ -406,7 +406,7 @@ void dmrMS (dsd_opts * opts, dsd_state * state) fprintf(stderr, " BPK %lld", state->K); fprintf (stderr, "%s", KNRM); } - if (vc1 == 6 && state->payload_keyid != 0 && opts->payload == 1) + if (vc1 == 6 && state->payload_algid != 0 && opts->payload == 1) { LFSR(state); } @@ -422,7 +422,7 @@ void dmrMS (dsd_opts * opts, dsd_state * state) fprintf(stderr, " BPK %lld", state->K); fprintf (stderr, "%s", KNRM); } - if (vc2 == 6 && state->payload_keyidR != 0 && opts->payload == 1) + if (vc2 == 6 && state->payload_algidR != 0 && opts->payload == 1) { LFSR(state); } @@ -437,7 +437,7 @@ void dmrMS (dsd_opts * opts, dsd_state * state) fprintf(stderr, " BPK %lld", state->K); fprintf (stderr, "%s", KNRM); } - if (vc2 == 6 && state->payload_keyidR != 0 && opts->payload == 1) + if (vc2 == 6 && state->payload_algidR != 0 && opts->payload == 1) { LFSR(state); } @@ -455,7 +455,7 @@ void dmrMS (dsd_opts * opts, dsd_state * state) //ProcessVoiceBurstSync(opts, state); //fprintf (stderr, "\n"); } - + state->dmr_ms_mode == 1; processMbeFrame (opts, state, NULL, ambe_fr, NULL); processMbeFrame (opts, state, NULL, ambe_fr2, NULL); processMbeFrame (opts, state, NULL, ambe_fr3, NULL); @@ -695,6 +695,7 @@ void dmrMSBootstrap (dsd_opts * opts, dsd_state * state) //reset drop values since we don't know which slot (because I'm too lazy to write that part) state->dropL = 256; state->dropR = 256; + state->dmr_ms_mode = 1; processMbeFrame (opts, state, NULL, ambe_fr, NULL); processMbeFrame (opts, state, NULL, ambe_fr2, NULL); processMbeFrame (opts, state, NULL, ambe_fr3, NULL); diff --git a/src/dmr_process_voice.c b/src/dmr_process_voice.c index 7af7e83..909f11d 100644 --- a/src/dmr_process_voice.c +++ b/src/dmr_process_voice.c @@ -76,6 +76,8 @@ int BP[256] = { 0x41F5, 0x5EF5, 0xA2F5, 0xBDF5, 0x64F6, 0x7BF6, 0x87F6, 0x98F6 //255 }; // +//H +// if (state->currentslot == 0 && state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) { fprintf (stderr, "%s", KYEL); @@ -83,7 +85,7 @@ if (state->currentslot == 0 && state->K > 0 && state->dmr_so & 0x40 && state->pa fprintf (stderr, "%s", KNRM); k = BP[state->K]; k = ( ((k & 0xFF0F) << 32 ) + (k << 16) + k ); - //fprintf (stderr, "\nK=0x%X\n", k); + for(Frame = 0; Frame < 6; Frame++) { for(i = 0; i < 3; i++) @@ -104,7 +106,7 @@ if (state->currentslot == 1 && state->K > 0 && state->dmr_soR & 0x40 && state->p fprintf (stderr, "%s", KNRM); k = BP[state->K]; k = ( ((k & 0xFF0F) << 32 ) + (k << 16) + k ); - //fprintf (stderr, "\nK=0x%X\n", k); + for(Frame = 0; Frame < 6; Frame++) { for(i = 0; i < 3; i++) @@ -122,7 +124,7 @@ if (state->currentslot == 1 && state->K > 0 && state->dmr_soR & 0x40 && state->p // if (state->currentslot == 0) { - if (opts->payload == 1) + if (opts->payload == 1 && state->R == 0) { fprintf(stderr, "\n"); //line break for AMBE printer } diff --git a/src/dmr_sync.c b/src/dmr_sync.c index 3cc9aa8..adbcd92 100644 --- a/src/dmr_sync.c +++ b/src/dmr_sync.c @@ -1549,27 +1549,27 @@ void ProcessCSBK(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_t //Hytera XPT if (csbk_o == 0x28) { - fprintf (stderr, "\nHytera TIII Announcement"); + //fprintf (stderr, "\nHytera TIII Announcement"); //sprintf(state->dmr_branding, " MotoTRBO Capacity Plus "); sprintf(state->dmr_branding, " TIII "); //?? one of these next two seems to be on both types, maybe its a TIII thing? } //if ( ((csbk_o << 8) + csbk_fid) == 0x3606 ) // if (csbk_o == 0x36) { - fprintf (stderr, "\nHytera XPT"); + //fprintf (stderr, "\nHytera XPT"); sprintf(state->dmr_branding, " Hytera XPT "); } if (csbk_o == 0x0A) { - fprintf (stderr, "\nHytera XPT Site State"); + //fprintf (stderr, "\nHytera XPT Site State"); sprintf(state->dmr_branding, " Hytera XPT "); } //if ( ((csbk_o << 8) + csbk_fid) == 0x3706 ) // if (csbk_o == 0x37) { - fprintf (stderr, "\nHytera XPT"); + //fprintf (stderr, "\nHytera XPT"); sprintf(state->dmr_branding, " Hytera XPT "); } @@ -1681,13 +1681,19 @@ void ProcessDmrPIHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], u state->payload_algid = DmrDataByte[0]; state->payload_keyid = DmrDataByte[2]; state->payload_mi = ( ((DmrDataByte[3]) << 24) + ((DmrDataByte[4]) << 16) + ((DmrDataByte[5]) << 8) + (DmrDataByte[6]) ); - if (1 == 1) //have it always print? + if (state->payload_algid < 0x26) //have it always print? only if a good value, was 1 == 1 { fprintf (stderr, "%s ", KYEL); fprintf (stderr, "\n Slot 1"); fprintf (stderr, " DMR PI Header ALG ID: 0x%02X KEY ID: 0x%02X MI: 0x%08X", state->payload_algid, state->payload_keyid, state->payload_mi); fprintf (stderr, "%s ", KNRM); } + if (state->payload_algid >= 0x26) //sanity check to make sure we aren't keeping bogus PI header info + { + state->payload_algid = 0; + state->payload_keyid = 0; + state->payload_mi = 0; + } } if (state->currentslot == 1) @@ -1695,13 +1701,19 @@ void ProcessDmrPIHeader(dsd_opts * opts, dsd_state * state, uint8_t info[196], u state->payload_algidR = DmrDataByte[0]; state->payload_keyidR = DmrDataByte[2]; state->payload_miR = ( ((DmrDataByte[3]) << 24) + ((DmrDataByte[4]) << 16) + ((DmrDataByte[5]) << 8) + (DmrDataByte[6]) ); - if (1 == 1) //have it always print? + if (state->payload_algidR < 0x26) //have it always print? only if a good value, was 1 == 1 { fprintf (stderr, "%s ", KYEL); fprintf (stderr, "\n Slot 2"); fprintf (stderr, " DMR PI Header ALG ID: 0x%02X KEY ID: 0x%02X MI: 0x%08X", state->payload_algidR, state->payload_keyidR, state->payload_miR); fprintf (stderr, "%s ", KNRM); } + if (state->payload_algidR >= 0x26) //sanity check to make sure we aren't keeping bogus PI header info + { + state->payload_algidR = 0; + state->payload_keyidR = 0; + state->payload_miR = 0; + } } @@ -2775,13 +2787,15 @@ uint8_t ComputeCrc5Bit(uint8_t * DMRData) * * @return A constant string pointer that explain the Alg ID used */ + /* uint8_t * DmrAlgIdToStr(uint8_t AlgID) { if(AlgID == 0x21) return (uint8_t *)"ARC4"; else if(AlgID == 0x25) return (uint8_t *)"AES256"; else return (uint8_t *)"UNKNOWN"; //state->payload_algid = AlgID; -} /* End DmrAlgIdToStr */ +} // End DmrAlgIdToStr +*/ /* * @brief : This function returns the encryption mode into an explicit string @@ -2798,6 +2812,7 @@ uint8_t * DmrAlgIdToStr(uint8_t AlgID) * * @return A constant string pointer that explain the encryption mode used */ + /* uint8_t * DmrAlgPrivacyModeToStr(uint32_t PrivacyMode) { switch(PrivacyMode) @@ -2842,8 +2857,8 @@ uint8_t * DmrAlgPrivacyModeToStr(uint32_t PrivacyMode) return (uint8_t *)"UNKNOWN"; break; } - } /* End switch(PrivacyMode) */ -} /* End DmrAlgPrivacyModeToStr() */ - + } // End switch(PrivacyMode) / +} //End DmrAlgPrivacyModeToStr() / +*/ /* End of file */ diff --git a/src/dmr_voice.c b/src/dmr_voice.c index 641fdb5..fb7385a 100644 --- a/src/dmr_voice.c +++ b/src/dmr_voice.c @@ -646,8 +646,8 @@ void processDMRvoice (dsd_opts * opts, dsd_state * state) ProcessDMR(opts, state); //LFSR if required, change condition? - if ( (state->currentslot == 0 && state->payload_keyid != 0 && opts->payload == 1) || - (state->currentslot == 1 && state->payload_keyidR != 0 && opts->payload == 1) ) + if ( (state->currentslot == 0 && state->payload_algid != 0 && opts->payload == 1) || + (state->currentslot == 1 && state->payload_algidR != 0 && opts->payload == 1) ) { LFSR(state); } diff --git a/src/dsd_main.c b/src/dsd_main.c index 64b3bc7..0498309 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -136,6 +136,21 @@ noCarrier (dsd_opts * opts, dsd_state * state) state->dropL = 256; //drop it like its hot state->dropR = 256; //drop it like its hot + //not sure if desirable here or not just yet, may need to disable a few of these + state->payload_mi = 0; + state->payload_miR = 0; + state->payload_mfid = 0; + state->payload_mfidR = 0; + state->payload_algid = 0; + state->payload_algidR = 0; + state->payload_keyid = 0; + state->payload_keyidR = 0; + //just for a test + if (state->M == 0) + { + state->K = 0; + } + } void @@ -232,6 +247,7 @@ initOpts (dsd_opts * opts) opts->audio_in_type = 0; //this was never initialized, causes issues on rPI 64 (bullseye) if not initialized opts->audio_out_type = 0; //this was never initialized, causes issues on rPI 64 (bullseye) if not initialized + } void @@ -366,8 +382,8 @@ initState (dsd_state * state) state->dpmr_caller_id = 0; state->dpmr_target_id = 0; - //state->payload_mi = 0; - //state->payload_miR = 0; + state->payload_mi = 0; + state->payload_miR = 0; state->payload_mfid = 0; state->payload_mfidR = 0; state->payload_algid = 0; @@ -402,7 +418,8 @@ initState (dsd_state * state) sprintf (state->dmr_lrrp[1][5], ""); state->K = 0; - state->R = 0; //make configurable later on? + state->R = 0; + state->M = 0; state->dmr_stereo = 0; state->dmrburstL = 17; //initialize at higher value than possible state->dmrburstR = 17; //17 in char array is set for ERR @@ -841,6 +858,7 @@ main (int argc, char **argv) case 'K': sscanf (optarg, "%lld", &state.K); + state.M = 1; if (state.K > 256) { state.K = 256; diff --git a/src/dsd_mbe.c b/src/dsd_mbe.c index 6e1edfa..16cc63b 100644 --- a/src/dsd_mbe.c +++ b/src/dsd_mbe.c @@ -117,8 +117,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a }; // - //comment out line below should return print back to normal - //strncpy (state->err_buf, state->err_str, sizeof(state->err_str)); //right at the very top before err_str gets returned? + int i; char imbe_d[88]; char ambe_d[49]; @@ -187,6 +186,9 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a state->errs2 = state->errs; mbe_demodulateAmbe3600x2450Data (ambe_fr); state->errs2 += mbe_eccAmbe3600x2450Data (ambe_fr, ambe_d); + // + //F + // if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) // { k = BP[state->K]; @@ -198,7 +200,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a } } // - //D + //D // mbe_processAmbe2450Dataf (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str, ambe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality); @@ -218,6 +220,9 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a state->errs2R = state->errsR; mbe_demodulateAmbe3600x2450Data (ambe_fr); state->errs2R += mbe_eccAmbe3600x2450Data (ambe_fr, ambe_d); + // + //G + // if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0) // { k = BP[state->K]; @@ -228,8 +233,8 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a ambe_d[j] ^= x; } } - // - //E + // + //E // mbe_processAmbe2450Dataf (state->audio_out_temp_bufR, &state->errsR, &state->errs2R, state->err_strR, ambe_d, state->cur_mp2, state->prev_mp2, state->prev_mp_enhanced2, opts->uvquality); diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index 6e8284d..9a997a4 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -627,7 +627,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) //printw ("| | "); //10 spaces printw ("| V XTRA | "); //10 spaces //Burger King - if(state->dmrburstL == 16 && state->payload_mi == 0 && (state->dmr_so & 0xCF) == 0x40) //4F or CF mask? + if(state->dmrburstL == 16 && state->payload_mi == 0 && (state->dmr_so & 0x4F) == 0x40) //4F or CF mask? & 0xCF currently { attron(COLOR_PAIR(5)); printw (" **BP** "); @@ -635,7 +635,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) attron(COLOR_PAIR(3)); } //Point - if(state->dmrburstL == 16 && state->payload_mi == 0 && state->K > 0 && (state->dmr_so & 0xCF) == 0x40) + if(state->dmrburstL == 16 && state->payload_mi == 0 && state->K > 0 && (state->dmr_so & 0x4F) == 0x40) { attron(COLOR_PAIR(1)); printw ("BPK [%3lld] ", state->K); @@ -643,7 +643,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) attron(COLOR_PAIR(3)); } //ALG, KeyID, MI - if(state->dmrburstL == 16 && state->payload_keyid > 0 && (state->dmr_so & 0xCF) == 0x40) + if(state->dmrburstL == 16 && state->payload_keyid > 0 && (state->dmr_so & 0x4F) == 0x40) { attron(COLOR_PAIR(1)); printw ("ALG: [0x%02X] KEY: [0x%02X] MI: [0x%08X]", state->payload_algid, state->payload_keyid, state->payload_mi); @@ -728,7 +728,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) printw ("| V XTRA | "); //10 spaces //Burger King 2 - if(state->dmrburstR == 16 && state->payload_miR == 0 && (state->dmr_soR & 0xCF) == 0x40) //4F or CF mask? + if(state->dmrburstR == 16 && state->payload_miR == 0 && (state->dmr_soR & 0x4F) == 0x40) //4F or CF mask? { attron(COLOR_PAIR(5)); printw (" **BP** "); @@ -736,7 +736,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) attron(COLOR_PAIR(3)); } //Point 2 - if(state->dmrburstR == 16 && state->payload_miR == 0 && state->K > 0 && (state->dmr_soR & 0xCF) == 0x40) + if(state->dmrburstR == 16 && state->payload_miR == 0 && state->K > 0 && (state->dmr_soR & 0x4F) == 0x40) { attron(COLOR_PAIR(1)); printw ("BPK [%3lld] ", state->K); diff --git a/src/nxdn_voice.c b/src/nxdn_voice.c index abe1c8f..9aa6fb2 100644 --- a/src/nxdn_voice.c +++ b/src/nxdn_voice.c @@ -143,9 +143,9 @@ void processNXDNVoice (dsd_opts * opts, dsd_state * state) y++; z++; } - if (opts->payload == 1) + if (opts->payload == 1 && opts->dmr_stereo == 1) { - //fprintf(stderr, "\n"); + fprintf(stderr, "\n"); } processMbeFrame (opts, state, NULL, ambe_fr, NULL); diff --git a/src/provoice.c b/src/provoice.c index 4c26850..9639ec8 100644 --- a/src/provoice.c +++ b/src/provoice.c @@ -4,23 +4,24 @@ void processProVoice (dsd_opts * opts, dsd_state * state) { - int i, j, dibit; - //char datestr[32]; + int i, j, dibit, k; + uint8_t lid[80]; + uint8_t lidbyte[10]; + uint8_t init[64]; + uint8_t initbyte[8]; char imbe7100_fr1[7][24]; char imbe7100_fr2[7][24]; const int *w, *x; - //struct tm timep; if (opts->errorbars == 1) { - //strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep); - //fprintf (stderr,"%s VOICE e:", datestr); - fprintf (stderr,"VOICE e:"); + fprintf (stderr,"VOICE "); } for (i = 0; i < 64; i++) { dibit = getDibit (opts, state); + init[i] = dibit; #ifdef PROVOICE_DUMP fprintf (stderr,"%i", dibit); #endif @@ -28,11 +29,29 @@ processProVoice (dsd_opts * opts, dsd_state * state) #ifdef PROVOICE_DUMP fprintf (stderr," "); #endif - + //init Bits (64)...MI? + if (opts->payload == 1) + { + k = 0; + //fprintf (stderr, "\nInit 64 "); + for(i = 0; i < 8; i++) + { + initbyte[i] = 0; + for (j = 0; j < 8; j++) + { + initbyte[i] = initbyte[i] << 1; + initbyte[i] = initbyte[i] | init[k]; + k++; + } + //fprintf (stderr, "%02X", initbyte[i]); + } + //fprintf (stderr, "\n"); + } // lid for (i = 0; i < 16; i++) { dibit = getDibit (opts, state); + lid[i] = dibit; #ifdef PROVOICE_DUMP fprintf (stderr,"%i", dibit); #endif @@ -44,6 +63,7 @@ processProVoice (dsd_opts * opts, dsd_state * state) for (i = 0; i < 64; i++) { dibit = getDibit (opts, state); + lid[i+16] = dibit; #ifdef PROVOICE_DUMP fprintf (stderr,"%i", dibit); #endif @@ -51,6 +71,25 @@ processProVoice (dsd_opts * opts, dsd_state * state) #ifdef PROVOICE_DUMP fprintf (stderr," "); #endif + //load lid (bits) into lidbyte + if (opts->payload == 1) + { + k = 0; + //fprintf (stderr, "LID "); + for(i = 0; i < 10; i++) + { + lidbyte[i] = 0; + for (j = 0; j < 8; j++) + { + lidbyte[i] = lidbyte[i] << 1; + lidbyte[i] = lidbyte[i] | lid[k]; + k++; + } + //fprintf (stderr, "%02X", lidbyte[i]); + } + //fprintf (stderr, "\n"); + } + // imbe frames 1,2 first half w = pW; @@ -282,7 +321,8 @@ processProVoice (dsd_opts * opts, dsd_state * state) for (i = 0; i < 16; i++) { - dibit = getDibit (opts, state); + dibit = getDibit (opts, state); //HERE + init[i] = dibit; //recycle #ifdef PROVOICE_DUMP fprintf (stderr,"%i", dibit); #endif @@ -290,7 +330,23 @@ processProVoice (dsd_opts * opts, dsd_state * state) #ifdef PROVOICE_DUMP fprintf (stderr," "); #endif - +if (opts->payload == 1) +{ + k = 0; + //fprintf (stderr, "16 bits? "); + for(i = 0; i < 2; i++) + { + initbyte[i] = 0; + for (j = 0; j < 8; j++) + { + initbyte[i] = initbyte[i] << 1; + initbyte[i] = initbyte[i] | init[k]; + k++; + } + //fprintf (stderr, "%02X", initbyte[i]); + } + //fprintf (stderr, "\n"); +} // imbe frames 3,4 first half w = pW; x = pX;