Пример #1
0
    virtual void run()
	{
    	try
		{
    		// Just to stabilize
    		dev_m->off();
			ACE_OS::sleep(2);

			// Activate the alarm
			ACS_SHORT_LOG((LM_INFO, "==> Going to changing value to ENABLE (1) to trigger an alarm."));
			dev_m->enable();
			ACE_OS::sleep(4);

			// Test changeAlarmFFFM with activated alarm
			ACS_SHORT_LOG((LM_INFO, "==> Going to test changing of FF and FM if we have an alarm."));
			dev_m->changeAlarmFFFM("UserDefinedFF", "UserDefinedFM");
			ACE_OS::sleep(2);

			// Deactivate the alarm
			ACS_SHORT_LOG((LM_INFO, "==> Going to changing value to DIAGNOSE (2) to deactivate the alarm."));
			dev_m->diagnose();
			ACE_OS::sleep(2);

			// Test changeAlarmFFFM with deactivated alarm
			ACS_SHORT_LOG((LM_INFO, "==> Going to test changing of FF and FM if we do not have an alarm."));
			dev_m->changeAlarmFFFM("UserDefinedFF2", "UserDefinedFM2");

			ACE_OS::sleep(4);
	    }
		catch(...)
	    {
		    ACS_SHORT_LOG((LM_ERROR,"Error!"));
	    }

	}
