Skip to content

Commit 09bf091

Browse files
committed
Network: Add *InterfacePriority, *InterfaceRunning and loss diagram
1 parent 0f169d1 commit 09bf091

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

Firmware/RTK_Everywhere/Network.ino

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)