Ezca
index
/usr/lib/python2.1/site-packages/Epics/Ezca.py

#  Ezca: Epics EZCA interface in Python
#
#  Copyright (c) 2000--2002  Matt Newville, The University of Chicago
#
#  email:       newville@cars.uchicago.edu
#
#  versions
#    1.00   initial use, debugging of connect, start/end group
#    1.10   added optional use of Numeric data type, switched
#           build to use distutils, and updated docs
#    1.11   added "type='char'" option to caget to try to force
#           data to be returned as a string.  For many record types 
#           (mbbi, mbbo), this has the added benefit of retrieving
#           the string value for the field.
#           also add "use_char=1" option to initialization, which
#           will set caget to use character strings when appropriate.
#    1.12   improved support for long character arrays (byte-arrays)
#           from Epics string waveform records.  these allow strings
#           longer than 40 characters to be used in Epics records.
#    1.13   changed installation to include Geoff Savage's ca extension,
#           and build windows extensions.
#    1.14   improved behavior of caput(....,wait=1) so that it works.
#           caget() on an unconnected pv nows set the status to -99.
#    1.15   fixed bug in use of Numeric arrays in caput
#
#   last update: 31-Oct-2002
#

 
Modules
            
string
types

 
Classes
            
Ezca

 
class Ezca
      Ezca: Epics EZCA interface in Python
 
example:
   import Ezca
   ez = Ezca.Ezca(timeout = 0.001, retry=20)
   x  = ez.caget('XX:m1.VAL')
   if (ez.status == 0):
       print x
   else:
       print ' not connected, status = ', ez.status
 
The Ezca class provides an interface to the EPICS Ezca library
from Python. The supported functions are:
 
   caput(pv,val)      :  set a PV value
   caget(pv)          :  get a PV value
   set_debug()        :  set debug flag
   show_config        :  show configuration of Ezca instance.
   get_status         :  return last Ezca exit status
   connect            :  connect to a pv, saving count,type in local cache
   use_numeric        :  set the use of Numeric Python arrays for array types
   GetCountAndType    :  return PV count and _python_ type
   GetNelem           :  return PV count
   GetStatus          :  Get time, status, and severity for a PV
   GetUnits           :  return units of a PV
   GetPrecision       :  return precision of a PV
   SetMonitor         :  set a PV monitor
   ClearMonitor       :  unset a PV monitor
   CheckMonitor       :  check status of a PV monitor
   StartGroup         :  start a group of efficient Ezca calls
   EndGroup           :  end a group of efficient Ezca calls
   delay              :  set an Ezca time delay
   getpv(pv, options) :  enhanced PV get (see doc below), largely
                         obsolete by caget(...,type='char') option.
 
 
options for creating each instance are:
   import Ezca
   ez = Ezca.Ezca(option=value, ....)
 
   Several optional arguments can be given to affect the 
   behavior of the Ezca instance:
 
    option          meaning                                     default
      timeout        ca timeout (in sec)                          0.001
      retry          ca retry count                               300
      debug          debug flag (1: on, 0: off)                   0
      trace          flag to turn ezcaTraceOn on/off              0
      autoerror      flag to turn ezcaAutoError on/off            0
 
      use_char       flag to usw string output where appropriate  0
      use_numeric    flag to use Numeric arrays for array data    0
 
   Both 'use_char' and 'use_numeric' are recommended!
 
  
CheckMonitor(self, pv)
Check the Status of Monitored PV:
status  = ezca.CheckMonitor(pv)
ClearMonitor(self, pv)
Clear a Monitor on a PV:
status  = ezca.ClearMonitor(pv)
EndGroup(self)
End a 'Group' for efficient get/puts:
status  = ezca.EndGroup()
GetCountAndType(self, pv)
Get Count and Type (python type!) of a PV:
(count,type) = ezca.GetNelem(pv)
GetNelem(self, pv)
Get Number of Elements (count) of a PV:
count = ezca.GetNelem(pv)
GetPrecision(self, pv)
Get Precision of a PV:
prec = ezca.GetPrecision(pv)
GetStatus(self, pv)
Get time, status, and severity for a PV:
(time, status, severity) = ezca.GetStatus(pv)
GetUnits(self, pv)
Get Units (as a character string) of a PV:
units = ezca.GetUnits(pv)
SetMonitor(self, pv)
Set a Monitor on a PV:
status  = ezca.SetMonitor(pv)
StartGroup(self)
Start a 'Group' for efficient get/puts:
status  = ezca.StartGroup()
__init__(self, **args)
caget(self, pv, fromcache=None, type=None)
get a Process Variable:
x = ezca.caget(pv)
options:
fromcache=1   do _not_ do a real caget, but get
              the last read value, as after a set
              of StartGroup/EndGroup.