Пример #2
0
//-----------------------------------------------------------------------------
void 
Consumer::suspend()
{
    ACS_TRACE("Consumer::suspend");
    
    try
	{
	proxySupplier_m->suspend_connection();
	}
    catch(CosNotifyChannelAdmin::ConnectionAlreadyInactive e)
	{
	//OK to ignore
	ACS_SHORT_LOG((LM_INFO,"Consumer::suspend failed because already suspended for the '%s' channel!",
		       channelName_mp));
	}
    catch(CosNotifyChannelAdmin::NotConnected e)
	{
	//OK to ignore
	ACS_SHORT_LOG((LM_INFO,"Consumer::suspend failed because not connected to the '%s' channel!",
		       channelName_mp));
	}
    catch(...)
	{
	ACS_SHORT_LOG((LM_INFO,"Consumer::suspend failed for the '%s' channel!",
		       channelName_mp));
	CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Consumer::suspend");
	throw err.getCORBAProblemEx();
	}
}
Пример #3
0
void 
TestLogLevelsComp::logDummyMessages (const ::contLogTest::LongSeq & levels)
{
	ACE_Log_Priority p;
	CORBA::ULong t=0;
	// Give client time to start waiting for logs
	usleep(100000);
	for (t=0; t<levels.length(); t++){
		p = LogLevelDefinition::getACELogPriority(levels[t]);
		LogLevelDefinition lld = LogLevelDefinition::fromInteger(levels[t]);
		ACS_SHORT_LOG((p, "dummy log message for core level %d/%s", lld.getValue(), lld.getName().c_str()));
	}
	// log last message always at highest, non-OFF level (so it should get always through,
	// unless the central level is put to OFF).
	p = LogLevelDefinition::getACELogPriority(AcsLogLevels::EMERGENCY_VAL);
	ACS_SHORT_LOG((p, "===last log message==="));

	// Note that these tests may be running in a container with default
	// settings, i.e. whereby " immediateDispatchLevel" can be anything,
	// and dispatchPacketSize as well. Empirically, in such case, 
	// C++ seems to sends logs in packets of 5 logs, so add 4 messages to
	// ensure all the above logs get sent across right now.
	for (int i = 0; i < 4; i++) {
		ACS_SHORT_LOG((p, "===packet fill-up message==="));
	}
   
	
}
Пример #4
0
void ImpController::setConfigurationReference(const short instance_number, const ::acsdaemon::ServiceInfoSeq & services_info) {
    try {
        ACS_SHORT_LOG((LM_DEBUG, "Setting configuration reference at instance %d to Imp with Corba URI '%s'.", instance_number, corbaloc.c_str()));
        CORBA::Object_var obj = getContext()->getORB()->string_to_object(corbaloc.c_str());
        if (CORBA::is_nil(obj.in())) {
            ACS_SHORT_LOG((LM_ERROR, "Failed to parse Corba URI '%s' for Imp '%s'!", corbaloc.c_str(), acsServices[service].impname));
            return;
        }

        obj = acsQoS::Timeout::setObjectTimeout(CORBA_TIMEOUT, obj.in());

        acsdaemon::ImpBase_var imp = acsdaemon::ImpBase::_narrow(obj.in());
        if (CORBA::is_nil(imp.in())) {
            ACS_SHORT_LOG((LM_INFO, "Imp reference '%s' is not valid.", acsServices[service].impname));
            return;
        }

        imp->set_configuration_reference(instance_number, services_info);
        ACS_SHORT_LOG((LM_DEBUG, "Configuration reference at instance %d set to Imp '%s'.", instance_number, acsServices[service].impname));
        return;
    } catch(CORBA::Exception &ex) {
        ACS_SHORT_LOG((LM_ERROR, "Failed to contact Imp '%s'.", acsServices[service].impname));
        return;
    }
}
Пример #5
0
void SenderPTImpl::stopSendNew(CORBA::Long flwNmbr)
{
    CORBA::ULong flowNumber = flwNmbr;

    try
    {
        getSender()->stopSend(flowNumber);
    }
    catch(ACSErr::ACSbaseExImpl &ex)
    {
        ACS_SHORT_LOG((LM_WARNING,"senderPTImpl::stopSendNew base exception catched !"));
        ACSBulkDataError::AVStopSendErrorExImpl err = ACSBulkDataError::AVStopSendErrorExImpl(ex,__FILE__,__LINE__,"senderPTImpl::stopSendNew");
        throw err.getAVStopSendErrorEx();
    }
    /*catch (AVInvalidFlowNumberExImpl & ex)
    {
    ACS_SHORT_LOG((LM_INFO,"SenderPTImpl::stopSendNew AVInvalidFlowNumberExImpl exception catched !"));
    AVStopSendErrorExImpl err = AVStopSendErrorExImpl(ex,__FILE__,__LINE__,"SenderPTImpl::stopSendNew");
    throw err.getAVStopSendErrorEx();
    }*/
    catch (...)
    {
        ACS_SHORT_LOG((LM_ERROR,"senderPTImpl::stopSendNew UNKNOWN exception"));
        ACSBulkDataError::AVStopSendErrorExImpl err = ACSBulkDataError::AVStopSendErrorExImpl(__FILE__,__LINE__,"senderPTImpl::stopSendNew");
        throw err.getAVStopSendErrorEx();
    }
}
Пример #6
0
//-----------------------------------------------------------------------------
void
Helper::resolveNamingService(CORBA::ORB_ptr orb_mp)
{
    ACS_TRACE("Helper::resolveNamingService");
    try
	{
	//Here we try a couple of different methods to get at the naming service.
	if(orb_mp == 0)    //We've been passed a fake ORB.
	    {
	    //Try to get at the Naming Service using the activator singleton first.
	    if ((ContainerImpl::getContainer() != 0) &&
		(ContainerImpl::getContainer()->getContainerCORBAProxy() != maci::Container::_nil()))
		{
		namingContext_m = ContainerImpl::getContainer()->getService<CosNaming::NamingContext>(acscommon::NAMING_SERVICE_NAME, 0, true);
		}
	    //DWF - Ideally there would be a SimpleClient singleton that we would try next (this would
	    // be especially useful in Consumers), but instead we will just create our own ORB
	    // and hope this is running on the same host as the Naming Service =(
	    else    //This is basically just a fail-safe mechanism.
		{
		ACS_SHORT_LOG((LM_INFO,
			       "Helper::resolveNameService wrong constructor - attempting recovery for the '%s' channel!",
			       channelName_mp));

		if (orbHelper_mp == 0)
		    {
		    //should never be the case but if it does happen...
		    orbHelper_mp = new ORBHelper();
		    orbHelper_mp->runOrb();
		    }
		// Get the naming context
		namingContext_m=MACIHelper::resolveNameService(orbHelper_mp->getORB());
		}
	    }

	//Passed a valid orb so we try to resolve the naming service using
	//the "normal" method
	else
	    {
	    namingContext_m=MACIHelper::resolveNameService(orb_mp);
	    }
	}
    catch(...)
	{
        ACS_SHORT_LOG((LM_ERROR, "Helper::resolveNameService CORBA exception caught for the '%s' channel!",
		       channelName_mp));
	CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Helper::resolveNamingService");
	throw err.getCORBAProblemEx();
	}

	//one last check to make sure we have the correct reference to the name service
	if(CORBA::is_nil(namingContext_m))
	    {
	    ACS_SHORT_LOG((LM_ERROR,"Helper::resolveNameService unable to resolve name service for the '%s' channel!",
			   channelName_mp));
	    CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Helper::resolveNamingService");
	    throw err.getCORBAProblemEx();
	    }
}
Пример #7
0
    virtual void run()
	{
	    		try
		    {
	    			for(unsigned int i=0; i<3; i++)
	    			{

	    				ACS_SHORT_LOG((LM_INFO, "==> Going to changing value to ENABLE (1) to trigger an alarm."));
	    				dev_m->enable ();
	    				ACE_OS::sleep(2);


	    				ACS_SHORT_LOG((LM_INFO, "==> Going to test changing of FF and FM if we have an alarm."));
	    				// first heaving an alarm
	    				dev_m->changeAlarmFFFM("UserDefinedFF", "UserDefinedFM");

	    				dev_m->disable ();
	    				ACE_OS::sleep(2);

	    				dev_m->diagnose ();
	    				ACE_OS::sleep(2);
	    				// here we should not have an alarm anymore
	    				ACS_SHORT_LOG((LM_INFO, "==> Going to test changing of FF and FM if we do not have an alarm."));

	    				dev_m->shutdown ();
	    				ACE_OS::sleep(2);
	    			}//for
		    }
		catch(...)
		    {
		    ACS_SHORT_LOG((LM_ERROR,"Error!"));
		    }

		/*
			    	ACS_SHORT_LOG((LM_INFO, "==> Going to test changing of FF and FM if we have a previous alarm."));
	    	// first heaving an alarm
	    	comp_m->changeAlarmFFFM("UserDefinedFF", "UserDefinedFM");

	    	// reset all alarms
	    	ACS_SHORT_LOG((LM_INFO, "==> Going to test changing of FF and FM if we do not have a previous alarm."));
	    	ACS_SHORT_LOG((LM_INFO, "==> First we reset all alarms an wait that are actaully cleared."));
	    	ACS_SHORT_LOG((LM_INFO, "%s: Setting rwPattern to %d", getName().c_str(), 2));
			rwPattern_m->set_sync(2);
			ACE_OS::sleep(2); //we have to wait that alarm is actually cleaned
			ACS_SHORT_LOG((LM_INFO, "==> After resting alarms  we set new FF FM"));
			comp_m->changeAlarmFFFM("AnotherUserDefinedFF", "AnotherUserDefinedFM");

			ACS_SHORT_LOG((LM_INFO, "==>  Generate an alarm after we have changed FF, FM."));
	    	ACS_SHORT_LOG((LM_INFO, "%s: Setting rwPattern to %d", getName().c_str(), 1));
			rwPattern_m->set_sync(1);

	    	setStopped();
	    	ACS_SHORT_LOG((LM_INFO, "%s: Stopped thread", getName().c_str()));
	    */
	}
