21 #include "pifacedigital.h"    25                            Direction direction, 
bool value, uint8_t hardware_address)
    27     , sock_(ctx, 
zmqpp::socket_type::rep)
    28     , bus_push_(new 
zmqpp::socket(ctx, 
zmqpp::socket_type::push))
    30     , direction_(direction)
    31     , default_value_(value)
    32     , hardware_address_(hardware_address)
    35     DEBUG(
"trying to bind to " << (
"inproc://" + name));
    36     sock_.bind(
"inproc://" + name);
    37     bus_push_->connect(
"inproc://zmq-bus-pull");
    56     this->
name_             = o.name_;
    61     o.bus_push_ = 
nullptr;
    74     else if (frame1 == 
"OFF")
    76     else if (frame1 == 
"TOGGLE")
    78     else if (frame1 == 
"STATE")
    81         ERROR(
"Invalid command received (" << frame1
    82                                            << 
"). Potential missconfiguration !");
    83     sock_.send(ok ? 
"OK" : 
"KO");
    91     if (msg && msg->parts() > 1)
    97             std::chrono::system_clock::now() + std::chrono::milliseconds(duration);
   135     return pifacedigital_read_bit(
   150     return std::chrono::system_clock::time_point::max();
 std::chrono::system_clock::time_point next_update() const
This method shall returns the time point at which we want to be updated. 
 
bool turn_on(zmqpp::message *msg=nullptr)
Write to PFDigital to turn the gpio on. 
 
bool turn_off()
Write to PFDigital turn the gpio off. 
 
zmqpp::socket * bus_push_
PUSH socket to write to the bus. 
 
zmqpp::socket sock_
listen to command from other component. 
 
void handle_message()
The PFGpioModule will register this method so its called when a message is ready on the pin socket...
 
This is a implementation class. 
 
PFDigitalPin(zmqpp::context &ctx, const std::string &name, int gpio_no, Direction direction, bool value, uint8_t hardware_address)
Create a new GPIO pin. 
 
void update()
Let the GPIO pin perform internal task. 
 
bool want_update_
Does this object wants to be update()d ? 
 
void send_state()
Send the current GPIO state on the socket. 
 
uint8_t hardware_address_
 
bool read_value()
Ask the PiFace device for this pin's value and return it. 
 
std::chrono::system_clock::time_point next_update_time_
Time point of next wished update. 
 
const Direction direction_
This is the direction of the GPIO pin. 
 
bool default_value_
The default value of the pin, it is only relevant is the pin is output.