Skip to content

Commit e09e37e

Browse files
authored
Merge pull request #402 from LeeLeahy2/tcp-server
TCP Server: Update to work over Ethernet
2 parents 257f6cd + 74b35ca commit e09e37e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Firmware/RTK_Everywhere/TcpServer.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ tcpServer.ino
3131
3232
*/
3333

34-
#ifdef COMPILE_WIFI
34+
#ifdef COMPILE_NETWORK
3535

3636
//----------------------------------------
3737
// Constants
@@ -65,7 +65,7 @@ const RtkMode_t tcpServerMode = RTK_MODE_BASE_FIXED | RTK_MODE_BASE_SURVEY_IN |
6565
//----------------------------------------
6666

6767
// TCP server
68-
static WiFiServer *tcpServer = nullptr;
68+
static NetworkServer *tcpServer = nullptr;
6969
static uint8_t tcpServerState;
7070
static uint32_t tcpServerTimer;
7171

@@ -234,13 +234,13 @@ bool tcpServerStart()
234234
systemPrintln("TCP server starting the server");
235235

236236
// Start the TCP server
237-
tcpServer = new WiFiServer(settings.tcpServerPort);
237+
tcpServer = new NetworkServer(settings.tcpServerPort, TCP_SERVER_MAX_CLIENTS);
238238
if (!tcpServer)
239239
return false;
240240

241241
tcpServer->begin();
242242
online.tcpServer = true;
243-
localIp = wifiGetIpAddress();
243+
localIp = networkGetIpAddress(networkGetType());
244244
systemPrintf("TCP server online, IP address %d.%d.%d.%d:%d\r\n", localIp[0], localIp[1], localIp[2], localIp[3],
245245
settings.tcpServerPort);
246246
return true;
@@ -460,7 +460,7 @@ void tcpServerUpdate()
460460
break;
461461

462462
// Start processing the new TCP server client connection
463-
tcpServerClient[index] = new RTKNetworkClientType(client, NETWORK_TYPE_WIFI);
463+
tcpServerClient[index] = new RTKNetworkClientType(client, networkGetType());
464464
tcpServerClientIpAddress[index] = tcpServerClient[index]->remoteIP();
465465
tcpServerClientConnected = tcpServerClientConnected | (1 << index);
466466
tcpServerClientDataSent = tcpServerClientDataSent | (1 << index);
@@ -515,4 +515,4 @@ void tcpServerZeroTail()
515515
tcpServerClientTails[index] = 0;
516516
}
517517

518-
#endif // COMPILE_WIFI
518+
#endif // COMPILE_NETWORK

0 commit comments

Comments
 (0)