Search in sources :

Example 1 with CBdouble

use of alma.ACS.CBdouble in project ACS by ACS-Community.

the class DemoCallbackResponderImpl method dummy3.

public void dummy3(String text, CBdouble cb, CBDescIn descIn) {
    System.out.println("dummy3('" + text + "') called");
    System.out.println("invoking callback");
    try {
        double returnValue = 2.7D;
        ResponderUtil.respond(returnValue, cb, descIn);
        throw new IllegalStateException("bla");
    } catch (Exception exc) {
        ResponderUtil.respond(exc, cb, descIn);
    }
}
Also used : CBdouble(alma.ACS.CBdouble)

Example 2 with CBdouble

use of alma.ACS.CBdouble in project ACS by ACS-Community.

the class LampCallbackImpl method monitorLampBrightness.

/////////////////////////////////////////////////////////////
// Implementation of LampCallbackOperations
/////////////////////////////////////////////////////////////
/**
	 * Attaches a monitor to the brightness object of the lamp component. 
	 * The component uses a callback when the interval set to the timer expires.
	 * @return double
	 * @see LampCallbackOperations#monitorLampBrightness()
	 * @throws alma.demo.LampUnavailable
	 */
public double monitorLampBrightness() throws LampUnavailable {
    if (m_cb == null) {
        m_cb = new CBdoubleLampCallback(m_logger);
        m_logger.finer("CBdoubleLampCallback instantiated...");
    }
    CBdouble cbdouble;
    try {
        //test
        //			CBdoubleHelper.narrow(m_containerServices.activateOffShoot(m_cb));
        //			m_containerServices.deactivateOffShoot(m_cb);
        // note that m_cb may go through a cycle of activation/deactivation, see stopMonitor()
        cbdouble = CBdoubleHelper.narrow(m_containerServices.activateOffShoot(m_cb, CBdoubleOperations.class));
    } catch (Exception e) {
        m_logger.log(Level.SEVERE, "failed to obtain the callback offshoot object.", e);
        throw new LampUnavailable(e.getMessage());
    }
    if (m_desc == null) {
        m_desc = new CBDescIn();
        m_logger.info("m_desc instantiated...");
    }
    double brightness = 0;
    try {
        getLampBrightnessObject();
        CompletionHolder completionHolder = new CompletionHolder();
        brightness = m_brightness.get_sync(completionHolder);
        m_monitor = m_brightness.create_monitor(cbdouble, m_desc);
        m_logger.info("monitor instantiated...");
        // call every 10th second		
        m_logger.info("prepares to trigger brightness every 10th second...");
        m_monitor.set_timer_trigger(100000000);
        m_logger.info("ready to trigger brightness...");
    } catch (Exception ex) {
        m_logger.log(Level.SEVERE, "ex in monitorLampBrightness impl", ex);
        throw new LampUnavailable(ex.getMessage());
    }
    return brightness;
}
Also used : CBdouble(alma.ACS.CBdouble) LampUnavailable(alma.demo.LampUnavailable) CBdouble(alma.ACS.CBdouble) RWdouble(alma.ACS.RWdouble) Monitordouble(alma.ACS.Monitordouble) CompletionHolder(alma.ACSErr.CompletionHolder) CBDescIn(alma.ACS.CBDescIn) ACSException(alma.ACSErr.ACSException) AcsJException(alma.acs.exceptions.AcsJException)

Example 3 with CBdouble

use of alma.ACS.CBdouble in project ACS by ACS-Community.

the class RequesterUtil method giveCBDouble.

/**
	 * 
	 * @param cs
	 * @param x
	 * @return
	 * @throws AcsJContainerServicesEx
	 */
public static CBdouble giveCBDouble(ContainerServicesBase cs, ResponseReceiver<Double> x) throws AcsJContainerServicesEx {
    CBdouble ret;
    Objects.CBdoubleImpl cb = new Objects.CBdoubleImpl(x);
    OffShoot offshoot = cs.activateOffShoot(cb);
    ret = CBdoubleHelper.narrow(offshoot);
    return ret;
}
Also used : CBdouble(alma.ACS.CBdouble) OffShoot(alma.ACS.OffShoot)

Aggregations

CBdouble (alma.ACS.CBdouble)3 CBDescIn (alma.ACS.CBDescIn)1 Monitordouble (alma.ACS.Monitordouble)1 OffShoot (alma.ACS.OffShoot)1 RWdouble (alma.ACS.RWdouble)1 ACSException (alma.ACSErr.ACSException)1 CompletionHolder (alma.ACSErr.CompletionHolder)1 AcsJException (alma.acs.exceptions.AcsJException)1 LampUnavailable (alma.demo.LampUnavailable)1