#pragma once #include #include #include #include #include "modules/base.hpp" #include "interfaces/net.hpp" #include "services/logger.hpp" #include "drawtypes/icon.hpp" #include "drawtypes/label.hpp" #include "drawtypes/animation.hpp" #include "drawtypes/ramp.hpp" namespace modules { DefineModule(NetworkModule, TimerModule) { static constexpr auto FORMAT_CONNECTED = "format-connected"; static constexpr auto FORMAT_PACKETLOSS = "format-packetloss"; static constexpr auto FORMAT_DISCONNECTED = "format-disconnected"; static constexpr auto TAG_RAMP_SIGNAL = ""; static constexpr auto TAG_LABEL_CONNECTED = ""; static constexpr auto TAG_LABEL_DISCONNECTED = ""; static constexpr auto TAG_LABEL_PACKETLOSS = ""; static constexpr auto TAG_ANIMATION_PACKETLOSS = ""; std::unique_ptr wired_network; std::unique_ptr wireless_network; std::unique_ptr ramp_signal; std::unique_ptr animation_packetloss; std::unique_ptr label_connected; std::unique_ptr label_connected_tokenized; std::unique_ptr label_disconnected; std::unique_ptr label_packetloss; std::unique_ptr label_packetloss_tokenized; std::string interface; concurrency::Atomic connected; concurrency::Atomic conseq_packetloss; concurrency::Atomic signal_quality; int ping_nth_update; int counter = -1; // Set to -1 to ignore the first run void subthread_routine(); public: explicit NetworkModule(std::string name); void start(); bool update(); std::string get_format(); bool build(Builder *builder, std::string tag); }; }