diff --git a/include/dsd.h b/include/dsd.h index e7423e7..03f0eda 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -472,6 +472,10 @@ typedef struct unsigned int dmr_color_code; unsigned int nxdn_last_ran; unsigned int nxdn_last_rid; + unsigned int nxdn_last_tg; + unsigned int nxdn_cipher_type; + unsigned int nxdn_key; + char nxdn_call_type[1024]; //borrow from LEH NxdnSacchRawPart_t NxdnSacchRawPart[4]; NxdnFacch1RawPart_t NxdnFacch1RawPart[2]; diff --git a/include/nxdn_const.h b/include/nxdn_const.h index 9bfa907..8b34ccf 100644 --- a/include/nxdn_const.h +++ b/include/nxdn_const.h @@ -65,7 +65,7 @@ extern const int DSDNXDN_UDCH_m_PunctureList[58]; //NXDN_DCALL_REC_RESP = 0b001010, /* NXDN_DCALL_REC_REQ = NXDN_DCALL_REC_RESP */ #define NXDN_DCALL_ASSGN = 0b001110 #define NXDN_DCALL_ASSGN_DUP = 0b001101 -#define NXDN_IDLE = 0b010000 +#define NXDN_IDLE 0b010000 #define NXDN_DISC_REQ = 0b010001 /* NXDN_DISC_REQ = NXDN_DISC */ #define NXDN_DISC = 0b010001 /* NXDN_DISC_REQ = NXDN_DISC */ diff --git a/src/dsd_audio.c b/src/dsd_audio.c index 5b203bc..10b0e9b 100644 --- a/src/dsd_audio.c +++ b/src/dsd_audio.c @@ -430,7 +430,7 @@ playSynthesizedVoice (dsd_opts * opts, dsd_state * state) } - //two slot audio testing, still need to seperate channels first internally, but this will play them out on left and RIGHT + //two slot audio testing, still need to seperate channels first internally, but this will play them out of different streams /* if(state->currentslot == 0) { @@ -442,7 +442,7 @@ playSynthesizedVoice (dsd_opts * opts, dsd_state * state) //pa_simple_write(opts->pulse_raw_dev_out, (state->audio_out_buf_pR - state->audio_out_idxR), (state->audio_out_idxR * 2), NULL); //Yay! It works. } */ - + pa_simple_write(opts->pulse_digi_dev_out, (state->audio_out_buf_p - state->audio_out_idx), (state->audio_out_idx * 2), NULL); //Yay! It works. state->audio_out_idx = 0; } diff --git a/src/dsd_main.c b/src/dsd_main.c index 3f2c82f..45a4090 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -193,11 +193,11 @@ initOpts (dsd_opts * opts) opts->pulse_raw_rate_in = 48000; opts->pulse_raw_rate_out = 24000; //doing tests with 2 channels at 24000 for 48000 audio default in pulse opts->pulse_digi_rate_in = 48000; - opts->pulse_digi_rate_out = 48000; //need to copy this to rtl type in and change rate out to 8000 + opts->pulse_digi_rate_out = 24000; //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 = 2; opts->pulse_digi_in_channels = 1; //2 - opts->pulse_digi_out_channels = 1; //2 + opts->pulse_digi_out_channels = 2; //2 //opts->output_name = "DSD-FME"; sprintf (opts->output_name, " "); opts->pulse_flush = 1; //set 0 to flush, 1 for flushed @@ -312,6 +312,10 @@ initState (dsd_state * state) state->nxdn_last_ran = -1; state->nxdn_last_rid = 0; + state->nxdn_last_tg = 0; + state->nxdn_cipher_type = 0; + state->nxdn_key = 0; + sprintf (state->nxdn_call_type, " "); state->dpmr_color_code = -1; state->dpmr_caller_id = 0; @@ -1079,6 +1083,7 @@ main (int argc, char **argv) opts.playfiles = 1; opts.errorbars = 0; opts.datascope = 0; + sprintf (opts.output_name, "MBE Playback"); state.optind = optind; break; case 'l': diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index fb4904f..cd59917 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -188,7 +188,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) call_matrix[9][1] = rn; call_matrix[9][2] = src; call_matrix[9][3] = 0; - call_matrix[9][4] = 0; + call_matrix[9][4] = tg; call_matrix[9][5] = time(NULL); } @@ -295,6 +295,16 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) printw ("--Call Info-------------------------------------------------------------------\n"); + //NXDN Ciper Types + //switch(CipherType) + //{ + // case 0: Ptr = ""; break; /* Non-ciphered mode / clear call */ + // case 1: Ptr = "Scrambler"; break; + // case 2: Ptr = "DES"; break; + // case 3: Ptr = "AES"; break; + // default: Ptr = "Unknown Cipher Type"; break; + //} + if (state->lastsynctype != -1) //not sure if this will be okay { lls = state->lastsynctype; @@ -302,13 +312,15 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (state->nxdn_last_rid > 0 && state->nxdn_last_rid != src); { src = state->nxdn_last_rid; - //rn = state->nxdn_last_ran; } if (state->nxdn_last_ran > -1 && state->nxdn_last_ran != rn); { - //src = state->nxdn_last_rid; rn = state->nxdn_last_ran; } + if (state->nxdn_last_tg > 0 && state->nxdn_last_tg != tg); + { + tg = state->nxdn_last_tg; + } //if (state->dmr_color_code > 0 && (lls == 10 || lls == 11 || lls == 12 || lls == 13) ) //DMR, DCC only carried on Data? //if (state->color_code > -1 && (lls == 10 || lls == 11 || lls == 12 || lls == 13) ) //DMR, DCC only carried on Data? @@ -334,9 +346,50 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) //if (state->lastsynctype == 8 || state->lastsynctype == 9 || state->lastsynctype == 16 || state->lastsynctype == 17) //change this to NXDN syncs later on if (lls == 8 || lls == 9 || lls == 16 || lls == 17) { - //printw ("| RAN: [%02d] \n", state->nxdn_last_ran); - printw ("| RAN: [%02d] \n", rn); - printw ("| RID: [%d] \n", src); //maybe change to nxdn_last_rid + printw ("| RAN: [%02d] ", rn); + printw ("TID: [%d] ", tg); + //printw ("| RID: [%d] \n", src); + printw ("RID: [%d] \n| ALG: [0x%02X] KEY [0x%02X] ", src, state->nxdn_cipher_type, state->nxdn_key); + if (state->carrier == 1) + { + printw("%s ", state->nxdn_call_type); + //attron(COLOR_PAIR(4)); + //printw ("No Encryption "); + //attroff(COLOR_PAIR(4)); + //attron(COLOR_PAIR(3)); + } + if (state->nxdn_cipher_type == 0x1 && state->carrier == 1) + { + attron(COLOR_PAIR(2)); + printw ("Scrambler Encryption "); + attroff(COLOR_PAIR(2)); + attron(COLOR_PAIR(3)); + } + if (state->nxdn_cipher_type == 0x2 && state->carrier == 1) + { + attron(COLOR_PAIR(2)); + printw ("DES Encryption "); + attroff(COLOR_PAIR(2)); + attron(COLOR_PAIR(3)); + } + if (state->nxdn_cipher_type == 0x3 && state->carrier == 1) + { + attron(COLOR_PAIR(2)); + printw ("AES Encryption "); + attroff(COLOR_PAIR(2)); + attron(COLOR_PAIR(3)); + } + if (state->nxdn_cipher_type > 0x3 && state->carrier == 1) + { + attron(COLOR_PAIR(2)); + printw ("Unknown Encryption "); + attroff(COLOR_PAIR(2)); + attron(COLOR_PAIR(3)); + } + //printw("%s ", state->nxdn_call_type); + printw("\n"); + + } //printw ("Error?: [%i] [%i] \n", state->errs, state->errs2); //what are these? @@ -515,6 +568,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (lls == 8 || lls == 9 || lls == 16 || lls == 17) { printw ("RAN [%2d] ", call_matrix[9-j][1]); + printw ("TG [%d] ", call_matrix[9-j][4]); } if (lls == 0 || lls == 1 || lls == 12 || lls == 13 || lls == 10 || lls == 11 ) //P25 P1 and DMR { diff --git a/src/nxdn_lib.c b/src/nxdn_lib.c index c3cef9b..6ed5f45 100644 --- a/src/nxdn_lib.c +++ b/src/nxdn_lib.c @@ -574,6 +574,14 @@ void NXDN_Elements_Content_decode(dsd_opts * opts, dsd_state * state, /* Decode the right "Message Type" */ switch(MessageType) { + //Idle + case NXDN_IDLE: + { + //fprintf(stderr, "NXDN IDLE\n"); + sprintf (state->nxdn_call_type, "NXDN IDLE "); + } + break; + /* VCALL */ case NXDN_VCALL: { @@ -728,19 +736,32 @@ 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 + sprintf (state->nxdn_call_type, NXDN_Call_Type_To_Str(CallType)); + //state->nxdn_call_type = NXDN_Call_Type_To_Str(CallType); /* Print the "Voice Call Option" */ NXDN_Voice_Call_Option_To_Str(VoiceCallOption, DuplexMode, TransmissionMode); fprintf(stderr, "%s %s - ", DuplexMode, TransmissionMode); + state->nxdn_key = (KeyID & 0xFF); + state->nxdn_cipher_type = CipherType; /* Print the "Cipher Type" */ - if(CipherType != 0) fprintf(stderr, "%s - ", NXDN_Cipher_Type_To_Str(CipherType)); + if(CipherType != 0) + { + fprintf(stderr, "%s - ", NXDN_Cipher_Type_To_Str(CipherType)); + //state->nxdn_cipher_type = CipherType; + } /* Print the Key ID */ - if(CipherType != 0) fprintf(stderr, "Key ID %u - ", KeyID & 0xFF); + if(CipherType != 0) + { + fprintf(stderr, "Key ID %u - ", KeyID & 0xFF); + //state->nxdn_key = (KeyID & 0xFF); + } /* Print Source ID and Destination ID (Talk Group or Unit ID) */ fprintf(stderr, "Src=%u - Dst/TG=%u ", SourceUnitID & 0xFFFF, DestinationID & 0xFFFF); + state->nxdn_last_tg = (DestinationID & 0xFFFF); if(state->NxdnElementsContent.VCallCrcIsGood) {