mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-17 03:07:24 -05:00
RTL Tuning Fix(UDP); Cosmetic Change;
This commit is contained in:
@@ -428,7 +428,7 @@ void processdPMRvoice (dsd_opts * opts, dsd_state * state)
|
|||||||
if (state->R != 0)
|
if (state->R != 0)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s", KYEL);
|
fprintf (stderr, "%s", KYEL);
|
||||||
fprintf (stderr, " KEY VALUE: [%05lld] ", state->R );
|
fprintf (stderr, " Key %05lld ", state->R );
|
||||||
fprintf (stderr, "%s", KNRM);
|
fprintf (stderr, "%s", KNRM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1684,31 +1684,17 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
|||||||
c = getch();
|
c = getch();
|
||||||
}
|
}
|
||||||
|
|
||||||
//testing sending UDP commands to the socket inside of rtl_sdr_fm.cpp
|
//use rtl_udp_tune
|
||||||
//this works, but we will want to make an init func open one time, and have sendto here
|
|
||||||
#ifdef USE_RTLSDR
|
#ifdef USE_RTLSDR
|
||||||
if (temp_freq == opts->rtlsdr_center_freq)
|
if (temp_freq == opts->rtlsdr_center_freq)
|
||||||
{
|
{
|
||||||
handle = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
rtl_udp_tune (opts, state, temp_freq);
|
||||||
|
|
||||||
memset((char * ) & address, 0, sizeof(address));
|
|
||||||
address.sin_family = AF_INET;
|
|
||||||
address.sin_addr.s_addr = inet_addr(SRV_IP); //address of host
|
|
||||||
address.sin_port = htons(udp_port);
|
|
||||||
sendto(handle, data, UDP_BUFLEN, 0, (const struct sockaddr * ) & address, sizeof(struct sockaddr_in));
|
|
||||||
|
|
||||||
temp_freq = -1;
|
temp_freq = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Variable reset/set section
|
//Variable reset/set section
|
||||||
|
|
||||||
//carrier reset
|
|
||||||
// if (state->carrier == 0) //reset these to 0 when no carrier
|
|
||||||
// {
|
|
||||||
// sprintf(state->dmr_branding, "%s", "");
|
|
||||||
// }
|
|
||||||
|
|
||||||
//set lls sync types
|
//set lls sync types
|
||||||
if (state->synctype >= 0 && state->synctype < 39)
|
if (state->synctype >= 0 && state->synctype < 39)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -273,4 +273,9 @@ void rtl_udp_tune(dsd_opts * opts, dsd_state * state, long int frequency)
|
|||||||
address.sin_addr.s_addr = inet_addr("127.0.0.1"); //make user configurable later
|
address.sin_addr.s_addr = inet_addr("127.0.0.1"); //make user configurable later
|
||||||
address.sin_port = htons(udp_port);
|
address.sin_port = htons(udp_port);
|
||||||
sendto(handle, data, 5, 0, (const struct sockaddr * ) & address, sizeof(struct sockaddr_in));
|
sendto(handle, data, 5, 0, (const struct sockaddr * ) & address, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
|
//BUGFIX: This was causing an indefinite number of UDP sockets to stay open on each tune request
|
||||||
|
//we open a new socket with each request, so we need to close the socket after writing to it
|
||||||
|
//this would cause the tuning to stop after x number of tune attempts (few hours? on a busy system)
|
||||||
|
close (handle); //close socket after sending.
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user