Skip to content

Commit 0909cb7

Browse files
committed
Rename networkHasInternet
1 parent c6f0085 commit 0909cb7

File tree

10 files changed

+54
-54
lines changed

10 files changed

+54
-54
lines changed

Firmware/RTK_Everywhere/Cellular.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void cellularEvent(arduino_event_id_t event)
8484
String module;
8585

8686
// Take the network offline if necessary
87-
if (networkIsInterfaceOnline(NETWORK_CELLULAR) && (event != ARDUINO_EVENT_ETH_GOT_IP) &&
87+
if (networkInterfaceHasInternet(NETWORK_CELLULAR) && (event != ARDUINO_EVENT_ETH_GOT_IP) &&
8888
(event != ARDUINO_EVENT_ETH_GOT_IP6) && (event != ARDUINO_EVENT_PPP_CONNECTED))
8989
{
9090
networkMarkOffline(NETWORK_CELLULAR);
@@ -108,7 +108,7 @@ void cellularEvent(arduino_event_id_t event)
108108

109109
case ARDUINO_EVENT_PPP_CONNECTED:
110110
systemPrintln("Cellular Connected");
111-
networkMarkOnline(NETWORK_CELLULAR);
111+
networkMarkHasInternet(NETWORK_CELLULAR);
112112
break;
113113

114114
case ARDUINO_EVENT_PPP_DISCONNECTED:

Firmware/RTK_Everywhere/Developer.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ const uint8_t * networkGetMacAddress()
4343
#endif
4444
return zero;
4545
}
46-
bool networkIsOnline() {return false;}
47-
bool networkIsOnline(NetIndex_t index) {return false;}
48-
bool networkIsInterfaceOnline(NetIndex_t index) {return false;}
46+
bool networkHasInternet() {return false;}
47+
bool networkHasInternet(NetIndex_t index) {return false;}
48+
bool networkInterfaceHasInternet(NetIndex_t index) {return false;}
4949
void networkMarkOffline(NetIndex_t index) {}
50-
void networkMarkOnline(NetIndex_t index) {}
50+
void networkMarkHasInternet(NetIndex_t index) {}
5151
void networkUpdate() {}
5252
void networkVerifyTables() {}
5353
uint16_t networkGetConsumerTypes() {return(0);}

Firmware/RTK_Everywhere/Display.ino

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void displayUpdate()
359359
iconPropertyBlinking prop;
360360
prop.icon = EthernetIconProperties.iconDisplay[present.display_type];
361361
#ifdef COMPILE_ETHERNET
362-
if (networkIsInterfaceOnline(NETWORK_ETHERNET))
362+
if (networkInterfaceHasInternet(NETWORK_ETHERNET))
363363
prop.duty = 0b11111111;
364364
else
365365
#endif // COMPILE_ETHERNET
@@ -381,7 +381,7 @@ void displayUpdate()
381381
iconPropertyBlinking prop;
382382
prop.icon = EthernetIconProperties.iconDisplay[present.display_type];
383383
#ifdef COMPILE_ETHERNET
384-
if (networkIsInterfaceOnline(NETWORK_ETHERNET))
384+
if (networkInterfaceHasInternet(NETWORK_ETHERNET))
385385
prop.duty = 0b11111111;
386386
else
387387
#endif // COMPILE_ETHERNET
@@ -405,7 +405,7 @@ void displayUpdate()
405405
displayWebConfigNotStarted(); // Display 'Web Config'
406406
break;
407407
case (STATE_WEB_CONFIG):
408-
if (networkIsInterfaceOnline(NETWORK_ETHERNET))
408+
if (networkInterfaceHasInternet(NETWORK_ETHERNET))
409409
displayConfigViaEthernet();
410410
else
411411
{
@@ -822,24 +822,24 @@ void setRadioIcons(std::vector<iconPropertyBlinking> *iconList)
822822
usbSerialIncomingRtcm = false;
823823
}
824824

825-
bool networkOnline = false;
825+
bool networkHasInternet = false;
826826

827827
#ifdef COMPILE_ETHERNET
828-
if (networkIsInterfaceOnline(NETWORK_ETHERNET))
829-
networkOnline = true;
828+
if (networkInterfaceHasInternet(NETWORK_ETHERNET))
829+
networkHasInternet = true;
830830
#endif // COMPILE_ETHERNET
831831

832832
#ifdef COMPILE_WIFI
833-
if (networkIsInterfaceOnline(NETWORK_WIFI))
834-
networkOnline = true;
833+
if (networkInterfaceHasInternet(NETWORK_WIFI))
834+
networkHasInternet = true;
835835
#endif // COMPILE_WIFI
836836

837837
#ifdef COMPILE_CELLULAR
838-
if (networkIsInterfaceOnline(NETWORK_CELLULAR))
839-
networkOnline = true;
838+
if (networkInterfaceHasInternet(NETWORK_CELLULAR))
839+
networkHasInternet = true;
840840
#endif // COMPILE_CELLULAR
841841

842-
if (networkOnline)
842+
if (networkHasInternet)
843843
{
844844
if (netIncomingRTCM == true) // Download : Columns 74 - 81
845845
{
@@ -1099,7 +1099,7 @@ void setESPNowIcon_TwoRadios(std::vector<iconPropertyBlinking> *iconList)
10991099
void setWiFiIcon_TwoRadios(std::vector<iconPropertyBlinking> *iconList)
11001100
{
11011101
#ifdef COMPILE_WIFI
1102-
if (networkIsInterfaceOnline(NETWORK_WIFI))
1102+
if (networkInterfaceHasInternet(NETWORK_WIFI))
11031103
{
11041104
if (netIncomingRTCM || netOutgoingRTCM || mqttClientDataReceived)
11051105
{
@@ -1169,7 +1169,7 @@ void setWiFiIcon_TwoRadios(std::vector<iconPropertyBlinking> *iconList)
11691169
void setWiFiIcon_ThreeRadios(std::vector<iconPropertyBlinking> *iconList)
11701170
{
11711171
#ifdef COMPILE_WIFI
1172-
if (networkIsInterfaceOnline(NETWORK_WIFI))
1172+
if (networkInterfaceHasInternet(NETWORK_WIFI))
11731173
{
11741174
if (netIncomingRTCM || netOutgoingRTCM || mqttClientDataReceived)
11751175
{
@@ -1248,7 +1248,7 @@ void setWiFiIcon(std::vector<iconPropertyBlinking> *iconList)
12481248
icon.icon.yPos = 0;
12491249

12501250
#ifdef COMPILE_WIFI
1251-
if (networkIsInterfaceOnline(NETWORK_WIFI))
1251+
if (networkInterfaceHasInternet(NETWORK_WIFI))
12521252
icon.duty = 0b11111111;
12531253
else
12541254
#endif // COMPILE_WIFI
@@ -1534,7 +1534,7 @@ void displayBatteryVsEthernet(std::vector<iconPropertyBlinking> *iconList)
15341534
#ifdef COMPILE_ETHERNET
15351535
else // if (present.ethernet_ws5500 == true)
15361536
{
1537-
if (!networkIsInterfaceOnline(NETWORK_ETHERNET))
1537+
if (!networkInterfaceHasInternet(NETWORK_ETHERNET))
15381538
return; // Only display the Ethernet icon if we are successfully connected (no blinking)
15391539

15401540
iconPropertyBlinking prop;

Firmware/RTK_Everywhere/ESPNOW.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void espnowStart()
166166
if (response != ESP_OK)
167167
systemPrintf("espnowStart: Failed to get protocols: %s\r\n", esp_err_to_name(response));
168168

169-
if ((!wifiIsRunning()) && espnowState == ESPNOW_OFF)
169+
if ((wifiIsRunning() == false) && espnowState == ESPNOW_OFF)
170170
{
171171
// Radio is off, turn it on
172172
if (protocols != (WIFI_PROTOCOL_LR))
@@ -362,9 +362,9 @@ void espnowStop()
362362

363363
espnowSetState(ESPNOW_OFF);
364364

365-
if (!wifiIsRunning())
365+
if (wifiIsRunning() == false)
366366
{
367-
// ESP Now was the only thing using the radio so turn WiFi radio off entirely
367+
// ESP-NOW was the only thing using the radio so turn WiFi radio off entirely
368368
WiFi.mode(WIFI_OFF);
369369

370370
if (settings.debugEspNow == true)

Firmware/RTK_Everywhere/Ethernet.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void ethernetEvent(arduino_event_id_t event, arduino_event_info_t info)
174174
if (settings.enablePrintEthernetDiag && (!inMainMenu))
175175
systemPrintf("ETH Got IP: '%s'\r\n", ETH.localIP().toString().c_str());
176176

177-
networkMarkOnline((NetIndex_t)NETWORK_ETHERNET);
177+
networkMarkHasInternet((NetIndex_t)NETWORK_ETHERNET);
178178

179179
if (settings.ethernetDHCP)
180180
paintEthernetConnected();
@@ -200,7 +200,7 @@ void ethernetEvent(arduino_event_id_t event, arduino_event_info_t info)
200200
}
201201

202202
// Take the network offline if necessary
203-
if (networkIsInterfaceOnline(NETWORK_ETHERNET) && (event != ARDUINO_EVENT_ETH_GOT_IP))
203+
if (networkInterfaceHasInternet(NETWORK_ETHERNET) && (event != ARDUINO_EVENT_ETH_GOT_IP))
204204
{
205205
networkMarkOffline((NetIndex_t)NETWORK_ETHERNET);
206206
}

Firmware/RTK_Everywhere/NTP.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ void ntpServerUpdate()
791791
if (EQ_RTK_MODE(ntpServerMode))
792792
{
793793
// The NTP server only works over Ethernet
794-
if (networkIsInterfaceOnline(NETWORK_ETHERNET))
794+
if (networkInterfaceHasInternet(NETWORK_ETHERNET))
795795
{
796796
ntpServerPriority = NETWORK_OFFLINE;
797797
ntpServerSetState(NTP_STATE_NETWORK_CONNECTED);

Firmware/RTK_Everywhere/Network.ino

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ NetPriority_t networkPriority = NETWORK_OFFLINE; // Index into networkPriorityTa
115115

116116
// The following entries have one bit per interface
117117
// Each bit represents an index into the networkInterfaceTable
118-
NetMask_t networkOnline; // Track the online networks
118+
NetMask_t networkHasInternet_bm; // Track the online networks
119119

120120
NetMask_t networkSeqStarting; // Track the starting sequences
121121
NetMask_t networkSeqStopping; // Track the stopping sequences
@@ -550,11 +550,11 @@ const uint8_t *networkGetMacAddress()
550550
return btMACAddress;
551551
#endif // COMPILE_BT
552552
#ifdef COMPILE_WIFI
553-
if (networkIsInterfaceOnline(NETWORK_WIFI))
553+
if (networkInterfaceHasInternet(NETWORK_WIFI))
554554
return wifiMACAddress;
555555
#endif // COMPILE_WIFI
556556
#ifdef COMPILE_ETHERNET
557-
if (networkIsInterfaceOnline(NETWORK_ETHERNET))
557+
if (networkInterfaceHasInternet(NETWORK_ETHERNET))
558558
return ethernetMACAddress;
559559
#endif // COMPILE_ETHERNET
560560
return zero;
@@ -591,24 +591,24 @@ bool networkIsConnected(NetPriority_t *clientPriority)
591591
{
592592
// If the client is using the highest priority network and that
593593
// network is still available then continue as normal
594-
if (networkOnline && (*clientPriority == networkPriority))
594+
if (networkHasInternet_bm && (*clientPriority == networkPriority))
595595
return true;
596596

597597
// The network has changed, notify the client of the change
598-
*clientPriority = networkPriority;
599598
return false;
599+
*clientPriority = networkPriority;
600600
}
601601

602602
//----------------------------------------
603603
// Determine if the network interface is online
604604
//----------------------------------------
605-
bool networkIsInterfaceOnline(NetIndex_t index)
605+
bool networkInterfaceHasInternet(NetIndex_t index)
606606
{
607607
// Validate the index
608608
networkValidateIndex(index);
609609

610610
// Return the network interface state
611-
return (networkOnline & (1 << index)) ? true : false;
611+
return (networkHasInternet_bm & (1 << index)) ? true : false;
612612
}
613613

614614
//----------------------------------------
@@ -626,10 +626,10 @@ bool networkIsInterfaceStarted(NetIndex_t index)
626626
//----------------------------------------
627627
// Determine if any network interface is online
628628
//----------------------------------------
629-
bool networkIsOnline()
629+
bool networkHasInternet()
630630
{
631631
// Return the network state
632-
return networkOnline ? true : false;
632+
return networkHasInternet_bm ? true : false;
633633
}
634634

635635
//----------------------------------------
@@ -658,12 +658,12 @@ void networkMarkOffline(NetIndex_t index)
658658

659659
// Check for network offline
660660
bitMask = 1 << index;
661-
if (!(networkOnline & bitMask))
661+
if (!(networkHasInternet_bm & bitMask))
662662
// Already offline, nothing to do
663663
return;
664664

665665
// Mark this network as offline
666-
networkOnline &= ~bitMask;
666+
networkHasInternet_bm &= ~bitMask;
667667

668668
// Disable mDNS if necessary
669669
networkMulticastDNSStop(index);
@@ -686,7 +686,7 @@ void networkMarkOffline(NetIndex_t index)
686686
// Is the network online?
687687
index = networkIndexTable[priority];
688688
bitMask = 1 << index;
689-
if (networkOnline & bitMask)
689+
if (networkHasInternet_bm & bitMask)
690690
{
691691
// Successfully found an online network
692692
networkMulticastDNSStart(index);
@@ -716,7 +716,7 @@ void networkMarkOffline(NetIndex_t index)
716716
//----------------------------------------
717717
// Mark network online
718718
//----------------------------------------
719-
void networkMarkOnline(NetIndex_t index)
719+
void networkMarkHasInternet(NetIndex_t index)
720720
{
721721
NetMask_t bitMask;
722722
NetIndex_t previousIndex;
@@ -729,12 +729,12 @@ void networkMarkOnline(NetIndex_t index)
729729
// Check for network online
730730
bitMask = 1 << index;
731731
previousIndex = index;
732-
if (networkOnline & bitMask)
732+
if (networkHasInternet_bm & bitMask)
733733
// Already online, nothing to do
734734
return;
735735

736736
// Mark this network as online
737-
networkOnline |= bitMask;
737+
networkHasInternet_bm |= bitMask;
738738

739739
// Raise the network priority if necessary
740740
previousPriority = networkPriority;
@@ -882,7 +882,7 @@ void networkPrintStatus(uint8_t priority)
882882
bitMask = (1 << index);
883883
highestPriority = (networkPriority == priority) ? '*' : ' ';
884884
status = "Starting";
885-
if (networkOnline & bitMask)
885+
if (networkHasInternet_bm & bitMask)
886886
status = "Online";
887887
else if (networkInterfaceTable[index].boot)
888888
{
@@ -1300,7 +1300,7 @@ void networkStartDelayed(NetIndex_t index, uintptr_t parameter, bool debug)
13001300
// Only lower priority networks running, start this network interface
13011301
name = networkGetNameByIndex(index);
13021302
currentInterfaceName = networkGetCurrentInterfaceName();
1303-
if ((networkOnline & highPriorityBitMask) == 0)
1303+
if ((networkHasInternet_bm & highPriorityBitMask) == 0)
13041304
{
13051305
if (debug)
13061306
systemPrintf("%s online, Starting %s\r\n", currentInterfaceName, name);
@@ -1406,7 +1406,7 @@ void networkUpdate()
14061406

14071407
// restartWiFi is used by the settings interface to indicate SSIDs or else has changed
14081408
// Stop WiFi to allow restart with new settings
1409-
if (restartWiFi == true && networkIsInterfaceOnline(NETWORK_WIFI))
1409+
if (restartWiFi == true && networkInterfaceHasInternet(NETWORK_WIFI))
14101410
{
14111411
if (settings.debugNetworkLayer)
14121412
systemPrintln("WiFi settings changed, restarting WiFi");
@@ -1418,9 +1418,9 @@ void networkUpdate()
14181418
}
14191419

14201420
// If there are no consumers, but the network is online, shut down all networks
1421-
if (consumerCount == 0 && networkIsOnline() == true)
1421+
if (consumerCount == 0 && networkHasInternet() == true)
14221422
{
1423-
if (settings.debugNetworkLayer && networkIsInterfaceOnline(NETWORK_ETHERNET) ==
1423+
if (settings.debugNetworkLayer && networkInterfaceHasInternet(NETWORK_ETHERNET) ==
14241424
false) // Ethernet is never stopped, so only print for other networks
14251425
systemPrintln("Stopping all networks because there are no consumers");
14261426

@@ -1446,18 +1446,18 @@ void networkUpdate()
14461446
// Allow consumers to start networks
14471447
// Each network is expected to shut itself down if it is unavailable or of a lower priority
14481448
// so that a networkStart() succeeds.
1449-
if (consumerCount > 0 && networkIsOnline() == false)
1449+
if (consumerCount > 0 && networkHasInternet() == false)
14501450
{
14511451
// Attempt to start any network that is needed, in the order Ethernet/WiFi/Cellular
14521452

14531453
if (consumerTypes && (1 << NETCONSUMER_ETHERNET))
14541454
networkStart(NETWORK_ETHERNET, settings.debugNetworkLayer);
14551455

1456-
if ((networkIsOnline() == false) && (consumerTypes && (1 << NETCONSUMER_WIFI_STA)) ||
1456+
if ((networkHasInternet() == false) && (consumerTypes && (1 << NETCONSUMER_WIFI_STA)) ||
14571457
(consumerTypes && (1 << NETCONSUMER_WIFI_AP)))
14581458
networkStart(NETWORK_WIFI, settings.debugNetworkLayer);
14591459

1460-
if ((networkIsOnline() == false) && (consumerTypes && (1 << NETCONSUMER_CELLULAR)))
1460+
if ((networkHasInternet() == false) && (consumerTypes && (1 << NETCONSUMER_CELLULAR)))
14611461
networkStart(NETWORK_CELLULAR, settings.debugNetworkLayer);
14621462
}
14631463

@@ -1731,7 +1731,7 @@ uint8_t networkConsumersOnline()
17311731
consumerId |= (1 << 2);
17321732
}
17331733

1734-
// Network needed for TCP Server
1734+
// Network needed for TCP Server - May use WiFi AP or WiFi STA
17351735
if (online.tcpServer)
17361736
{
17371737
consumerCountOnline++;

Firmware/RTK_Everywhere/TcpClient.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ void tcpClientUpdate()
433433
{
434434
#ifdef COMPILE_WIFI
435435
// Determine if WiFi is required
436-
if ((!strlen(settings.tcpClientHost)) && (!networkIsInterfaceOnline(NETWORK_WIFI)))
436+
if ((!strlen(settings.tcpClientHost)) && (!networkInterfaceHasInternet(NETWORK_WIFI)))
437437
{
438438
// Wrong network type, WiFi is required but another network is being used
439439
if ((millis() - timer) >= (15 * 1000))

Firmware/RTK_Everywhere/menuFirmware.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ bool otaCheckVersion(char *versionAvailable, uint8_t versionAvailableLength)
446446
bool gotVersion = false;
447447
#ifdef COMPILE_NETWORK
448448

449-
if (networkIsOnline() == false)
449+
if (networkHasInternet() == false)
450450
{
451451
systemPrintln("Error: Network not available!");
452452
return (false);

Firmware/RTK_Everywhere/menuMain.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ void menuRadio()
638638
}
639639
else
640640
{
641-
systemPrintln("ESP-NOW channel can't be modified while WiFi is connected.");
641+
systemPrintln("ESP-NOW channel can't be modified while WiFi is active.");
642642
}
643643
}
644644
else if (settings.enableEspNow == true && incoming == 5 && settings.debugEspNow == true)

0 commit comments

Comments
 (0)