Пример #8
0
static void checkLogging(ACSDaemonContext * context, short instance)
{
	if (!loggingSystemInitialized)
	{
		// we need msg_callback to get LoggingProxy
		if (ACE_LOG_MSG->msg_callback () != 0 &&
				context->hasConfigurationReference(instance, acsServices[NAMING_SERVICE].xmltag))
		{
			try
			{
				// we get via NS and not a manager (to support logging when manager is not running)
				std::string nsReference = context->getConfigurationReference(instance, acsServices[NAMING_SERVICE].xmltag);
				CORBA::Object_var nc_obj = context->getORB()->string_to_object(nsReference.c_str());
				if (nc_obj.ptr() != CORBA::Object::_nil())
				{
					CosNaming::NamingContext_var nc = CosNaming::NamingContext::_narrow(nc_obj.in());
					if (nc.ptr() != CosNaming::NamingContext::_nil())
					{
						CosNaming::Name name;
						name.length(1);
						name[0].id = CORBA::string_dup("Log");

						CORBA::Object_var obj = nc->resolve(name);
						if (!CORBA::is_nil(obj.in()))
                    	{
							Logging::AcsLogService_var logger = Logging::AcsLogService::_narrow(obj.in());

							LoggingProxy* lp = static_cast<LoggingProxy*>(ACE_LOG_MSG->msg_callback());
							lp->setCentralizedLogger(logger.in());
							lp->setNamingContext(nc.in());
                            loggingSystemInitialized = true;
                            ACS_SHORT_LOG((LM_DEBUG, "Remote logging system initialized."));
                        }
						else
						{
							ACS_SHORT_LOG((LM_DEBUG, "Unable to resolve Log from the naming service."));
						}
					}
					else
					{
						ACS_SHORT_LOG((LM_DEBUG, "Unable to narrow NamingContext."));
					}
				}
				else
				{
					ACS_SHORT_LOG((LM_ERROR, "Unable to resolve naming service, invalid corbaloc reference: '%s'.", nsReference.c_str()));
				}
			}
			catch (...)
			{
				ACS_SHORT_LOG((LM_DEBUG, "Unable to initialize logging sytem, unexpected exception caught."));
			}
		}
	}
}
Пример #9
0
/* --------------------- [ CORBA interface ] ----------------------*/
CORBA::Long
CounterSupplierImpl::sendBlocks (const CORBA::Long initialVal,
		const CORBA::Long lastVal,
		const CORBA::Long changeVal,
		const CORBA::Float period)	
{

	CORBA::Boolean flag = false;
	
	ACS_SHORT_LOG((LM_INFO, "sendBlocks called ...."));

	ACS_SHORT_LOG((LM_INFO, "Ready to send NC events..."));
	// Send the events
	int val = (int)initialVal;
	int eventCount = 0;
	
	::COUNTER::statusBlockEvent t_data;
	
	while (val < (int)lastVal) {
		if (val < (int)changeVal)
			flag = false;
		else
			flag = true;

		t_data.onOff    = COUNTER::ON;
		//t_data.onOff    = 1.0;
		t_data.myString = "C++ supplier";
		t_data.counter1 = val;
		t_data.counter2 = lastVal;
		t_data.counter3 = changeVal;
		t_data.flipFlop = flag;
		t_data.period   = period;
		m_CounterSupplier_p->publishData<COUNTER::statusBlockEvent>(t_data);
		eventCount++;
		ACS_SHORT_LOG((LM_INFO, "Counting ongoing with period %.3fs up to %d, now %d", period,  lastVal, val));
		val++;
		usleep((unsigned long)(period * 1000000.f));
	}

	// Tell consumers this is the last event
	t_data.onOff    = COUNTER::OFF;
	//t_data.onOff    = 0.0;
	t_data.myString = "Last event from C++ supplier";
	t_data.counter1 = val;
	t_data.counter2 = lastVal;
	t_data.counter3 = changeVal;
	t_data.flipFlop = true;
	t_data.period   = period;
	m_CounterSupplier_p->publishData<COUNTER::statusBlockEvent>(t_data);
	eventCount++;
	ACS_SHORT_LOG((LM_INFO, "Counter stopped, last value %d", val));

	
	return (CORBA::Long)eventCount;
}
Пример #10
0
acsdaemon::ServiceState ACSServiceController::getActualState() {
    try {
        ACS_SHORT_LOG((LM_DEBUG, "Evaluating state of ACS service with Corba URI '%s'.", corbaloc.c_str()));
        CORBA::Object_var obj = getContext()->getORB()->string_to_object(corbaloc.c_str());
        if (CORBA::is_nil(obj.in())) {
            ACS_SHORT_LOG((LM_ERROR, "Failed to parse Corba URI '%s' for ACS service '%s'!", corbaloc.c_str(), desc->getACSServiceName()));
            return acsdaemon::DEFUNCT;
        }

        obj = acsQoS::Timeout::setObjectTimeout(CORBA_TIMEOUT, obj.in());

        if (obj->_non_existent()) {
        	if (state != acsdaemon::NOT_EXISTING)
        	{
				if (desc->getName()) {
					ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' with name '%s' doesn't exist.", desc->getACSServiceName(), desc->getName()));
				} else {
					ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' doesn't exist.", desc->getACSServiceName()));
				}
        	}
            return acsdaemon::NOT_EXISTING;
        }
    	if (desc->getName()) {
            ACS_SHORT_LOG((LM_DEBUG, "ACS service '%s' with name '%s' responded.", desc->getACSServiceName(), desc->getName()));
    	} else {
	        ACS_SHORT_LOG((LM_DEBUG, "ACS service '%s' responded.", desc->getACSServiceName()));
	    }
        return getContext()->getDetailedServiceState(desc, obj.in()); // acsdaemon::RUNNING;
//    } catch(CORBA::OBJECT_NOT_EXIST &ex) {
    } catch(CORBA::TRANSIENT &ex) {
    	if (state != acsdaemon::NOT_EXISTING)
    	{
			if (desc->getName()) {
				ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' with name '%s' doesn't exist.", desc->getACSServiceName(), desc->getName()));
			} else {
				ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' doesn't exist.", desc->getACSServiceName()));
			}
    	}
        return acsdaemon::NOT_EXISTING;
    } catch(CORBA::Exception &ex) {
//        ACS_SHORT_LOG((LM_ERROR, "Failed."));
//        ACE_PRINT_EXCEPTION (ex, ACE_TEXT ("Caught unexpected exception:"));
    	if (state != acsdaemon::DEFUNCT)
    	{
			if (desc->getName()) {
				ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' with name '%s' is defunct.", desc->getACSServiceName(), desc->getName()));
			} else {
				ACS_SHORT_LOG((LM_ERROR, "ACS service '%s' is defunct.", desc->getACSServiceName()));
			}
    	}
        return acsdaemon::DEFUNCT;
    }
}
Пример #11
0
int
BulkDataSendRecvCb::cbStop()
{
    if(flowNumber_m == 1)
	ACS_SHORT_LOG((LM_INFO, "flow 1 total length: %d", count1_m)); 
    if(flowNumber_m == 2)
	ACS_SHORT_LOG((LM_INFO, "flow 2 total length: %d", count2_m)); 

    // flows 3 and 4 not handled (see bulkDataReceiverCbEx1.cpp)

    return 0;
}
Пример #12
0
int
BulkDataReceiverCbDistr1::cbReceive(ACE_Message_Block * frame_p)
{
    ACS_TRACE("BulkDataReceiverCbDistr1::cbReceive"); 

    if(flowNumber_m == 1)
	{
        ACS_SHORT_LOG((LM_DEBUG, "RECEIVER 1 flowname 1: %s", flowname_m.c_str()));
        ACS_SHORT_LOG((LM_DEBUG, "RECEIVER 1 length data flowname 1: %d", frame_p->length()));
	count1_m += frame_p->length();
	}

    return 0;
}
Пример #13
0
int
BulkDataReceiverCbDistr1::cbStart(ACE_Message_Block * userParam_p)
{
    ACS_TRACE("BulkDataReceiverCbDistr1::cbStart"); 

    if(flowNumber_m == 1)
	{
	ACS_SHORT_LOG((LM_INFO, "RECEIVER 1 flowname 1: %s", flowname_m.c_str()));
	ACS_SHORT_LOG((LM_INFO, "RECEIVER 1 length param flowname 1: %d", userParam_p->length()));

	count1_m = 0;
	}

    return 0;
}
Пример #14
0
  void alarm_raised (ACS::pattern value,
		const ACSErr::Completion & c,
		const ACS::CBDescOut & desc
		 ) 
  {
    ACS_SHORT_LOG ((LM_DEBUG, "(%s::AlarmCBStates::raised) Value: %s (%llu). Completion (type=%d, code=%d)", prop.c_str(), description[value].in(), value, c.type, c.code));
  }
