/* Copyright (c) 20011 Hovanes Egiyan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _BaseIUCommand_HH_ #define _BaseIUCommand_HH_ #include #include //#include "AnaGateDllCan.h" #include "BaseIUMessage.hh" //! Class to handle the commands sent to IU bases //! It inherits from the generic BaseIUMessage class //! designed to handle IU base messages in general. class BaseIUCommand : public BaseIUMessage { protected: public: //! Define commands which the board on the bases understands static const uint8_t PD_INIT; static const uint8_t PU_INIT; static const uint8_t ADC_INIT; static const uint8_t DA_INIT; static const uint8_t IAP_INIT; // static const uint8_t PULSER_INIT; static const uint8_t RC_INIT; static const uint8_t HV_INIT; static const uint8_t ID_INIT; static const uint8_t RLED_INIT; static const uint8_t VER_INIT; BaseIUCommand() : BaseIUMessage() {;} //! Constructor which sets the command byte part of the //! CANbus message. BaseIUCommand ( int cmd ) : BaseIUMessage( cmd ) {;} //! Constructor which sets the whole command based on the buffer //! address and the length of the buffer BaseIUCommand( const unsigned char* buffer, int bufLength ) : BaseIUMessage( buffer, bufLength ) {;} //! Copy constructor utilizing assignment operator BaseIUCommand( const BaseIUCommand& cmd ) { *this = operator=( cmd ); } //! Copy operator BaseIUCommand& operator=( const BaseIUCommand& cmd ); //! Function to set the command BaseIUMessage SetCommand( uint8_t cmd ); //! Set the message to what it needs to be to request board IDs inline BaseIUMessage setGetID() { return SetCommand( ID_INIT ); } //! Set the message to what it needs to be to request board version inline BaseIUMessage setGetVersion() { return SetCommand( VER_INIT ); } }; #endif // _BaseIUCommand_HH_