DbcSignal.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2018 New Eagle
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 New Eagle 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 _NEW_EAGLE_DBC_SIGNAL_H
00036 #define _NEW_EAGLE_DBC_SIGNAL_H
00037 
00038 #include <ros/ros.h>
00039 
00040 #include <string>
00041 
00042 namespace NewEagle
00043 {
00044   struct DbcSignalComment
00045   {
00046     uint32_t Id;
00047     std::string SignalName;
00048     std::string Comment;
00049   };
00050 
00051   enum SignType
00052   {
00053     UNSIGNED = 0,
00054     SIGNED = 1
00055   };
00056 
00057   enum ByteOrder
00058   {
00059     LITTLE_END = 0,
00060     BIG_END = 1
00061   };
00062 
00063   enum DataType
00064   {
00065     INT = 0,
00066     FLOAT = 1,
00067     DOUBLE = 2
00068   };
00069 
00070   enum MultiplexerMode
00071   {
00072     NONE = 0,
00073     MUX_SWITCH = 1,
00074     MUX_SIGNAL = 2
00075   };
00076 
00077   class DbcSignal {
00078     public:
00079       DbcSignal(
00080         uint8_t dlc,
00081         double gain,
00082         double offset,
00083         uint8_t startBit,
00084         ByteOrder endianness,
00085         uint8_t length,
00086         SignType sign,
00087         std::string name, 
00088         MultiplexerMode multiplexerMode);
00089 
00090       DbcSignal(
00091         uint8_t dlc,
00092         double gain,
00093         double offset,
00094         uint8_t startBit,
00095         ByteOrder endianness,
00096         uint8_t length,
00097         SignType sign,
00098         std::string name, 
00099         MultiplexerMode multiplexerMode,
00100         int32_t multiplexerSwitch);
00101 
00102       ~DbcSignal();
00103 
00104       uint8_t GetDlc() const;
00105       double GetResult() const;
00106       double GetGain() const;
00107       double GetOffset() const;
00108       uint8_t GetStartBit() const;
00109       ByteOrder GetEndianness() const;
00110       uint8_t GetLength() const;
00111       SignType GetSign() const;
00112       std::string GetName() const;
00113       void SetResult(double result);
00114       void SetComment(NewEagle::DbcSignalComment comment);
00115       void SetInitialValue(double value);
00116       double GetInitialValue();
00117       DataType GetDataType();
00118       void SetDataType(DataType type);
00119       MultiplexerMode GetMultiplexerMode() const;
00120       int32_t GetMultiplexerSwitch() const;      
00121 
00122     private:
00123       uint8_t _dlc;
00124       double _result;
00125       double _gain;
00126       double _offset;
00127       uint8_t _startBit;
00128       ByteOrder _endianness;
00129       uint8_t _length;
00130       SignType _sign;
00131       std::string _name;
00132       NewEagle::DbcSignalComment _comment;
00133       double _initialValue;
00134       DataType _type;
00135       MultiplexerMode _multiplexerMode;
00136       int32_t _multiplexerSwitch;
00137   };
00138 }
00139 
00140 #endif // _NEW_EAGLE_DBC_SIGNAL_H


dbc
Author(s): Ryan Borchert
autogenerated on Mon Jun 24 2019 19:18:30