PlatformVersion.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018-2022, 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 _DATASPEED_ULC_CAN_PLATFORM_VERSION_H
36 #define _DATASPEED_ULC_CAN_PLATFORM_VERSION_H
37 
38 // Module Version class
40 
41 namespace dataspeed_ulc_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
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_FCA_RU = 0x10, // Chrysler Pacifica
54  P_FCA_WK2 = 0x11, // Jeep Grand Cherokee
55  P_POLARIS_GEM = 0x80, // Polaris GEM
56  P_POLARIS_RZR = 0x81, // Polaris RZR
57 } Platform;
58 
59 // Module type enumeration
60 typedef enum {
61  M_BPEC = 1, // Brake Pedal Emulator Combo
62  M_TPEC = 2, // Throttle Pedal Emulator Combo
63  M_STEER = 3, // CAN Steering and gateway
64  M_SHIFT = 4, // Shifting
65  M_ABS = 5, // ACC/AEB Braking
66  M_BOO = 6, // Brake-On-Off for ABS Braking
67  M_EPS = 7, // EPS Steering
68 } Module;
69 
70 static const char* platformToString(Platform x) {
71  switch (x) {
72  case P_FORD_CD4: return "FORD_CD4";
73  case P_FORD_P5: return "FORD_P5";
74  case P_FORD_C1: return "FORD_C1";
75  case P_FORD_T6: return "FORD_T6";
76  case P_FORD_U6: return "FORD_U6";
77  case P_FORD_CD5: return "FORD_CD5";
78  case P_FORD_GE1: return "FORD_GE1";
79  case P_FCA_RU: return "FCA_RU";
80  case P_FCA_WK2: return "FCA_WK2";
81  case P_POLARIS_GEM: return "POLARIS_GEM";
82  case P_POLARIS_RZR: return "POLARIS_RZR";
83  default: return "UNKNOWN";
84  }
85 }
86 
87 static const char* moduleToString(Module x) {
88  switch (x) {
89  case M_BPEC: return "BPEC ";
90  case M_TPEC: return "TPEC ";
91  case M_STEER: return "STEER";
92  case M_SHIFT: return "SHIFT";
93  case M_ABS: return "ABS ";
94  case M_BOO: return "BOO ";
95  case M_EPS: return "EPS ";
96  default: return "UNKNOWN";
97  }
98 }
99 
101 public:
102  PlatformVersion() : p((Platform)0), m((Module)0) {};
103  PlatformVersion(Platform _p, Module _m, ModuleVersion _v) : p(_p), m(_m), v(_v) {};
104  PlatformVersion(Platform _p, Module _m, uint16_t major, uint16_t minor, uint16_t build) : p(_p), m(_m), v(ModuleVersion(major, minor, build)) {};
105  bool operator< (const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v < other.v); }
106  bool operator> (const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v > other.v); }
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); }
112 };
113 
114 static bool operator< (const PlatformVersion& x, const ModuleVersion& y) { return x.v < y; }
115 static bool operator> (const PlatformVersion& x, const ModuleVersion& y) { return x.v > y; }
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 
121 } // namespace dataspeed_ulc_can
122 
123 #endif // _DATASPEED_ULC_CAN_PLATFORM_VERSION_H
124 
static const char * platformToString(Platform x)
bool operator<=(const PlatformVersion &other) const
bool operator<(const PlatformVersion &other) const
bool operator==(const PlatformVersion &other) const
bool operator>=(const PlatformVersion &other) const
PlatformVersion(Platform _p, Module _m, uint16_t major, uint16_t minor, uint16_t build)
bool operator!=(const PlatformVersion &other) const
PlatformVersion(Platform _p, Module _m, ModuleVersion _v)
bool operator>(const PlatformVersion &other) const
static const char * moduleToString(Module x)


dataspeed_ulc_can
Author(s): Micho Radovnikovich
autogenerated on Fri Dec 2 2022 03:20:37