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:
committed by
Douglas Clowes
parent
537204f2e2
commit
ad7d24aea2
@@ -30,19 +30,8 @@
|
||||
#include <time.h>
|
||||
#include "anstoutil.h"
|
||||
|
||||
/*
|
||||
#include "splint/splint_fortify.h"
|
||||
#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
|
||||
#define UNITSLEN 256
|
||||
#define TEXTPARLEN 1024
|
||||
void KillRS232(/*@only@*/ void *pData);
|
||||
/*@+incondefs@*/
|
||||
|
||||
@@ -75,6 +64,8 @@ typedef struct __MoDriv {
|
||||
void (*ListDriverPar)(void *self, char *motorName,
|
||||
SConnection *pCon);
|
||||
void (*KillPrivate)(/*@only@*/void *self);
|
||||
int (*GetDriverTextPar)(void *self, char *name,
|
||||
char *textPar);
|
||||
|
||||
|
||||
/* DMC-2280 specific fields */
|
||||
@@ -1174,6 +1165,23 @@ static int DMC2280Halt(void *pData){
|
||||
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,
|
||||
* implements the GetDriverPar method in the MotorDriver interface.
|
||||
*
|
||||
@@ -1526,7 +1534,7 @@ static void DMC2280List(void *self, char *name, SConnection *pCon){
|
||||
SCWrite(pCon, buffer, eStatus);
|
||||
snprintf(buffer, BUFFLEN, "%s.home = %f\n", name, ((pDMC2280Driv)self)->home);
|
||||
SCWrite(pCon, buffer, eStatus);
|
||||
snprintf(buffer, BUFFLEN, "%s.units = %s\n", name, ((pDMC2280Driv)self)->units);
|
||||
snprintf(buffer, BUFFLEN, "%s.units = %s\n", name, ((pDMC2280Driv)self)->units);
|
||||
SCWrite(pCon, buffer, eStatus);
|
||||
snprintf(buffer, BUFFLEN, "%s.speed = %f\n", name, ((pDMC2280Driv)self)->speed);
|
||||
SCWrite(pCon, buffer, eStatus);
|
||||
@@ -1713,6 +1721,7 @@ static void KillDMC2280(/*@only@*/void *pData){
|
||||
pNew->SetDriverPar = DMC2280SetPar;
|
||||
pNew->ListDriverPar = DMC2280List;
|
||||
pNew->KillPrivate = KillDMC2280;
|
||||
pNew->GetDriverTextPar = DMC2280GetTextPar;
|
||||
pNew->blockage_ckInterval = 0.5;
|
||||
pNew->blockage_thresh = 0.5;
|
||||
pNew->blockage_ratio = 2.0;
|
||||
|
||||
Reference in New Issue
Block a user