Use newly generated cpp file with default encoders
[apps/agl-service-can-low-level.git] / low-can-binding / binding / 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,"AGL Virtual Car",
9                         { // beginning can_message_definition_ vector
10                                 {std::make_shared<can_message_definition_t>(can_message_definition_t{"ls",0x30,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                                                         "hvac.fan.speed",
14                                                         32,
15                                                         8,
16                                                         23.5294f,
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                                                         "hvac.temperature.left",
32                                                         0,
33                                                         8,
34                                                         1.00000f,
35                                                         0.00000,
36                                                         0,
37                                                         0,
38                                                         frequency_clock_t(0.00000f),
39                                                         true,
40                                                         false,
41                                                         {
42                                                         },
43                                                         true,
44                                                         nullptr,
45                                                         nullptr,
46                                                         false
47                                                 })},
48                                                 {std::make_shared<can_signal_t> (can_signal_t{
49                                                         "hvac.temperature.right",
50                                                         8,
51                                                         8,
52                                                         1.00000f,
53                                                         0.00000,
54                                                         0,
55                                                         0,
56                                                         frequency_clock_t(0.00000f),
57                                                         true,
58                                                         false,
59                                                         {
60                                                         },
61                                                         true,
62                                                         nullptr,
63                                                         nullptr,
64                                                         false
65                                                 })},
66                                                 {std::make_shared<can_signal_t> (can_signal_t{
67                                                         "hvac.temperature.average",
68                                                         16,
69                                                         8,
70                                                         1.00000f,
71                                                         0.00000,
72                                                         0,
73                                                         0,
74                                                         frequency_clock_t(0.00000f),
75                                                         true,
76                                                         false,
77                                                         {
78                                                         },
79                                                         true,
80                                                         nullptr,
81                                                         nullptr,
82                                                         false
83                                                 })}
84                                         } // end can_signals vector
85                                 })} // end can_message_definition entry
86 ,                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3D9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
87                                         { // beginning can_signals vector
88                                                 {std::make_shared<can_signal_t> (can_signal_t{
89                                                         "engine.speed",
90                                                         16,
91                                                         16,
92                                                         0.250000f,
93                                                         0.00000,
94                                                         0,
95                                                         0,
96                                                         frequency_clock_t(0.00000f),
97                                                         true,
98                                                         false,
99                                                         {
100                                                         },
101                                                         false,
102                                                         nullptr,
103                                                         nullptr,
104                                                         false
105                                                 })},
106                                                 {std::make_shared<can_signal_t> (can_signal_t{
107                                                         "fuel.level.low",
108                                                         55,
109                                                         1,
110                                                         1.00000f,
111                                                         0.00000,
112                                                         0,
113                                                         0,
114                                                         frequency_clock_t(0.00000f),
115                                                         true,
116                                                         false,
117                                                         {
118                                                         },
119                                                         false,
120                                                         decoder_t::decode_boolean,
121                                                         nullptr,
122                                                         false
123                                                 })},
124                                                 {std::make_shared<can_signal_t> (can_signal_t{
125                                                         "fuel.level",
126                                                         8,
127                                                         8,
128                                                         0.392157f,
129                                                         0.00000,
130                                                         0,
131                                                         0,
132                                                         frequency_clock_t(0.00000f),
133                                                         true,
134                                                         false,
135                                                         {
136                                                         },
137                                                         false,
138                                                         nullptr,
139                                                         nullptr,
140                                                         false
141                                                 })}
142                                         } // end can_signals vector
143                                 })} // end can_message_definition entry
144 ,                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x3E9,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
145                                         { // beginning can_signals vector
146                                                 {std::make_shared<can_signal_t> (can_signal_t{
147                                                         "vehicle.average.speed",
148                                                         0,
149                                                         15,
150                                                         0.0156250f,
151                                                         0.00000,
152                                                         0,
153                                                         0,
154                                                         frequency_clock_t(0.00000f),
155                                                         true,
156                                                         false,
157                                                         {
158                                                         },
159                                                         false,
160                                                         nullptr,
161                                                         nullptr,
162                                                         false
163                                                 })}
164                                         } // end can_signals vector
165                                 })} // end can_message_definition entry
166 ,                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x4D1,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
167                                         { // beginning can_signals vector
168                                                 {std::make_shared<can_signal_t> (can_signal_t{
169                                                         "engine.oil.temp",
170                                                         16,
171                                                         8,
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                                                         nullptr,
183                                                         nullptr,
184                                                         false
185                                                 })},
186                                                 {std::make_shared<can_signal_t> (can_signal_t{
187                                                         "engine.oil.temp.high",
188                                                         7,
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                                         } // end can_signals vector
205                                 })} // end can_message_definition entry
206 ,                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x620,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
207                                         { // beginning can_signals vector
208                                                 {std::make_shared<can_signal_t> (can_signal_t{
209                                                         "doors.boot.open",
210                                                         47,
211                                                         1,
212                                                         1.00000f,
213                                                         0.00000,
214                                                         0,
215                                                         0,
216                                                         frequency_clock_t(0.00000f),
217                                                         true,
218                                                         false,
219                                                         {
220                                                         },
221                                                         false,
222                                                         decoder_t::decode_boolean,
223                                                         nullptr,
224                                                         false
225                                                 })},
226                                                 {std::make_shared<can_signal_t> (can_signal_t{
227                                                         "doors.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                                                         "doors.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                                                         "doors.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                                                         "doors.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 ,                               {std::make_shared<can_message_definition_t>(can_message_definition_t{"hs",0x799,can_message_format_t::STANDARD,frequency_clock_t(5.00000f),true,
301                                         { // beginning can_signals vector
302                                                 {std::make_shared<can_signal_t> (can_signal_t{
303                                                         "windows.front_left.open",
304                                                         43,
305                                                         1,
306                                                         1.00000f,
307                                                         0.00000,
308                                                         0,
309                                                         0,
310                                                         frequency_clock_t(0.00000f),
311                                                         true,
312                                                         false,
313                                                         {
314                                                         },
315                                                         false,
316                                                         decoder_t::decode_boolean,
317                                                         nullptr,
318                                                         false
319                                                 })},
320                                                 {std::make_shared<can_signal_t> (can_signal_t{
321                                                         "windows.front_right.open",
322                                                         44,
323                                                         1,
324                                                         1.00000f,
325                                                         0.00000,
326                                                         0,
327                                                         0,
328                                                         frequency_clock_t(0.00000f),
329                                                         true,
330                                                         false,
331                                                         {
332                                                         },
333                                                         false,
334                                                         decoder_t::decode_boolean,
335                                                         nullptr,
336                                                         false
337                                                 })},
338                                                 {std::make_shared<can_signal_t> (can_signal_t{
339                                                         "windows.rear_left.open",
340                                                         46,
341                                                         1,
342                                                         1.00000f,
343                                                         0.00000,
344                                                         0,
345                                                         0,
346                                                         frequency_clock_t(0.00000f),
347                                                         true,
348                                                         false,
349                                                         {
350                                                         },
351                                                         false,
352                                                         decoder_t::decode_boolean,
353                                                         nullptr,
354                                                         false
355                                                 })},
356                                                 {std::make_shared<can_signal_t> (can_signal_t{
357                                                         "windows.rear_right.open",
358                                                         45,
359                                                         4,
360                                                         1.00000f,
361                                                         0.00000,
362                                                         0,
363                                                         0,
364                                                         frequency_clock_t(0.00000f),
365                                                         true,
366                                                         false,
367                                                         {
368                                                         },
369                                                         false,
370                                                         decoder_t::decode_boolean,
371                                                         nullptr,
372                                                         false
373                                                 })}
374                                         } // end can_signals vector
375                                 })} // end can_message_definition entry
376
377                 }, // end can_message_definition vector
378                         { // beginning diagnostic_messages_ vector
379                                 {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
380                                         4,
381                                         "engine.load",
382                                         0,
383                                         0,
384                                         UNIT::INVALID,
385                                         5.00000f,
386                                         decoder_t::decode_obd2_response,
387                                         nullptr,
388                                         true,
389                                         false
390                                 })}
391 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
392                                         5,
393                                         "engine.coolant.temperature",
394                                         0,
395                                         0,
396                                         UNIT::INVALID,
397                                         1.00000f,
398                                         decoder_t::decode_obd2_response,
399                                         nullptr,
400                                         true,
401                                         false
402                                 })}
403 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
404                                         10,
405                                         "fuel.pressure",
406                                         0,
407                                         0,
408                                         UNIT::INVALID,
409                                         1.00000f,
410                                         decoder_t::decode_obd2_response,
411                                         nullptr,
412                                         true,
413                                         false
414                                 })}
415 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
416                                         11,
417                                         "intake.manifold.pressure",
418                                         0,
419                                         0,
420                                         UNIT::INVALID,
421                                         1.00000f,
422                                         decoder_t::decode_obd2_response,
423                                         nullptr,
424                                         true,
425                                         false
426                                 })}
427 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
428                                         12,
429                                         "engine.speed",
430                                         0,
431                                         0,
432                                         UNIT::INVALID,
433                                         5.00000f,
434                                         decoder_t::decode_obd2_response,
435                                         nullptr,
436                                         true,
437                                         false
438                                 })}
439 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
440                                         13,
441                                         "vehicle.speed",
442                                         0,
443                                         0,
444                                         UNIT::INVALID,
445                                         5.00000f,
446                                         decoder_t::decode_obd2_response,
447                                         nullptr,
448                                         true,
449                                         false
450                                 })}
451 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
452                                         15,
453                                         "intake.air.temperature",
454                                         0,
455                                         0,
456                                         UNIT::INVALID,
457                                         1.00000f,
458                                         decoder_t::decode_obd2_response,
459                                         nullptr,
460                                         true,
461                                         false
462                                 })}
463 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
464                                         16,
465                                         "mass.airflow",
466                                         0,
467                                         0,
468                                         UNIT::INVALID,
469                                         5.00000f,
470                                         decoder_t::decode_obd2_response,
471                                         nullptr,
472                                         true,
473                                         false
474                                 })}
475 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
476                                         17,
477                                         "throttle.position",
478                                         0,
479                                         0,
480                                         UNIT::INVALID,
481                                         5.00000f,
482                                         decoder_t::decode_obd2_response,
483                                         nullptr,
484                                         true,
485                                         false
486                                 })}
487 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
488                                         31,
489                                         "running.time",
490                                         0,
491                                         0,
492                                         UNIT::INVALID,
493                                         1.00000f,
494                                         decoder_t::decode_obd2_response,
495                                         nullptr,
496                                         true,
497                                         false
498                                 })}
499 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
500                                         45,
501                                         "EGR.error",
502                                         0,
503                                         0,
504                                         UNIT::INVALID,
505                                         0.00000f,
506                                         decoder_t::decode_obd2_response,
507                                         nullptr,
508                                         true,
509                                         false
510                                 })}
511 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
512                                         47,
513                                         "fuel.level",
514                                         0,
515                                         0,
516                                         UNIT::INVALID,
517                                         1.00000f,
518                                         decoder_t::decode_obd2_response,
519                                         nullptr,
520                                         true,
521                                         false
522                                 })}
523 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
524                                         51,
525                                         "barometric.pressure",
526                                         0,
527                                         0,
528                                         UNIT::INVALID,
529                                         1.00000f,
530                                         decoder_t::decode_obd2_response,
531                                         nullptr,
532                                         true,
533                                         false
534                                 })}
535 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
536                                         70,
537                                         "ambient.air.temperature",
538                                         0,
539                                         0,
540                                         UNIT::INVALID,
541                                         1.00000f,
542                                         decoder_t::decode_obd2_response,
543                                         nullptr,
544                                         true,
545                                         false
546                                 })}
547 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
548                                         76,
549                                         "commanded.throttle.position",
550                                         0,
551                                         0,
552                                         UNIT::INVALID,
553                                         1.00000f,
554                                         decoder_t::decode_obd2_response,
555                                         nullptr,
556                                         true,
557                                         false
558                                 })}
559 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
560                                         82,
561                                         "ethanol.fuel.percentage",
562                                         0,
563                                         0,
564                                         UNIT::INVALID,
565                                         1.00000f,
566                                         decoder_t::decode_obd2_response,
567                                         nullptr,
568                                         true,
569                                         false
570                                 })}
571 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
572                                         90,
573                                         "accelerator.pedal.position",
574                                         0,
575                                         0,
576                                         UNIT::INVALID,
577                                         5.00000f,
578                                         decoder_t::decode_obd2_response,
579                                         nullptr,
580                                         true,
581                                         false
582                                 })}
583 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
584                                         91,
585                                         "hybrid.battery-pack.remaining.life",
586                                         0,
587                                         0,
588                                         UNIT::INVALID,
589                                         5.00000f,
590                                         decoder_t::decode_obd2_response,
591                                         nullptr,
592                                         true,
593                                         false
594                                 })}
595 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
596                                         92,
597                                         "engine.oil.temperature",
598                                         0,
599                                         0,
600                                         UNIT::INVALID,
601                                         1.00000f,
602                                         decoder_t::decode_obd2_response,
603                                         nullptr,
604                                         true,
605                                         false
606                                 })}
607 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
608                                         94,
609                                         "engine.fuel.rate",
610                                         0,
611                                         0,
612                                         UNIT::INVALID,
613                                         1.00000f,
614                                         decoder_t::decode_obd2_response,
615                                         nullptr,
616                                         true,
617                                         false
618                                 })}
619 ,                               {std::make_shared<diagnostic_message_t>(diagnostic_message_t{
620                                         99,
621                                         "engine.torque",
622                                         0,
623                                         0,
624                                         UNIT::INVALID,
625                                         1.00000f,
626                                         decoder_t::decode_obd2_response,
627                                         nullptr,
628                                         true,
629                                         false
630                                 })}
631
632                         } // end diagnostic_messages_ vector
633                 })} // end can_message_set entry
634         } // end can_message_set vector
635 {
636         for(auto& cms: can_message_set_)
637         {
638                 std::vector<std::shared_ptr<can_message_definition_t> >& can_messages_definition = cms->get_can_message_definition();
639                 for(auto& cmd : can_messages_definition)
640                 {
641                         cmd->set_parent(cms.get());
642                         std::vector<std::shared_ptr<can_signal_t> >& can_signals = cmd->get_can_signals();
643                         for(auto& sig: can_signals)
644                         {
645                                 sig->set_parent(cmd.get());
646                         }
647                 }
648
649                 std::vector<std::shared_ptr<diagnostic_message_t> >& diagnostic_messages = cms->get_diagnostic_messages();
650                 for(auto& dm : diagnostic_messages)
651                 {
652                         dm->set_parent(cms.get());
653                 }
654         }
655                 }
656
657 const std::string application_t::get_diagnostic_bus() const
658 {
659         return "hs";
660 }
661
662