#pragma once #include "item.h" #include class Signal: public Item { public: static constexpr uint8_t GO = 0; static constexpr uint8_t STOP = 1; static constexpr uint8_t SLOW = 2; static constexpr uint8_t EXPECT_GO = 0; static constexpr uint8_t EXPECT_STOP = 1 << 3; static constexpr uint8_t RIGHT = 2 << 3; static constexpr uint8_t TYPE_NORMAL = 0; static constexpr uint8_t TYPE_RELAY = 1; static constexpr uint8_t TYPE_HAS_SLOW = 1 << 1; static constexpr uint8_t TYPE_HAS_EXPECT = 1 << 2; private: uint8_t _state = GO; uint8_t _subaddress; uint8_t _type; public: Signal(uint8_t address, uint8_t subaddress, uint8_t type = TYPE_NORMAL | TYPE_HAS_SLOW); void setState(uint8_t state); uint8_t getState(); uint8_t getSubaddress(); uint16_t getPacket(); void sendData(bool single = false); uint8_t getType(); };