Пример #15
0
void logBatchUsingMacrosGeneralLogger()
{
	std::cout << "Log batch for logger [" << "GeneralLogger" << "]. USING ACS MACROS." << std::endl;

	// Test macros
	{
		AUTO_TRACE("TEST_MACROS");
		ACS_LOG(LM_RUNTIME_CONTEXT, __PRETTY_FUNCTION__, (LM_INFO, "LM_RUNTIME_CONTEXT inside TEST_MACROS"));
		ACS_LOG(LM_SOURCE_INFO, __PRETTY_FUNCTION__, (LM_INFO, "LM_SOURCE_INFO inside TEST_MACROS"));
	}

	ACS_LOG(LM_RUNTIME_CONTEXT, __PRETTY_FUNCTION__, (LM_INFO, "LM_RUNTIME_CONTEXT outside TEST_MACROS"));
	ACS_LOG( LM_SOURCE_INFO, __PRETTY_FUNCTION__, (LM_INFO, "LM_SOURCE_INFO outside TEST_MACROS"));

	ACS_TRACE(__PRETTY_FUNCTION__);

    ACS_SHORT_LOG((LM_INFO, "Test ACS_SHORT_LOG with LM_INFO"));

    //ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_SHUTDOWN, "Test of LM_SHUTDOWN log")); // NOT logging a thing
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_TRACE, "Test of LM_TRACE log"));
    //ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_DELOUSE, "Test of LM_DELOUSE log")); // Not logginf a thing
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_DEBUG, "Test of LM_DEBUG log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_INFO, "Test of LM_INFO log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_NOTICE, "Test of LM_NOTICE log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_WARNING, "Test of LM_WARNING log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_ERROR, "Test of LM_ERROR log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_CRITICAL, "Test of LM_CRITICAL log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_ALERT, "Test of LM_ALERT log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_EMERGENCY, "Test of LM_EMERGENCY log"));

    // Debug messages
    ACS_DEBUG(__PRETTY_FUNCTION__, "Test of ACS_DEBUG macro");
    ACS_DEBUG_PARAM(__PRETTY_FUNCTION__, "Test of ACS_DEBUG_PARAM macro with param: %s", "param1");
} // 17 + 2 messages (entering + exiting)
Пример #16
0
// Implementation skeleton constructor
enumpropTestDeviceImpl::enumpropTestDeviceImpl (
    const ACE_CString& name,
    maci::ContainerServices* containerServices) :
    CharacteristicComponentImpl(name,containerServices),
    m_currentState(0), 
    m_currentStateRW(0)
{
  ACS_TRACE("enumpropTestDeviceImpl::enumpropTestDeviceImpl");
  
  // properties
  m_currentState = new ROEnumImpl<ACS_ENUM_T(ENUMPROP_TEST::States), POA_ENUMPROP_TEST::ROStates> (name+":currentStates", getComponent());
  CHARACTERISTIC_COMPONENT_PROPERTY(currentState,m_currentState)
 
  m_currentStateRW = new RWEnumImpl<ACS_ENUM_T(ENUMPROP_TEST::States), POA_ENUMPROP_TEST::RWStates> (name+":currentStatesRW", getComponent());
  CHARACTERISTIC_COMPONENT_PROPERTY(currentStateRW,m_currentStateRW)
 
  ACS_SHORT_LOG((LM_INFO, "enumprop Test Device: %s created", name.c_str()));

 /*
  * Here we are at the top of the hierarchy and we do not have
  * a container to use for the test.
  * Therefore we call by hand initialize() and execute()
  * to "activate" the component
  */
  __initialize();
  __execute();
}
Пример #17
0
// The time negotiation is not yet implemented	
CORBA::Boolean AsyncCBdouble::negotiate (ACS::TimeInterval time_to_transmit, const ACS::CBDescOut &desc) 
	{
		char logStr[128];
		sprintf(logStr,"AsyncCBdouble::negotiate property %s",propertyName.c_str());
		ACS_SHORT_LOG((LM_INFO,logStr));
		return true;
}
/**
 * Reads the commanded azimuth from Mount2 telescope.
 *
 */
