// // Created by yingluo907 on 2019/4/11. // #ifndef HGSCANSERVICE_GPIO_H #define HGSCANSERVICE_GPIO_H #include class Gpio { public: enum GpioLevel { Low, High }; public: static const std::string falling; static const std::string rising; static const std::string both; static const std::string none; static const std::string in; static const std::string out; public: Gpio(int port); int getPort(); void setValue(GpioLevel level); GpioLevel getValue(); std::string getDirection(); void setDirection(std::string direction); void setActive(GpioLevel level); GpioLevel getActive(); void setEdge(std::string edge); std::string getEdge(); std::string getValuePath() { return path_value; } private: const std::string path_gpiobase = "/sys/class/gpio"; int port; std::string path_value = "value"; std::string path_edge = "edge"; std::string path_direction = "direction"; std::string path_active_low = "active_low"; }; class GpioOut : public Gpio { public: GpioOut(int port); }; #endif //HGSCANSERVICE_GPIO_H