gpioClient.h
Go to the documentation of this file.
1 
4 #pragma once
5 #include "../../../../LIBRARIES/MIDDLEWARE/src/com/dpyMwClient.h"
6 #include "gpioApi.h"
7 #include "gpioProto.pb.h"
8 
13 class GpioClient: public DpyMwClient
14 {
15 private:
16  /*
17  * @brief Method to register callbacks with lambda functions
18  */
19  void RegisterCallbacks();
20 public:
21  /*
22  * @brief Constructor of the class
23  * @param ip IP address to be binded to the client
24  * @param dport Port to use by dealer
25  * @param sport to use by subscriber
26  */
27  GpioClient(std::string& ip, int dport, int sport);
28 
29  /*
30  * @brief Destructor of the class
31  */
32  ~GpioClient();
33 
34  /*
35  * @brief Method which requests gpios
36  * @param handler Handler to be called when a response comes from the service
37  */
38  void getGpios(dpyGpio::gpio_list_handler handler);
39 
46  void setGpioValue(dpyGpio::result_handler_function handler, const std::string& gpioid, bool value);
47 
48  /*
49  * @brief Gets gpio status: value and counter
50  * @param handler Hanlder to be called when a response comes from the service
51  * @param gpioid gpio id
52  */
53  void getGpioStatus(dpyGpio::gpio_status_handler_function handler, const std::string& gpioid);
54 
55  /*
56  * @brief Modifies gpio configuration
57  * @param handler Handler to be called when a response comes from the service
58  * @param gpioid gpio id
59  * @param gpioConfiguration configuration of the gpio to modify
60  */
61  void setGpioConfiguration(dpyGpio::result_handler_function handler, const std::string& gpioid, dpyGpio::GpioInfoConf gpioConfiguration);
62 
63 
68 
72  void gpioEvents_U();
73 };
boost::function< void(boost::system::error_code error_code)> result_handler_function
Prototype of the handler function for obtaining a result.
Definition: gpioApi.h:32
Interacts with Gpio service.
Definition: gpioClient.h:13
void gpioEvents_U()
Stops receiving GPIO events.
void gpioEvents_S(dpyGpio::gpio_status_handler_function handler)
Start receiving GPIO events.
Definition: iGpio.h:30
void setGpioValue(dpyGpio::result_handler_function handler, const std::string &gpioid, bool value)
Modifies a gpio value.
boost::function< void(boost::system::error_code error_code, const std::string &id, dpyGpio::GpioStatus status)> gpio_status_handler_function
Prototype of the handler function for getting gpio value.
Definition: gpioApi.h:47
Manages dealer and susbriber.
Definition: dpyMwClient.h:59
boost::function< void(boost::system::error_code, std::map< std::string, dpyGpio::GpioInfoConf > gpioMap)> gpio_list_handler
Prototype of the handler function for getting gpios.
Definition: gpioApi.h:39