@@ -1269,6 +1269,37 @@ void networkInterfaceInternetConnectionAvailable(NetIndex_t index)
12691269 networkMulticastDNSStart (previousIndex);
12701270}
12711271
1272+ /*
1273+ Network Loss Handling:
1274+
1275+ Arduino IP lost event
1276+ |
1277+ |
1278+ V
1279+ networkInterfaceEventInternetLost
1280+ |
1281+ | Set internet lost event flag
1282+ V
1283+ networkUpdate
1284+ |
1285+ | Clear internet lost event flag
1286+ V
1287+ +<------- Fake connection loss
1288+ |
1289+ V
1290+ networkInterfaceInternetConnectionLost
1291+ |
1292+ | Notify Interface of connection loss
1293+ V
1294+ .----------------+----------------.
1295+ | |
1296+ | |
1297+ V V
1298+ networkInterfaceRunning Interface stop sequence
1299+ called by xxxUpdate
1300+ or xxxEnabled
1301+ */
1302+
12721303// ----------------------------------------
12731304// Mark network interface as having NO access to the internet
12741305// ----------------------------------------
@@ -1377,6 +1408,35 @@ void networkInterfaceInternetConnectionLost(NetIndex_t index)
13771408 }
13781409}
13791410
1411+ // ----------------------------------------
1412+ // Get the interface priority
1413+ // ----------------------------------------
1414+ NetPriority_t networkInterfacePriority (NetIndex_t index)
1415+ {
1416+ NetPriority_t priority;
1417+
1418+ // Validate the index
1419+ networkValidateIndex (index);
1420+
1421+ // Get the interface priority
1422+ priority = networkIndexTable[index];
1423+ return priority;
1424+ }
1425+
1426+ // ----------------------------------------
1427+ // Determine if the interface should be running
1428+ // ----------------------------------------
1429+ NetPriority_t networkInterfaceRunning (NetIndex_t index)
1430+ {
1431+ NetPriority_t priority;
1432+
1433+ // Get the interface priority
1434+ priority = networkInterfacePriority (index);
1435+
1436+ // Return the running status
1437+ return (networkPriority >= priority);
1438+ }
1439+
13801440// ----------------------------------------
13811441// Determine if the specified network interface is higher priority than
13821442// the current network interface
@@ -2434,6 +2494,25 @@ void networkUpdate()
24342494 }
24352495}
24362496
2497+ // ----------------------------------------
2498+ // Set the default network interface
2499+ // ----------------------------------------
2500+ void networkUseDefaultInterface ()
2501+ {
2502+ NetIndex_t index;
2503+ bool isDefault;
2504+
2505+ // Get the network index
2506+ index = networkGetCurrentInterfaceIndex ();
2507+ if (index < NETWORK_OFFLINE)
2508+ {
2509+ // Get the default network interface
2510+ isDefault = networkInterfaceTable[index].netif ->isDefault ();
2511+ if (!isDefault)
2512+ networkInterfaceTable[index].netif ->setDefault ();
2513+ }
2514+ }
2515+
24372516// ----------------------------------------
24382517// Add a network user
24392518// ----------------------------------------
0 commit comments