PlatformVersion.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2015-2019, Dataspeed Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Dataspeed Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 #ifndef _DBW_MKZ_CAN_PLATFORM_VERSION_H
36 #define _DBW_MKZ_CAN_PLATFORM_VERSION_H
37 
38 // Module Version class
40 
41 namespace dbw_mkz_can
42 {
43 
44 // Vehicle platform enumeration
45 typedef enum {
46  P_FORD_CD4 = 0x00, // Lincoln MKZ, Ford Fusion/Mondeo
47  P_FORD_P5 = 0x01, // Ford F150 (2015-2020)
48  P_FORD_C1 = 0x02, // Ford Transit Connect
49  P_FORD_T6 = 0x03, // Ford Ranger
50  P_FORD_U6 = 0x04, // Lincoln Aviator
51  P_FORD_CD5 = 0x05, // Ford Edge, Lincoln Nautilus
52  P_FORD_GE1 = 0x06, // Ford Mustang Mach-E
53  P_FORD_P702 = 0x07, // Ford F150 (2021+)
54  P_FCA_RU = 0x10, // Chrysler Pacifica
55  P_FCA_WK2 = 0x11, // Jeep Grand Cherokee
56  P_POLARIS_GEM = 0x80, // Polaris GEM
57  P_POLARIS_RZR = 0x81, // Polaris RZR
58 } Platform;
59 
60 // Module type enumeration
61 typedef enum {
62  M_BPEC = 1, // Brake Pedal Emulator Combo
63  M_TPEC = 2, // Throttle Pedal Emulator Combo
64  M_STEER = 3, // CAN Steering and gateway
65  M_SHIFT = 4, // Shifting
66  M_ABS = 5, // ACC/AEB Braking
67  M_BOO = 6, // Brake-On-Off for ABS Braking
68  M_EPS = 7, // EPS Steering
69 } Module;
70 
71 static const char* platformToString(Platform x) {
72  switch (x) {
73  case P_FORD_CD4: return "FORD_CD4";
74  case P_FORD_P5: return "FORD_P5";
75  case P_FORD_C1: return "FORD_C1";
76  case P_FORD_T6: return "FORD_T6";
77  case P_FORD_U6: return "FORD_U6";
78  case P_FORD_CD5: return "FORD_CD5";
79  case P_FORD_GE1: return "FORD_GE1";
80  case P_FORD_P702: return "FORD_P702";
81  case P_FCA_RU: return "FCA_RU";
82  case P_FCA_WK2: return "FCA_WK2";
83  case P_POLARIS_GEM: return "POLARIS_GEM";
84  case P_POLARIS_RZR: return "POLARIS_RZR";
85  default: return "UNKNOWN";
86  }
87 }
88 
89 static const char* moduleToString(Module x) {
90  switch (x) {
91  case M_BPEC: return "BPEC ";
92  case M_TPEC: return "TPEC ";
93  case M_STEER: return "STEER";
94  case M_SHIFT: return "SHIFT";
95  case M_ABS: return "ABS ";
96  case M_BOO: return "BOO ";
97  case M_EPS: return "EPS ";
98  default: return "UNKNOWN";
99  }
100 }
101 
103 public:
104  PlatformVersion() : p((Platform)0), m((Module)0) {};
105  PlatformVersion(Platform _p, Module _m, ModuleVersion _v) : p(_p), m(_m), v(_v) {};
106  PlatformVersion(Platform _p, Module _m, uint16_t major, uint16_t minor, uint16_t build) : p(_p), m(_m), v(ModuleVersion(major, minor, build)) {};
107  bool operator< (const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v < other.v); }
108  bool operator> (const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v > other.v); }
109  bool operator<=(const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v <= other.v); }
110  bool operator>=(const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v >= other.v); }
111  bool operator==(const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v == other.v); }
112  bool operator!=(const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v != other.v); }
114 };
115 
116 static bool operator< (const PlatformVersion& x, const ModuleVersion& y) { return x.v < y; }
117 static bool operator> (const PlatformVersion& x, const ModuleVersion& y) { return x.v > y; }
118 static bool operator<=(const PlatformVersion& x, const ModuleVersion& y) { return x.v <= y; }
119 static bool operator>=(const PlatformVersion& x, const ModuleVersion& y) { return x.v >= y; }
120 static bool operator==(const PlatformVersion& x, const ModuleVersion& y) { return x.v == y; }
121 static bool operator!=(const PlatformVersion& x, const ModuleVersion& y) { return x.v != y; }
122 
123 } // namespace dbw_mkz_can
124 
125 #endif // _DBW_MKZ_CAN_PLATFORM_VERSION_H
126 
PlatformVersion(Platform _p, Module _m, uint16_t major, uint16_t minor, uint16_t build)
float x
Definition: sonar_lut.h:43
bool operator!=(const PlatformVersion &other) const
static const char * moduleToString(Module x)
bool operator>(const PlatformVersion &other) const
static const char * platformToString(Platform x)
bool operator<(const PlatformVersion &other) const
bool operator==(const PlatformVersion &other) const
float y
Definition: sonar_lut.h:43
bool operator<=(const PlatformVersion &other) const
bool operator>=(const PlatformVersion &other) const
PlatformVersion(Platform _p, Module _m, ModuleVersion _v)


dbw_mkz_can
Author(s): Kevin Hallenbeck
autogenerated on Fri Jun 16 2023 02:54:50