80 likes | 96 Views
Asynchronous behavior with ACS. Bogdan Jeram (bjeram@eso.org) European Southern Observatory. Asynchronous calls. Callee (client) is not blocked Result is send later Callback mechanism is used in asynchronous communication for sending notification on action completion. Callback.
E N D
Asynchronous behaviorwithACS Bogdan Jeram (bjeram@eso.org) European Southern Observatory Socorro July, 2004
Asynchronous calls • Callee (client) is not blocked • Result is send later • Callback mechanism is used in asynchronous communication for sending notification on action completion ALMA Common Software course
Callback • component calls back the client (method on the callback object) when command is done • Callback object has two methods: • working • done • passed completion data (+ result) • used also for send monitor values ALMA Common Software course
Callbacks in IDL • callback interfaces predefined by BACI (baci.idl) • baci properties use them • different types with same functionality: interface CBvoid : Callback { oneway void working (in ACSErr::Completion c, in CBDescOut desc ); oneway void done (in ACSErr::Completion c, in CBDescOut desc ); }; interface CB<T> : Callback { oneway void working (in T value, in ACSErr::Completion c, in CBDescOut desc); oneway void done (in T value, in ACSErr::Completion c, in CBDescOut desc); }; ALMA Common Software course
Introducing asynchronous behavior in IDL • Asynchronous methods has to pass callback object (ACS::CB<T>) and structure ACS::CBDescIn. • Example: void objfix_async (in double az, in double elev, in ACS::CBvoid callBack, in ACS::CBDescIn desc); ALMA Common Software course
Client side • It has to implement callback or to get already implemented (default) one with default behavior ! • Implement means implementing methods: • working • done ALMA Common Software course
Component (server) side • implement IDL method (with callback as one of parameter): • register action (ID of command + callback + data+ …) • return immediately • implement actual command which will be called asynchronously from invokeAction • implement invokeAction switch which calls right command depend on ID ALMA Common Software course
Mount4 • objfix -> objfix_async ALMA Common Software course