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);
}
}
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;
}
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;
}
Aggregations