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


dbw_fca_can
Author(s): Kevin Hallenbeck
autogenerated on Wed May 12 2021 02:14:05