Asynchronous behavior with ACS Bogdan Jeram bjerameso org
Asynchronous behavior with ACS Bogdan Jeram (bjeram@eso. org) European Southern Observatory Socorro July, 2004
Asynchronous calls ALMA Project • Callee (client) is not blocked • Result is send later • Callback mechanism is used in asynchronous communication for sending notification on action completion Socorro, July 2004 ALMA Common Software course 2
Callback ALMA Project • 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 Socorro, July 2004 ALMA Common Software course 3
Callbacks in IDL ALMA Project • • • 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 CBDesc. Out desc ); oneway void done (in ACSErr: : Completion c, in CBDesc. Out desc ); }; interface CB<T> : Callback { oneway void working (in T value, in ACSErr: : Completion c, in CBDesc. Out desc); oneway void done (in T value, in ACSErr: : Completion c, in CBDesc. Out desc); }; Socorro, July 2004 ALMA Common Software course 4
Introducing asynchronous behavior in IDL ALMA Project • Asynchronous methods has to pass callback object (ACS: : CB<T>) and structure ACS: : CBDesc. In. • Example: void objfix_async (in double az, in double elev, in ACS: : CBvoid call. Back, in ACS: : CBDesc. In desc); Socorro, July 2004 ALMA Common Software course 5
Client side ALMA Project • It has to implement callback or to get already implemented (default) one with default behavior ! • Implement means implementing methods: – working – done Socorro, July 2004 ALMA Common Software course 6
Component (server) side ALMA Project • 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 invoke. Action • implement invoke. Action switch which calls right command depend on ID Socorro, July 2004 ALMA Common Software course 7
Mount 4 ALMA Project • objfix -> objfix_async Socorro, July 2004 ALMA Common Software course 8
- Slides: 8