Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _DBW_FCA_CAN_PLATFORM_VERSION_H
00036 #define _DBW_FCA_CAN_PLATFORM_VERSION_H
00037
00038
00039 #include <dbw_fca_can/ModuleVersion.h>
00040
00041 namespace dbw_fca_can
00042 {
00043
00044
00045 typedef enum {
00046 P_FORD_CD4 = 0x00,
00047 P_FORD_P5 = 0x01,
00048 P_FORD_C1 = 0x02,
00049 P_FCA_RU = 0x10,
00050 P_FCA_WK2 = 0x11,
00051 } Platform;
00052
00053
00054 typedef enum {
00055 M_BPEC = 1,
00056 M_TPEC = 2,
00057 M_STEER = 3,
00058 M_SHIFT = 4,
00059 M_ABS = 5,
00060 M_BOO = 6,
00061 M_EPS = 7,
00062 } Module;
00063
00064 static const char* platformToString(Platform x) {
00065 switch (x) {
00066 case P_FORD_CD4: return "FORD_CD4";
00067 case P_FORD_P5: return "FORD_P5";
00068 case P_FORD_C1: return "FORD_C1";
00069 case P_FCA_RU: return "FCA_RU";
00070 case P_FCA_WK2: return "FCA_WK2";
00071 default: return "UNKNOWN";
00072 }
00073 }
00074
00075 static const char* moduleToString(Module x) {
00076 switch (x) {
00077 case M_BPEC: return "BPEC ";
00078 case M_TPEC: return "TPEC ";
00079 case M_STEER: return "STEER";
00080 case M_SHIFT: return "SHIFT";
00081 case M_ABS: return "ABS ";
00082 case M_BOO: return "BOO ";
00083 default: return "UNKNOWN";
00084 case M_EPS: return "EPS ";
00085 }
00086 }
00087
00088 class PlatformVersion {
00089 public:
00090 PlatformVersion() : p((Platform)0), m((Module)0) {};
00091 PlatformVersion(Platform _p, Module _m, ModuleVersion _v) : p(_p), m(_m), v(_v) {};
00092 PlatformVersion(Platform _p, Module _m, uint16_t major, uint16_t minor, uint16_t build) : p(_p), m(_m), v(ModuleVersion(major, minor, build)) {};
00093 bool operator< (const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v < other.v); }
00094 bool operator> (const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v > other.v); }
00095 bool operator<=(const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v <= other.v); }
00096 bool operator>=(const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v >= other.v); }
00097 bool operator==(const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v == other.v); }
00098 bool operator!=(const PlatformVersion& other) const { return (this->p == other.p) && (this->m == other.m) && (this->v != other.v); }
00099 Platform p; Module m; ModuleVersion v;
00100 };
00101
00102 static bool operator< (const PlatformVersion& x, const ModuleVersion& y) { return x.v < y; }
00103 static bool operator> (const PlatformVersion& x, const ModuleVersion& y) { return x.v > y; }
00104 static bool operator<=(const PlatformVersion& x, const ModuleVersion& y) { return x.v <= y; }
00105 static bool operator>=(const PlatformVersion& x, const ModuleVersion& y) { return x.v >= y; }
00106 static bool operator==(const PlatformVersion& x, const ModuleVersion& y) { return x.v == y; }
00107 static bool operator!=(const PlatformVersion& x, const ModuleVersion& y) { return x.v != y; }
00108
00109 }
00110
00111 #endif // _DBW_FCA_CAN_PLATFORM_VERSION_H
00112