ALMA Computing Group

acscourseMount3Impl.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: acscourseMount3Impl.cpp,v 1.7 2008/10/02 08:58:19 cparedes Exp $"
00025 *
00026 */
00027  
00028 #include <acscourseMount3Impl.h>
00029 #include <iostream>
00030 using namespace std;
00031 
00032 /* ----------------------------------------------------------------*/
00033 Mount3Impl::Mount3Impl(const ACE_CString &_name, maci::ContainerServices *containerServices) :
00034     CharacteristicComponentImpl(_name, containerServices),
00035     m_cmdAz_sp(new baci::ROdouble(_name+":cmdAz", getComponent()),this),
00036     m_cmdEl_sp(new baci::ROdouble(_name+":cmdEl", getComponent()),this),
00037     m_actAz_sp(new baci::ROdouble(_name+":actAz", getComponent()),this),
00038     m_actEl_sp(new baci::ROdouble(_name+":actEl", getComponent()),this)
00039 {
00040     // ACS_TRACE is used for debugging purposes
00041     ACS_TRACE("::Mount3Impl::Mount3Impl");
00042 
00043 }
00044 
00045 /* ----------------------------------------------------------------*/
00046 Mount3Impl::~Mount3Impl()
00047 {
00048     // ACS_TRACE is used for debugging purposes
00049     ACS_TRACE("::Mount3Impl::~Mount3Impl");
00050     ACS_DEBUG_PARAM("::Mount3Impl::~Mount3Impl", "Destroying %s...", name());
00051 
00052 }
00053 /* --------------------- [ CORBA interface ] ----------------------*/
00054 void 
00055 Mount3Impl::objfix (CORBA::Double az,
00056                     CORBA::Double elev)
00057 {
00058     ACS_TRACE("::Mount3Impl::objfix");
00059     ACS::Time timestamp;
00060     
00061     try
00062         {
00063         m_cmdAz_sp->getDevIO()->write(az,   timestamp);
00064         m_cmdEl_sp->getDevIO()->write(elev, timestamp);
00065         }
00066     catch (...) 
00067         {
00068         // Here we have to better handle errors!
00069         ACS_SHORT_LOG((LM_ERROR,"Error accessing devIO"));
00070         }
00071     
00072     ACS_SHORT_LOG((LM_INFO,"Received objfix command. Az: %f El: %f", az, elev));
00073 }
00074 
00075 ACS::ROdouble_ptr
00076 Mount3Impl::cmdAz ()
00077 {
00078     if (m_cmdAz_sp == 0)
00079         {
00080         return ACS::ROdouble::_nil();
00081         }
00082 
00083     ACS::ROdouble_var prop = ACS::ROdouble::_narrow(m_cmdAz_sp->getCORBAReference());
00084     return prop._retn();
00085 }
00086 
00087 
00088 ACS::ROdouble_ptr
00089 Mount3Impl::cmdEl ()
00090 {
00091     if (m_cmdEl_sp == 0)
00092         {
00093         return ACS::ROdouble::_nil();
00094         }
00095 
00096     ACS::ROdouble_var prop = ACS::ROdouble::_narrow(m_cmdEl_sp->getCORBAReference());
00097     return prop._retn();
00098 }
00099 
00100 
00101 ACS::ROdouble_ptr
00102 Mount3Impl::actAz ()
00103 {
00104     if (m_actAz_sp == 0)
00105         {
00106         return ACS::ROdouble::_nil();
00107         }
00108 
00109     ACS::ROdouble_var prop = ACS::ROdouble::_narrow(m_actAz_sp->getCORBAReference());
00110     return prop._retn();
00111 }
00112 
00113 
00114 ACS::ROdouble_ptr
00115 Mount3Impl::actEl ()
00116 {
00117     if (m_actEl_sp == 0)
00118         {
00119         return ACS::ROdouble::_nil();
00120         }
00121     
00122     ACS::ROdouble_var prop = ACS::ROdouble::_narrow(m_actEl_sp->getCORBAReference());
00123     return prop._retn();
00124 }
00125 
00126 /* --------------- [ MACI DLL support functions ] -----------------*/
00127 #include <maciACSComponentDefines.h>
00128 MACI_DLL_SUPPORT_FUNCTIONS(Mount3Impl)
00129 /* ----------------------------------------------------------------*/
00130 
00131 /*___oOo___*/
00132 
00133 
00134 
00135