- Reworked the connection object and the IO system
- Reworked the support for TRICS - Added a second generation motor
This commit is contained in:
26
interface.w
26
interface.w
@ -46,12 +46,14 @@ Let's start with the objectdescriptor:
|
||||
#define SICSDESCRIPTOR
|
||||
#include <stdio.h>
|
||||
#include <ifile.h>
|
||||
#include <hipadaba.h>
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
int (*SaveStatus)(void *self, char *name,FILE *fd);
|
||||
void *(*GetInterface)(void *self, int iInterfaceID);
|
||||
IPair *pKeys;
|
||||
pHdb parNode;
|
||||
} ObjectDescriptor, *pObjectDescriptor;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -186,6 +188,7 @@ This is an interface for interacting with anything which counts.
|
||||
@d count @{
|
||||
typedef struct {
|
||||
int ID;
|
||||
int running;
|
||||
int (*Halt)(void *self);
|
||||
void (*SetCountParameters)(void *self, float fPreset,
|
||||
CounterMode eMode);\
|
||||
@ -197,9 +200,13 @@ This is an interface for interacting with anything which counts.
|
||||
} ICountable, *pICountable;
|
||||
|
||||
pICountable GetCountableInterface(void *pObject);
|
||||
|
||||
int GetCountLock(pICountable self, SConnection *pCon);
|
||||
void ReleaseCountLock(pICountable self);
|
||||
int isRunning(pICountable self);
|
||||
@}
|
||||
|
||||
{\bf running } Is a flag which says if the counter is operating or not.
|
||||
|
||||
{\bf Halt and StartCount} are self explaining, they just do what they say. Please
|
||||
note, that counting configuration must have happened before usage of this
|
||||
interface.
|
||||
@ -223,6 +230,13 @@ the existence of a countable interface. If it exists a pointer to it will be
|
||||
returned. NEVER free this pointer. If no countable interface exists, NULL
|
||||
will be returned.
|
||||
|
||||
{\bf GetCountLock} will try to set the running flag. If it is already running, an error
|
||||
is printed to pCon and 0 is returned.
|
||||
|
||||
{\bf ReleaseCountLock} release the count lock.
|
||||
|
||||
{\bf isRunning} returns the running flag.
|
||||
|
||||
\subsubsection{The Callback Interface}
|
||||
The Callback Interface is SICS suport for component behaviour for objects.
|
||||
Consider objects A and B. A now is able to generate certain events when it's
|
||||
@ -239,7 +253,7 @@ function:
|
||||
@d callfunc @{
|
||||
typedef void (*KillFuncIT)(void *pData);
|
||||
typedef int (*SICSCallBack)(int iEvent, void *pEventData,
|
||||
void *pUserData, commandContext cc);
|
||||
void *pUserData);
|
||||
@}
|
||||
|
||||
The callback function is meant to return 0 for failure or 1 for success.
|
||||
@ -267,11 +281,12 @@ interface:
|
||||
int InvokeCallBack(pICallBack pInterface, int iEvent, void *pEventData);
|
||||
|
||||
/* callback client side */
|
||||
long RegisterCallback(pICallBack pInterface, commandContext comCon,
|
||||
long RegisterCallback(pICallBack pInterface,
|
||||
int iEvent, SICSCallBack pFunc,
|
||||
void *pUserData, KillFuncIT pKill);
|
||||
int RemoveCallback(pICallBack pInterface, long iID);
|
||||
int RemoveCallback2(pICallBack pInterface, void *pUserData);
|
||||
int RemoveCallbackCon(pICallBack pInterface, SConnection *pCon);
|
||||
|
||||
int CallbackScript(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
@ -317,6 +332,11 @@ RegisterCallBack.
|
||||
search key for deletion is the pointer to user data. All callbacks related
|
||||
to this user data in the interface specified will be removed.
|
||||
|
||||
{\bf RemoveCallbackCon} is another variant for removing callbacks. This time the
|
||||
search key for deletion is the pointer to user data which must be a connection object.
|
||||
All callbacks related to this connection in the interface specified will be removed. This is
|
||||
a convenience function for removing interest callbacks in SICS.
|
||||
|
||||
{\bf CallbackScript} allows to connect callbacks to scripts. Please
|
||||
note, that those scripts will have a dummy connection to clients only
|
||||
and will not be able to write to clients. All output occurring in
|
||||
|
Reference in New Issue
Block a user