PlatformVersion.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2018-2019, Dataspeed Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Dataspeed Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *********************************************************************/
00034 
00035 #ifndef _DBW_FCA_CAN_PLATFORM_VERSION_H
00036 #define _DBW_FCA_CAN_PLATFORM_VERSION_H
00037 
00038 // Module Version class
00039 #include <dbw_fca_can/ModuleVersion.h>
00040 
00041 namespace dbw_fca_can
00042 {
00043 
00044 // Vehicle platform enumeration
00045 typedef enum {
00046   P_FORD_CD4 = 0x00, // Lincoln MKZ, Ford Fusion/Mondeo
00047   P_FORD_P5  = 0x01, // Ford F150
00048   P_FORD_C1  = 0x02, // Ford Transit Connect
00049   P_FCA_RU   = 0x10, // Chrysler Pacifica
00050   P_FCA_WK2  = 0x11, // Jeep Grand Cherokee
00051 } Platform;
00052 
00053 // Module type enumeration
00054 typedef enum {
00055   M_BPEC  = 1, // Brake Pedal Emulator Combo
00056   M_TPEC  = 2, // Throttle Pedal Emulator Combo
00057   M_STEER = 3, // CAN Steering and gateway
00058   M_SHIFT = 4, // Shifting
00059   M_ABS   = 5, // ACC/AEB Braking
00060   M_BOO   = 6, // Brake-On-Off for ABS Braking
00061   M_EPS   = 7, // EPS Steering
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 } // namespace dbw_fca_can
00110 
00111 #endif // _DBW_FCA_CAN_PLATFORM_VERSION_H
00112 


dbw_fca_can
Author(s): Kevin Hallenbeck
autogenerated on Sat May 4 2019 02:40:31