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 /HSMODEM.c | |
| parent | 23de03a0c8bf8a564cc0442f49d050ed11e372b8 (diff) | |
New upstream version 6.0.25.41+repackupstream/6.0.25.41+repack
Diffstat (limited to 'HSMODEM.c')
| -rw-r--r-- | HSMODEM.c | 181 |
1 files changed, 100 insertions, 81 deletions
@@ -372,12 +372,12 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) switch (fn)
{
- case 7:
+ case 7:
- // 100 mS Timer. May now be needed, as Poll can be called more frequently in some circumstances
+ // 100 mS Timer. May now be needed, as Poll can be called more frequently in some circumstances
// G7TAJ's code to record activity for stats display
-
+
if ( TNC->BusyFlags && CDBusy )
TNC->PortRecord->PORTCONTROL.ACTIVE += 2;
@@ -385,28 +385,109 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) TNC->PortRecord->PORTCONTROL.SENDING += 2;
if (TNC->CONNECTED)
+ {
+ TNC->CONNECTED--;
+
+ if (TNC->CONNECTED == 0)
{
- TNC->CONNECTED--;
+ sprintf(TNC->WEB_COMMSSTATE, "Connection to HSMODEM lost");
+ MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
+ }
+ }
+
+ TNC->PollDelay++;
- if (TNC->CONNECTED == 0)
+ if (TNC->PollDelay > 20)
+ {
+ TNC->PollDelay = 0;
+
+ SendPoll(TNC);
+ }
+
+ if (TNC->DiscPending)
+ {
+ TNC->DiscPending--;
+
+ if (TNC->DiscPending == 0)
+ {
+ // Too long in Disc Pending - Kill and Restart TNC
+ }
+ }
+
+ for (Stream = 0; Stream <= 2; Stream++)
+ {
+ STREAM = &TNC->Streams[Stream];
+
+ if (STREAM->NeedDisc)
+ {
+ STREAM->NeedDisc--;
+
+ if (STREAM->NeedDisc == 0)
{
- sprintf(TNC->WEB_COMMSSTATE, "Connection to HSMODEM lost");
- MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
+ // Send the DISCONNECT
+
+ HSMODEMSendCommand(TNC, "DISCONNECT\r");
}
}
+ }
+
+ for (Stream = 0; Stream <= 2; Stream++)
+ {
+ STREAM = &TNC->Streams[Stream];
+
+ if (STREAM->NeedDisc)
+ {
+ STREAM->NeedDisc--;
- TNC->PollDelay++;
+ if (STREAM->NeedDisc == 0)
+ {
+ // Send the DISCONNECT
- if (TNC->PollDelay > 20)
+ HSMODEMSendCommand(TNC, "DISCONNECT\r");
+ }
+ }
+
+ if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] && STREAM->Attached == 0)
{
- TNC->PollDelay = 0;
+ // New Attach
+
+ int calllen;
+ char Msg[80];
+
+ Debugprintf("HSMODEM New Attach Stream %d", Stream);
+
+ STREAM->Attached = TRUE;
+
+ calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4USER, TNC->Streams[Stream].MyCall);
+ TNC->Streams[Stream].MyCall[calllen] = 0;
+
- SendPoll(TNC);
- }
+ HSMODEMChangeMYC(TNC, TNC->Streams[0].MyCall);
- return 0;
+ // Stop other ports in same group
- case 1: // poll
+ SuspendOtherPorts(TNC);
+
+ //sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
+ //MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
+
+ // Stop Scanning
+
+ sprintf(Msg, "%d SCANSTOP", TNC->Port);
+
+ Rig_Command( (TRANSPORTENTRY *) -1, Msg);
+ }
+
+ if (STREAM->Attached)
+ CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
+
+ }
+
+
+
+ return 0;
+
+ case 1: // poll
HSMODEMCheckRX(TNC);
@@ -476,69 +557,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) ReleaseBuffer(buffptr);
}
-
- if (TNC->DiscPending)
- {
- TNC->DiscPending--;
- if (TNC->DiscPending == 0)
- {
- // Too long in Disc Pending - Kill and Restart TNC
- }
- }
-
-
- for (Stream = 0; Stream <= 2; Stream++)
- {
- STREAM = &TNC->Streams[Stream];
-
- if (STREAM->NeedDisc)
- {
- STREAM->NeedDisc--;
-
- if (STREAM->NeedDisc == 0)
- {
- // Send the DISCONNECT
-
- HSMODEMSendCommand(TNC, "DISCONNECT\r");
- }
- }
-
- if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] && STREAM->Attached == 0)
- {
- // New Attach
-
- int calllen;
- char Msg[80];
-
- Debugprintf("HSMODEM New Attach Stream %d", Stream);
-
- STREAM->Attached = TRUE;
-
- calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4USER, TNC->Streams[Stream].MyCall);
- TNC->Streams[Stream].MyCall[calllen] = 0;
-
-
- HSMODEMChangeMYC(TNC, TNC->Streams[0].MyCall);
-
- // Stop other ports in same group
-
- SuspendOtherPorts(TNC);
-
- //sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
- //MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
-
- // Stop Scanning
-
- sprintf(Msg, "%d SCANSTOP", TNC->Port);
-
- Rig_Command( (TRANSPORTENTRY *) -1, Msg);
- }
-
- if (STREAM->Attached)
- CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
-
- }
// See if any frames for this port
@@ -734,7 +753,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) // Save Command, and wait up to 10 secs
sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel");
- MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
+ MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
TNC->ConnectCmd = _strdup(Connect);
TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs
@@ -749,7 +768,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", STREAM->MyCall, STREAM->RemoteCall);
HSMODEMSendCommand(TNC, Connect);
- MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
+ MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->Connecting = TRUE;
return 0;
@@ -878,7 +897,7 @@ VOID HSMODEMReleasePort(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');"
@@ -1420,7 +1439,7 @@ VOID HSMODEMProcessTNCMessage(struct TNCINFO * TNC, unsigned char * Msg, int Len // Just come up
sprintf(TNC->WEB_COMMSSTATE, "Connected to HSMODEM");
- MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
+ MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
SendMode(TNC);
}
@@ -1507,7 +1526,7 @@ VOID HSMODEMProcessTNCMessage(struct TNCINFO * TNC, unsigned char * Msg, int Len Info->lastBlock = 0;
Info->lostBlocks = 0;
- Info->LastRX = time(NULL);
+ Info->LastRX = NOW;
Debugprintf("%d %d %04X %02x %s %d %s", Msg[1], Seq, FH->CRC, Msg[4],
FH->filename, fileLen, FH->Data);
|
