1 #include <binding/application.hpp>
2 #include <can/can-decoder.hpp>
3 #include <can/can-encoder.hpp>
6 CTLP_CAPI_REGISTER("example");
8 std::shared_ptr<message_set_t> cms = std::make_shared<message_set_t>(message_set_t{0,"example",
9 { // beginning message_definition_ vector
10 }, // end message_definition vector
11 { // beginning diagnostic_messages_ vector
12 {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
19 decoder_t::decode_obd2_response,
24 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
26 "engine.coolant.temperature",
31 decoder_t::decode_obd2_response,
36 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
43 decoder_t::decode_obd2_response,
48 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
50 "intake.manifold.pressure",
55 decoder_t::decode_obd2_response,
60 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
67 decoder_t::decode_obd2_response,
72 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
79 decoder_t::decode_obd2_response,
84 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
86 "intake.air.temperature",
91 decoder_t::decode_obd2_response,
96 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
103 decoder_t::decode_obd2_response,
108 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
115 decoder_t::decode_obd2_response,
120 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
127 decoder_t::decode_obd2_response,
132 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
139 decoder_t::decode_obd2_response,
144 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
151 decoder_t::decode_obd2_response,
156 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
158 "barometric.pressure",
163 decoder_t::decode_obd2_response,
168 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
170 "ambient.air.temperature",
175 decoder_t::decode_obd2_response,
180 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
182 "commanded.throttle.position",
187 decoder_t::decode_obd2_response,
192 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
194 "ethanol.fuel.percentage",
199 decoder_t::decode_obd2_response,
204 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
206 "accelerator.pedal.position",
211 decoder_t::decode_obd2_response,
216 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
218 "hybrid.battery-pack.remaining.life",
223 decoder_t::decode_obd2_response,
228 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
230 "engine.oil.temperature",
235 decoder_t::decode_obd2_response,
240 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
247 decoder_t::decode_obd2_response,
252 , {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
259 decoder_t::decode_obd2_response,
265 } // end diagnostic_messages_ vector
266 }); // end message_set entry
268 CTLP_ONLOAD(plugin, handle) {
269 afb_api_t api = (afb_api_t) plugin->api;
270 CtlConfigT* CtlConfig = (CtlConfigT*) afb_api_get_userdata(api);
271 application_t* app = (application_t*) getExternalData(CtlConfig);
273 return app->add_message_set(cms);