mcuApiPrivate.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "mcuApi.h"
9 
10 namespace dpyMcu {
15  namespace dpyPowerstatesflags {
16  const std::uint32_t NONE_EXIT = 0x00;
17  const std::uint32_t IGNITION_EXIT = 0x01;
18  const std::uint32_t TIMERS_EXIT = 0x02;
19  }
22  {
23  std::string port_id;
25  };
26 
32  typedef boost::function<void(boost::system::error_code error_code, dpyMcu::SerialPortProtocolConfig &)> serialport_handler_function;
33 
39  typedef boost::function<void(boost::system::error_code error_code, dpyMcu::CANBusFrame frame)> get_can_bus_message_handler_function;
40 }
41 
46 {
47 public:
52  virtual void NewCANBusFrame(dpyMcu::CANBusFrame frame) = 0;
56  virtual ~CANBusObserver()
57  {
58  }
59 };
60 
64 static std::vector<CANBusObserver*> CANBusObserversList;
65 
70 class McuPrivate: public Mcu
71 {
72 public:
73 
78  explicit McuPrivate(std::string ip = "127.0.0.1");
79 
83  virtual ~McuPrivate();
84 
90  boost::system::error_code subscribe(CANBusObserver *observer);
91 
97  boost::system::error_code unsubscribe(CANBusObserver *observer);
98 
100 #ifndef TESTING
101 
108 
115  void asyncSetTimersConfig(dpyMcu::timers_handler_function handler, std::uint32_t standby_min, std::uint32_t halt_min);
116 
123 
129  boost::system::error_code setRtcDateConfig(dpyMcu::DateConfig configDate);
130 
136 
138 
143  void asyncSetGUIDValues(dpyMcu::GUIDConfigList guids, dpyMcu::guid_handler_function handler);
145 
152  void asyncSetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number, bool gpo_value);
153 
160  boost::system::error_code setGpoDefValue(std::uint32_t gpo_number, bool gpo_value);
161 
167  void asyncGetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number);
168 
175  void asyncSetSerialPortProtocol(dpyMcu::serialport_handler_function handler, const std::string &portid, dpyMcu::SerialPortProtocol protocol);
176 
182 
188 
194 
200  void asyncSetCanBusFilters(dpyMcu::result_handler_function handler, std::list<dpyMcu::CANBusFilter> &filter_list);
201 
207 
213  boost::system::error_code setCanBusFilters(std::list<dpyMcu::CANBusFilter> &filter_list);
214 
219  boost::system::error_code resetCanBusFilters();
220 
227 
233  boost::system::error_code setCanBusConfiguration(dpyMcu::CANBusConfiguration conf);
234 
240 
241 #else
242  virtual void asyncSetPowerStateConfig(dpyMcu::power_states_handler_function handler, dpyMcu::PowerStates state, std::uint32_t flags);
243  virtual void asyncSetTimersConfig(dpyMcu::timers_handler_function handler, std::uint32_t standby_min, std::uint32_t halt_min);
245  virtual boost::system::error_code setRtcDateConfig(dpyMcu::DateConfig configDate);
247  virtual void asyncSetGUIDValues(dpyMcu::GUIDConfigList guids, dpyMcu::guid_handler_function handler);
248  virtual void asyncSetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number, bool gpo_value);
249  virtual boost::system::error_code setGpoDefValue(std::uint32_t gpo_number, bool gpo_value);
250  virtual void asyncGetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number);
251  virtual void asyncSetSerialPortProtocol(dpyMcu::serialport_handler_function handler, const std::string &portid, dpyMcu::SerialPortProtocol protocol);
255  virtual void asyncSetCanBusFilters(dpyMcu::result_handler_function handler, std::list<dpyMcu::CANBusFilter> &filter_list);
257  virtual boost::system::error_code setCanBusFilters(std::list<dpyMcu::CANBusFilter> &filter_list);
258  virtual boost::system::error_code resetCanBusFilters();
260  virtual boost::system::error_code setCanBusConfiguration(dpyMcu::CANBusConfiguration conf);
261 #endif
262 };
boost::system::error_code setGpoDefValue(std::uint32_t gpo_number, bool gpo_value)
Synchronous method which allows to set default value for a GPO.
CAN BUS configuration structure.
Definition: mcuTypes.h:67
void asyncSetCanBusConfiguration(dpyMcu::result_handler_function handler, dpyMcu::CANBusConfiguration conf)
Method to set CAN bus configuration to MCU device.
boost::system::error_code unsubscribe(CANBusObserver *observer)
Removes an observer from notification list.
boost::system::error_code setCanBusConfiguration(dpyMcu::CANBusConfiguration conf)
Method to set CAN bus configuration to MCU device.
virtual ~McuPrivate()
Destructor of the class.
void asyncResetMcu(dpyMcu::result_handler_function handler)
Method to reset MCU.
DateConfig struct which contains the response received from the service.
Definition: mcuApi.h:205
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:240
void asyncDisablePowerButton(dpyMcu::set_power_button_state_handler_function handler)
Method which disables the Power Button.
SerialPortProtocol protocol
protocol to configure (RS232,RS485)
Definition: mcuApiPrivate.h:24
boost::system::error_code setCanBusFilters(std::list< dpyMcu::CANBusFilter > &filter_list)
Method to set CAN bus filters to MCU device.
Power states flags that may be used.
void asyncSetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number, bool gpo_value)
Method which allows to set default value for a GPO.
virtual ~CANBusObserver()
Destructor.
Definition: mcuApiPrivate.h:56
boost::system::error_code subscribe(CANBusObserver *observer)
Adds an observer to notification list.
PowerStates
Possible power state to be set.
Definition: mcuApi.h:44
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:325
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:246
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:289
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
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:331
virtual void NewCANBusFrame(dpyMcu::CANBusFrame frame)=0
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)> result_handler_function
Prototype of the handler function for obtaining the result of the operations status.
Definition: mcuApi.h:344
Serial Port protocol configuration structure.
Definition: mcuApiPrivate.h:21
void asyncTestMisc(dpyMcu::test_misc_handler_function handler)
Method which requests the current MISC status.
Class which interfaces with the API logic.
Definition: mcuApi.h:353
McuPrivate(std::string ip="127.0.0.1")
Constructor of the class.
void asyncResetCanBusFilters(dpyMcu::result_handler_function handler)
Method to reset CAN bus filters in MCU device.
Deepsy Mcu namespace that includes the different enums, structs or method signatures that should be u...
Definition: mcuApi.h:16
Class which interfaces with the API logic.
Definition: mcuApiPrivate.h:70
void asyncSetCanBusFilters(dpyMcu::result_handler_function handler, std::list< dpyMcu::CANBusFilter > &filter_list)
Method to set CAN bus filters to MCU device.
std::string port_id
Port Identifier.
Definition: mcuApiPrivate.h:23
void asyncSetPowerStateConfig(dpyMcu::power_states_handler_function handler, dpyMcu::PowerStates state, std::uint32_t flags)
Method which requests to change Power State of OBU.
boost::system::error_code resetCanBusFilters()
Method to reset CAN bus filters in MCU device.
boost::system::error_code setRtcDateConfig(dpyMcu::DateConfig configDate)
Method which requests to set RTC date configuration values.
GUID list struct which contains the response received from the service.
Definition: mcuApi.h:172
void asyncSetRtcDateConfig(dpyMcu::rtc_date_handler_function handler, dpyMcu::DateConfig configDate)
Method which requests to set RTC date configuration values.
CAN Bus Observer class.
Definition: mcuApiPrivate.h:45
SerialPortProtocol
Serial Ports Protocol.
Definition: mcuTypes.h:72
void asyncGetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number)
Method which allows to get default value of a GPO.
const std::uint32_t NONE_EXIT
Power states transition set to NONE.
Definition: mcuApiPrivate.h:16
void asyncEnablePowerButton(dpyMcu::set_power_button_state_handler_function handler)
Method which enables the Power Button.
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:338
void asyncGetPowerButtonState(dpyMcu::get_power_button_state_handler_function handler)
Method which gets Power Button state.
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:295
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
const std::uint32_t TIMERS_EXIT
Power states transition set to TIMERS Values.
Definition: mcuApiPrivate.h:18
void asyncSetTimersConfig(dpyMcu::timers_handler_function handler, std::uint32_t standby_min, std::uint32_t halt_min)
Method which requests to change Standby and Halt Timers.
const std::uint32_t IGNITION_EXIT
Power states transition set to IGNITION ON.
Definition: mcuApiPrivate.h:17
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:258
It contains the CAN Bus Frame structure.
Definition: mcuTypes.h:39