EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: New asynEnumStrings interface?
From: Mark Rivers <[email protected]>
To: Andrew Johnson <[email protected]>, "'Eric Norum'" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Mon, 30 Jan 2012 16:26:04 +0000
Andrew and Eric,

One things that has been missing from asyn is the ability for a driver to provide a list of valid enum strings for a parameter.  For example, a device may support a set up choices for gain, speed, etc.  Right now the database designer needs to know those choices and hardcode them into the mbbo enum strings, for example.  It would be nice to provide an interface by which device support can query the enum strings from the driver in init_record, and support callbacks from the driver if the enum strings change (because some mode has changed, etc.).

I am thinking about supporting this in asyn.  One way would be to add a new interface, asynEnumStrings.  This is what that interface might look like:

corvette:asyn/asyn/interfaces>more asynEnumStrings.h 
/*  asynEnumStrings.h */
/***********************************************************************
* Copyright (c) 2012 The University of Chicago, as Operator of Argonne
* National Laboratory, and the Regents of the University of
* California, as Operator of Los Alamos National Laboratory, and
* Berliner Elektronenspeicherring-Gesellschaft m.b.H. (BESSY).
* asynDriver is distributed subject to a Software License Agreement
* found in file LICENSE that is included with this distribution.
***********************************************************************/

/*    30-January-2012 Mark Rivers

*/

#ifndef asynEnumStringsH
#define asynEnumStringsH

#include <asynDriver.h>
#include <epicsTypes.h>
#include <shareLib.h>

#ifdef __cplusplus
extern "C" {
#endif  /* __cplusplus */

typedef void (*interruptCallbackEnumStrings)(
              void *userPvt, asynUser *pasynUser,
              char *value[], size_t nelements);
typedef struct asynEnumStringsInterrupt {
    asynUser *pasynUser;
    int addr;
    interruptCallbackEnumStrings callback;
    void *userPvt;
} asynEnumStringsInterrupt;
#define asynEnumStringsType "asynEnumStrings"
typedef struct asynEnumStrings {
    asynStatus (*write)(void *drvPvt, asynUser *pasynUser,
                       char *value[], size_t nelements);
    asynStatus (*read)(void *drvPvt, asynUser *pasynUser,
                       char *value[], size_t nelements, size_t *nIn);
    asynStatus (*registerInterruptUser)(void *drvPvt, asynUser *pasynUser,
             interruptCallbackEnumStrings callback, void *userPvt,
             void **registrarPvt);
    asynStatus (*cancelInterruptUser)(void *drvPvt, asynUser *pasynUser,
             void *registrarPvt);
} asynEnumStrings;

#define asynEnumStringsBaseType "asynEnumStringsBase"
typedef struct asynEnumStringsBase {
    asynStatus (*initialize)(const char *portName,
                            asynInterface *pEnumStringsInterface);
} asynEnumStringsBase;
epicsShareExtern asynEnumStringsBase *pasynEnumStringsBase;

#ifdef __cplusplus
}
#endif  /* __cplusplus */

#endif /* asynEnumStringsH */



Any thoughts?  Is "char *value[]" the best way to pass the strings?

Mark




Navigate by Date:
Prev: Re: EDM dosn't handle file system links Andrew Johnson
Next: Cryocool LHe support? matthew.pearson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EDM dosn't handle file system links Andrew Johnson
Next: Cryocool LHe support? matthew.pearson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024