PSI update

r1464 | ffr | 2007-02-12 12:20:21 +1100 (Mon, 12 Feb 2007) | 2 lines
This commit is contained in:
Ferdi Franceschini
2007-02-12 12:20:21 +11:00
committed by Douglas Clowes
parent 634f2023b1
commit 3168325921
157 changed files with 29053 additions and 910 deletions

View File

@@ -25,6 +25,11 @@ typedef struct {
int iEnd;
}hdbUpdateTask, *pHdbUpdateTask;
/*======================== common callbacks =====================================*/
/**
* make a ReadOnly callback
* @return a callback which disallows setting of a parameter.
*/
pHdbCallback MakeReadOnlyCallback();
/**
* make a callback which checks permissions. To be used on write
* @param priv The privilege to check against
@@ -81,7 +86,7 @@ pHdbCallback MakeIntRangeCallback(int min, int max);
* @return a suitably configured callback or NULL
* when out of memory
*/
pHdbCallback MakeIntFixedCallback(long *data, int length);
pHdbCallback MakeIntFixedCallback(int *data, int length);
/**
* make a callback for checking if a parameter is within a given
* range of floats
@@ -91,6 +96,29 @@ pHdbCallback MakeIntFixedCallback(long *data, int length);
* when out of memory
*/
pHdbCallback MakeFloatRangeCallback(double min, double max);
/**
* make a callback which reads a memory address (perhaps in a
* data structure) which is a float value
* @param address The address of the parameter
* @return a suitable callback for reading this parameter.
*/
pHdbCallback MakeMemReadCallback(float *address);
/**
* make a callback which sets a memory address (perhaps in a
* data structure) which is a float value. It is assumed that
* this is a direct parameter, i.e, UpdateHipadabaPar is
* automatically called.
* @param address The address of the parameter
* @return a suitable callback for setting this parameter.
*/
pHdbCallback MakeMemSetCallback(float *address);
/**
* make a tree chnage callback
* @param pCon The connection to notfy on tree chnages
* @id The ID of this callback
* @return a suitable callback for notififications about tree changes.
*/
pHdbCallback MakeTreeChangeCallback(SConnection *pCon, int id);
/*======================== parameter creation ===================================*/
/**
* make a simple SICS hdb parameter. Setting it will call update immediately. Use
@@ -101,6 +129,19 @@ pHdbCallback MakeFloatRangeCallback(double min, double max);
* @return A new suitably configured Hdb parameter or NULL when out of memory.
*/
pHdb MakeSICSHdbPar(char *name, int priv, hdbValue v);
/**
* make a simple SICS hdb parameter. Setting it will call update immediately. Use
* this for program parameters.
* @param name The name of the parameter
* @param priv The privilege required to change that parameter
* @param dataType The datatype for the new parameter.
* @param length The length of any arrays
* @param data Data to initalise the parameter with. Can be NULL, then
* no initialisation takes place.
* @return A new suitably configured Hdb parameter or NULL when out of memory.
*/
pHdb CreateSICSHdbPar(char *name, int priv, int dataType,
int length, void *data);
/**
* make a SICS hdb drivable parameter. Setting it will start the motor,
* virtual motor or environment parameter. This will call StartDevice
@@ -111,8 +152,15 @@ pHdb MakeSICSHdbPar(char *name, int priv, hdbValue v);
* @param dataType The datatype of this variable
* @return A new suitably configured Hdb parameter or NULL when out of memory.
*/
pHdb MakeSICSHdbDriv(char *name, int priv,void *sicsObject, int datatype);
/**
* make SICS hdb variable which is connected to a memory location, perhaps in
* an objects data structure.
* @param name The name of the variable
* @param priv The privilege required to set this parameter
* @param address A pointer to the memory location of the variable.
*/
pHdb MakeSICSMemPar(char *name, int priv, float *address);
/**
* makes a SICS Hdb read only parameter. Setting such a parameter causes an error.
* @param name The name of the parameter
@@ -130,36 +178,102 @@ pHdb MakeSICSROPar(char *name, hdbValue v);
* @return A new suitably configured Hdb parameter or NULL when out of memory.
*/
pHdb MakeSICSScriptPar(char *name, char *setScript, char *readScript, hdbValue v);
/**
* make a SICS scriptable parameter. I.e. when this parameter is set or read,
* appropriate scripts are invoked.
* @param name The name of the parameter
* @param dataType The datatype for the new parameter.
* @param length The length of any arrays
* @param data Data to initalise the parameter with. Can be NULL, then
* no initialisation takes place.
* @return A new suitably configured Hdb parameter or NULL when out of memory.
*/
pHdb CreateSICSScriptPar(char *name, char *setScript, char *readScript,
int dataType, int length, void *data);
/**
* remove a SICS paramameter node and its children. In contrast to the
* normal DeletHipadabaNode, this function also takes care of
* clearing scipted nodes out of the update tasks watch list.
* @param node The node to delete
* @param callData User data for the tree change callback
*/
void RemoveSICSPar(pHdb node);
void RemoveSICSPar(pHdb node, void *callData);
/*=============== Add par functions =======================================*/
/**
* add a new simple hdb parameter as child to node
* @param node The node to add the new node too.
* @param priv The privilege required to change that parameter
* @param v The initial value and datatype of this parameter
* @return 1 on success, 0 else
*/
int AddSICSHdbPar(pHdb node, char *name, int priv, hdbValue v);
/**
* add a new read only hdb parameter as child to node
* @param node The node to add the new node too.
* @param v The initial value and datatype of this parameter
* @return 1 on success, 0 else
*/
int AddSICSHdbROPar(pHdb node, char *name, hdbValue v);
/**
* Add a new hdb parameter as child to node. Updates are synced
* to the memory location data. This works for simple variables, fixed size
* arrays and fixed sized strings. This does not work for dynamically sized
* arrays or strings.
* @param node The node to add the new node too.
* @param priv The privilege required to change that parameter
* @param data The pointer to map this parameter too. This must be in
* dynamically allocated memory.
* @param datalength The length of the data area pointed to by data.
* @param type The data type of the parameter
* @param length The length of the type. Used for array types.
* @return 1 on success, 0 else
*/
int AddSICSHdbMemPar(pHdb node, char *name, int priv,
void *data, int datalength, int type, int length);
/*============== access support functions =================================*/
/**
* SICSHdbGetFloat returns the float value of a parameter. Integers are
* automatically converted.
* @param parent The parent node where to start searching for the parameter
* SICSHdbGetPar returns the value of a parameter.
* @param obj The object for which to get a parameter.
* @param pCon The optional connection object to use for reporting errors.
* @param path The path to the parameter.
* @param value The value of the parameter
* @param dataType The datatype for the parameter.
* @param data Target pointer to which to copy data too.
* @param length The length of data
* @return 1 on success, a negative error code else.
*/
int SICSHdbGetFloat(pHdb parent, SConnection *pCon,
char *path, float *value);
int SICSHdbGetPar(void *obj, SConnection *pCon,
char *path, int dataType, void *data, int length);
/**
* SICSHdbSetFloat sets the value of a parameter. Integers are
* automatically converted.
* @param parent The parent node where to start searching for the parameter
* SICSHdbUpdatePar updates the value of a parameter.
* @param obj The object for which to get a parameter.
* @param pCon The optional connection object to use for reporting errors.
* @param path The path to the parameter.
* @param value The new value of the parameter
* @param dataType The datatype for the parameter.
* @param data Pointer from which to copy data.
* @param length The length of data
* @return 1 on success, a negative error code else.
*/
int SICSHdbSetFloat(pHdb parent, SConnection *pCon,
char *path, float value);
int SICSHdbUpdatePar(void *obj, SConnection *pCon,
char *path, int dataType, void *data, int length);
/**
* SICSHdbSetPar sets the value of a parameter.
* @param obj The object for which to get a parameter.
* @param pCon The optional connection object to use for reporting errors.
* @param path The path to the parameter.
* @param dataType The datatype for the parameter.
* @param data Pointer from which to copy data.
* @param length The length of data
* @return 1 on success, a negative error code else.
*/
int SICSHdbSetPar(void *obj, SConnection *pCon,
char *path, int dataType, void *data, int length);
/**
* query function if a parameter is read only.
* @param node The ndoe to query
* @return 1 when RO, 0 else
*/
int isSICSHdbRO(pHdb node);
/*============= common SICS Interactions ===================================*/
/**
* Install a SICS automatic notification callback on the node. This is
@@ -187,6 +301,23 @@ int InstallSICSNotify(pHdb node, SConnection *pCon, int id, int recurse);
*/
int ProcessSICSHdbPar(pHdb root, SConnection *pCon, char *printPrefix,
int argc, char *argv[]);
/**
* print a listing of the parameters of node to pCon, using the
* specified prefix.
* @param The node to print
* @pCon The connection to print too
* @prefix The prefix to use for printing
*/
void PrintSICSParList(pHdb node, SConnection *pCon, char *prefix);
/**
* save the content of the Hipadaba starting at node into a file. This can
* be used to save the configuration of an instrument. This routine is
* recursive.
* @param fd The file to write to
* @param node The node to print from
* @param prefix A prefix to use for printing.
*/
void SaveSICSHipadaba(FILE *fd, pHdb node, char *prefix);
/**
* A SICS task which scans a Hipadaba and reads and updates all parameters,
* one per invocation. TODO: how to distinguish between automatic pars which