refactored the IP address handling code
It is now split up much more cleanly, has less stuff running on the
cRIO, and doesn't do as much of the stuff with string manipulation.
Before, it was kind of ridicilous how many times the code converted IP
addresses back and forth between 32-bit ints and strings to do various
manipulations and pass them around. Also, there was various junk that
the cRIO code did that it did not need to be doing.
diff --git a/frc971/crio/dumb_main.cc b/frc971/crio/dumb_main.cc
index 4accd9c..8cf0eb4 100644
--- a/frc971/crio/dumb_main.cc
+++ b/frc971/crio/dumb_main.cc
@@ -1,17 +1,23 @@
#include "WPILib/NetworkRobot/NetworkRobot.h"
#include "WPILib/RobotBase.h"
-#include "aos/common/Configuration.h"
+
+#include "aos/common/network_port.h"
+#include "aos/crio/ip.h"
+#include "aos/common/util.h"
+
+using ::aos::util::MakeIPAddress;
+using ::aos::util::GetOwnIPAddress;
namespace frc971 {
class MyRobot : public NetworkRobot {
public:
MyRobot() : NetworkRobot(static_cast<uint16_t>(::aos::NetworkPort::kMotors),
- ::aos::configuration::GetIPAddress(
- ::aos::configuration::NetworkDevice::kAtom),
+ ::MakeIPAddress(::GetOwnIPAddress(),
+ ::aos::NetworkAddress::kAtom),
static_cast<uint16_t>(::aos::NetworkPort::kDS),
- ::aos::configuration::GetIPAddress(
- ::aos::configuration::NetworkDevice::kAtom)) {}
+ ::MakeIPAddress(::GetOwnIPAddress(),
+ ::aos::NetworkAddress::kAtom)) {}
};
} // namespace frc971