/* 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. */ #include "BaseIUCommand.hh" //#include "BaseIUBoard.hh" //! These are the Command Byte contents for various requests to //! the boards on the IU HV bases taken from the write up by //! Claire Tarbert on June 27, 2010 const uint8_t BaseIUCommand::PD_INIT = 0xAA; const uint8_t BaseIUCommand::PU_INIT = 0xAB; const uint8_t BaseIUCommand::ADC_INIT = 0xBB; const uint8_t BaseIUCommand::DA_INIT = 0xCC; const uint8_t BaseIUCommand::IAP_INIT = 0xDD; //const uint8_t BaseIUCommand::PULSER_INIT = 0xEE; const uint8_t BaseIUCommand::RC_INIT = 0xFF; const uint8_t BaseIUCommand::HV_INIT = 0x99; const uint8_t BaseIUCommand::ID_INIT = 0x88; const uint8_t BaseIUCommand::RLED_INIT = 0x77; const uint8_t BaseIUCommand::VER_INIT = 0x66; //! Assignment operator BaseIUCommand& BaseIUCommand::operator=( const BaseIUCommand& msg ) { if( this == &msg ) return *this; BaseIUMessage::operator=( msg ); return *this; } //! Reset the message and add the appropriate command as the //! first byte of this message. BaseIUMessage BaseIUCommand::SetCommand( uint8_t cmd ) { this->resize(0); // resize to 0 this->push_back( cmd ); // Set first byte and that's it // Cast the pointer to the base pointer type and return the message content return (* (dynamic_cast( this ) ) ); }