diff --git a/src/p25p2_frame.c b/src/p25p2_frame.c index 04461f9..c1a606c 100644 --- a/src/p25p2_frame.c +++ b/src/p25p2_frame.c @@ -798,10 +798,9 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state) fprintf (stderr,"%s ", getTime()); fprintf (stderr, " P25p2 "); - //print our VCH channel number, or print S for SACCH since its inverted - if (state->currentslot == 0 && duid_decoded != 3 && duid_decoded != 12) + if (state->currentslot == 0 && duid_decoded != 3 && duid_decoded != 12 && duid_decoded != 13 && duid_decoded != 4) { - fprintf (stderr, "VCH 0 "); + fprintf (stderr, "LCH 0 "); //open MBEout file - slot 1 - USE WITH CAUTION on Phase 2! Consider using a symbol capture bin instead! if (duid_decoded == 0 || duid_decoded == 6) //4V or 2V (voice) { @@ -809,9 +808,9 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state) if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL)) openMbeOutFile (opts, state); } } - else if (state->currentslot == 1 && duid_decoded != 3 && duid_decoded != 12) + else if (state->currentslot == 1 && duid_decoded != 3 && duid_decoded != 12 && duid_decoded != 13 && duid_decoded != 4) { - fprintf (stderr, "VCH 1 "); + fprintf (stderr, "LCH 1 "); //open MBEout file - slot 2 - USE WITH CAUTION on Phase 2! Consider using a symbol capture bin instead! if (duid_decoded == 0 || duid_decoded == 6) //4V or 2V (voice) { @@ -819,10 +818,21 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state) if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_fR == NULL)) openMbeOutFileR (opts, state); } } + //The LCCH may occupy LCH 0 or LCH 1 or both. BBAD 3.3 p8 + else if (duid_decoded == 13) //MAC_SIGNAL, or clear LCCH + { + // sacch = 1; //only an 'inverted' slot when its TS index 10 or 11 + fprintf (stderr, "LCCH "); + } + else if (duid_decoded == 4) //Scrambled LCCH (TDMA_CC only...look in the manual again) + { + // sacch = 1; //only an 'inverted' slot when its TS index 10 or 11 + fprintf (stderr, "LCCHs "); + } else { - sacch = 1; - fprintf (stderr, "VCH S "); + sacch = 1; //always an "inverted" sacch slot + fprintf (stderr, "SACCH "); } //check to see when last voice activity occurred in order to allow tuning on phase 2 @@ -891,7 +901,6 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state) } else if (duid_decoded == 4) { - fprintf (stderr, " LCCH Sc"); //w/ scrambling if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0 && state->p2_wacn != 0xFFFFF && state->p2_cc != 0xFFF && state->p2_sysid != 0xFFF) { @@ -932,13 +941,20 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state) //add 360 bits to each counter vc_counter = vc_counter + 360; - //WIP: revert from voice to !sacch -- voice was causing blip/stutter on single and dual voice (!sacch is still smoother playback) + //NOTE: Could be an issue if MAC_SIGNAL onn LCH 1 and voice in LCH 0? It might Stutter? if (sacch == 0 && ts_counter & 1 && opts->floating_point == 1 && opts->pulse_digi_rate_out == 8000) playSynthesizedVoiceFS4 (opts, state); if (sacch == 0 && ts_counter & 1 && opts->floating_point == 0 && opts->pulse_digi_rate_out == 8000) playSynthesizedVoiceSS4 (opts, state); + //debug: fix burst indicator for ncurses if marginal signal + // if (voice) + // { + // if (state->currentslot == 0) state->dmrburstL = 21; + // else state->dmrburstR = 21; + // } + //flip slots after each TS processed if (state->currentslot == 0) { diff --git a/src/p25p2_vpdu.c b/src/p25p2_vpdu.c index d20d374..25338d9 100644 --- a/src/p25p2_vpdu.c +++ b/src/p25p2_vpdu.c @@ -67,8 +67,13 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon //assigning here if OECI MAC SIGNAL, after passing RS and CRC if (state->p2_is_lcch == 1) { - if (slot == 1) state->dmrburstL = 30; - else state->dmrburstR = 30; + //fix for blinking SIGNAL on Slot 2 during inverted slot in Ncurses + //TEMP: assume LCH 0 is the SIGNAL slot, fix for blinking SIGNAL on Slot 2 during inverted slot + if (type == 0 && slot == 0) state->dmrburstL = 30; + if (type == 1 && slot == 0) state->dmrburstL = 30; + // if (type == 0 && slot == 1) state->dmrburstR = 30; + // if (type == 1 && slot == 1) state->dmrburstR = 30; + } @@ -1382,21 +1387,44 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon //TODO: Restructure this function to group standard Opcodes away from MFID 90 and MFID A4, and Unknown MFID //or just go to if-elseif-else layout (probably easier that way) - //Unknown Harris A4 Opcodes + //Harris A4 Opcodes if (MAC[1+len_a] != 0xB0 && MAC[2+len_a] == 0xA4) { // 6.2.36 Manufacturer Specific regarding octet 3 as len int len = MAC[3+len_a] & 0x3F; int res = MAC[3+len_a] >> 6; + int k = 0; + + //NOTE: slot is already checked + //sanity check that we don't exceed the max MAC array size if (len > 24) len = 24; //should never exceed this len, but just in case it does - //sanity check that we don't pick this up in a second message and exceed the MAC array - // if ( (len + len_a) > 24) len = 24-len_a; //not required, since we can only go to 24 anyways - //end sanity checks - fprintf (stderr, "\n MFID A4 (Harris); Res: %d; Len: %d; Opcode: %02llX; ", res, len, MAC[1+len_a]); - for (i = 1; i < len; i++) - fprintf (stderr, "%02llX", MAC[i+len_a]); + + //Harris "Talker" Alias -- Not always in the SACCH, has been seen in the FACCH as well (before MAC_PTT) + if (MAC[1+len_a] == 0xA8) //1010 1000 (so, its opcode is 0x28, with the b = 0b10 value for manufacturer message?) + { + fprintf (stderr, "\n MFID A4 (Harris); VCH %d Talker Alias: ", slot); + for (i = 4; i < len; i++) //this should be okay + { + if ( (MAC[i+len_a] > 0x19) && (MAC[i+len_a] < 0x7F) ) + fprintf (stderr, "%c", (char)MAC[i+len_a]); + else fprintf (stderr, " "); + + if ( (MAC[i+len_a] > 0x19) && (MAC[i+len_a] < 0x7F) ) + state->dmr_alias_block_segment[slot][0][k/4][k%4] = MAC[i+len_a]; + else state->dmr_alias_block_segment[slot][0][k/4][k%4] = 0x20; + k++; + } + } + + else + { + fprintf (stderr, "\n MFID A4 (Harris); Res: %d; Len: %d; Opcode: %02llX; ", res, len, MAC[1+len_a] & 0x3F); //first two bits are the b0 and b1 + for (i = 4; i < len; i++) + fprintf (stderr, "%02llX", MAC[i+len_a]); + } + } /* diff --git a/src/p25p2_xcch.c b/src/p25p2_xcch.c index daf60a6..7ff4fb5 100644 --- a/src/p25p2_xcch.c +++ b/src/p25p2_xcch.c @@ -260,10 +260,14 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180] } - //TEST: Return to CC on MAC_END_PTT if other slot is idle... - //NOTE: This may or may not work well, need to run some tests first - //I really need to look into what SUIDs do when there is a MAC_END_PTT - //do they linger momentarily, or immediately go back to the CC? + //Return to CC on MAC_END_PTT if other slot is idle + //TODO: Look at the source address of the END_PTT, if it is 0xFFFFFF, then its from the FNE? + //if from the FNE, that may be when we know channel teardown will really occur vs using MAC_END_PTT directly + + /* + Upon receipt of a MAC_END_PTT PDU on the assigned VCH, and having verified it contains the + correct color code, the SU shall return to the idle state on the control channel. + */ //NOTE: Disable return later on if not desirable to use @@ -603,6 +607,7 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156] state->aout_gainR = opts->audio_gain; } + //Return to CC on MAC_END_PTT if other slot is idle //NOTE: Disable return later on if not desirable to use //end_ptt in this slot, idle in the other slot (Normal Slots)