Added "DMC2280GetTextPar" implementation of the new motor driver GetDriverTextPar function.

This refactoring is moving towards the goal in SICS-10 on Jira.

r1678 | ffr | 2007-03-20 11:24:36 +1100 (Tue, 20 Mar 2007) | 3 lines
This commit is contained in:
Ferdi Franceschini
2007-03-20 11:24:36 +11:00
committed by Douglas Clowes
parent 537204f2e2
commit ad7d24aea2

View File

@@ -30,19 +30,8 @@
#include <time.h> #include <time.h>
#include "anstoutil.h" #include "anstoutil.h"
/* #define UNITSLEN 256
#include "splint/splint_fortify.h" #define TEXTPARLEN 1024
#include "splint/splint_tclDecls.h"
#include "splint/splint_dynstring.h"
#include "splint/splint_SCinter.h"
*/
/*@-incondefs@*/
/* XXX Should this also free pData */
#if 0
int readRS232(prs232 self, /*@out@*/void *data, /*@out@*/int *dataLen);
int readRS232TillTerm(prs232 self, /*@out@*/void *data, int *datalen);
#endif
void KillRS232(/*@only@*/ void *pData); void KillRS232(/*@only@*/ void *pData);
/*@+incondefs@*/ /*@+incondefs@*/
@@ -75,6 +64,8 @@ typedef struct __MoDriv {
void (*ListDriverPar)(void *self, char *motorName, void (*ListDriverPar)(void *self, char *motorName,
SConnection *pCon); SConnection *pCon);
void (*KillPrivate)(/*@only@*/void *self); void (*KillPrivate)(/*@only@*/void *self);
int (*GetDriverTextPar)(void *self, char *name,
char *textPar);
/* DMC-2280 specific fields */ /* DMC-2280 specific fields */
@@ -1174,6 +1165,23 @@ static int DMC2280Halt(void *pData){
return 1; return 1;
} }
/** \brief Allow motor drivers to return text values like units.
*
* Refactoring: Should replace this with a function that will
* return hdb values.
* This is the first step in the refactoring process. */
int DMC2280GetTextPar(void *pData, char *name, char *textPar) {
pDMC2280Driv self = NULL;
self = (pDMC2280Driv)pData;
if(strcmp(name,UNITS) == 0) {
snprintf(textPar, UNITSLEN, self->units);
return 1;
}
return 0;
}
/** \brief Fetches the value of the named parameter, /** \brief Fetches the value of the named parameter,
* implements the GetDriverPar method in the MotorDriver interface. * implements the GetDriverPar method in the MotorDriver interface.
* *
@@ -1713,6 +1721,7 @@ static void KillDMC2280(/*@only@*/void *pData){
pNew->SetDriverPar = DMC2280SetPar; pNew->SetDriverPar = DMC2280SetPar;
pNew->ListDriverPar = DMC2280List; pNew->ListDriverPar = DMC2280List;
pNew->KillPrivate = KillDMC2280; pNew->KillPrivate = KillDMC2280;
pNew->GetDriverTextPar = DMC2280GetTextPar;
pNew->blockage_ckInterval = 0.5; pNew->blockage_ckInterval = 0.5;
pNew->blockage_thresh = 0.5; pNew->blockage_thresh = 0.5;
pNew->blockage_ratio = 2.0; pNew->blockage_ratio = 2.0;