type='char'   try to force output as string (useful for
              bo//bi/mbbi/mbbo output)
caput(self, pv, data, wait=0)
set a Process Variable:
x = ezca.caput(pv,val)
options:
wait=1        wait for record to completely process before returning
connect(self, pv)
initiate a connection to a PV,
internally storing useful information about the PV
such as count, type, rtype, and allocating a  pointer
for the data.
   res = ezca.connect(pv)
returns a tuple of count, ezcatype, python_type, and pointer
delay(self, time)
Do an Ezca time delay:
status  = ezca.delay(time)
get_status(self)
get Ezca status
getpv(self, pv, type='scalar', format=None, descpv=None)
Enhanced caget of a PV:
(val, desc) = ezca.getpv(pv, options)
 
where the options controlling what the output value and
and description are, and how they are formatted.
 
In general, a PV is assumed to have a '.VAL' (which is
optional), and the corresponding '.VAL'   and '.DESC'
fields will be found and passed back:
val,desc = ezca.getpv('XXX:m1')
will return the values of XXX:m1.VAL and XXX:m1.DESC
 
option     meaning
type       PV type (full, bo, mbbi)
           'bo':   PV is a binary out, lookup '.ZNAM'
                   or '.ONAM' field as appropriate
                   for the output VALUE
           'mbbi': PV is a mbbi, lookup '.ZRST', ...
                   as appropriate for the output VALUE
           'full': Do _NOT_ append '.VAL' and '.DESC'
                   to PV.
           'yes/no': translate 1/0 to 'Yes/No'
desc       PV to use to lookup description field (instead
           of using the '.DESC' field.
format     C/Python format string to use to format output
set_debug(self, d=1)
set debug status:
ezca.set_debug(1)   turn debugging on
ezca.set_debug()    turn debugging on
ezca.set_debug(0)   turn debugging off
show_config(self)
print current configuration to standard output
use_numeric(self, val=1)
set the use of Numeric Python arrays for array types
ez.use_numeric()          turn on Numeric arrays
ez.use_numeric(val=0)     turn off Numeric arrays

 
Functions
            
ezcaAutoErrorMessageOff(...)
ezcaAutoErrorMessageOn(...)
ezcaClearMonitor(...)
ezcaDebugOff(...)
ezcaDebugOn(...)
ezcaDelay(...)
ezcaEndGroup(...)
ezcaEndGroupWithReport(...)
ezcaFree(...)
ezcaGet(...)
ezcaGetControlLimits(...)
ezcaGetErrorString(...)
ezcaGetGraphicLimits(...)
ezcaGetNelem(...)
ezcaGetPrecision(...)
ezcaGetRetryCount(...)
ezcaGetStatus(...)
ezcaGetTimeout(...)
ezcaGetUnits(...)
ezcaGetWithStatus(...)
ezcaNewMonitorValue(...)
ezcaPerror(...)
ezcaPut(...)
ezcaPutOldCa(...)
ezcaPvToChid(...)
ezcaSetMonitor(...)
ezcaSetRetryCount(...)
ezcaSetTimeout(...)
ezcaStartGroup(...)
ezcaTraceOff(...)
ezcaTraceOn(...)
ezca_GetChar(...)
ezca_GetCharArray(...)
ezca_GetCountAndType(...)
ezca_GetStatus_(...)
ezca_GetUnits_(...)
ezca_PutChar(...)
ptradd(...)
ptrcast(...)
ptrcreate(...)
ptrfree(...)
ptrmap(...)
ptrset(...)
ptrvalue(...)

 
Data
             EZCA_CAFAILURE = 3
EZCA_FAILEDMALLOC = 2
EZCA_INGROUP = 7
EZCA_INVALIDARG = 1
EZCA_NOTCONNECTED = 5
EZCA_NOTIMELYRESPONSE = 6
EZCA_NOTINGROUP = 8
EZCA_OK = 0
EZCA_UDFREQ = 4
EZCA_UNITS_SIZE = 8
__file__ = '/usr/lib/python2.1/site-packages/Epics/Ezca.pyc'
__name__ = 'Ezca'
ezcaByte = 0
ezcaDouble = 5
ezcaFloat = 4
ezcaLong = 3
ezcaShort = 2
ezcaString = 1