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_INTERFACE_H 00040 #define RMP_INTERFACE_H 00041 00042 #include <string> 00043 00044 #include <RmpTransport.h> 00045 #include <RmpUserDefinedFeedbackType.h> 00046 #include <RmpConfigurationCommand.h> 00047 #include <RmpFault.h> 00048 00049 namespace segway 00050 { 00055 class RmpInterface 00056 { 00057 public: 00061 RmpInterface(); 00062 00066 virtual ~RmpInterface(); 00067 00076 virtual void Initialize(const std::string& rIpAddress, uint16_t portNumber); 00077 00085 virtual void Initialize(const std::string& rDevicePort); 00086 00090 virtual void ShutDown(); 00091 00106 template<typename T> 00107 bool SetConfiguration(const RmpConfigurationCommand<T>& rConfigurationCommand, T value); 00108 00116 virtual bool Update(bool forceUpdate = false); 00117 00131 template<typename T> 00132 T GetUserDefinedFeedback(UserDefinedFeedbackType type); 00133 00143 bool ResetIntegrators(uint32_t bitmap); 00144 00151 bool ResetParamsToDefault(); 00152 00164 bool SetUserDefinedFeedbackBitmap(UserDefinedFeedbackBitmapType bitmapType, const uint32_t bitmap); 00165 00173 bool ChangeOperationalMode(RmpOperationalModeRequest modeRequest); 00174 00180 void GetFaultStatusDescription(FaultStatusDescription& rDescription); 00181 00182 protected: 00194 void Initialize(); 00195 00206 void InitializeFeedbackBitmaps(); 00207 00221 bool SetConfiguration(uint16_t commandId, UserDefinedFeedbackType feedbackType, uint32_t value); 00222 00229 bool SendConfigurationCommand(uint16_t commandId, uint32_t value); 00230 00235 size_t GetFeedbackEntryCount(); 00236 00242 void UpdateUserDefinedFeedback(const Bytes& rBytes); 00243 00250 bool IsValidFeedbackBitmap(const RmpConfigurationCommand<uint32_t>& rConfigurationCommand, const uint32_t bitmap); 00251 00255 RmpTransport::Ptr m_pTransport; 00256 00260 bool m_IsFeedbackBitmapSet; 00261 00265 uint32_t m_FeedbackBitmap[FEEDBACK_TYPE_NBR]; 00266 00270 uint32_t m_UserDefinedFeedback[FEEDBACK_TYPE_NBR][MAX_ENTRIES_PER_FEEDBACK]; 00271 }; // class RmpInterface 00272 } // namespace segway 00273 00274 #endif // RMP_INTERFACE_H