CORBA::Double Mount2RefAzDevIO::read(ACS::Time& timestamp) throw (ACSErr::ACSbaseExImpl)
{
	ACS_SHORT_LOG( (LM_INFO, "Mount2RefAzDevIO: read"));
	CORBA::Double ret_val(0.0);
//	char *msg;
//	unsigned long read_alt, read_azm;
//	CORBA::Double azm;

	Communication comm = Communication("/dev/ttyUSB0");
	ret_val = comm.getAzm();
//	SerialRS232 *sp = new SerialRS232("/dev/ttyUSB0");
//	sp->write_RS232("z");
//	msg = sp->read_RS232();
//	sscanf(msg,"%08lX,%08lX#",&read_azm,&read_alt);
//
//#define MAX_PRECISE_ROTATION 4294967296.0
//
//	azm = (double)read_azm / MAX_PRECISE_ROTATION;
//	azm *= 360.0;
//
//	ret_val = azm;
//
//	timestamp=getTimeStamp();
//	delete sp;
	return ret_val;
}
Пример #19
0
    virtual void done (const ACSErr::Completion& c)
    {
	ACS_SHORT_LOG((LM_INFO, "Start ACS request completed:"));
	ACSErr::CompletionImpl comp = c;
	comp.log();
	complete = true;
    }
