ALMA Computing Group

acscourseMount2Impl.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 *    ALMA - Atacama Large Millimiter Array
00003 *    (c) Associated Universities Inc., 2002 *
00004 *    (c) European Southern Observatory, 2002
00005 *    Copyright by ESO (in the framework of the ALMA collaboration)
00006 *    and Cosylab 2002, All rights reserved
00007 *
00008 *    This library is free software; you can redistribute it and/or
00009 *    modify it under the terms of the GNU Lesser General Public
00010 *    License as published by the Free Software Foundation; either
00011 *    version 2.1 of the License, or (at your option) any later version.
00012 *
00013 *    This library is distributed in the hope that it will be useful,
00014 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 *    Lesser General Public License for more details.
00017 *
00018 *    You should have received a copy of the GNU Lesser General Public
00019 *    License along with this library; if not, write to the Free Software
00020 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00021 *
00022 *
00023 *
00024 * "@(#) $Id: acscourseMount2Impl.cpp,v 1.9 2008/10/02 08:58:19 cparedes Exp $"
00025 *
00026 */
00027  
00028 #include <acscourseMount2Impl.h>
00029 
00030 /* ----------------------------------------------------------------*/
00031 Mount2Impl::Mount2Impl(const ACE_CString &_name, maci::ContainerServices *containerServices) :
00032     CharacteristicComponentImpl(_name, containerServices),
00033     m_cmdAz_sp(new baci::RWdouble(_name+":cmdAz", getComponent()),this),
00034     m_cmdEl_sp(new baci::RWdouble(_name+":cmdEl", getComponent()),this),
00035     m_actAz_sp(new baci::ROdouble(_name+":actAz", getComponent()),this),
00036     m_actEl_sp(new baci::ROdouble(_name+":actEl", getComponent()),this)
00037 {
00038     // ACS_TRACE is used for debugging purposes
00039     ACS_TRACE("::Mount2Impl::Mount2Impl");
00040 }
00041 
00042 /* ----------------------------------------------------------------*/
00043 Mount2Impl::~Mount2Impl()
00044 {
00045     // ACS_TRACE is used for debugging purposes
00046     ACS_TRACE("::Mount2Impl::~Mount2Impl");
00047 }
00048 /* --------------------- [ CORBA interface ] ----------------------*/
00049 void 
00050 Mount2Impl::objfix (CORBA::Double az,
00051                     CORBA::Double elev)
00052 {
00053     ACS_TRACE("::Mount2Impl::objfix");
00054     ACS::Time timestamp;
00055 
00056     try
00057         {
00058         m_cmdAz_sp->getDevIO()->write(az, timestamp);
00059         m_cmdEl_sp->getDevIO()->write(elev, timestamp);
00060         }
00061     catch (...) 
00062         {
00063         // Here we have to better handle errors!
00064         ACS_SHORT_LOG((LM_ERROR,"Error accessing devIO"));
00065         }
00066     
00067     ACS_SHORT_LOG((LM_INFO,"Received objfix command. Az: %f El: %f", az, elev));
00068 }
00069 
00070 ACS::RWdouble_ptr
00071 Mount2Impl::cmdAz ()
00072 {
00073     if (m_cmdAz_sp == 0)
00074         {
00075         return ACS::RWdouble::_nil();
00076         }
00077 
00078     ACS::RWdouble_var prop = ACS::RWdouble::_narrow(m_cmdAz_sp->getCORBAReference());
00079     return prop._retn();
00080 }
00081 
00082 
00083 ACS::RWdouble_ptr
00084 Mount2Impl::cmdEl ()
00085 {
00086     if (m_cmdEl_sp == 0)
00087         {
00088         return ACS::RWdouble::_nil();
00089         }
00090 
00091     ACS::RWdouble_var prop = ACS::RWdouble::_narrow(m_cmdEl_sp->getCORBAReference());
00092     return prop._retn();
00093 }
00094 
00095 
00096 ACS::ROdouble_ptr
00097 Mount2Impl::actAz ()
00098 {
00099     if (m_actAz_sp == 0)
00100         {
00101         return ACS::ROdouble::_nil();
00102         }
00103 
00104     ACS::ROdouble_var prop = ACS::ROdouble::_narrow(m_actAz_sp->getCORBAReference());
00105     return prop._retn();
00106 }
00107 
00108 
00109 ACS::ROdouble_ptr
00110 Mount2Impl::actEl ()
00111 {
00112     if (m_actEl_sp == 0)
00113         {
00114         return ACS::ROdouble::_nil();
00115         }
00116     
00117     ACS::ROdouble_var prop = ACS::ROdouble::_narrow(m_actEl_sp->getCORBAReference());
00118     return prop._retn();
00119 }
00120 
00121 /*
00122  * ATTENTION:
00123  * We do not put here the macro used to instantiate components.
00124  * Because the class Mount2ImplLopp will be derived from Mount2Impl, but
00125  * we also want to be able to activate a PS object on it's own, we must separate the DLL 
00126  * functions used by Container from the *Impl.cpp file
00127  * and put it them in the acscourseMount2ImplDLL.cpp file 
00128  */
00129 
00130 // #include "acscourseMount2Impl.h"
00131 
00132 /* --------------- [ MACI DLL support functions ] -----------------*/
00133 //  #include <maciACSComponentDefines.h>
00134 //  MACI_DLL_SUPPORT_FUNCTIONS(Mount2Impl)
00135 /* ----------------------------------------------------------------*/
00136 
00137 /*___oOo___*/
00138 
00139 
00140