User Configurable TCP Audio and SetMod BW;
This commit is contained in:
parent
68bbea64d5
commit
896f3a8533
|
|
@ -308,7 +308,7 @@ typedef struct
|
|||
//tcp socket for SDR++, etc
|
||||
int tcp_sockfd;
|
||||
int tcp_portno;
|
||||
char * tcp_hostname;
|
||||
char tcp_hostname[1024];
|
||||
SNDFILE *tcp_file_in;
|
||||
|
||||
//wav file sample rate, interpolator and decimator
|
||||
|
|
@ -329,6 +329,9 @@ typedef struct
|
|||
//reverse mute
|
||||
uint8_t reverse_mute;
|
||||
|
||||
//setmod bandwidth
|
||||
int setmod_bw;
|
||||
|
||||
} dsd_opts;
|
||||
|
||||
typedef struct
|
||||
|
|
|
|||
|
|
@ -170,8 +170,8 @@ void dmr_cspdu (dsd_opts * opts, dsd_state * state, uint8_t cs_pdu_bits[], uint8
|
|||
//RIGCTL
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500); //bw depends on system strength more than anything, 12.5 should be safe for DMR
|
||||
SetFreq(opts->rigctl_sockfd, freq); //minus one because our index starts at zero
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, freq);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = freq;
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
}
|
||||
|
|
@ -495,8 +495,8 @@ void dmr_cspdu (dsd_opts * opts, dsd_state * state, uint8_t cs_pdu_bits[], uint8
|
|||
//RIGCTL
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500); //bw depends on system strength more than anything, 12.5 should be safe for DMR
|
||||
SetFreq(opts->rigctl_sockfd, state->trunk_chan_map[j+1]); //minus one because our index starts at zero
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, state->trunk_chan_map[j+1]);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = state->trunk_chan_map[j+1];
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
j = 11; //break loop
|
||||
|
|
@ -594,8 +594,8 @@ void dmr_cspdu (dsd_opts * opts, dsd_state * state, uint8_t cs_pdu_bits[], uint8
|
|||
//RIGCTL
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500); //bw depends on system strength more than anything, 12.5 should be safe for DMR
|
||||
SetFreq(opts->rigctl_sockfd, state->trunk_chan_map[lcn]); //minus one because our index starts at zero
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, state->trunk_chan_map[lcn]);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = state->trunk_chan_map[lcn];
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,9 +173,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
//may or may not use setmod here, let user control it instead?
|
||||
if (opts->frame_nxdn48 == 1) SetModulation(opts->rigctl_sockfd, 6250);
|
||||
else SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, state->trunk_lcn_freq[state->lcn_freq_roll]);
|
||||
}
|
||||
//rtludp
|
||||
|
|
|
|||
|
|
@ -94,9 +94,7 @@ noCarrier (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
if (opts->use_rigctl == 1) //rigctl tuning
|
||||
{
|
||||
//may or may not use setmod here, let user control it instead?
|
||||
if (opts->frame_nxdn48 == 1) SetModulation(opts->rigctl_sockfd, 6250);
|
||||
else SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, state->p25_cc_freq);
|
||||
state->dmr_rest_channel = -1; //maybe?
|
||||
}
|
||||
|
|
@ -469,7 +467,7 @@ initOpts (dsd_opts * opts)
|
|||
//tcp input options
|
||||
opts->tcp_sockfd = 0;
|
||||
opts->tcp_portno = 7355; //default favored by SDR++
|
||||
opts->tcp_hostname = "localhost";
|
||||
sprintf (opts->tcp_hostname, "%s", "localhost");
|
||||
|
||||
opts->p25_trunk = 0; //0 disabled, 1 is enabled
|
||||
opts->p25_is_tuned = 0; //set to 1 if currently on VC, set back to 0 on carrier drop
|
||||
|
|
@ -478,6 +476,9 @@ initOpts (dsd_opts * opts)
|
|||
//reverse mute
|
||||
opts->reverse_mute = 0;
|
||||
|
||||
//setmod bandwidth
|
||||
opts->setmod_bw = 0; //default to 0 - off
|
||||
|
||||
} //initopts
|
||||
|
||||
void
|
||||
|
|
@ -820,6 +821,7 @@ usage ()
|
|||
printf (" -i <device> Audio input device (default is pulse audio)\n");
|
||||
printf (" - for piped stdin, rtl for rtl device\n");
|
||||
printf (" tcp for tcp client SDR++/GNURadio Companion/Other (Port 7355)\n");
|
||||
printf (" tcp:192.168.7.5:7355 for custom address and port \n");
|
||||
printf (" filename.bin for OP25/FME capture bin files\n");
|
||||
printf (" filename.wav for 48K/1 wav files (SDR++, GQRX)\n");
|
||||
printf (" filename.wav -s 96000 for 96K/1 wav files (DSDPlus)\n");
|
||||
|
|
@ -919,7 +921,8 @@ usage ()
|
|||
printf (" -5 <udp p> Enable RIGCTL/TCP; Set UDP Port for RIGCTL. (4532 on SDR++)\n");
|
||||
printf (" -6 <secs> Set Trunking VC/sync loss hangtime in seconds. (default = 1 second)\n");
|
||||
printf (" -8 Reverse Mute - Mute Unencrypted Voice Channels\n");
|
||||
//printf (" (Currently only available on UDP port 4532)\n");
|
||||
printf (" -9 <Hertz> Set RIGCTL Setmod Bandwidth in Hertz (0 - default - OFF)\n");
|
||||
printf (" P25 - 7000; NXDN48 - 4000; DMR - 12500; EDACS/PV - 12500; May vary based on system stregnth, etc.\n");
|
||||
printf ("\n");
|
||||
exit (0);
|
||||
}
|
||||
|
|
@ -1127,7 +1130,7 @@ main (int argc, char **argv)
|
|||
exitflag = 0;
|
||||
signal (SIGINT, sigfun);
|
||||
|
||||
while ((c = getopt (argc, argv, "haep:P:qs:tv:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:V:U:Y:K:H:X:NQWrlZTF1:2:345:6:7:8")) != -1)
|
||||
while ((c = getopt (argc, argv, "haep:P:qs:tv:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:V:U:Y:K:H:X:NQWrlZTF1:2:345:6:7:89:")) != -1)
|
||||
{
|
||||
opterr = 0;
|
||||
switch (c)
|
||||
|
|
@ -1178,6 +1181,11 @@ main (int argc, char **argv)
|
|||
opts.reverse_mute = 1;
|
||||
fprintf (stderr, "Reverse Mute\n");
|
||||
break;
|
||||
//placeholder until letters get re-arranged
|
||||
case '9': //rigctl setmod bandwidth;
|
||||
sscanf (optarg, "%d", &opts.setmod_bw);
|
||||
if (opts.setmod_bw > 25000) opts.setmod_bw = 25000; //not too high
|
||||
break;
|
||||
case 'e':
|
||||
opts.errorbars = 1;
|
||||
opts.datascope = 0;
|
||||
|
|
@ -1546,6 +1554,7 @@ main (int argc, char **argv)
|
|||
opts.dmr_mono = 0;
|
||||
opts.pulse_digi_rate_out = 8000;
|
||||
opts.pulse_digi_out_channels = 1;
|
||||
// opts.setmod_bw = 7000;
|
||||
sprintf (opts.output_name, "P25P1");
|
||||
fprintf (stderr,"Decoding only P25 Phase 1 frames.\n");
|
||||
}
|
||||
|
|
@ -1572,6 +1581,7 @@ main (int argc, char **argv)
|
|||
opts.dmr_stereo = 0;
|
||||
state.dmr_stereo = 0;
|
||||
opts.dmr_mono = 0;
|
||||
// opts.setmod_bw = 4000;
|
||||
sprintf (opts.output_name, "NXDN48");
|
||||
fprintf (stderr,"Setting symbol rate to 2400 / second\n");
|
||||
fprintf (stderr,"Decoding only NXDN 4800 baud frames.\n");
|
||||
|
|
@ -1625,6 +1635,7 @@ main (int argc, char **argv)
|
|||
opts.dmr_stereo = 1;
|
||||
state.dmr_stereo = 0;
|
||||
opts.dmr_mono = 0;
|
||||
// opts.setmod_bw = 7000;
|
||||
sprintf (opts.output_name, "P25P2");
|
||||
fprintf (stderr,"Decoding P25-P2 frames C4FM or OP25 Symbol Captures!\n");
|
||||
}
|
||||
|
|
@ -1699,6 +1710,7 @@ main (int argc, char **argv)
|
|||
opts.dmr_stereo = 0;
|
||||
opts.dmr_mono = 0;
|
||||
state.dmr_stereo = 0;
|
||||
// opts.setmod_bw = 7000;
|
||||
sprintf (opts.output_name, "NXDN96");
|
||||
fprintf (stderr,"Decoding only NXDN 9600 baud frames.\n");
|
||||
}
|
||||
|
|
@ -1915,6 +1927,22 @@ main (int argc, char **argv)
|
|||
{
|
||||
//use same handling as connect function from rigctl
|
||||
//also still needs err handling
|
||||
fprintf (stderr, "TCP Direct Link: ");
|
||||
char * curr;
|
||||
|
||||
curr = strtok(opts.audio_in_dev, ":"); //should be 'tcp'
|
||||
if (curr != NULL) ; //continue
|
||||
else goto TCPEND; //end early with preset values
|
||||
|
||||
curr = strtok(NULL, ":"); //host address
|
||||
if (curr != NULL) strncpy (opts.tcp_hostname, curr, 1023);
|
||||
|
||||
curr = strtok(NULL, ":"); //host port
|
||||
if (curr != NULL) opts.tcp_portno = atoi (curr);
|
||||
|
||||
TCPEND:
|
||||
fprintf (stderr, "%s:", opts.tcp_hostname);
|
||||
fprintf (stderr, "%d \n", opts.tcp_portno);
|
||||
opts.tcp_sockfd = Connect(opts.tcp_hostname, opts.tcp_portno);
|
||||
opts.audio_in_type = 8;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,8 +146,7 @@ bool SetFreq(int sockfd, long int freq)
|
|||
bool SetModulation(int sockfd, int bandwidth)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
//ideally, on P25, we want to use the iden_up with bw, and calc bandwidth first
|
||||
//bandwidth = 12500; //default value, if doing pV, may want to swtich to 25000
|
||||
//the bandwidth is now a user/system based configurable variable
|
||||
sprintf (buf, "M FM %d\n", bandwidth);
|
||||
Send(sockfd, buf);
|
||||
Recv(sockfd, buf);
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ void edacs(dsd_opts * opts, dsd_state * state)
|
|||
//do condition here, in future, will allow us to use tuning methods as well, or rtl_udp as well
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500); //bw depends on system strength, but we want a wide one for now
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, state->trunk_lcn_freq[lcn-1]); //minus one because the lcn index starts at zero
|
||||
state->edacs_tuned_lcn = lcn;
|
||||
opts->p25_is_tuned = 1;
|
||||
|
|
@ -366,7 +366,7 @@ void edacs(dsd_opts * opts, dsd_state * state)
|
|||
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500); //bw depends on system strength, but we want a wide one for now
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, state->trunk_lcn_freq[lcn-1]); //minus one because our index starts at zero
|
||||
state->edacs_tuned_lcn = lcn;
|
||||
opts->p25_is_tuned = 1;
|
||||
|
|
|
|||
|
|
@ -260,9 +260,7 @@ void NXDN_decode_VCALL_ASSGN(dsd_opts * opts, dsd_state * state, uint8_t * Messa
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
//may or may not use setmod here, let user control it instead?
|
||||
if (opts->frame_nxdn48 == 1) SetModulation(opts->rigctl_sockfd, 6250);
|
||||
else SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, freq);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = freq;
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, freq);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = freq;
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
|
|
@ -182,10 +182,10 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
|||
state->symbolCenter = 3;
|
||||
}
|
||||
}
|
||||
//do condition here, in future, will allow us to use tuning methods as well, or rtl_udp as well
|
||||
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, freq);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = freq;
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
|
|
@ -283,7 +283,7 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, tunable_freq);
|
||||
//probably best to only set these when really tuning
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = tunable_freq;
|
||||
|
|
@ -358,7 +358,7 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, freq);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = freq;
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
|
|
@ -428,7 +428,7 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, freq);
|
||||
if (state->synctype == 0 || state->synctype == 1) state->p25_vc_freq[0] = freq;
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
|
|
@ -525,10 +525,10 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
|||
state->symbolCenter = 3;
|
||||
}
|
||||
}
|
||||
//do condition here, in future, will allow us to use tuning methods as well, or rtl_udp as well
|
||||
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, tunable_freq);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = tunable_freq;
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
|
|
@ -637,7 +637,7 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, tunable_freq);
|
||||
//probably best to only set these when really tuning
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = tunable_freq;
|
||||
|
|
@ -736,7 +736,7 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, tunable_freq);
|
||||
//probably best to only set these when really tuning
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = tunable_freq;
|
||||
|
|
@ -815,7 +815,7 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
|||
//rigctl
|
||||
if (opts->use_rigctl == 1)
|
||||
{
|
||||
SetModulation(opts->rigctl_sockfd, 12500);
|
||||
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
|
||||
SetFreq(opts->rigctl_sockfd, freq1);
|
||||
state->p25_vc_freq[0] = state->p25_vc_freq[1] = freq1;
|
||||
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
|
||||
|
|
|
|||
Loading…
Reference in New Issue