User-selectable multicast or unicast data from Linrad.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@575 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2007-11-05 19:19:46 +00:00
parent ce99c590dd
commit eace46718d
4 changed files with 41 additions and 20 deletions

View File

@ -16,6 +16,7 @@ integer iter !(why is this here??)
integer ndecoding !Decoder status (see decode2.f90) GUI,Decoder
integer ndecoding0 !Status on previous decode GUI,Decoder
integer mousebutton !Which button was clicked? GUI
integer multicast !1 for multicast data, 0 for unicast GUI
integer nagc !Set to 1 to activate waterfall AGC GUI
integer ndecdone !Is decoder finished? GUI,Decoder
integer npingtime !Time in file of mouse-selected ping GUI,Decoder
@ -106,7 +107,7 @@ character*8 utcdata !HHMM UTC for the processed data Decoder
common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), &
green(500),fselect,pctlost,fcenter,rxnoise,dphi,ngreen,dgain,iter, &
ndecoding,ndecoding0,mousebutton,nagc, &
ndecoding,ndecoding0,mousebutton,multicast,nagc, &
ndecdone,npingtime,ierr,lauto,mantx,nrestart,ntr,nmsg,nsave,nadd5, &
dftolerance,LDecoded,rxdone,monitoring,nzap,minsigdb, &
nclearave,nfreeze,nafc,ncsmin,newspec,nfa,nfb,nfcal,idphi,nkeep, &

View File

@ -70,6 +70,7 @@ loopall=0
mode=StringVar()
mode.set("")
mrudir=os.getcwd()
multicast=IntVar()
nafc=IntVar()
naz=0
ndepth=IntVar()
@ -251,6 +252,10 @@ def stopmon(event=NONE):
bmonitor.configure(bg='gray85')
Audio.gcom2.monitoring=0
###------------------------------------------------------- toggle_multicast
##def toggle_multicast(event=NONE):
## print multicast.get()
#------------------------------------------------------ dbl_click_text
def dbl_click_text(event):
t=text.get('1.0',END) #Entire contents of text box
@ -1271,6 +1276,7 @@ def update():
Audio.gcom2.dftolerance=ntol[itol]
Audio.gcom2.neme=neme.get()
Audio.gcom2.ndepth=ndepth.get()
Audio.gcom2.multicast=multicast.get()
try:
Audio.gcom2.idinterval=options.IDinterval.get()
except:
@ -1368,6 +1374,11 @@ setupmenu.add_checkbutton(label = 'Double-click on callsign sets TxFirst',
variable=setseq)
setupmenu.add_checkbutton(label = 'GenStdMsgs sets Tx1',variable=k2txb)
setupmenu.add_separator()
setupmenu.add_radiobutton(label = 'Input data multicast', variable=multicast, \
value=1)
setupmenu.add_radiobutton(label = 'Input data unicast', variable=multicast, \
value=0)
setupmenu.add_separator()
setupmenu.add_checkbutton(label = 'Enable diagnostics',variable=ndebug)
setupmenu.add_checkbutton(label = 'Verbose diagnostics',variable=ndebug2)
@ -1818,6 +1829,7 @@ try:
elif key == 'NoShJT65': noshjt65.set(value)
elif key == 'NEME': neme.set(value)
elif key == 'NDepth': ndepth.set(value)
elif key == 'Multicast': multicast.set(value)
elif key == 'Debug': ndebug.set(value)
elif key == 'Debug2': ndebug2.set(value)
elif key == 'HisCall':
@ -1836,6 +1848,7 @@ g.mode=mode.get()
Audio.gcom2.appdir=(appdir+' ')[:80]
Audio.gcom2.azeldir=(options.azeldir.get()+' ')[:80]
Audio.gcom2.ndepth=ndepth.get()
Audio.gcom2.multicast=multicast.get()
f=open(appdir+'/tmp26.txt','w')
f.truncate(0)
f.close
@ -1912,6 +1925,7 @@ f.write("NoSh441 " + str(nosh441.get()) + "\n")
f.write("NoShJT65 " + str(noshjt65.get()) + "\n")
f.write("NEME " + str(neme.get()) + "\n")
f.write("NDepth " + str(ndepth.get()) + "\n")
f.write("Multicast " + str(multicast.get()) + "\n")
f.write("Debug " + str(ndebug.get()) + "\n")
f.write("Debug2 " + str(ndebug2.get()) + "\n")
mrudir2=mrudir.replace(" ","#")

View File

@ -11,7 +11,7 @@ struct sockaddr_in addr;
int fd;
//void __stdcall SETUP_RSOCKET(void)
void setup_rsocket_(void)
void setup_rsocket_(int *multicast0)
{
struct ip_mreq mreq;
u_int yes=1;
@ -59,13 +59,17 @@ void setup_rsocket_(void)
printf("Error: %d %d\n",err,j);
}
/*
if (*multicast0) {
// allow multiple sockets to use the same PORT number
if (setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(yes)) < 0) {
perror("Reusing ADDR failed");
exit(1);
}
*/
printf("Accepting multicast data from Linrad.\n");
}
else {
printf("Accepting unicast data from Linrad.\n");
}
/* set up destination address */
memset(&addr,0,sizeof(addr));
@ -78,7 +82,7 @@ void setup_rsocket_(void)
exit(1);
}
/*
if (*multicast0) {
// use setsockopt() to request that the kernel join a multicast group
mreq.imr_multiaddr.s_addr=inet_addr(HELLO_GROUP);
mreq.imr_interface.s_addr=htonl(INADDR_ANY);
@ -87,8 +91,7 @@ void setup_rsocket_(void)
perror("setsockopt");
exit(1);
}
*/
}
}
//void __stdcall RECV_PKT(char buf[])

View File

@ -22,16 +22,19 @@ subroutine recvpkt(iarg)
equivalence (id,d8)
data nblock0/0/,first/.true./,kb/1/,ntx/0/,npkt/0/,nw/0/
data sqave/0.0/,u/0.001/,rxnoise/0.0/,kbuf/1/,lost_tot/0/
data multicast0/-99/
save
call setup_rsocket ! Open socket to receive multicast data
1 call setup_rsocket(multicast) !Open socket for multicast/unicast data
nreset=-1
k=0
nsec0=-999
fcenter=144.125 !Default (startup) frequency)
multicast0=multicast
10 call recv_pkt(center_freq)
10 if(multicast.ne.multicast0) go to 1
call recv_pkt(center_freq)
if(nsec0.eq.-999) fcenter=center_freq
isec=sec_midn()
imin=isec/60