Пример #20
0
void ACSDaemonContext::initialize(CORBA::ORB_ptr iorb) {
    ACS_SHORT_LOG((LM_DEBUG, "Initializing ACSDaemonContext!"));
    orb = iorb;
    acsQoS::init(orb);
    reqproc->resume();
    ctrl->resume();
}
Пример #21
0
void Consumer::setAntennaName(std::string antennaName) {
    //If the antenna name is already set, do nothing
    if (this->antennaName.compare("") != 0)
        return;
    this->antennaName = antennaName;
    if (antennaName.compare("") != 0) {
        std::cout << "Adding filter" << std::endl;
        CosNotifyFilter::FilterFactory_var filter_factory =
                notifyChannel_m->default_filter_factory();
        CosNotifyFilter::Filter_var filter = filter_factory->create_filter(
                "ETCL");
        if (CORBA::is_nil(filter)) {
            ACS_SHORT_LOG(
                    (LM_ERROR,"Consumer::createConsumer failed for the '%s' channel due the filter cannot be created!", channelName_mp));
        }
        CosNotifyFilter::ConstraintExpSeq constraint_list;
        constraint_list.length(1);
        constraint_list[0].event_types.length(0);
        std::string filter_expr = "$antenna_name == '" + antennaName + "'";
        std::cout << filter_expr << std::endl;
        constraint_list[0].constraint_expr = CORBA::string_dup(
                filter_expr.c_str());
        filter->add_constraints(constraint_list);
        proxySupplier_m->add_filter(filter.in());
    }
}
Пример #22
0
bool ImpRequest::execute() {
    ACS_SHORT_LOG ((LM_INFO, "Executing: '%s'.", command.c_str()));
    ACE_OS::system(command.c_str());
    for (int i = 0; i <= 9; i++)
      if (controller->getContext()->hasConfigurationReference(i))
        controller->setConfigurationReference(i, controller->getContext()->getConfigurationReference(i));
    return true;
}
Пример #23
0
void  enumpropTestDeviceImpl::serverShutdown ()
{
    
#ifndef MAKE_VXWORKS
    ACS_SHORT_LOG((LM_INFO, "enumpropTestDeviceImpl::serverShutdown")); 
    BACI_CORBA::getORB()->shutdown(true);
    //LoggingProxy::done();
#endif
}
Пример #24
0
void AsyncCBdouble::working (CORBA::Double value, const ACSErr::Completion &c, const ACS::CBDescOut &desc)
	{
		char logStr[128];
		sprintf(logStr,
			"AsyncCBdouble::working property %s and val=%lf",
			propertyName.c_str(),
			value);
		ACS_SHORT_LOG((LM_INFO,logStr));
}
Пример #25
0
//-----------------------------------------------------------------------------
void
Supplier::destroyNotificationChannel()
{
    ACS_TRACE("Supplier::destroyNotificationChannel");

    //Sanity check
    if (CORBA::is_nil(notifyChannel_m.in())==true)
	{
	ACS_SHORT_LOG((LM_ERROR, "Supplier::destroyNotificationChannel() error occured for the '%s' channel!",
		       channelName_mp));
	CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Supplier::destroyNotificationChannel");
	throw err.getCORBAProblemEx();
	}

    try
	{
	//Destroy the remote object and dereference it's pointer.
	notifyChannel_m->destroy();
	notifyChannel_m = 0;

	// Unbind notification channel from Naming service
	CosNaming::Name name(1);
	name.length(1);
	name[0].id = CORBA::string_dup(getCombinedChannelAndDomainName().c_str());
	name[0].kind = acscommon::NC_KIND;
	ACE_ASSERT(CORBA::is_nil(namingContext_m.in()) == false);
	namingContext_m->unbind(name);
	}
    catch(CORBAProblemEx)
	{
	ACS_SHORT_LOG((LM_ERROR, "Supplier::destroyNotificationChannel() failed for the '%s' channel with an ACS-based exception!",
		       channelName_mp));
	//exception thrown by us...OK to rethrow
	throw;
	}
    catch(...)
	{
	ACS_SHORT_LOG((LM_ERROR, "Supplier::destroyNotificationChannel() error occured for the '%s' channel!",
		       channelName_mp));
	CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Supplier::destroyNotificationChannel");
	throw err.getCORBAProblemEx();
	}
}
Пример #26
0
    virtual void working (
        const char * service,
        const char * host,
        ::CORBA::Short instance_number,
        const ::ACSErr::Completion & c)
    {
	ACS_SHORT_LOG((LM_INFO, "Start %s service status:", service));
        ACSErr::CompletionImpl comp = c;
        comp.log();
    }
