00001 // 00002 // Created by tom on 16/05/16. 00003 // 00004 00005 #ifndef ROBOTICAN_HARDWARE_INTERFACE_RELAY_H 00006 #define ROBOTICAN_HARDWARE_INTERFACE_RELAY_H 00007 00008 #include <ric_board/Relay.h> 00009 #include <robotican_hardware_interface/Device.h> 00010 #include <robotican_hardware_interface/ros_utils.h> 00011 #include <robotican_hardware_interface/RiCBoardManager.h> 00012 00013 namespace robotican_hardware { 00014 class Relay : public Device { 00015 private: 00016 byte _pin; 00017 bool _relayState; 00018 std::string _serviceName; 00019 ros::ServiceServer _server; 00020 bool _isChange; 00021 bool relayCallback(ric_board::RelayRequest &req, ric_board::RelayResponse &res); 00022 00023 public: 00024 Relay(byte id, TransportLayer *transportLayer, byte pin, std::string serviceName); 00025 virtual void write(); 00026 00027 virtual void update(const DeviceMessage *deviceMessage); 00028 00029 virtual void deviceAck(const DeviceAck *ack); 00030 00031 virtual void buildDevice(); 00032 00033 }; 00034 } 00035 00036 #endif //ROBOTICAN_HARDWARE_INTERFACE_RELAY_H