/*----------------------------------------------------------------------------*/ /* Copyright (c) 2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #ifndef RPICONFIGSERVER_NETWORKSETTINGS_H_ #define RPICONFIGSERVER_NETWORKSETTINGS_H_ #include #include #include #include #include namespace wpi { class json; } // namespace wpi class NetworkSettings { struct private_init {}; public: explicit NetworkSettings(const private_init&) {} NetworkSettings(const NetworkSettings&) = delete; NetworkSettings& operator=(const NetworkSettings&) = delete; void SetLoop(std::shared_ptr loop) { m_loop = std::move(loop); } enum Mode { kDhcp, kStatic, kDhcpStatic }; void Set(Mode mode, wpi::StringRef address, wpi::StringRef mask, wpi::StringRef gateway, wpi::StringRef dns, std::function onFail); void UpdateStatus(); wpi::json GetStatusJson(); wpi::sig::Signal status; static std::shared_ptr GetInstance(); private: std::shared_ptr m_loop; }; #endif // RPICONFIGSERVER_NETWORKSETTINGS_H_