diff --git a/CMakeLists.txt b/CMakeLists.txt index bdd41b4..a1c7ca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,13 @@ if (COLORS) add_definitions(-DPRETTY_COLORS) endif () +#use cmake option -DPVC=ON to enable Provoice Conventional Frame Sync +option(PVC + "Build with Provoice Conventional Frame Sync Enabled" OFF) +if (PVC) + add_definitions(-DPVCONVENTIONAL) +endif () + #use cmake option -DNXDN=ON to enable new NXDN Sync Pattern Testing option(NXDN "Build with new NXDN Sync Pattern Testing Enabled" OFF) diff --git a/include/dsd.h b/include/dsd.h index ed3ef0f..c3c95b4 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -756,6 +756,26 @@ typedef struct #define INV_PROVOICE_EA_SYNC "13313133113113333311313133133311" #define PROVOICE_EA_SYNC "31131311331331111133131311311133" +//define the provoice conventional string pattern to default 85/85 if not enabled, else mute it so we won't double sync on accident in frame_sync +#ifdef PVCONVENTIONAL +#define PROVOICE_CONV "00000000000000000000000000000000" //all zeroes should be unobtainable string in the frame_sync synctests +#define INV_PROVOICE_CONV "00000000000000000000000000000000" //all zeroes should be unobtainable string in the frame_sync synctests +#else +#define PROVOICE_CONV "13131333111311311313131313131313" //TX 85 RX 85 (default programming value) +#define INV_PROVOICE_CONV "31313111333133133131313131313131" //TX 85 RX 85 (default programming value) +#endif +//we use the short sync instead of the default 85/85 wnen PVCONVENTIONAL is defined by cmake +#define PROVOICE_CONV_SHORT "1313133311131131" //16-bit short pattern, last 16-bits change based on TX an RX values +#define INV_PROVOICE_CONV_SHORT "3131311133313313" +//In this pattern (inverted polarity, the norm for PV) 3 is bit 0, and 1 is bit 1 (2 level GFSK) + //same pattern //TX //RX +// Sync Pattern = 3131311133313313 31331131 31331131 TX/RX 77 -- 31331131 symbol = 01001101 binary = 77 decimal +// Sync Pattern = 3131311133313313 33333333 33333333 TX/RX 0 -- 33333333 symbol = 00000000 binary = 0 decimal +// Sync Pattern = 3131311133313313 33333331 33333331 TX/RX 1 -- 33333331 symbol = 00000001 binary = 1 decimal +// Sync Pattern = 3131311133313313 13131133 13131133 TX/RX 172 -- 13131133 symbol = 10101100 binary = 172 decimal +// Sync Pattern = 3131311133313313 11333111 11333111 TX/RX 199 -- 11333111 symbol = 11000111 binary = 199 decimal +// Sync Pattern = 3131311133313313 31313131 31313131 TX/RX 85 -- 31313131 symbol = 01010101 binary = 85 decimal + #define EDACS_SYNC "313131313131313131313111333133133131313131313131" #define INV_EDACS_SYNC "131313131313131313131333111311311313131313131313" diff --git a/src/dsd_frame_sync.c b/src/dsd_frame_sync.c index 2af2591..64923c0 100644 --- a/src/dsd_frame_sync.c +++ b/src/dsd_frame_sync.c @@ -1454,6 +1454,94 @@ getFrameSync (dsd_opts * opts, dsd_state * state) } #endif //NXDN Sync Type Selection + + //Provoice Conventional -- Some False Positives due to shortened frame sync pattern, so use squelch if possible + #ifdef PVCONVENTIONAL + if (opts->frame_provoice == 1) + { + memset (synctest32, 0, sizeof(synctest32)); + strncpy (synctest32, (synctest_p - 31), 16); //short sync grab here on 32 + char pvc_txs[9]; //string (symbol) value of TX Address + char pvc_rxs[9]; //string (symbol) value of RX Address + uint8_t pvc_txa = 0; //actual value of TX Address + uint8_t pvc_rxa = 0; //actual value of RX Address + strncpy (pvc_txs, (synctest_p - 15), 8); //copy string value of TX Address + strncpy (pvc_rxs, (synctest_p - 7), 8); //copy string value of RX Address + if ((strcmp (synctest32, INV_PROVOICE_CONV_SHORT) == 0)) + { + if (state->lastsynctype == 15) //use this condition, like NXDN, to migitage false positives due to short sync pattern + { + state->carrier = 1; + state->offset = synctest_pos; + state->max = ((state->max) + lmax) / 2; + state->min = ((state->min) + lmin) / 2; + sprintf (state->ftype, "ProVoice "); + // fprintf (stderr, "Sync Pattern = %s ", synctest32); + // fprintf (stderr, "TX = %s ", pvc_txs); + // fprintf (stderr, "RX = %s ", pvc_rxs); + for (int i = 0; i < 8; i++) + { + pvc_txa = pvc_txa << 1; + pvc_rxa = pvc_rxa << 1; + //symbol 1 is binary 1 on inverted + //I hate working with strings, has to be a better way to evaluate this + memset (pvc_txs, 0, sizeof (pvc_txs)); + memset (pvc_rxs, 0, sizeof (pvc_rxs)); + strncpy (pvc_txs, (synctest_p - 15+i), 1); + strncpy (pvc_rxs, (synctest_p - 7+i), 1); + if ((strcmp (pvc_txs, "1") == 0)) + pvc_txa = pvc_txa + 1; + if ((strcmp (pvc_rxs, "1") == 0)) + pvc_rxa = pvc_rxa + 1; + } + printFrameSync (opts, state, "-PV_C ", synctest_pos + 1, modulation); + fprintf (stderr, "TX: %d ", pvc_txa); + fprintf (stderr, "RX: %d ", pvc_rxa); + if (pvc_txa == 172) fprintf (stderr, "ALL CALL "); + state->lastsynctype = 15; + return (15); + } + state->lastsynctype = 15; + } + else if ((strcmp (synctest32, PROVOICE_CONV_SHORT) == 0)) + { + if (state->lastsynctype == 14) //use this condition, like NXDN, to migitage false positives due to short sync pattern + { + state->carrier = 1; + state->offset = synctest_pos; + state->max = ((state->max) + lmax) / 2; + state->min = ((state->min) + lmin) / 2; + sprintf (state->ftype, "ProVoice "); + // fprintf (stderr, "Sync Pattern = %s ", synctest32); + // fprintf (stderr, "TX = %s ", pvc_txs); + // fprintf (stderr, "RX = %s ", pvc_rxs); + for (int i = 0; i < 8; i++) + { + pvc_txa = pvc_txa << 1; + pvc_rxa = pvc_rxa << 1; + //symbol 3 is binary 1 on positive + //I hate working with strings, has to be a better way to evaluate this + memset (pvc_txs, 0, sizeof (pvc_txs)); + memset (pvc_rxs, 0, sizeof (pvc_rxs)); + strncpy (pvc_txs, (synctest_p - 15+i), 1); + strncpy (pvc_rxs, (synctest_p - 7+i), 1); + if ((strcmp (pvc_txs, "3") == 0)) + pvc_txa = pvc_txa + 1; + if ((strcmp (pvc_rxs, "3") == 0)) + pvc_rxa = pvc_rxa + 1; + } + printFrameSync (opts, state, "+PV_C ", synctest_pos + 1, modulation); + fprintf (stderr, "TX: %d ", pvc_txa); + fprintf (stderr, "RX: %d ", pvc_rxa); + if (pvc_txa == 172) fprintf (stderr, "ALL CALL "); + state->lastsynctype = 14; + return (14); + } + state->lastsynctype = 14; + } + } + #endif //End Provoice Conventional + } // t >= 10 if (exitflag == 1) diff --git a/src/dsd_main.c b/src/dsd_main.c index e1edf36..e71af99 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -52,7 +52,7 @@ char * FM_banner[9] = { " ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ", " ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗", " ╚═════╝ ╚═════╝ ╚═════╝    ╚═╝ ╚═╝ ╚═╝╚══════╝", - " 'Aero' Edition v2.0.0-86-gfef36e3 Windows 32-bit " + " 'Aero' Edition v2.0.0-94-gd1e1572 Windows 32-bit " }; int comp (const void *a, const void *b) diff --git a/src/dsd_mbe.c b/src/dsd_mbe.c index c8f0098..0032604 100644 --- a/src/dsd_mbe.c +++ b/src/dsd_mbe.c @@ -218,17 +218,16 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a //state->errs2 = state->errs; mbe_demodulateImbe7100x4400Data (imbe7100_fr); state->errs2 = mbe_eccImbe7100x4400Data (imbe7100_fr, imbe_d); - mbe_convertImbe7100to7200(imbe_d); //needs extra conversion step apparently + if (opts->payload == 1) + { + PrintIMBEData (opts, state, imbe_d); + } + + mbe_convertImbe7100to7200(imbe_d); mbe_processImbe4400Dataf (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str, imbe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality); - //below line the old way of doing this - // mbe_processImbe7100x4400Framef (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str, imbe7100_fr, imbe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality); - if (opts->payload == 1) - { - PrintIMBEData (opts, state, imbe_d); - } if (opts->mbe_out_f != NULL) { saveImbe4400Data (opts, state, imbe_d); diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index 1b47626..2d45207 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -2073,7 +2073,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (opts->ncurses_compact == 1) { printw ("------------------------------------------------------------------------------\n"); - printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "v2.0.0-86-gfef36e3 Win32"); + printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "v2.0.0-94-gd1e1572 Win32"); } if (opts->ncurses_compact == 0) { @@ -2085,7 +2085,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (i == 2) printw (" 'q' to Quit "); if (i == 4) printw (" MBElib %s", versionstr); if (i == 5) printw (" %s ", "Aero Win32"); //printw (" %s \n", GIT_TAG); - if (i == 6) printw (" %s \n", "v2.0.0-86-gfef36e3"); //printw (" %s \n", GIT_TAG); + if (i == 6) printw (" %s \n", "v2.0.0-94-gd1e1572"); //printw (" %s \n", GIT_TAG); else printw ("\n"); } attroff(COLOR_PAIR(6)); //6 diff --git a/src/provoice.c b/src/provoice.c index 24fc26d..75539bd 100644 --- a/src/provoice.c +++ b/src/provoice.c @@ -1,584 +1,432 @@ #include "dsd.h" #include "provoice_const.h" -void -processProVoice (dsd_opts * opts, dsd_state * state) +// #define PVDEBUG + +void processProVoice (dsd_opts * opts, dsd_state * state) { - int i, j, dibit, k; - uint8_t lid[80]; - uint8_t lidbyte[10]; - uint8_t init[64]; - uint8_t initbyte[8]; + int i, j, dibit; char imbe7100_fr1[7][24]; char imbe7100_fr2[7][24]; const int *w, *x; + //raw bits storage for analysis + uint8_t raw_bits[800]; + memset (raw_bits, 0, sizeof(raw_bits)); + //raw bytes storage for analysis + uint8_t raw_bytes[100]; + memset (raw_bytes, 0, sizeof(raw_bytes)); + + unsigned long long int initial = 0; //initial 64-bits before the lid + uint16_t lid = 0; //lid value 16-bit + unsigned long long int secondary = 0; //secondary 64-bits after lid, before voice + + uint8_t spacer_bit[8]; //check this value to see if its a status thing (like P25 P1) + memset (spacer_bit, 0, sizeof (spacer_bit)); + uint8_t spacer = 0; + uint16_t bf = 0; //the 16-bit value in-between imbe 2 and imbe 3 that is usually 2175 + fprintf (stderr," VOICE"); - if (opts->p25_trunk == 1 && opts->p25_is_tuned == 1) + + //print group and source values if EA trunked + if (opts->p25_trunk == 1 && opts->p25_is_tuned == 1 && state->ea_mode == 1) { fprintf (stderr, "%s", KGRN); - fprintf (stderr, " Site [%02llX][%03lld] Group [%05d] Source [%08d] LCN[%02d] ", - state->edacs_site_id, state->edacs_site_id, state->lasttg, state->lastsrc, state->edacs_tuned_lcn); + fprintf (stderr, " Site: %lld Group: %d Source: %d LCN: %d ", + state->edacs_site_id, state->lasttg, state->lastsrc, state->edacs_tuned_lcn); + fprintf (stderr, "%s", KNRM); + } + //print afs value if standard/networked trunked + else if (opts->p25_trunk == 1 && opts->p25_is_tuned == 1 && state->ea_mode == 0) + { + fprintf (stderr, "%s", KGRN); + fprintf (stderr, " Site: %lld AFS: %d-%d LCN: %d ", + state->edacs_site_id, (state->lasttg >> 7) & 0xF, state->lasttg & 0x7F, state->edacs_tuned_lcn); fprintf (stderr, "%s", KNRM); } - for (i = 0; i < 64; i++) - { - dibit = getDibit (opts, state); - init[i] = dibit; -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - } -#ifdef PROVOICE_DUMP - fprintf (stderr," "); -#endif - //iNitial 64 bits + //load all initial bits before voice into raw_bits array for analysis/handling + for (i = 0; i < 64+16+64; i++) + raw_bits[i] = getDibit (opts, state); + + //Note: the initial 144-bits seem to be provisioned differently depending on system type + initial = (unsigned long long int)ConvertBitIntoBytes(&raw_bits[0], 64); + lid = (uint16_t)ConvertBitIntoBytes(&raw_bits[64], 16); + secondary = (unsigned long long int)ConvertBitIntoBytes(&raw_bits[80], 64); if (opts->payload == 1) { - k = 0; - fprintf (stderr, "\n N64: "); - 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]); - if (i == 3) fprintf (stderr, "-"); - } - fprintf (stderr, "\n"); + fprintf (stderr, "\n N64: %016llX", initial); + fprintf (stderr, "\n LID: %04X", lid); + fprintf (stderr, " %016llX", secondary); } - // lid - for (i = 0; i < 16; i++) - { - dibit = getDibit (opts, state); - lid[i] = dibit; -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - } -#ifdef PROVOICE_DUMP - fprintf (stderr," "); -#endif - - for (i = 0; i < 64; i++) - { - dibit = getDibit (opts, state); - lid[i+16] = dibit; -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - } -#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]); - if (i == 3 || i == 7) fprintf (stderr, "-"); - } - // fprintf (stderr, "\n"); - } - // imbe frames 1,2 first half w = pW; x = pX; for (i = 0; i < 11; i++) - { - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr1[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - //fprintf (stderr,"_"); -#endif - w -= 6; - x -= 6; - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif - } - - for (j = 0; j < 6; j++) + { + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif imbe7100_fr1[*w][*x] = dibit; w++; x++; + raw_bits[144+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif + + w -= 6; + x -= 6; + for (j = 0; j < 6; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[150+j+(i*12)] = dibit; + } + + } + + for (j = 0; j < 6; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr1[*w][*x] = dibit; + w++; + x++; + raw_bits[j+282] = dibit; + } + w -= 6; x -= 6; for (j = 0; j < 4; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr," "); -#endif + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[j+288] = dibit; + } // spacer bits dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif + spacer_bit[0] = dibit; + raw_bits[292] = dibit; + dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); - fprintf (stderr," "); -#endif + spacer_bit[1] = dibit; + raw_bits[293] = dibit; // imbe frames 1,2 second half - for (j = 0; j < 2; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[j+294] = dibit; + } for (i = 0; i < 3; i++) - { - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr1[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif - w -= 6; - x -= 6; - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif - } - - for (j = 0; j < 5; j++) + { + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif imbe7100_fr1[*w][*x] = dibit; w++; x++; + raw_bits[296+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif - w -= 5; - x -= 5; - for (j = 0; j < 5; j++) + w -= 6; + x -= 6; + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif imbe7100_fr2[*w][*x] = dibit; w++; x++; + raw_bits[302+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif + } + + for (j = 0; j < 5; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr1[*w][*x] = dibit; + w++; + x++; + raw_bits[j+338] = dibit; + } + + w -= 5; + x -= 5; + for (j = 0; j < 5; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[j+343] = dibit; + } for (i = 0; i < 7; i++) - { - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr1[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif - w -= 6; - x -= 6; - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif - } - - for (j = 0; j < 5; j++) + { + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif imbe7100_fr1[*w][*x] = dibit; w++; x++; + raw_bits[348+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif - w -= 5; - x -= 5; - for (j = 0; j < 5; j++) + + w -= 6; + x -= 6; + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif imbe7100_fr2[*w][*x] = dibit; w++; x++; + raw_bits[354+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - fprintf (stderr," "); -#endif + + } + + for (j = 0; j < 5; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr1[*w][*x] = dibit; + w++; + x++; + raw_bits[j+438] = dibit; + } + w -= 5; + x -= 5; + + for (j = 0; j < 5; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[j+443] = dibit; + } processMbeFrame (opts, state, NULL, NULL, imbe7100_fr1); processMbeFrame (opts, state, NULL, NULL, imbe7100_fr2); // spacer bits dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif + spacer_bit[2] = dibit; + raw_bits[448] = dibit; + dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); - fprintf (stderr," "); -#endif + spacer_bit[3] = dibit; + raw_bits[449] = dibit; + + //resume raw_bits at +6 current value to round out payload bytes + //easier to visualize patterns for (i = 0; i < 16; i++) - { - dibit = getDibit (opts, state); //HERE - init[i] = dibit; //recycle -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - } -#ifdef PROVOICE_DUMP - fprintf (stderr," "); -#endif -if (opts->payload == 1) -{ - k = 0; - fprintf (stderr, "\n 16B: "); - 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"); -} + raw_bits[i+450+6] = getDibit (opts, state); + + bf = (uint16_t)ConvertBitIntoBytes(&raw_bits[456], 16); + + if (opts->payload == 1) + fprintf (stderr, "\n BF: %04X ", bf); + // imbe frames 3,4 first half w = pW; x = pX; for (i = 0; i < 11; i++) - { - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr1[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif - w -= 6; - x -= 6; - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif - } - for (j = 0; j < 6; j++) + { + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif imbe7100_fr1[*w][*x] = dibit; w++; x++; + raw_bits[6+466+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - fprintf (stderr,"_"); -#endif + + w -= 6; + x -= 6; + for (j = 0; j < 6; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[6+472+j+(i*12)] = dibit; + } + } + + for (j = 0; j < 6; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr1[*w][*x] = dibit; + w++; + x++; + raw_bits[j+604+6] = dibit; + } + w -= 6; x -= 6; for (j = 0; j < 4; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - fprintf (stderr," "); -#endif + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[i+610+6] = dibit; + } // spacer bits dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif + spacer_bit[4]; + raw_bits[614+2] = dibit; + dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); - //fprintf (stderr,"_"); -#endif + spacer_bit[5]; + raw_bits[615+2] = dibit; // imbe frames 3,4 second half for (j = 0; j < 2; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - //fprintf (stderr,"_"); -#endif + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[j+616+6] = dibit; + } for (i = 0; i < 3; i++) - { - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr1[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - //fprintf (stderr,"_"); -#endif - w -= 6; - x -= 6; - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - //fprintf (stderr,"_"); -#endif - } - - for (j = 0; j < 5; j++) + { + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif imbe7100_fr1[*w][*x] = dibit; w++; x++; + raw_bits[6+618+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - //fprintf (stderr,"_"); -#endif - w -= 5; - x -= 5; - for (j = 0; j < 5; j++) + w -= 6; + x -= 6; + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif imbe7100_fr2[*w][*x] = dibit; w++; x++; + raw_bits[6+624+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - //fprintf (stderr," "); -#endif + } + + for (j = 0; j < 5; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr1[*w][*x] = dibit; + w++; + x++; + raw_bits[j+660+6] = dibit; + } + w -= 5; + x -= 5; + for (j = 0; j < 5; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[j+665+6] = dibit; + } for (i = 0; i < 7; i++) - { - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr1[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - //fprintf (stderr,"_"); -#endif - w -= 6; - x -= 6; - for (j = 0; j < 6; j++) - { - dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif - imbe7100_fr2[*w][*x] = dibit; - w++; - x++; - } -#ifdef PROVOICE_DUMP - //fprintf (stderr,"_"); -#endif - } - - for (j = 0; j < 5; j++) + { + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif imbe7100_fr1[*w][*x] = dibit; w++; x++; + raw_bits[6+670+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - //fprintf (stderr,"_"); -#endif - w -= 5; - x -= 5; - for (j = 0; j < 5; j++) + w -= 6; + x -= 6; + for (j = 0; j < 6; j++) { dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif imbe7100_fr2[*w][*x] = dibit; w++; x++; + raw_bits[6+676+j+(i*12)] = dibit; } -#ifdef PROVOICE_DUMP - //fprintf (stderr," "); -#endif + } + + for (j = 0; j < 5; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr1[*w][*x] = dibit; + w++; + x++; + raw_bits[j+760+6] = dibit; + } + + w -= 5; + x -= 5; + for (j = 0; j < 5; j++) + { + dibit = getDibit (opts, state); + imbe7100_fr2[*w][*x] = dibit; + w++; + x++; + raw_bits[j+765+6] = dibit; + } processMbeFrame (opts, state, NULL, NULL, imbe7100_fr1); processMbeFrame (opts, state, NULL, NULL, imbe7100_fr2); // spacer bits dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); -#endif + spacer_bit[6] = dibit; + raw_bits[782] = dibit; + dibit = getDibit (opts, state); -#ifdef PROVOICE_DUMP - //fprintf (stderr,"%i", dibit); - //fprintf (stderr," "); + spacer_bit[7] = dibit; + raw_bits[783] = dibit; + +#ifdef PVDEBUG + + spacer = (uint8_t)ConvertBitIntoBytes(&spacer_bit[0], 8); + if (opts->payload == 1) + fprintf (stderr, "\n SP: %X", spacer); + + //convert raw bits into raw bytes for payload analysis + for (j = 0; j < 98; j++) + { + raw_bytes[j] = (uint8_t)ConvertBitIntoBytes(&raw_bits[(j*8)], 8); + } + + //payload on all raw bytes for analysis...its a lot of 'em + if (opts->payload == 1) //find better thingy later or change this + // if (opcode != 0x3333) + { + fprintf (stderr, "%s", KCYN); + fprintf (stderr, "\n pV Payload Dump: \n "); + for (j = 0; j < 98; j++) + { + fprintf (stderr, "[%02X]", raw_bytes[j]); + if (j == 17 || j == 35 || j == 53 || j == 71 || j == 89) + { + fprintf (stderr, "\n "); + } + } + fprintf (stderr, "%s", KNRM); + } + #endif - if (opts->errorbars == 1) - { - fprintf (stderr,"\n"); - } + //line break at end of frame + fprintf (stderr,"\n"); + }