mcuClient.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "../../../../LIBRARIES/MIDDLEWARE/src/com/dpyMwClient.h"
9 #include "mcuApiPrivate.h"
10 
11 #include "can.pb.h"
12 #include "pm.pb.h"
13 #include "upgrade.pb.h"
14 #include "leds.pb.h"
15 #include "memory.pb.h"
16 #include "status.pb.h"
17 #include "rtc.pb.h"
18 #include "gpios.pb.h"
19 #include "i2c.pb.h"
20 
21 
26 class McuClient: public DpyMwClient
27 {
28 
29 public:
36  McuClient(std::string ip, int dport, int sport);
37 
41  ~McuClient();
42 
48 
56  void asyncSetLedsConfig(dpyMcu::leds_handler_function handler, dpyMcu::LedsColor color, std::uint32_t period, std::uint32_t duty_cycle);
57 
65 
77  void asyncSetBatteryProtectionConfig(dpyMcu::battery_protection_handler_function handler, float idle_voltage, float voltage_percentage_threshold,
78  float hysteresis_percentage, std::uint32_t grace_period_minutes);
79 
85 
92 
98 
105  void asyncSetTimersConfig(dpyMcu::timers_handler_function handler, std::uint32_t standby_minutes, std::uint32_t halt_minutes);
106 
112 
118 
124 
130 
136 
142 
148 
154 
160  void asyncGetGpioValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpio_number);
161 
167 
174  void asyncSetGpioValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpio_number, bool gpio_value);
175 
176 
185  void asyncGetI2CValue(dpyMcu::i2c_handler_function handler, unsigned char busid, unsigned char deviceid, std::list<unsigned char> address, int lenght);
186 
196  void asyncSetI2CValue(dpyMcu::i2c_handler_function handler, unsigned char busid, unsigned char deviceid, std::list<unsigned char> address, std::list<unsigned char> values);
197 
204 
210 
212 
217  void asyncSetGUIDValues(dpyMcu::GUIDConfigList guids, dpyMcu::guid_handler_function handler);
219 
220 
224  void getPowerInformation_U();
225 
231 
238  void asyncSetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number, bool gpo_value);
239 
245  void asyncGetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number);
246 
253  void asyncSetSerialPortProtocol(dpyMcu::serialport_handler_function handler, const std::string &portid, dpyMcu::SerialPortProtocol protocol);
254 
260 
264  void getCANMessages_U();
265 
271 
277 
283 
289  void asyncSetCanBusFilters(dpyMcu::result_handler_function handler, std::list<dpyMcu::CANBusFilter> &filter_list);
290 
296 
303 
309 
310 private:
314  void RegisterCallbacks();
315 
316 };
boost::function< void(boost::system::error_code error_code)> result_handler_function
Prototype of the handler function for obtaining the result of the operations status.
Definition: mcuApi.h:342
void asyncGetI2CValue(dpyMcu::i2c_handler_function handler, unsigned char busid, unsigned char deviceid, std::list< unsigned char > address, int lenght)
Method which requests one message with I2C information.
boost::function< void(boost::system::error_code error_code, dpyMcu::CANBusFrame frame)> get_can_bus_message_handler_function
Prototype of the handler function for getting CAN Bus Messages.
Definition: mcuApiPrivate.h:39
void asyncEnablePowerButton(dpyMcu::set_power_button_state_handler_function handler)
Method which enables the Power Button.
void getPowerInformation_U()
Method to stop receiving Power information coming from the service periodically.
boost::function< void(boost::system::error_code error_code, dpyMcu::TimersConfig &)> timers_handler_function
Prototype of the handler function for obtaining the Timers Configuration.
Definition: mcuApi.h:244
void asyncGetLedsConfig(dpyMcu::leds_handler_function handler)
Method which requests the LED color state.
void asyncGetGpioValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpio_number)
Method which requests one message with GPIO information.
McuClient(std::string ip, int dport, int sport)
Constructor of the class.
void asyncResetCanBusFilters(dpyMcu::result_handler_function handler)
Method to reset CAN bus filters in MCU device.
void asyncGetBatteryProtectionConfig(dpyMcu::battery_protection_handler_function handler)
Method which requests to get battery protection configuration values.
DateConfig struct which contains the response received from the service.
Definition: mcuApi.h:203
void asyncGetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number)
Method to get default value of a GPO pin.
Class with the logic of the client.
Definition: mcuClient.h:26
void asyncSetSerialPortProtocol(dpyMcu::serialport_handler_function handler, const std::string &portid, dpyMcu::SerialPortProtocol protocol)
Method to set serial protocol to MCU-placed serial ports.
boost::function< void(boost::system::error_code error_code, dpyMcu::MCUStatus &)> mcu_status_handler_function
Prototype of the handler function for obtaining the MCU Status.
Definition: mcuApi.h:275
void asyncGetRtcDateConfig(dpyMcu::rtc_date_handler_function handler)
Method which requests to get RTC date configuration values.
void asyncSetTimersConfig(dpyMcu::timers_handler_function handler, std::uint32_t standby_minutes, std::uint32_t halt_minutes)
Method which requests to change Standby and Halt Timers.
void asyncSetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number, bool gpo_value)
Method to set default value to a GPO pin.
boost::function< void(boost::system::error_code error_code, const dpyFirmware::FirmwareVersionInfo &fw_version)> version_handler_function
Prototype of the handler function for obtaining the fw version.
Definition: mcuApi.h:311
void asyncSetRtcDateConfig(dpyMcu::rtc_date_handler_function handler, dpyMcu::DateConfig config)
Method which requests to set RTC date configuration values.
void asyncGetVersion(dpyMcu::version_handler_function handler, dpyFirmware::Rfs rfs)
Method which requests the firware version of the MCU.
boost::function< void(boost::system::error_code error_code, dpyMcu::GpioConfig &)> gpio_handler_function
Prototype of the handler function for obtaining the GPIO Configuration.
Definition: mcuApi.h:293
void asyncGetGpiosEvents(dpyMcu::gpios_events_handler_function handler)
Method which receives one message with Gpios events coming from the service.
void asyncGetPowerButtonState(dpyMcu::get_power_button_state_handler_function handler)
Method which gets Power Button state.
void getCANMessages_S(dpyMcu::get_can_bus_message_handler_function handler)
Establish the handler that the will be called when a CAN bus message is received. ...
void asyncSetLedsConfig(dpyMcu::leds_handler_function handler, dpyMcu::LedsColor color, std::uint32_t period, std::uint32_t duty_cycle)
Method which requests to change the LED color state.
void asyncSetCanBusFilters(dpyMcu::result_handler_function handler, std::list< dpyMcu::CANBusFilter > &filter_list)
Method to set CAN bus filters to MCU device.
void asyncGetEQVar(dpyMcu::eqvar_handler_function handler)
Method which requests equipment and variant identifiers.
void asyncGetCanStatus(dpyMcu::can_status_handler_function handler)
Method to get the current CAN Bus status.
Rfs
Defines the possible root file systems where binaries are located.
Definition: firmware.h:54
void asyncResetMcu(dpyMcu::result_handler_function handler)
Method to reset MCU device.
void asyncSetPowerStateConfig(dpyMcu::power_states_handler_function handler, dpyMcu::PowerStates state, std::uint32_t flags)
Method which requests to change Power State of OBU.
void asyncTestMisc(dpyMcu::test_misc_handler_function handler)
Method which requests the current MISC status.
boost::function< void(boost::system::error_code error_code, dpyMcu::CanStatusEvent &)> can_status_handler_function
Prototype of the handler function for obtaining the CAN Status Information.
Definition: mcuApi.h:317
void getCANMessages_U()
Stop the calls to the handler that updates CAN bus messages.
boost::function< void(boost::system::error_code error_code, dpyMcu::WorkingTimeConfig &)> working_time_handler_function
Prototype of the handler function for obtaining the Working Time Values.
Definition: mcuApi.h:269
void asyncGetPowerInformation(dpyMcu::power_mng_handler_function handler)
Method which requests one message with Power information coming from the service. ...
void asyncGetMCUStatus(dpyMcu::mcu_status_handler_function handler)
Method which gets one message indicating hardware and software exceptions coming from MCU...
boost::function< void(boost::system::error_code error_code, dpyMcu::GpiosAvailable &)> gpios_events_handler_function
Prototype of the handler function for obtaining the GPIO Events.
Definition: mcuApi.h:299
void asyncSetBatteryProtectionConfig(dpyMcu::battery_protection_handler_function handler, float idle_voltage, float voltage_percentage_threshold, float hysteresis_percentage, std::uint32_t grace_period_minutes)
Method which requests to set battery protection configuration values.
boost::function< void(boost::system::error_code error_code, bool enabled)> get_power_button_state_handler_function
Prototype of the handler function for obtaining the result of power button.
Definition: mcuApi.h:336
void asyncSetCanBusConfiguration(dpyMcu::result_handler_function handler, dpyMcu::CANBusConfiguration conf)
Method to set CAN bus configuration to MCU device.
SerialPortProtocol
Serial Ports Protocol.
Definition: mcuTypes.h:72
boost::function< void(boost::system::error_code error_code, dpyMcu::I2CValue &)> i2c_handler_function
Prototype of the handler function for obtaining the I2C information.
Definition: mcuApi.h:305
void asyncSetI2CValue(dpyMcu::i2c_handler_function handler, unsigned char busid, unsigned char deviceid, std::list< unsigned char > address, std::list< unsigned char > values)
Method which requests to set a I2C address pin with a value.
boost::function< void(boost::system::error_code error_code, dpyMcu::SerialPortProtocolConfig &)> serialport_handler_function
Prototype of the handler function for setting the Serial Port Protocol.
Definition: mcuApiPrivate.h:32
~McuClient()
Destructor of the class.
boost::function< void(boost::system::error_code error_code, dpyMcu::GUIDConfigList &)> guid_handler_function
Prototype of the handler function for obtaining the GUIDs.
Definition: mcuApi.h:256
boost::function< void(boost::system::error_code error_code)> set_power_button_state_handler_function
Prototype of the handler function for obtaining the result of power button.
Definition: mcuApi.h:329
CAN BUS configuration structure.
Definition: mcuTypes.h:67
boost::function< void(boost::system::error_code error_code, dpyMcu::UpdateConfig &)> update_firmware_handler_function
Prototype of the handler function for obtaining the updated configuration.
Definition: mcuApi.h:250
boost::function< void(boost::system::error_code error_code, dpyMcu::BatteryProtectionConfig &)> battery_protection_handler_function
Prototype of the handler function for obtaining the Battery Protection Configuration.
Definition: mcuApi.h:281
boost::function< void(boost::system::error_code error_code, dpyMcu::DateConfig &)> rtc_date_handler_function
Prototype of the handler function for obtaining the RTC Date Configuration.
Definition: mcuApi.h:287
void getPowerInformation_S(dpyMcu::power_mng_handler_function handler)
Method which receives one message with Power information coming from the service periodically.
boost::function< void(boost::system::error_code error_code, dpyMcu::PowerStateConfig &)> power_states_handler_function
Prototype of the handler function for obtaining the Power State Configuration.
Definition: mcuApi.h:238
void asyncDisablePowerButton(dpyMcu::set_power_button_state_handler_function handler)
Method which enables the Power Button.
void asyncGetGUIDValues(dpyMcu::guid_handler_function handler)
Method which requests one message with Part Number, Serial Number nad CIDL of the equipment...
Manages dealer and susbriber.
Definition: dpyMwClient.h:59
GUID list struct which contains the response received from the service.
Definition: mcuApi.h:170
void asyncGetWorkingTimeValues(dpyMcu::working_time_handler_function handler)
Method which requests one message with the Power-On, Standby and Halt States working half-hours...
PowerStates
Possible power state to be set.
Definition: mcuApi.h:43
void asyncUpdateMCU(dpyMcu::update_firmware_handler_function handler)
Method which updates the firmware of the MCU (the new image must be in the right PATH of the system) ...
boost::function< void(boost::system::error_code error_code)> test_misc_handler_function
Prototype of the handler function for obtaining the current MISC status.
Definition: mcuApi.h:323
void asyncGetTimersConfig(dpyMcu::timers_handler_function handler)
Method which requests one message with Standby and Halt Timers.
boost::function< void(boost::system::error_code error_code, char &, char &)> eqvar_handler_function
Prototype of the handler function for obtaining the GUIDs.
Definition: mcuApi.h:263
boost::function< void(boost::system::error_code error_code, dpyMcu::LedsConfig &)> leds_handler_function
Prototype of the handler function for obtaining the LEDs configuration.
Definition: mcuApi.h:232
void asyncSetGpioValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpio_number, bool gpio_value)
Method which requests to set a GPIO pin with a value.
boost::function< void(boost::system::error_code error_code, dpyMcu::PowerInformationConfig &)> power_mng_handler_function
Prototype of the handler function for obtaining the Power Information.
Definition: mcuApi.h:226
LedsColor
Possible color to be set.
Definition: mcuApi.h:31