ecuApi.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include <boost/function.hpp>
6 #include <boost/system/error_code.hpp>
7 #include <boost/shared_ptr.hpp>
8 #include <vector>
9 #include <map>
10 #include "ecuTypes.h"
11 
12 class EcuClient;
13 
14 namespace dpyEcu {
15 
20 typedef boost::function<void(boost::system::error_code error_code)> result_handler_function;
21 
26 typedef boost::function<void(const bool &available)> service_availability_handler;
27 
33 typedef boost::function<void(boost::system::error_code& ec, std::vector<dpyEcu::Parameter> params)> parameters_handler_function;
34 
40 typedef boost::function<void(boost::system::error_code& ec, std::vector<std::string> EPIDs)> epids_handler_function;
41 
47 typedef boost::function<void(boost::system::error_code& ec, uint16_t id)> confirmation_alarm_handler_function;
53 typedef boost::function<void(boost::system::error_code& ec, std::vector<dpyEcu::Alarm> alarms)> alarms_handler_function;
54 
60 typedef boost::function<void(boost::system::error_code& ec, dpyEcu::Protocol protocols)> protocols_handler_function;
61 
67 typedef boost::function<void(boost::system::error_code& ec, dpyEcu::CANBusConfiguration config)> can_config_handler_function;
68 
74 typedef boost::function<void(boost::system::error_code& ec, std::pair<dpyEcu::Alarm, dpyEcu::Parameter> alarm_event)> alarm_event_handler_function;
75 
81 typedef boost::function<void(boost::system::error_code& ec, dpyEcu::CANBusFrame frame)> can_bus_message_handler_function;
82 
83 }
84 
90 class Ecu
91 {
92 private:
93 
94  boost::shared_ptr<EcuClient> mClient;
95 public:
96 
97  explicit Ecu(std::string ip = "127.0.0.1");
98  ~Ecu();
99  bool isAlive();
100  void monitorServiceAvailability_S(dpyEcu::service_availability_handler handler);
101  void monitorServiceAvailability_U();
102  void ecuAlarmEvent_S(dpyEcu::alarm_event_handler_function handler);
103  void ecuAlarmEvent_U();
104  void asyncGetCurrentProtocol(dpyEcu::protocols_handler_function handler);
105  void asyncGetParameter(dpyEcu::parameters_handler_function handler, std::vector<std::string> EPIDs);
106  void asyncGetAvailableEPIDs(dpyEcu::epids_handler_function handler);
107  void asyncSetAlarm(dpyEcu::confirmation_alarm_handler_function handler, dpyEcu::Alarm alarm);
108  void asyncDeleteAlarm(dpyEcu::confirmation_alarm_handler_function handler, uint32_t id);
109  void asyncGetConfiguredAlarms(dpyEcu::alarms_handler_function handler);
110  void getCanBusMessages_S(dpyEcu::can_bus_message_handler_function handler);
111  void getCanBusMessages_U();
112  void asyncAddCustomCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id, uint32_t can_mask);
113  void asyncAddStandardCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
114  void asyncAddExtendedCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
115  void asyncAddJ1939CanFilter(dpyEcu::result_handler_function handler, uint32_t pgn);
116  void asyncRemoveCustomCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
117  void asyncRemoveStandardCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
118  void asyncRemoveExtendedCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
119  void asyncRemoveJ1939CanFilter(dpyEcu::result_handler_function handler, uint32_t pgn);
120  void asyncResetCanFilter(dpyEcu::result_handler_function handler);
121  void asyncSetCanBusConfiguration(dpyEcu::result_handler_function handler, dpyEcu::CANBusConfiguration conf);
122  void asyncGetCanBusConfiguration(dpyEcu::can_config_handler_function handler);
123 };
boost::function< void(boost::system::error_code &ec, dpyEcu::Protocol protocols)> protocols_handler_function
Handler for protocols function callback. This type of function is called when the get protocols callb...
Definition: ecuApi.h:60
Alarm info.
Definition: ecuTypes.h:111
CAN BUS configuration structure.
Definition: ecuTypes.h:74
boost::function< void(boost::system::error_code &ec, dpyEcu::CANBusFrame frame)> can_bus_message_handler_function
Handler for CAN bus message function callback. This type of function is called when a CAN bus frame i...
Definition: ecuApi.h:81
boost::function< void(boost::system::error_code &ec, dpyEcu::CANBusConfiguration config)> can_config_handler_function
Handler for can config function callback. This type of function is called when the get can config cal...
Definition: ecuApi.h:67
boost::function< void(boost::system::error_code &ec, std::pair< dpyEcu::Alarm, dpyEcu::Parameter > alarm_event)> alarm_event_handler_function
Handler for alarm event function callback. This type of function is called when the ecuAlarmEvent_S c...
Definition: ecuApi.h:74
Deepsy ECU namespace that includes the different enums, structs or method signatures that should be u...
Definition: ecuApi.h:14
boost::function< void(boost::system::error_code &ec, uint16_t id)> confirmation_alarm_handler_function
Handler for status function callback. This type of function is called when the status callback is don...
Definition: ecuApi.h:47
boost::function< void(boost::system::error_code &ec, std::vector< dpyEcu::Parameter > params)> parameters_handler_function
Handler for vehicle information. This type of function is called when the status callback is done...
Definition: ecuApi.h:33
boost::function< void(boost::system::error_code &ec, std::vector< std::string > EPIDs)> epids_handler_function
Handler for vehicle available parameters. This type of function is called when the status callback is...
Definition: ecuApi.h:40
Allows to interact with a platform manager.
Definition: ecuApi.h:90
boost::function< void(boost::system::error_code &ec, std::vector< dpyEcu::Alarm > alarms)> alarms_handler_function
Handler for status function callback. This type of function is called when the status callback is don...
Definition: ecuApi.h:53
boost::function< void(const bool &available)> service_availability_handler
Prototype of the handler function used to monitor service availability.
Definition: ecuApi.h:26
boost::function< void(boost::system::error_code error_code)> result_handler_function
Prototype of the handler function for obtaining a result.
Definition: ecuApi.h:20
This class is responsible of the client logic. His main target is to subscribe to the server informat...
Definition: ecuClient.h:15