@@ -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
120120NetMask_t networkSeqStarting; // Track the starting sequences
121121NetMask_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++;
0 commit comments