Initial revision
This commit is contained in:
146
devexec.h
Normal file
146
devexec.h
Normal file
@ -0,0 +1,146 @@
|
||||
|
||||
#line 184 "devexec.w"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
||||
D E V I C E E X E C U T O R
|
||||
|
||||
Joachim Kohlbrecher wants to give several commands to the server
|
||||
and than wait for them to happen before proceeding. Actually a useful
|
||||
thing. A command will map to one or several positioning commands for a
|
||||
device. This scheme is also useful for implementing objects which
|
||||
drive several motors simulataneously, such as Monochromators. etc.
|
||||
However, the whole thing is rather complicated.
|
||||
|
||||
It is forbidden, that several clients drive the instrument. In order
|
||||
to ensure this the Executor remembers the connection which emitted the
|
||||
first command. Subsequent AddExeEntries from different clients will
|
||||
be rejected. The owner will be reset when the execution is found finished
|
||||
in calls to CheckExe, Wait4Success or StopExe.
|
||||
|
||||
|
||||
Mark Koennecke, December 1996
|
||||
|
||||
copyright: see implementation file
|
||||
---------------------------------------------------------------------------*/
|
||||
#ifndef SICSDEVEXEC
|
||||
#define SICSDEVEXEC
|
||||
#include "obdes.h"
|
||||
#include "task.h"
|
||||
|
||||
typedef struct __EXELIST *pExeList;
|
||||
|
||||
/* Returncodes */
|
||||
|
||||
#define DEVDONE 1
|
||||
#define DEVINT 0
|
||||
#define DEVERROR 2
|
||||
#define DEVBUSY 3
|
||||
|
||||
/*------------------------------------------------------------------------
|
||||
B I R T H & D E A T H
|
||||
*/
|
||||
pExeList CreateExeList(pTaskMan pTask);
|
||||
void DeleteExeList(void *self);
|
||||
|
||||
/* ================= Functions to talk to the above ====================== */
|
||||
|
||||
#line 43 "devexec.w"
|
||||
|
||||
int StartDevice(pExeList self, char *name, pObjectDescriptor pDes,
|
||||
void *pData, SConnection *pCon, float fNew);
|
||||
int StartMotor(pExeList self, SicsInterp *pSics, SConnection *pCon,
|
||||
char *name, float fNew);
|
||||
int StartCounter(pExeList self, SicsInterp *pSics, SConnection *pCon,
|
||||
char *name);
|
||||
|
||||
#line 228 "devexec.w"
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#line 88 "devexec.w"
|
||||
|
||||
int CheckExeList(pExeList self);
|
||||
/*
|
||||
checks the entries for success and deletes entries which have finished
|
||||
operation. If there are none left, the pOwner will be set to NULL.
|
||||
*/
|
||||
int Wait4Success(pExeList self);
|
||||
|
||||
long GetDevexecID(pExeList self);
|
||||
|
||||
int DevExecTask(void *pEL);
|
||||
void DevExecSignal(void *pEL, int iSignal, void *pSigData);
|
||||
|
||||
|
||||
#line 230 "devexec.w"
|
||||
|
||||
|
||||
/*
|
||||
Waits for execution to finish. returns 1 on Success, 0 if problems
|
||||
ocurred. Than the Interrupt code shall be checked and acted upon
|
||||
accordingly.
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
SConnection *GetExeOwner(pExeList self);
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int isInRunMode(pExeList self);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int ListPending(pExeList self, SConnection *pCon);
|
||||
/*
|
||||
lists the Operations still pending on pCon.
|
||||
*/
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#line 137 "devexec.w"
|
||||
|
||||
int StopExe(pExeList self, char *name);
|
||||
int StopExeWait(pExeList self);
|
||||
/*
|
||||
will stop the entry name and its subentries from executing.
|
||||
If ALL is specified as name, everything will be stopped and
|
||||
the Executor cleared.
|
||||
StopExeWait will stop all running things and wait for the stop
|
||||
to complete.
|
||||
*/
|
||||
/*------------------------------------------------------------------------*/
|
||||
void ClearExecutor(pExeList self);
|
||||
/*
|
||||
clears the executor without sending commands to the devices.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int IsCounting(pExeList self);
|
||||
int PauseExecution(pExeList self);
|
||||
int ContinueExecution(pExeList self);
|
||||
|
||||
|
||||
#line 248 "devexec.w"
|
||||
|
||||
/*-------------------------- Commands ------------------------------------*/
|
||||
int StopCommand(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
/*
|
||||
implements the stop command
|
||||
*/
|
||||
|
||||
int ListExe(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
|
||||
/*
|
||||
lists all currently executing objects
|
||||
*/
|
||||
int Success(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
/*
|
||||
waits until completion of all pending operations. Used in
|
||||
connection with non blocking operation such as motors started
|
||||
with run.
|
||||
*/
|
||||
|
||||
/* -------------------------- Executor management -------------------------*/
|
||||
|
||||
pExeList GetExecutor(void);
|
||||
void SetExecutor(pExeList pExe);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user