diff options
| author | Dave Hibberd <hibby@debian.org> | 2026-09-29 21:39:24 +0100 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2026-09-29 21:39:24 +0100 |
| commit | 592e5967b8fcd79423802071319d0c646f2080df (patch) | |
| tree | 0eef3a28cfe1a939caf9d61e419a56d79b3c38e3 /FLDigi.c | |
| parent | 23de03a0c8bf8a564cc0442f49d050ed11e372b8 (diff) | |
New upstream version 6.0.25.41+repackupstream/6.0.25.41+repack
Diffstat (limited to 'FLDigi.c')
| -rw-r--r-- | FLDigi.c | 256 |
1 files changed, 131 insertions, 125 deletions
@@ -224,7 +224,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) // 100 mS Timer.
// G7TAJ's code to record activity for stats display
-
+
if ( TNC->BusyFlags && CDBusy )
TNC->PortRecord->PORTCONTROL.ACTIVE += 2;
@@ -246,7 +246,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) char Reply[80];
SendLen = sprintf(Reply, "c%s:42 %s:24 %c 7 T60R5W10",
- STREAM->MyCall, STREAM->RemoteCall, ARQ->OurStream);
+ STREAM->MyCall, STREAM->RemoteCall, ARQ->OurStream);
strcpy(TNC->WEB_PROTOSTATE, "Connecting");
SetWindowText(TNC->xIDC_PROTOSTATE, TNC->WEB_PROTOSTATE);
@@ -317,105 +317,142 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) TNC->SlowTimer = 100;
FLSlowTimer(TNC); // 10 Secs
}
-
+
return 0;
- case 1: // poll
+ if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE && TNC->FLInfo->KISSMODE == FALSE)
+ {
+ // See if time to reconnect
- if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE && TNC->FLInfo->KISSMODE == FALSE)
+ time( <ime );
+ if (ltime-lasttime[port] >9 )
{
- // See if time to reconnect
-
- time( <ime );
- if (ltime-lasttime[port] >9 )
- {
- ConnecttoFLDigi(port);
- lasttime[port]=ltime;
- }
+ ConnecttoFLDigi(port);
+ lasttime[port]=ltime;
}
+ }
pollloop:
- FD_ZERO(&readfs);
-
- if (TNC->CONNECTED)
- if (TNC->TCPSock)
- FD_SET(TNC->TCPSock,&readfs);
+ FD_ZERO(&readfs);
- if (TNC->CONNECTED || TNC->FLInfo->KISSMODE)
- FD_SET(TNC->TCPDataSock,&readfs);
-
-
-// FD_ZERO(&writefs);
+ if (TNC->CONNECTED)
+ if (TNC->TCPSock)
+ FD_SET(TNC->TCPSock,&readfs);
-// if (TNC->BPQtoWINMOR_Q) FD_SET(TNC->TCPDataSock,&writefs); // Need notification of busy clearing
+ if (TNC->CONNECTED || TNC->FLInfo->KISSMODE)
+ FD_SET(TNC->TCPDataSock,&readfs);
- FD_ZERO(&errorfs);
-
- if (TNC->CONNECTED)
- if (TNC->TCPSock)
- FD_SET(TNC->TCPSock,&errorfs);
-
- if (TNC->CONNECTED || TNC->FLInfo->KISSMODE)
- FD_SET(TNC->TCPDataSock,&errorfs);
-
- if (select((int)TNC->TCPDataSock + 1, &readfs, &writefs, &errorfs, &timeout) > 0)
+ // FD_ZERO(&writefs);
+
+ // if (TNC->BPQtoWINMOR_Q) FD_SET(TNC->TCPDataSock,&writefs); // Need notification of busy clearing
+
+ FD_ZERO(&errorfs);
+
+ if (TNC->CONNECTED)
+ if (TNC->TCPSock)
+ FD_SET(TNC->TCPSock,&errorfs);
+
+ if (TNC->CONNECTED || TNC->FLInfo->KISSMODE)
+ FD_SET(TNC->TCPDataSock,&errorfs);
+
+
+ if (select((int)TNC->TCPDataSock + 1, &readfs, &writefs, &errorfs, &timeout) > 0)
+ {
+ // See what happened
+
+ if (FD_ISSET(TNC->TCPDataSock,&readfs))
{
- // See what happened
+ // data available
- if (FD_ISSET(TNC->TCPDataSock,&readfs))
- {
- // data available
-
- ProcessReceivedData(port);
- goto pollloop;
- }
+ ProcessReceivedData(port);
+ goto pollloop;
+ }
- if (FD_ISSET(TNC->TCPSock,&readfs))
- {
- // data available
-
- ProcessXMLData(port);
- }
+ if (FD_ISSET(TNC->TCPSock,&readfs))
+ {
+ // data available
+ ProcessXMLData(port);
+ }
- if (FD_ISSET(TNC->TCPDataSock,&writefs))
- {
- // Connect success
- TNC->CONNECTED = TRUE;
- TNC->CONNECTING = FALSE;
+ if (FD_ISSET(TNC->TCPDataSock,&writefs))
+ {
+ // Connect success
- sprintf(TNC->WEB_COMMSSTATE, "Connected to FLDIGI");
- SetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
+ TNC->CONNECTED = TRUE;
+ TNC->CONNECTING = FALSE;
- // If required, send signon
-
-// SendPacket(TNC->TCPDataSock,"\x1a", 1, 0);
-// SendPacket(TNC->TCPDataSock,"DIGITAL MODE ?", 14, 0);
-// SendPacket(TNC->TCPDataSock,"\x1b", 1, 0);
+ sprintf(TNC->WEB_COMMSSTATE, "Connected to FLDIGI");
+ SetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
-// EnumWindows(EnumTNCWindowsProc, (LPARAM)TNC);
- }
-
- if (FD_ISSET(TNC->TCPDataSock,&errorfs) || FD_ISSET(TNC->TCPSock,&errorfs))
- {
- // if connecting, then failed, if connected then has just disconnected
+ // If required, send signon
-// if (CONNECTED[port])
-// if (!CONNECTING[port])
-// {
-// i=sprintf(ErrMsg, "MPSK Connection lost for BPQ Port %d\r\n", port);
-// WritetoConsole(ErrMsg);
-// }
+ // SendPacket(TNC->TCPDataSock,"\x1a", 1, 0);
+ // SendPacket(TNC->TCPDataSock,"DIGITAL MODE ?", 14, 0);
+ // SendPacket(TNC->TCPDataSock,"\x1b", 1, 0);
- CONNECTING[port]=FALSE;
- CONNECTED[port]=FALSE;
-
- }
+ // EnumWindows(EnumTNCWindowsProc, (LPARAM)TNC);
+ }
+
+ if (FD_ISSET(TNC->TCPDataSock,&errorfs) || FD_ISSET(TNC->TCPSock,&errorfs))
+ {
+ // if connecting, then failed, if connected then has just disconnected
+
+ // if (CONNECTED[port])
+ // if (!CONNECTING[port])
+ // {
+ // i=sprintf(ErrMsg, "MPSK Connection lost for BPQ Port %d\r\n", port);
+ // WritetoConsole(ErrMsg);
+ // }
+
+ CONNECTING[port]=FALSE;
+ CONNECTED[port]=FALSE;
}
+ }
+ if (TNC->PortRecord->UI_Q)
+ {
+ struct _MESSAGE * buffptr;
+ int SendLen;
+ char Reply[256];
+ int UILen;
+ char * UIMsg;
+
+ buffptr = Q_REM(&TNC->PortRecord->UI_Q);
+
+ UILen = buffptr->LENGTH;
+ UILen -= 23;
+ UIMsg = buffptr->L2DATA;
+
+ UIMsg[UILen] = 0;
+
+ if (UILen < 129 && TNC->Streams[0].Attached == FALSE) // Be sensible!
+ {
+ // >00uG8BPQ:72 TestA
+ SendLen = sprintf(Reply, "u%s:72 %s", TNC->NodeCall, UIMsg);
+ SendPacket(TNC, Reply, SendLen);
+ }
+ ReleaseBuffer(buffptr);
+ }
+
+
+ if (STREAM->PACTORtoBPQ_Q == 0)
+ {
+ if (STREAM->DiscWhenAllSent)
+ {
+ STREAM->DiscWhenAllSent--;
+ if (STREAM->DiscWhenAllSent == 0)
+ STREAM->ReportDISC = TRUE; // Dont want to leave session attached. Causes too much confusion
+ }
+ }
+
+ return 0;
+
+
+ case 1: // poll
// See if any frames for this port
@@ -437,16 +474,7 @@ pollloop: // if Busy, send buffer status poll
- if (STREAM->PACTORtoBPQ_Q == 0)
- {
- if (STREAM->DiscWhenAllSent)
- {
- STREAM->DiscWhenAllSent--;
- if (STREAM->DiscWhenAllSent == 0)
- STREAM->ReportDISC = TRUE; // Dont want to leave session attached. Causes too much confusion
- }
- }
- else
+ if (STREAM->PACTORtoBPQ_Q)
{
int datalen;
@@ -464,36 +492,12 @@ pollloop: WritetoTrace(TNC, &buffptr->Data[0], datalen - (MSGHDDRLEN + 1));
ReleaseBuffer(buffptr);
- return (1);
+ return 1;
}
}
- if (TNC->PortRecord->UI_Q)
- {
- struct _MESSAGE * buffptr;
- int SendLen;
- char Reply[256];
- int UILen;
- char * UIMsg;
-
- buffptr = Q_REM(&TNC->PortRecord->UI_Q);
-
- UILen = buffptr->LENGTH;
- UILen -= 23;
- UIMsg = buffptr->L2DATA;
-
- UIMsg[UILen] = 0;
+ return 0;
- if (UILen < 129 && TNC->Streams[0].Attached == FALSE) // Be sensible!
- {
- // >00uG8BPQ:72 TestA
- SendLen = sprintf(Reply, "u%s:72 %s", TNC->NodeCall, UIMsg);
- SendPacket(TNC, Reply, SendLen);
- }
- ReleaseBuffer(buffptr);
- }
-
- return (0);
case 2: // send
@@ -1113,7 +1117,7 @@ static int RestartTNC(struct TNCINFO * TNC) static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
- int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
+ int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
@@ -1171,7 +1175,7 @@ VOID * FLDigiExtInit(EXTPORTDATA * PortEntry) // The Socket to connect to is in IOBASE
//
- srand((unsigned int)time(NULL));
+ srand((unsigned int)NOW);
port = PortEntry->PORTCONTROL.PORTNUMBER;
@@ -1565,7 +1569,7 @@ VOID ConnecttoFLDigiThread(void * portptr) WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
- MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
+ MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@@ -2538,7 +2542,7 @@ VOID ProcessFLDigiData(struct TNCINFO * TNC, UCHAR * Input, int Len, char Channe SESS = TNC->PortRecord->ATTACHEDSESSIONS[0];
strcpy(STREAM->MyCall, call2);
- STREAM->ConnectTime = time(NULL);
+ STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
if (TNC->RIG && TNC->RIG != &TNC->DummyRig && strcmp(TNC->RIG->RigName, "PTT"))
@@ -2697,7 +2701,7 @@ AckConnectRequest: if (STREAM->Connected)
goto SendKReply; // Repeated ACK
- STREAM->ConnectTime = time(NULL);
+ STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
STREAM->Connected = TRUE;
@@ -3682,15 +3686,17 @@ VOID FLSlowTimer(struct TNCINFO * TNC) if (FL->KISSMODE)
{
if (FL->Responding)
+ {
FL->Responding--;
- if (FL->Responding == 0)
- {
- TNC->TNCOK = FALSE;
- TNC->CONNECTED = FALSE;
+ if (FL->Responding == 0)
+ {
+ TNC->TNCOK = FALSE;
+ TNC->CONNECTED = FALSE;
- sprintf(TNC->WEB_COMMSSTATE, "Connection to FLDIGI lost");
- SetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
+ sprintf(TNC->WEB_COMMSSTATE, "Connection to FLDIGI lost");
+ SetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
+ }
// Set basic params till it responds
}
@@ -3838,7 +3844,7 @@ static int ProcessXMLData(int port) SetWindowText(TNC->xIDC_CHANSTATE, "Busy");
strcpy(TNC->WEB_CHANSTATE, "Busy");
- TNC->WinmorRestartCodecTimer = time(NULL);
+ TNC->WinmorRestartCodecTimer = NOW;
*/
return 0;
}
@@ -3852,7 +3858,7 @@ static int ProcessXMLData(int port) strcpy(TNC->WEB_CHANSTATE, "Clear");
SetWindowText(TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE);
- TNC->WinmorRestartCodecTimer = time(NULL);
+ TNC->WinmorRestartCodecTimer = NOW;
return;
}
*/
|