Пример #27
0
int
BulkDataReceiverCbDistr1::cbStop()
{
    ACS_TRACE("BulkDataReceiverCbDistr1::cbStop"); 

    if(flowNumber_m == 1)
	ACS_SHORT_LOG((LM_INFO, "RECEIVER 1 flow 1 total length: %d", count1_m)); 

    return 0;
}
Пример #28
0
	SetterThread(const ACE_CString& name,
			ENUMPROP_TEST::enumpropTestDevice* dev,
			const ACS::TimeInterval& responseTime=ThreadBase::defaultResponseTime,
			const ACS::TimeInterval& sleepTime=ThreadBase::defaultSleepTime) :
	ACS::Thread(name, responseTime, sleepTime)
	{
	    ACS_TRACE("SetterThread::SetterThread");
	    dev_m = ENUMPROP_TEST::enumpropTestDevice::_duplicate(dev);

	    ACS_SHORT_LOG((LM_INFO, "%s: Created thread", getName().c_str()));
	}
Пример #29
0
void ServiceController::restart() {
    m_mutex->acquire();
    if (active && setState(getActualState()) && autorestart && startreq == NULL /*&& stopreq == NULL*/) {
        // restarts only if state has just changed from RUNNING/DEGRADED to NOT_EXISTING

        ACS_SHORT_LOG((LM_WARNING, "Restarting %s.", getServiceName().c_str()));
        stopreq = NULL;
        context->getRequestProcessor()->process(startreq = createControlledServiceRequest(START_SERVICE)); // enqueue service startup request
    }
    m_mutex->release();
}
Пример #30
0
void ServiceController::restart() {
    m_mutex->acquire();
    if (active && setState(getActualState()) && autorestart && startreq == NULL /*&& stopreq == NULL*/) {
        // restarts only if state has just changed from RUNNING/DEGRADED to NOT_EXISTING

        ACS_SHORT_LOG((LM_WARNING, "Restarting %s.", getServiceName().c_str()));
        stopreq = NULL;
        context->getRequestProcessor()->process(startreq = createControlledServiceRequest(START_SERVICE)); // enqueue service startup request
        //restart loggingService, otherwise remote logger get stuck
        if (ACSServiceController * c = dynamic_cast<ACSServiceController*>(this)) {
        	if (c->desc->getACSService() == NOTIFICATION_SERVICE &&
        			std::string(c->desc->getName()).compare("LoggingNotifyEventChannelFactory") == 0) {
        		std::ostringstream addr_str;
        		addr_str << "corbaloc::";
        		addr_str << c->desc->getHost() << ":" << acsServices[LOGGING_SERVICE].impport << "/";
        		addr_str << acsServices[LOGGING_SERVICE].imptype;

        		ACS_SHORT_LOG((LM_INFO, "Getting reference of %s using address: %s",
        				acsServices[LOGGING_SERVICE].imptype,
        				addr_str.str().c_str()));
        		int argc = 1;
        		char *argv[] = {"some_daemon"};
        		CORBA::ORB_var orb = CORBA::ORB_init (argc,argv,"TAO");
        		CORBA::Object_var obj = orb->string_to_object(addr_str.str().c_str());
        		if (CORBA::is_nil(obj.in())){
					ACS_SHORT_LOG(
							(LM_ERROR, "Failed to resolve reference '%s'.", addr_str.str().c_str()));
					return;
				}
				acsdaemon::LoggingServiceImp_var imp = acsdaemon::LoggingServiceImp::_narrow(obj.in());
				if (CORBA::is_nil(imp.in())) {
					ACS_SHORT_LOG(
							(LM_ERROR, "Failed to narrow reference '%s'.", addr_str.str().c_str()));
					return;
				}
				ACS_SHORT_LOG((LM_INFO, "Calling stop_logging_service"));
				imp->stop_logging_service("Log",
						acsdaemon::DaemonCallback::_nil(),
						c->desc->getInstanceNumber());
				ACS_SHORT_LOG((LM_INFO, "Calling stop_logging_service completed"));
				sleep(5);
				ACS_SHORT_LOG((LM_INFO, "Calling start_logging_service"));
				imp->start_logging_service("Log",
						acsdaemon::DaemonCallback::_nil(),
						c->desc->getInstanceNumber());
				ACS_SHORT_LOG((LM_INFO, "Calling start_logging_service completed"));
        	}
        }
    }
    m_mutex->release();
}