RmpFault.h
Go to the documentation of this file.
00001 /*
00002   COPYRIGHT (c) 2014 SEGWAY Inc.
00003 
00004   Software License Agreement:
00005 
00006   The software supplied herewith by Segway Inc. (the "Company") for its 
00007   RMP Robotic Platforms is intended and supplied to you, the Company's 
00008   customer, for use solely and exclusively with Segway products. The 
00009   software is owned by the Company and/or its supplier, and is protected 
00010   under applicable copyright laws.  All rights are reserved. Any use in 
00011   violation of the foregoing restrictions may subject the user to criminal
00012   sanctions under applicable laws, as well as to civil liability for the 
00013   breach of the terms and conditions of this license. The Company may 
00014   immediately terminate this Agreement upon your use of the software with 
00015   any products that are not Segway products.
00016 
00017   You shall indemnify, defend and hold the Company harmless from any claims, 
00018   demands, liabilities or expenses, including reasonable attorneys fees, incurred 
00019   by the Company as a result of any claim or proceeding against the Company 
00020   arising out of or based upon: 
00021 
00022   (i) The combination, operation or use of the software by you with any hardware, 
00023       products, programs or data not supplied or approved in writing by the Company, 
00024       if such claim or proceeding would have been avoided but for such combination, 
00025       operation or use.
00026 
00027   (ii) The modification of the software by or on behalf of you.
00028 
00029   (iii) Your use of the software.
00030 
00031   THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
00032   WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
00033   TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00034   PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
00035   IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
00036   CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
00037 */
00038 
00039 #ifndef RMP_FAULT_H
00040 #define RMP_FAULT_H
00041 
00042 #include <cstdint>
00043 #include <string>
00044 #include <vector>
00045 #include <memory>
00046 
00047 #include <RmpUserDefinedFeedbackType.h>
00048 
00049 namespace segway
00050 {
00051   static const uint32_t NO_FAULT = 0x00000000;
00052   
00053   typedef std::vector<std::string> FaultStatusDescription;
00054 
00059   enum FaultGroup
00060   {
00061     TRANSIENT = 0,
00062     CRITICAL,
00063     COMM,
00064     SENSORS,
00065     BSA,
00066     MCU,
00067     ARCHITECTURE,
00068     INTERNAL
00069   };
00070 
00071   class RmpFault;
00072   
00077   class FaultPacking
00078   {
00079     friend class RmpFault;
00080 
00081   public:
00086     FaultPacking(const FaultPacking& rOther)
00087       : m_Shift(rOther.m_Shift)
00088       , m_Mask(rOther.m_Mask)
00089       , m_Group(rOther.m_Group)
00090     {}
00091 
00096     FaultPacking& operator=(const FaultPacking& rOther)
00097     {
00098       m_Shift = rOther.m_Shift;
00099       m_Mask = rOther.m_Mask;
00100       m_Group = rOther.m_Group;
00101     }
00102 
00107     const uint32_t& GetShift() const;
00108 
00113     const uint32_t& GetMask() const;
00114 
00119     const FaultGroup& GetGroup() const;
00120 
00121   private:
00128     FaultPacking(uint32_t shift, uint32_t mask, FaultGroup group)
00129       : m_Shift(shift)
00130       , m_Mask(mask)
00131       , m_Group(group)
00132     {}
00133   
00137     FaultPacking()
00138     {}
00139 
00143     uint32_t m_Shift;
00144 
00148     uint32_t m_Mask;
00149 
00153     FaultGroup m_Group;
00154   };
00155 
00156   typedef std::vector<FaultPacking> FaultPackingList;
00157   typedef std::vector<UserDefinedFeedbackType> FeedbackTypeList;
00158   typedef std::vector<std::string> FaultDecodeList;
00159 
00164   class RmpFault
00165   {
00166   public:
00171     static const FeedbackTypeList& GetFaultFeedbackEntryList();
00172 
00178     static const FaultPackingList& GetFaultPackingList(UserDefinedFeedbackType feedbackType);
00179 
00185     static const FaultDecodeList& GetFaultDecodeList(FaultGroup faultGroup);
00186 
00187   private:
00196     RmpFault();
00197 
00201     RmpFault(const RmpFault&);
00202 
00206     RmpFault& operator=(const RmpFault&);
00207 
00211     ~RmpFault();
00212 
00216     struct Impl;
00217     std::unique_ptr<Impl> m_pImpl;
00218   };
00219   
00220 } // namespace segway
00221 
00222 #endif // RMP_FAULT_H


rmp_base
Author(s):
autogenerated on Wed Aug 26 2015 16:24:39