1 #include "application.hpp"
2 #include "../can/can-decoder.hpp"
3 #include "../can/can-encoder.hpp"
5 application_t::application_t()
6 : can_bus_manager_{utils::config_parser_t{"/etc/dev-mapping.conf"}}
8 {std::make_shared<message_set_t>(message_set_t{0,"J1939",
9 { // beginning message_definition_ vector
11 {std::make_shared<message_definition_t>(message_definition_t{"j1939",61442,0,message_format_t::J1939,frequency_clock_t(5.00000f),true,8,
12 { // beginning signals vector
13 {std::make_shared<signal_t> (signal_t{
14 "EngMomentaryOverspeedEnable",// generic_name
21 frequency_clock_t(0.00000f),// frequency
23 false,// force_send_changed
25 {0,"MomentaryEngOverspeedIsDisabled"},
26 {1,"MomentaryEngOverspeedIsEnabled"},
34 std::make_pair<bool, int>(false, 0),// multiplex
38 "Command signal used to indicate that the engine speed may be boosted up to the maximum engine overspeed value to"// comment
40 {std::make_shared<signal_t> (signal_t{
41 "MomentaryEngMaxPowerEnable",// generic_name
48 frequency_clock_t(0.00000f),// frequency
50 false,// force_send_changed
53 {1,"mmntarilyRqingMaxPowerAvailable"},
55 {0,"notRqingMaxPowerAvailable"}
61 std::make_pair<bool, int>(false, 0),// multiplex
65 "Momentarily Requesting highest torque map from the engine control"// comment
67 {std::make_shared<signal_t> (signal_t{
68 "PercentClutchSlip",// generic_name
75 frequency_clock_t(0.00000f),// frequency
77 false,// force_send_changed
84 std::make_pair<bool, int>(false, 0),// multiplex
88 "Parameter which represents the ratio of input shaft speed to current engine speed (in percent)."// comment
90 {std::make_shared<signal_t> (signal_t{
91 "ProgressiveShiftDisable",// generic_name
98 frequency_clock_t(0.00000f),// frequency
100 false,// force_send_changed
102 {1,"ProgressiveShiftIsDisabled"},
103 {0,"ProgressiveShiftIsNotDisabled"},
111 std::make_pair<bool, int>(false, 0),// multiplex
115 "Command signal used to indicate that progressive shifting by the engine should be disallowed."// comment
117 {std::make_shared<signal_t> (signal_t{
118 "SrcAddrssOfCtrllngDvcFrTrnsCntrl",// generic_name
125 frequency_clock_t(0.00000f),// frequency
127 false,// force_send_changed
134 std::make_pair<bool, int>(false, 0),// multiplex
138 "The source address of the SAE J1939 device currently controlling the transmission."// comment
140 {std::make_shared<signal_t> (signal_t{
141 "TransDrivelineEngaged",// generic_name
148 frequency_clock_t(0.00000f),// frequency
150 false,// force_send_changed
152 {0,"DrivelineDisengaged"},
153 {1,"DrivelineEngaged"},
161 std::make_pair<bool, int>(false, 0),// multiplex
165 "Driveline engaged indicates the transmission controlled portion of the driveline is engaged sufficiently to allow a transfer"// comment
167 {std::make_shared<signal_t> (signal_t{
168 "TransInputShaftSpeed",// generic_name
175 frequency_clock_t(0.00000f),// frequency
177 false,// force_send_changed
184 std::make_pair<bool, int>(false, 0),// multiplex
188 "Rotational velocity of the primary shaft transferring power into the transmission."// comment
190 {std::make_shared<signal_t> (signal_t{
191 "TransOutputShaftSpeed",// generic_name
198 frequency_clock_t(0.00000f),// frequency
200 false,// force_send_changed
207 std::make_pair<bool, int>(false, 0),// multiplex
211 "Calculated speed of the transmission output shaft."// comment
213 {std::make_shared<signal_t> (signal_t{
214 "TransShiftInProcess",// generic_name
221 frequency_clock_t(0.00000f),// frequency
223 false,// force_send_changed
227 {1,"ShiftInProcess"},
228 {0,"ShiftIsNotInProcess"}
234 std::make_pair<bool, int>(false, 0),// multiplex
238 "Indicates that the transmission is in process of shifting from the current gear to the selected gear."// comment
240 {std::make_shared<signal_t> (signal_t{
241 "TrnsTrqCnvrtrLckpTrnstnInPrcess",// generic_name
248 frequency_clock_t(0.00000f),// frequency
250 false,// force_send_changed
254 {1,"TransitionIsInProcess"},
255 {0,"TransitionIsNotInProcess"}
261 std::make_pair<bool, int>(false, 0),// multiplex
265 "State signal indicating whether or not the transmission torque converter lock up clutch is transitioning between being"// comment
267 {std::make_shared<signal_t> (signal_t{
268 "TrnsTrqueConverterLockupEngaged",// generic_name
275 frequency_clock_t(0.00000f),// frequency
277 false,// force_send_changed
281 {0,"TorqueConverterLockupDisengaged"},
282 {1,"TorqueConverterLockupEngaged"}
288 std::make_pair<bool, int>(false, 0),// multiplex
292 "State signal which indicates whether the torque converter lockup is engaged."// comment
294 } // end signals vector
295 })}, // end message_definition entry
297 {std::make_shared<message_definition_t>(message_definition_t{"j1939",61449,0,message_format_t::J1939,frequency_clock_t(5.00000f),true,8,
298 { // beginning signals vector
299 {std::make_shared<signal_t> (signal_t{
300 "LateralAcceleration",// generic_name
303 0.000488281f,// factor
307 frequency_clock_t(0.00000f),// frequency
309 false,// force_send_changed
316 std::make_pair<bool, int>(false, 0),// multiplex
320 "Indicates a lateral acceleration of the vehicle."// comment
322 {std::make_shared<signal_t> (signal_t{
323 "LongitudinalAcceleration",// generic_name
330 frequency_clock_t(0.00000f),// frequency
332 false,// force_send_changed
339 std::make_pair<bool, int>(false, 0),// multiplex
343 "Indicates the longitudinal acceleration of the vehicle."// comment
345 {std::make_shared<signal_t> (signal_t{
346 "SteerWheelAngle",// generic_name
349 0.000976562f,// factor
353 frequency_clock_t(0.00000f),// frequency
355 false,// force_send_changed
362 std::make_pair<bool, int>(false, 0),// multiplex
366 "The main operator`s steering wheel angle (on the steering column, not the actual wheel angle)."// comment
368 {std::make_shared<signal_t> (signal_t{
369 "SteerWheelAngleSensorType",// generic_name
376 frequency_clock_t(0.00000f),// frequency
378 false,// force_send_changed
380 {1,"AbsMeasuringPrinciple"},
382 {0,"RelativeMeasuringPrinciple"},
389 std::make_pair<bool, int>(false, 0),// multiplex
393 "Indicates whether the steering wheel angle sensor is capable of absolute measuring of the number of steering wheel"// comment
395 {std::make_shared<signal_t> (signal_t{
396 "SteerWheelTurnCounter",// generic_name
403 frequency_clock_t(0.00000f),// frequency
405 false,// force_send_changed
412 std::make_pair<bool, int>(false, 0),// multiplex
416 "Indicates number of steering wheel turns, absolute position or relative position at ignition on."// comment
418 {std::make_shared<signal_t> (signal_t{
419 "YawRate",// generic_name
422 0.000122070f,// factor
426 frequency_clock_t(0.00000f),// frequency
428 false,// force_send_changed
435 std::make_pair<bool, int>(false, 0),// multiplex
439 "Indicates the rotation about the vertical axis."// comment
441 } // end signals vector
442 })}, // end message_definition entry
444 {std::make_shared<message_definition_t>(message_definition_t{"j1939",65253,0,message_format_t::J1939,frequency_clock_t(5.00000f),true,8,
445 { // beginning signals vector
446 {std::make_shared<signal_t> (signal_t{
447 "EngTotalHoursOfOperation",// generic_name
454 frequency_clock_t(0.00000f),// frequency
456 false,// force_send_changed
463 std::make_pair<bool, int>(false, 0),// multiplex
467 "Accumulated time of operation of engine."// comment
469 {std::make_shared<signal_t> (signal_t{
470 "EngTotalRevolutions",// generic_name
477 frequency_clock_t(0.00000f),// frequency
479 false,// force_send_changed
486 std::make_pair<bool, int>(false, 0),// multiplex
490 "Accumulated number of revolutions of engine crankshaft during its operation."// comment
492 } // end signals vector
493 })}, // end message_definition entry
496 {std::make_shared<message_definition_t>(message_definition_t{"j1939",65262,0,message_format_t::J1939,frequency_clock_t(5.00000f),true,8,
497 { // beginning signals vector
498 {std::make_shared<signal_t> (signal_t{
499 "EngCoolantTemp",// generic_name
506 frequency_clock_t(0.00000f),// frequency
508 false,// force_send_changed
515 std::make_pair<bool, int>(false, 0),// multiplex
519 "Temperature of liquid found in engine cooling system."// comment
521 {std::make_shared<signal_t> (signal_t{
522 "EngFuelTemp1",// generic_name
529 frequency_clock_t(0.00000f),// frequency
531 false,// force_send_changed
538 std::make_pair<bool, int>(false, 0),// multiplex
542 "Temperature of fuel (or gas) passing through the first fuel control system."// comment
544 {std::make_shared<signal_t> (signal_t{
545 "EngIntercoolerTemp",// generic_name
552 frequency_clock_t(0.00000f),// frequency
554 false,// force_send_changed
561 std::make_pair<bool, int>(false, 0),// multiplex
565 "Temperature of liquid found in the intercooler located after the turbocharger."// comment
567 {std::make_shared<signal_t> (signal_t{
568 "EngIntercoolerThermostatOpening",// generic_name
575 frequency_clock_t(0.00000f),// frequency
577 false,// force_send_changed
584 std::make_pair<bool, int>(false, 0),// multiplex
588 "The current position of the thermostat used to regulate the temperature of the engine intercooler."// comment
590 {std::make_shared<signal_t> (signal_t{
591 "EngOilTemp1",// generic_name
598 frequency_clock_t(0.00000f),// frequency
600 false,// force_send_changed
607 std::make_pair<bool, int>(false, 0),// multiplex
611 "Temperature of the engine lubricant."// comment
613 {std::make_shared<signal_t> (signal_t{
614 "EngTurboOilTemp",// generic_name
621 frequency_clock_t(0.00000f),// frequency
623 false,// force_send_changed
630 std::make_pair<bool, int>(false, 0),// multiplex
634 "Temperature of the turbocharger lubricant."// comment
636 } // end signals vector
637 })} // end message_definition entry
639 }, // end message_definition vector
640 { // beginning diagnostic_messages_ vector
642 } // end diagnostic_messages_ vector
643 })} // end message_set entry
644 } // end message_set vector
646 for(std::shared_ptr<message_set_t> cms: message_set_)
648 std::vector<std::shared_ptr<message_definition_t>> messages_definition = cms->get_messages_definition();
649 for(std::shared_ptr<message_definition_t> cmd : messages_definition)
651 cmd->set_parent(cms);
652 std::vector<std::shared_ptr<signal_t>> signals = cmd->get_signals();
653 for(std::shared_ptr<signal_t> sig: signals)
655 sig->set_parent(cmd);
659 std::vector<std::shared_ptr<diagnostic_message_t>> diagnostic_messages = cms->get_diagnostic_messages();
660 for(std::shared_ptr<diagnostic_message_t> dm : diagnostic_messages)
667 const std::string application_t::get_diagnostic_bus() const