Search in sources :

Example 1 with Lamp

use of alma.acsexmplLamp.Lamp in project ACS by ACS-Community.

the class LampAccessImpl method getLampBrightnessProperty.

/////////////////////////////////////////////////////////////
// other
/////////////////////////////////////////////////////////////	
/**
	 * Gets the lamp component's (LAMP1) brightness as RWdouble.
	 * @return RWdouble
	 * @throws LampUnavailable
	 */
RWdouble getLampBrightnessProperty() throws LampUnavailable {
    if (m_brightness == null) {
        org.omg.CORBA.Object cmp = null;
        try {
            cmp = m_containerServices.getComponent(m_lampCurl);
            Lamp lamp = LampHelper.narrow(cmp);
            m_brightness = lamp.brightness();
        } catch (Exception ex) {
            throw new LampUnavailable(ex.getMessage());
        }
        if (m_brightness == null) {
            throw new LampUnavailable("failed to obtain the lamp component's brightness property (NULL).");
        }
    }
    return m_brightness;
}
Also used : LampUnavailable(alma.demo.LampUnavailable) Lamp(alma.acsexmplLamp.Lamp) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException)

Example 2 with Lamp

use of alma.acsexmplLamp.Lamp in project ACS by ACS-Community.

the class MyTestCBvoid method testActivateOffShoot.

public void testActivateOffShoot() throws Exception {
    // activate callback object
    MyTestCBvoid cb = new MyTestCBvoid(m_logger);
    m_logger.info("MyTestCBvoid instantiated...");
    CBvoid cbvoid = alma.ACS.CBvoidHelper.narrow(getContainerServices().activateOffShoot(cb));
    m_logger.info("MyTestCBvoid activated.");
    // activate dal listener object
    m_logger.info("activating dal listener offshoot...");
    DALChangeListenerPOA dalListenerSrv = new MyTestDALChangeListener();
    OffShoot offshoot2 = getContainerServices().activateOffShoot(dalListenerSrv);
    DALChangeListener dalListenerRef = DALChangeListenerHelper.narrow(offshoot2);
    m_logger.info("done activating dal listener offshoot.");
    // check if dal listener works...
    m_logger.info("calling dal listener...");
    dalListenerRef.object_changed("happyCurl");
    m_logger.info("done calling dal listener.");
    // check if callback works...
    RWdouble brightness = null;
    Lamp lamp = LampHelper.narrow(getContainerServices().getComponent(m_lampCurl));
    assertNotNull("reference to Lamp component not null", lamp);
    brightness = lamp.brightness();
    assertNotNull("brightness property of lamp not null", brightness);
    CBDescIn desc = new CBDescIn();
    m_logger.info("m_desc instantiated...");
    m_logger.info("before setting callback...");
    brightness.set_async(7.345, cbvoid, desc);
    m_logger.finer("callback set...");
//todo: do something and get feedback from the callback object		
//		m_logger.finer("changing value (sync)...");
//		brightness.set_sync(8.456);
}
Also used : DALChangeListenerPOA(com.cosylab.CDB.DALChangeListenerPOA) RWdouble(alma.ACS.RWdouble) OffShoot(alma.ACS.OffShoot) DALChangeListener(com.cosylab.CDB.DALChangeListener) Lamp(alma.acsexmplLamp.Lamp) CBvoid(alma.ACS.CBvoid) CBDescIn(alma.ACS.CBDescIn)

Aggregations

Lamp (alma.acsexmplLamp.Lamp)2 CBDescIn (alma.ACS.CBDescIn)1 CBvoid (alma.ACS.CBvoid)1 OffShoot (alma.ACS.OffShoot)1 RWdouble (alma.ACS.RWdouble)1 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)1 LampUnavailable (alma.demo.LampUnavailable)1 DALChangeListener (com.cosylab.CDB.DALChangeListener)1 DALChangeListenerPOA (com.cosylab.CDB.DALChangeListenerPOA)1