Use newly generated cpp file with default encoders
[apps/agl-service-can-low-level.git] / examples / toyota / auris / application-generated.cpp
1 #include "application.hpp"
2 #include "../can/can-decoder.hpp"
3 #include "../can/can-encoder.hpp"
4
5 application_t::application_t()
6         : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}}
7         , can_message_set_{
8                 {std::make_shared<can_message_set_t>(can_message_set_t{0,"example",
9                         { // beginning can_message_definition_ vector
10                                 {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
11                                         { // beginning can_signals vector
12                                                 {std::make_shared<can_signal_t> (can_signal_t{
13                                                         "engine.speed",
14                                                         16,
15                                                         16,
16                                                         0.250000f,
17                                                         0.00000,
18                                                         0,
19                                                         0,
20                                                         frequency_clock_t(0.00000f),
21                                                         true,
22                                                         false,
23                                                         {
24                                                         },
25                                                         false,
26                                                         nullptr,
27                                                         nullptr,
28                                                         false
29                                                 })},
30                                                 {std::make_shared<can_signal_t> (can_signal_t{
31                                                         "fuel.level.low",
32                                                         55,
33                                                         1,
34                                                         1.00000f,
35                                                         0.00000,
36                                                         0,
37                                                         0,
38                                                         frequency_clock_t(0.00000f),
39                                                         true,
40                                                         false,
41                                                         {
42                                                         },
43                                                         false,
44                                                         decoder_t::decode_boolean,
45                                                         nullptr,
46                                                         false
47                                                 })},
48                                                 {std::make_shared<can_signal_t> (can_signal_t{
49                                                         "fuel.level",
50                                                         8,
51                                                         8,
52                                                         0.392157f,
53                                                         0.00000,
54                                                         0,
55                                                         0,
56                                                         frequency_clock_t(0.00000f),
57                                                         true,
58                                                         false,
59                                                         {
60                                                         },
61                                                         false,
62                                                         nullptr,
63                                                         nullptr,
64                                                         false
65                                                 })}
66                                         } // end can_signals vector
67                                 })} // end can_message_definition entry
68 ,                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
69                                         { // beginning can_signals vector
70                                                 {std::make_shared<can_signal_t> (can_signal_t{
71                                                         "vehicle.average.speed",
72                                                         0,
73                                                         15,
74                                                         0.0156250f,
75                                                         0.00000,
76                                                         0,
77                                                         0,
78                                                         frequency_clock_t(0.00000f),
79                                                         true,
80                                                         false,
81                                                         {
82                                                         },
83                                                         false,
84                                                         nullptr,
85                                                         nullptr,
86                                                         false
87                                                 })}
88                                         } // end can_signals vector
89                                 })} // end can_message_definition entry
90 ,                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
91                                         { // beginning can_signals vector
92                                                 {std::make_shared<can_signal_t> (can_signal_t{
93                                                         "engine.oil.temp",
94                                                         16,
95                                                         8,
96                                                         1.00000f,
97                                                         0.00000,
98                                                         0,
99                                                         0,
100                                                         frequency_clock_t(0.00000f),
101                                                         true,
102                                                         false,
103                                                         {
104                                                         },
105                                                         false,
106                                                         nullptr,
107                                                         nullptr,
108                                                         false
109                                                 })},
110                                                 {std::make_shared<can_signal_t> (can_signal_t{
111                                                         "engine.oil.temp.high",
112                                                         7,
113                                                         1,
114                                                         1.00000f,
115                                                         0.00000,
116                                                         0,
117                                                         0,
118                                                         frequency_clock_t(0.00000f),
119                                                         true,
120                                                         false,
121                                                         {
122                                                         },
123                                                         false,
124                                                         decoder_t::decode_boolean,
125                                                         nullptr,
126                                                         false
127                                                 })}
128                                         } // end can_signals vector
129                                 })} // end can_message_definition entry
130 ,                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
131                                         { // beginning can_signals vector
132                                                 {std::make_shared<can_signal_t> (can_signal_t{
133                                                         "doors.boot.open",
134                                                         47,
135                                                         1,
136                                                         1.00000f,
137                                                         0.00000,
138                                                         0,
139                                                         0,
140                                                         frequency_clock_t(0.00000f),
141                                                         true,
142                                                         false,
143                                                         {
144                                                         },
145                                                         false,
146                                                         decoder_t::decode_boolean,
147                                                         nullptr,
148                                                         false
149                                                 })},
150                                                 {std::make_shared<can_signal_t> (can_signal_t{
151                                                         "doors.front_left.open",
152                                                         43,
153                                                         1,
154                                                         1.00000f,
155                                                         0.00000,
156                                                         0,
157                                                         0,
158                                                         frequency_clock_t(0.00000f),
159                                                         true,
160                                                         false,
161                                                         {
162                                                         },
163                                                         false,
164                                                         decoder_t::decode_boolean,
165                                                         nullptr,
166                                                         false
167                                                 })},
168                                                 {std::make_shared<can_signal_t> (can_signal_t{
169                                                         "doors.front_right.open",
170                                                         44,
171                                                         1,
172                                                         1.00000f,
173                                                         0.00000,
174                                                         0,
175                                                         0,
176                                                         frequency_clock_t(0.00000f),
177                                                         true,
178                                                         false,
179                                                         {
180                                                         },
181                                                         false,
182                                                         decoder_t::decode_boolean,
183                                                         nullptr,
184                                                         false
185                                                 })},
186                                                 {std::make_shared<can_signal_t> (can_signal_t{
187                                                         "doors.rear_left.open",
188                                                         46,
189                                                         1,
190                                                         1.00000f,
191                                                         0.00000,
192                                                         0,
193                                                         0,
194                                                         frequency_clock_t(0.00000f),
195                                                         true,
196                                                         false,
197                                                         {
198                                                         },
199                                                         false,
200                                                         decoder_t::decode_boolean,
201                                                         nullptr,
202                                                         false
203                                                 })},
204                                                 {std::make_shared<can_signal_t> (can_signal_t{
205                                                         "doors.rear_right.open",
206                                                         45,
207                                                         4,
208                                                         1.00000f,
209                                                         0.00000,
210                                                         0,
211                                                         0,
212                                                         frequency_clock_t(0.00000f),
213                                                         true,
214                                                         false,
215                                                         {
216                                                         },
217                                                         false,
218                                                         decoder_t::decode_boolean,
219                                                         nullptr,
220                                                         false
221                                                 })}
222                                         } // end can_signals vector
223                                 })} // end can_message_definition entry
224 ,                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x799,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
225                                         { // beginning can_signals vector
226                                                 {std::make_shared<can_signal_t> (can_signal_t{
227                                                         "windows.front_left.open",
228                                                         43,
229                                                         1,
230                                                         1.00000f,
231                                                         0.00000,
232                                                         0,
233                                                         0,
234                                                         frequency_clock_t(0.00000f),
235                                                         true,
236                                                         false,
237                                                         {
238                                                         },
239                                                         false,
240                                                         decoder_t::decode_boolean,
241                                                         nullptr,
242                                                         false
243                                                 })},
244                                                 {std::make_shared<can_signal_t> (can_signal_t{
245                                                         "windows.front_right.open",
246                                                         44,
247                                                         1,
248                                                         1.00000f,
249                                                         0.00000,
250                                                         0,
251                                                         0,
252                                                         frequency_clock_t(0.00000f),
253                                                         true,
254                                                         false,
255                                                         {
256                                                         },
257                                                         false,
258                                                         decoder_t::decode_boolean,
259                                                         nullptr,
260                                                         false
261                                                 })},
262                                                 {std::make_shared<can_signal_t> (can_signal_t{
263                                                         "windows.rear_left.open",
264                                                         46,
265                                                         1,
266                                                         1.00000f,
267                                                         0.00000,
268                                                         0,
269                                                         0,
270                                                         frequency_clock_t(0.00000f),
271                                                         true,
272                                                         false,
273                                                         {
274                                                         },
275                                                         false,
276                                                         decoder_t::decode_boolean,
277                                                         nullptr,
278                                                         false
279                                                 })},
280                                                 {std::make_shared<can_signal_t> (can_signal_t{
281                                                         "windows.rear_right.open",
282                                                         45,
283                                                         4,
284                                                         1.00000f,
285                                                         0.00000,
286                                                         0,
287                                                         0,
288                                                         frequency_clock_t(0.00000f),
289                                                         true,
290                                                         false,
291                                                         {
292                                                         },
293                                                         false,
294                                                         decoder_t::decode_boolean,
295                                                         nullptr,
296                                                         false
297                                                 })}
298                                         } // end can_signals vector
299                                 })} // end can_message_definition entry
300
301                 }, // end can_message_definition vector
302                         { // beginning diagnostic_messages_ vector
303                                 {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
304                                         4,
305                                         "engine.load",
306                                         0,
307                                         0,
308                                         UNIT::INVALID,
309                                         5.00000f,
310                                         decoder_t::decode_obd2_response,
311                                         nullptr,
312                                         true,
313                                         false
314                                 })}
315 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
316                                         5,
317                                         "engine.coolant.temperature",
318                                         0,
319                                         0,
320                                         UNIT::INVALID,
321                                         1.00000f,
322                                         decoder_t::decode_obd2_response,
323                                         nullptr,
324                                         true,
325                                         false
326                                 })}
327 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
328                                         10,
329                                         "fuel.pressure",
330                                         0,
331                                         0,
332                                         UNIT::INVALID,
333                                         1.00000f,
334                                         decoder_t::decode_obd2_response,
335                                         nullptr,
336                                         true,
337                                         false
338                                 })}
339 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
340                                         11,
341                                         "intake.manifold.pressure",
342                                         0,
343                                         0,
344                                         UNIT::INVALID,
345                                         1.00000f,
346                                         decoder_t::decode_obd2_response,
347                                         nullptr,
348                                         true,
349                                         false
350                                 })}
351 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
352                                         12,
353                                         "engine.speed",
354                                         0,
355                                         0,
356                                         UNIT::INVALID,
357                                         5.00000f,
358                                         decoder_t::decode_obd2_response,
359                                         nullptr,
360                                         true,
361                                         false
362                                 })}
363 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
364                                         13,
365                                         "vehicle.speed",
366                                         0,
367                                         0,
368                                         UNIT::INVALID,
369                                         5.00000f,
370                                         decoder_t::decode_obd2_response,
371                                         nullptr,
372                                         true,
373                                         false
374                                 })}
375 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
376                                         15,
377                                         "intake.air.temperature",
378                                         0,
379                                         0,
380                                         UNIT::INVALID,
381                                         1.00000f,
382                                         decoder_t::decode_obd2_response,
383                                         nullptr,
384                                         true,
385                                         false
386                                 })}
387 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
388                                         16,
389                                         "mass.airflow",
390                                         0,
391                                         0,
392                                         UNIT::INVALID,
393                                         5.00000f,
394                                         decoder_t::decode_obd2_response,
395                                         nullptr,
396                                         true,
397                                         false
398                                 })}
399 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
400                                         17,
401                                         "throttle.position",
402                                         0,
403                                         0,
404                                         UNIT::INVALID,
405                                         5.00000f,
406                                         decoder_t::decode_obd2_response,
407                                         nullptr,
408                                         true,
409                                         false
410                                 })}
411 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
412                                         31,
413                                         "running.time",
414                                         0,
415                                         0,
416                                         UNIT::INVALID,
417                                         1.00000f,
418                                         decoder_t::decode_obd2_response,
419                                         nullptr,
420                                         true,
421                                         false
422                                 })}
423 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
424                                         45,
425                                         "EGR.error",
426                                         0,
427                                         0,
428                                         UNIT::INVALID,
429                                         0.00000f,
430                                         decoder_t::decode_obd2_response,
431                                         nullptr,
432                                         true,
433                                         false
434                                 })}
435 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
436                                         47,
437                                         "fuel.level",
438                                         0,
439                                         0,
440                                         UNIT::INVALID,
441                                         1.00000f,
442                                         decoder_t::decode_obd2_response,
443                                         nullptr,
444                                         true,
445                                         false
446                                 })}
447 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
448                                         51,
449                                         "barometric.pressure",
450                                         0,
451                                         0,
452                                         UNIT::INVALID,
453                                         1.00000f,
454                                         decoder_t::decode_obd2_response,
455                                         nullptr,
456                                         true,
457                                         false
458                                 })}
459 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
460                                         70,
461                                         "ambient.air.temperature",
462                                         0,
463                                         0,
464                                         UNIT::INVALID,
465                                         1.00000f,
466                                         decoder_t::decode_obd2_response,
467                                         nullptr,
468                                         true,
469                                         false
470                                 })}
471 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
472                                         76,
473                                         "commanded.throttle.position",
474                                         0,
475                                         0,
476                                         UNIT::INVALID,
477                                         1.00000f,
478                                         decoder_t::decode_obd2_response,
479                                         nullptr,
480                                         true,
481                                         false
482                                 })}
483 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
484                                         82,
485                                         "ethanol.fuel.percentage",
486                                         0,
487                                         0,
488                                         UNIT::INVALID,
489                                         1.00000f,
490                                         decoder_t::decode_obd2_response,
491                                         nullptr,
492                                         true,
493                                         false
494                                 })}
495 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
496                                         90,
497                                         "accelerator.pedal.position",
498                                         0,
499                                         0,
500                                         UNIT::INVALID,
501                                         5.00000f,
502                                         decoder_t::decode_obd2_response,
503                                         nullptr,
504                                         true,
505                                         false
506                                 })}
507 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
508                                         91,
509                                         "hybrid.battery-pack.remaining.life",
510                                         0,
511                                         0,
512                                         UNIT::INVALID,
513                                         5.00000f,
514                                         decoder_t::decode_obd2_response,
515                                         nullptr,
516                                         true,
517                                         false
518                                 })}
519 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
520                                         92,
521                                         "engine.oil.temperature",
522                                         0,
523                                         0,
524                                         UNIT::INVALID,
525                                         1.00000f,
526                                         decoder_t::decode_obd2_response,
527                                         nullptr,
528                                         true,
529                                         false
530                                 })}
531 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
532                                         94,
533                                         "engine.fuel.rate",
534                                         0,
535                                         0,
536                                         UNIT::INVALID,
537                                         1.00000f,
538                                         decoder_t::decode_obd2_response,
539                                         nullptr,
540                                         true,
541                                         false
542                                 })}
543 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
544                                         99,
545                                         "engine.torque",
546                                         0,
547                                         0,
548                                         UNIT::INVALID,
549                                         1.00000f,
550                                         decoder_t::decode_obd2_response,
551                                         nullptr,
552                                         true,
553                                         false
554                                 })}
555
556                         } // end diagnostic_messages_ vector
557                 })} // end can_message_set entry
558         } // end can_message_set vector
559 {
560         for(auto& cms: can_message_set_)
561         {
562                 std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition();
563                 for(auto& cmd : can_messages_definition)
564                 {
565                         cmd->set_parent(cms.get());
566                         std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals();
567                         for(auto& sig: can_signals)
568                         {
569                                 sig->set_parent(cmd.get());
570                         }
571                 }
572
573                 std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages();
574                 for(auto& dm : diagnostic_messages)
575                 {
576                         dm->set_parent(cms.get());
577                 }
578         }
579                 }
580
581 const std::string application_t::get_diagnostic_bus() const
582 {
583         return "hs";
584 }
585
586