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, std::pair<dpyEcu::Alarm, dpyEcu::Parameter> alarm_event)> alarm_event_handler_function;
68 
74 typedef boost::function<void(boost::system::error_code& ec, dpyEcu::CANBusFrame frame)> can_bus_message_handler_function;
75 
76 }
77 
83 class Ecu
84 {
85 private:
86 
87  boost::shared_ptr<EcuClient> mClient;
88 public:
89 
90  explicit Ecu(std::string ip = "127.0.0.1");
91  ~Ecu();
92  bool isAlive();
93  void monitorServiceAvailability_S(dpyEcu::service_availability_handler handler);
94  void monitorServiceAvailability_U();
95  void ecuAlarmEvent_S(dpyEcu::alarm_event_handler_function handler);
96  void ecuAlarmEvent_U();
97  void asyncGetCurrentProtocol(dpyEcu::protocols_handler_function handler);
98  void asyncGetParameter(dpyEcu::parameters_handler_function handler, std::vector<std::string> EPIDs);
99  void asyncGetAvailableEPIDs(dpyEcu::epids_handler_function handler);
100  void asyncSetAlarm(dpyEcu::confirmation_alarm_handler_function handler, dpyEcu::Alarm alarm);
101  void asyncDeleteAlarm(dpyEcu::confirmation_alarm_handler_function handler, uint32_t id);
102  void asyncGetConfiguredAlarms(dpyEcu::alarms_handler_function handler);
103  void getCanBusMessages_S(dpyEcu::can_bus_message_handler_function handler);
104  void getCanBusMessages_U();
105  void asyncAddCustomCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id, uint32_t can_mask);
106  void asyncAddStandardCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
107  void asyncAddExtendedCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
108  void asyncAddJ1939CanFilter(dpyEcu::result_handler_function handler, uint32_t pgn);
109  void asyncRemoveCustomCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
110  void asyncRemoveStandardCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
111  void asyncRemoveExtendedCanFilter(dpyEcu::result_handler_function handler, uint32_t can_id);
112  void asyncRemoveJ1939CanFilter(dpyEcu::result_handler_function handler, uint32_t pgn);
113  void asyncResetCanFilter(dpyEcu::result_handler_function handler);
114  void asyncSetCanBusConfiguration(dpyEcu::result_handler_function handler, dpyEcu::CANBusConfiguration conf);
115 };
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:101
CAN BUS configuration structure.
Definition: ecuTypes.h:66
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:74
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:67
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:83
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