pvaccess module is a python wrapper for EPICS PV Access and other C++ libraries.
PvObject¶
- class pvaccess.PvObject¶
Bases:
instance
PvObject represents a generic PV structure.
PvObject(structureDict [,valueDict][,typeId][,fieldTypeIdDict])
- Parameter:
structureDict (dict) - dictionary of key:value pairs describing the underlying PV structure in terms of field names and their types
The dictionary key is a string (PV field name), and value is one of:
PVTYPE: scalar type, can be BOOLEAN, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, FLOAT, DOUBLE, or STRING
[PVTYPE]: single element list representing scalar array
{key:value, …}: structure
[{key:value, …}]: single element list representing structure array
(): variant union
[()]: single element list representing variant union array
({key:value, …},): restricted union
[({key:value, …},)]: single element list representing restricted union array
- Parameter:
valueDict (dict) - (optional) dictionary of key:value pairs to be used to set field values in the underlying PV structure
- Parameter:
typeId (str) - (optional) The type ID string of the PV structure
- Parameter:
typeIdDict (dict) - (optional) dictionary of key:value pairs to be used to set field type IDs in the underlying PV structure
- Raises:
InvalidArgument - in case structure dictionary cannot be parsed
Examples of PvObject initialization:
pv1 = PvObject({'anInt' : INT}) pv2 = PvObject({'aShort' : SHORT, 'anUInt' : UINT, 'aString' : STRING}) pv3 = PvObject({'aStringArray' : [STRING], 'aStruct' : {'aString2' : STRING, 'aBoolArray' : [BOOLEAN], 'aStruct2' : {'aFloat' : FLOAT, 'aString3' : [STRING]}}}) pv4 = PvObject({'aStructArray' : [{'anInt' : INT, 'anInt2' : INT, 'aDouble' : DOUBLE}]}) pv5 = PvObject({'anUnion' : ({'anInt' : INT, 'aDouble' : DOUBLE},)}) pv6 = PvObject({'aVariant' : ()}) pv7 = PvObject({'value' : DOUBLE}, 'epics:nt/NTScalar:1.0') pv8 = PvObject({'x' : DOUBLE, 'y' : DOUBLE}, {'x' : 1, 'y' : 2}, 'pair_t:1.0') pv9 = PvObject({'id' : ULONG, 'pair' : {'x' : DOUBLE, 'y' : DOUBLE}}, 'pair_with_id_t:1.0', {'pair' : 'pair_t'}) pv10 = PvObject({'id' : ULONG, 'pair' : {'x' : DOUBLE, 'y' : DOUBLE}}, {'id' : 1, 'pair' : {'x' : 1, 'y' : 2}}, 'pair_with_id_t:1.0', {'pair' : 'pair_t'})
In addition to various set/get methods described below, PvObject elements can be accessed and manipulated similar to dictionaries:
>>> pv = PvObject({'a' : {'b' : STRING, 'c' : FLOAT}}, {'a' : {'b' : 'my string', 'c' : 10.1}}) >>> print(pv) structure structure a float c 10.1 string b my string >>> dict(pv) {'a': {'b': 'my string', 'c': 10.1}} >>> pv['a.b'] 'my string' >>> pv['a.c'] 10.1 >>> print('a.b' in pv) True >>> print('a.d' in pv) False >>> pv['a.b'] = 'updated string' >>> pv['a.c'] = 20.2 >>> print(pv) structure structure a float c 20.2 string b updated string
Note that compiling pvaPy with Boost.NumPy allows one to retrieve numeric scalar arrays as read-only NumPy arrays:
>>> pv = PvObject({'a' : {'b' : STRING, 'c' : [INT]}}, {'a' : {'b' : 'my string', 'c' : [1,2,3,4,5]}}) >>> print(pv) structure structure a int[] c [1,2,3,4,5] string b my string >>> print(pv.useNumPyArrays) True >>> c = pv['a.c'] >>> c array([1, 2, 3, 4, 5], dtype=int32) >>> type(c) <type 'numpy.ndarray'> >>> pv.useNumPyArrays = False >>> c2 = pv['a.c'] >>> c2 >>> [1, 2, 3, 4, 5] >>> type(c2) <type 'list'>
One can also set numeric scalar arrays using NumPy arrays:
>>> pv = PvObject({'a' : [SHORT]}) >>> b = numpy.array([11,22,33,44,55,66,77], dtype=numpy.dtype('int16')) >>> print(b) ([11 22 33 44 55 66 77], dtype=int16) >>> pv['a'] = b >>> print(pv) structure short[] a [11,22,33,44,55,66,77]
- copy((PvObject)arg1) PvObject : ¶
- copy() => PvObject :
Makes deep copy of the PvObject instance. This method may be useful for processing queued objects retrieved via channel monitor, where underlying structures may be re-used.
- Returns:
copy of the original PV object
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) pv2 = pv.copy()
- createUnionArrayElementField((PvObject)arg1, (str)fieldName, (str)unionFieldName) PvObject : ¶
- createUnionArrayElementField((str)fieldName, (str)unionFieldName) => PvObject :
Creates union field object for an union array assigned to a given field name.
- Parameter:
fieldName (str) - field name
- Parameter:
unionFieldName (str) - union field name to be created
- Returns:
PV object for new union field
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union array
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)], 'aString' : STRING}) unionPv = pv.createUnionArrayElementField('anUnionArray', 'anInt')
- createUnionArrayElementField((str)unionFieldName) => PvObject :
Creates union field object for an union array from a single-field structure, or from a structure that has union array field named ‘value’.
- Parameter:
unionFieldName (str) - union field name to be created
- Returns:
PV object for new union field
- Raises:
InvalidRequest - when single-field structure has no union array field or multiple-field structure has no union array ‘value’ field
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)]}) unionPv = pv.createUnionArrayElementField('anInt')
- createUnionField((PvObject)arg1, (str)fieldName, (str)unionFieldName) PvObject : ¶
- createUnionField((str)fieldName, (str)unionFieldName) => PvObject :
Creates union field object for an union assigned to a given field name.
- Parameter:
fieldName (str) - field name
- Parameter:
unionFieldName (str) - union field name to be created
- Returns:
PV object for new union field
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},), 'aString' : STRING}) createdPv = pv.createUnionField('anUnion', 'anInt')
- createUnionField((str)unionFieldName) => PvObject :
Creates union field object for an union from a single-field structure, or from a structure that has union field named ‘value’.
- Parameter:
unionFieldName (str) - union field name to be created
- Returns:
PV object for new union field
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) createdPv = pv.createUnionField('anInt')
- get((PvObject)arg1) dict : ¶
- get() => dict :
Retrieves PV structure as python dictionary.
- Returns:
python key:value dictionary representing current PV structure in terms of field names and their values
pv = PvObject({'anInt' : INT, 'aString' : STRING}) pv.set({'anInt' : 1}) valueDict = pv.get()
- getAsString((PvObject)arg1) str : ¶
- getAsString() => str :
Retrieves value object from a single-field structure, or from a structure that has field named ‘value’, and converts it into a string.
- Returns:
string representation of the value object
- Raises:
InvalidRequest - when single-field structure has no field or multiple-field structure has no ‘value’ field
pv = PvObject({'byteArray' : [BYTE]}) value = pv.getAsString()
- getAsString((str)fieldPath) => str :
Retrieves value object assigned to the given PV field path, which uses ‘.’ as the field name separator, and converts it into a string.
- Parameter:
fieldPath (str) - field path
- Returns:
string representation of the value object
- Raises:
FieldNotFound - when a part of the specified field path is not found
pv = PvObject({'byteArray' : [BYTE], 'aStruct' : {'anInt' : INT, 'ubyteArray' : [UBYTE]}}) value = pv.getAsString('byteArray') value2 = pv.getAsString('aStruct.ubyteArray')
- getBoolean((PvObject)arg1) bool : ¶
- getBoolean() => bool :
Retrieves boolean value from a single-field structure, or from a structure that has boolean field named ‘value’.
- Returns:
boolean value
- Raises:
InvalidRequest - when single-field structure has no boolean field or multiple-field structure has no boolean ‘value’ field
pv = PvObject({'aBoolean' : BOOLEAN}) value = pv.getBoolean()
- getBoolean((str)fieldName) => bool :
Retrieves boolean value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
boolean value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a boolean
pv = PvObject({'aBoolean' : BOOLEAN, 'aString' : STRING}) value = pv.getBoolean('aBoolean')
- getByte((PvObject)arg1) str : ¶
- getByte() => str :
Retrieves byte (character) value from a single-field structure, or from a structure that has byte field named ‘value’.
- Returns:
byte value
- Raises:
InvalidRequest - when single-field structure has no byte field or multiple-field structure has no byte ‘value’ field
pv = PvObject({'aByte' : BYTE}) value = pv.getByte()
- getByte((str)fieldName) => str :
Retrieves byte (character) value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
byte value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a byte
pv = PvObject({'aByte' : BYTE, 'aString' : STRING}) value = pv.getByte('aByte')
- getDouble((PvObject)arg1) float : ¶
- getDouble() => float :
Retrieves double value from a single-field structure, or from a structure that has double field named ‘value’.
- Returns:
double value
- Raises:
InvalidRequest - when single-field structure has no double field or multiple-field structure has no double ‘value’ field
pv = PvObject({'aDouble' : DOUBLE}) value = pv.getDouble()
- getDouble((str)fieldName) => float :
Retrieves double value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
double value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a double
pv = PvObject({'aDouble' : DOUBLE, 'aString' : STRING}) value = pv.getDouble('aDouble')
- getFloat((PvObject)arg1) float : ¶
- getFloat() => float :
Retrieves float value from a single-field structure, or from a structure that has float field named ‘value’.
- Returns:
float value
- Raises:
InvalidRequest - when single-field structure has no float field or multiple-field structure has no float ‘value’ field
pv = PvObject({'aFloat' : FLOAT}) value = pv.getFloat()
- getFloat((str)fieldName) => float :
Retrieves float value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
float value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a float
pv = PvObject({'aFloat' : FLOAT, 'aString' : STRING}) value = pv.getFloat('aFloat')
- getInt((PvObject)arg1) int : ¶
- getInt() => int :
Retrieves int value from a single-field structure, or from a structure that has int field named ‘value’.
- Returns:
int value
- Raises:
InvalidRequest - when single-field structure has no int field or multiple-field structure has no int ‘value’ field
pv = PvObject({'anInt' : INT}) value = pv.getInt()
- getInt((str)fieldName) => int :
Retrieves int value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
int value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an int
pv = PvObject({'anInt' : INT, 'aString' : STRING}) value = pv.getInt('anInt')
- getIntrospectionDict((PvObject)arg1) dict : ¶
- getIntrospectionDict() => dict :
Retrieves PV structure definition as python dictionary (same as getStructureDict() method).
- Returns:
python key:value dictionary representing PV structure definition in terms of field names and their types (introspection dictionary)
introspectionDict = pv.getIntrospectionDict()
- getLong((PvObject)arg1) int : ¶
- getLong() => int :
Retrieves long value from a single-field structure, or from a structure that has long field named ‘value’.
- Returns:
long value
- Raises:
InvalidRequest - when single-field structure has no long field or multiple-field structure has no long ‘value’ field
pv = PvObject({'aLong' : LONG}) value = pv.getLong()
- getLong((str)fieldName) => int :
Retrieves short value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
long value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a long
pv = PvObject({'aLong' : LONG, 'aString' : STRING}) value = pv.getLong('aLong')
- getPyObject((PvObject)arg1) object : ¶
- getPyObject() => object :
Retrieves value object from a single-field structure, or from a structure that has field named ‘value’.
- Returns:
value object
- Raises:
InvalidRequest - when single-field structure has no field or multiple-field structure has no ‘value’ field
pv = PvObject({'aString' : STRING}) value = pv.getPyObject()
- getPyObject((str)fieldPath) => object :
Retrieves value object assigned to the given PV field path, which uses ‘.’ as the field name separator.
- Parameter:
fieldPath (str) - field path
- Returns:
value object
- Raises:
FieldNotFound - when a part of the specified field path is not found
pv = PvObject({'aString' : STRING, 'aStruct' : {'anInt' : INT, 'aString2' : STRING}}) value = pv.getPyObject('aString') value2 = pv.getPyObject('aStruct.aString2')
- getScalarArray((PvObject)arg1) object : ¶
- getScalarArray() => object :
Retrieves scalar array value from a single-field structure, or from a structure that has scalar array field named ‘value’.
- Returns:
list of scalar values
- Raises:
InvalidRequest - when single-field structure has no scalar array field or multiple-field structure has no scalar array ‘value’ field
pv = PvObject({'aScalarArray' : [INT]}) valueList = pv.getScalarArray()
- getScalarArray((str)fieldName) => object :
Retrieves scalar array value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
list of scalar values
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a scalar array
Retrieves scalar array assigned to the given PV field.
pv = PvObject({'aScalarArray' : [INT]}) valueList = pv.getScalarArray('aScalarArray', 'aString' : STRING)
- getSelectedUnionFieldName((PvObject)arg1, (str)fieldName) str : ¶
- getSelectedUnionFieldName((str)fieldName) => str :
Retrieves selected field name for an union.
- Parameter:
fieldName (str) - field name
- Returns:
selected union field name
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},), 'aString' : STRING}) fieldName = pv.getSelectedUnionFieldName('anUnion')
- getSelectedUnionFieldName() => str :
Retrieves selected field name for an union from a single-field structure, or from a structure that has union field named ‘value’.
- Returns:
selected union field name
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) fieldName = pv.getSelectedUnionFieldNames()
- getShort((PvObject)arg1) int : ¶
- getShort() => int :
Retrieves short value from a single-field structure, or from a structure that has short field named ‘value’.
- Returns:
short value
- Raises:
InvalidRequest - when single-field structure has no short field or multiple-field structure has no short ‘value’ field
pv = PvObject({'aShort' : SHORT}) value = pv.getShort()
- getShort((str)fieldName) => int :
Retrieves short value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
short value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a short
pv = PvObject({'aShort' : SHORT, 'aString' : STRING}) value = pv.getShort('aShort')
- getString((PvObject)arg1) str : ¶
- getString() => str :
Retrieves string value from a single-field structure, or from a structure that has string field named ‘value’.
- Returns:
string value
- Raises:
InvalidRequest - when single-field structure has no string field or multiple-field structure has no string ‘value’ field
pv = PvObject({'aString' : STRING}) value = pv.getString()
- getString((str)fieldName) => str :
Retrieves string value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
string value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a string
pv = PvObject({'aString' : STRING, 'anInt' : INT}) value = pv.getString('aString')
- getStructure((PvObject)arg1) dict : ¶
- getStructure() => dict :
Retrieves structure value from a single-field structure, or from a structure that has structure field named ‘value’.
- Returns:
dictionary of structure key:value pairs
- Raises:
InvalidRequest - when single-field structure has no structure field or multiple-field structure has no structure ‘value’ field
pv = PvObject({'aStruct' : {'anInt':INT, 'aDouble':DOUBLE}}) valueDict = pv.getStructure()
- getStructure((str)fieldName) => dict :
Retrieves structure value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
dictionary of structure key:value pairs
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a structure
pv = PvObject({'aStruct' : {'anInt':INT, 'aDouble':DOUBLE}, 'aString' : STRING}) valueDict = pv.getStructure('aStruct')
- getStructureArray((PvObject)arg1) list : ¶
- getStructureArray() => list :
Retrieves structure array value from a single-field structure, or from a structure that has structure array field named ‘value’.
- Returns:
list of dictionaries
- Raises:
InvalidRequest - when single-field structure has no structure array field or multiple-field structure has no structure array ‘value’ field
pv = PvObject({'aStructArray' : [{'anInt' : INT, 'aFloat' : FLOAT}]}) dictList = pv.getStructureArray()
- getStructureArray((str)fieldName) => list :
Retrieves structure array value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
list of dictionaries
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a structure array
pv = PvObject({'aStructArray' : [{'anInt' : INT, 'aFloat' : FLOAT}], 'aString' : STRING}) dictList = pv.getStructureArray('aStructArray')
- getStructureDict((PvObject)arg1) dict : ¶
- getStructureDict() => dict :
Retrieves PV structure definition as python dictionary.
- Returns:
python key:value dictionary representing PV structure definition in terms of field names and their types (introspection dictionary)
structureDict = pv.getStructureDict()
- getUByte((PvObject)arg1) int : ¶
- getUByte() => int :
Retrieves unsigned byte (character) value from a single-field structure, or from a structure that has unsigned byte field named ‘value’.
- Returns:
unsigned byte value
- Raises:
InvalidRequest - when single-field structure has no unsigned byte field or multiple-field structure has no unsigned byte ‘value’ field
pv = PvObject({'anUByte' : UBYTE}) value = pv.getUByte()
- getUByte((str)fieldName) => int :
Retrieves unsigned byte (character) value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
unsigned byte value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an unsigned byte
pv = PvObject({'anUByte' : UBYTE, 'aString' : STRING}) value = pv.getUByte('anUByte')
- getUInt((PvObject)fieldName) int : ¶
- getUInt( (PvObject)fieldName) => int :
Retrieves unsigned int value from a single-field structure, or from a structure that has unsigned int field named ‘value’.
- Returns:
unsigned integer value
- Raises:
InvalidRequest - when single-field structure has no unsigned int field or multiple-field structure has no unsigned int ‘value’ field
pv = PvObject({'anUInt' : UINT}) value = pv.getUInt()
- getUInt((str)fieldName) => int :
Retrieves unsigned int value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
unsigned integer value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an unsigned int
pv = PvObject({'anUInt' : UINT, 'aString' : STRING}) value = pv.getUInt('anUInt')
- getULong((PvObject)arg1) int : ¶
- getULong() => int :
Retrieves unsigned long value from a single-field structure, or from a structure that has unsigned long field named ‘value’.
- Returns:
unsigned long value
- Raises:
InvalidRequest - when single-field structure has no unsigned long field or multiple-field structure has no unsigned long ‘value’ field
pv = PvObject({'anULong' : ULONG}) value = pv.getULong()
- getULong((str)fieldName) => int :
Retrieves unsigned long value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
unsigned long value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an unsigned long
pv = PvObject({'anULong' : ULONG, 'aString' : STRING}) value = pv.getULong('anULong')
- getUShort((PvObject)arg1) int : ¶
- getUShort() => int :
Retrieves unsigned short value from a single-field structure, or from a structure that has unsigned short field named ‘value’.
- Returns:
unsigned short value
- Raises:
InvalidRequest - when single-field structure has no unsigned short field or multiple-field structure has no unsigned short ‘value’ field
pv = PvObject({'anUShort' : USHORT}) value = pv.getUShort()
- getUShort((str)fieldName) => int :
Retrieves unsigned short value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
unsigned short value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an unsigned short
pv = PvObject({'anUShort' : USHORT, 'aString' : STRING}) value = pv.getUShort('anUShort')
- getUnion((PvObject)arg1) PvObject : ¶
- getUnion() => PvObject :
Retrieves union value from a single-field structure, or from a structure that has union field named ‘value’.
- Returns:
union PV object
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) value = pv.getUnion()
- getUnion((str)fieldName) => PvObject :
Retrieves union assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
union PV object
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},), 'aString' : STRING}) value = pv.getUnion('anUnion')
- getUnionArray((PvObject)arg1) list : ¶
- getUnionArray() => list :
Retrieves union array value from a single-field structure, or from a structure that has union array field named ‘value’.
- Returns:
list of union PV objects
- Raises:
InvalidRequest - when single-field structure has no union array field or multiple-field structure has no union array ‘value’ field
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)]}) unionPvList = pv.getUnionArray()
- getUnionArray((str)fieldName) => list :
Retrieves union array value assigned to the given PV field.
- Parameter:
fieldName (str) - field name
- Returns:
list of union PV objects
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union array
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)], 'aString' : STRING}) unionPvList = pv.getUnionArray('anUnionArray')
- getUnionArrayFieldNames((PvObject)arg1, (str)fieldName) list : ¶
- getUnionArrayFieldNames((str)fieldName) => list :
Retrieves list of field names for an union array.
- Parameter:
fieldName (str) - field name
- Returns:
list of union array field names
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union array
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)], 'aString' : STRING}) fieldNameList = pv.getUnionArrayFieldNames('anUnionArray')
- getUnionArrayFieldNames() => list :
Retrieves list of union array field names from a single-field structure, or from a structure that has union array field named ‘value’.
- Returns:
list of union array field names
- Raises:
InvalidRequest - when single-field structure has no union array field or multiple-field structure has no union array ‘value’ field
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)]}) fieldNameList = pv.getUnionArrayFieldNames()
- getUnionFieldNames((PvObject)arg1, (str)fieldName) list : ¶
- getUnionFieldNames((str)fieldName) => list :
Retrieves list of field names for a union.
- Parameter:
fieldName (str) - field name
- Returns:
list of union field names
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},), 'aString' : STRING}) fieldNameList = pv.getUnionFieldNames('anUnion')
- getUnionFieldNames() => list :
Retrieves list of union field names from a single-field structure, or from a structure that has union field named ‘value’.
- Returns:
list of union field names
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) fieldNameList = pv.getUnionFieldNames()
- hasField((PvObject)arg1, (str)fieldPath) bool : ¶
- hasField((str)fieldPath) => bool :
Checks if the PV object has field specified by the given path, using ‘.’ as the field name separator.
- Parameter:
fieldPath (str) - field path
- Returns:
true if path exists, false otherwise
pv = PvObject({'aString' : STRING, 'aStruct' : {'anInt' : INT, 'aString2' : STRING}}) hasField = pv.hasField('aString') hasField2 = pv.hasField('aString.anInt')
- has_key((PvObject)arg1, (str)fieldPath) bool : ¶
- has_key((str)fieldPath) => bool :
Checks if the PV object has field specified by the given path, using ‘.’ as the field name separator.
- Parameter:
fieldPath (str) - field path
- Returns:
true if path exists, false otherwise
pv = PvObject({'aString' : STRING, 'aStruct' : {'anInt' : INT, 'aString2' : STRING}}) hasField = pv.has_key('aString' hasField2 = pv.has_key('aStruct.anInt')
- isUnionArrayVariant((PvObject)arg1, (str)fieldName) bool : ¶
- isUnionArrayVariant((str)fieldName) => bool :
Checks if an union array assigned to a given field name is variant.
- Parameter:
fieldName (str) - field name
- Returns:
true if union array is variant, false otherwise
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union array
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)], 'aString' : STRING}) isVariant = pv.isUnionArrayVariant('anUnionArray')
- isUnionArrayVariant() => bool :
Checks if an union array from a single-field structure, or from a structure that has union array field named ‘value’, is variant.
- Returns:
true if union array is variant, false otherwise
- Raises:
InvalidRequest - when single-field structure has no union array field or multiple-field structure has no union array ‘value’ field
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)]}) isVariant = pv.isUnionArrayVariant()
- isUnionVariant((PvObject)arg1, (str)fieldName) bool : ¶
- isUnionVariant((str)fieldName) => bool :
Checks if an union assigned to a given field name is variant.
- Parameter:
fieldName (str) - field name
- Returns:
true if union is variant, false otherwise
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},), 'aString' : STRING}) isVariant = pv.isUnionVariant('anUnion')
- isUnionVariant() => bool :
Checks if an union from a single-field structure, or from a structure that has union field named ‘value’, is variant.
- Returns:
true if union is variant, false otherwise
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) isVariant = pv.isUnionVariant()
- items((PvObject)arg1) list : ¶
- items() => list :
Returns list of PV object’s dictionary items.
- Returns:
list of PV object’s dictionary (key,value) pairs
items = pv.items()
- keys((PvObject)arg1) list : ¶
- keys() => list :
Returns list of PV object’s dictionary keys (top level field names).
- Returns:
list of PV object’s dictionary keys
keys = pv.keys()
- selectUnionField((PvObject)arg1, (str)fieldName, (str)unionFieldName) PvObject : ¶
- selectUnionField((str)fieldName, (str)unionFieldName) => PvObject :
Selects field for an union assigned to a given field name.
- Parameter:
fieldName (str) - field name
- Parameter:
unionFieldName (str) - union field name to be selected
- Returns:
PV object for the selected union field
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an union
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},), 'aString' : STRING}) selectedPv = pv.selectUnionField('anUnion', 'anInt')
- selectUnionField((str)unionFieldName) => PvObject :
Selects field for an union from a single-field structure, or from a structure that has union field named ‘value’.
- Parameter:
unionFieldName (str) - union field name to be selected
- Returns:
PV object for the selected union field
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) selectedPv = pv.selectUnionField('anInt')
- set((PvObject)arg1, (dict)valueDict) None : ¶
- set((dict)valueDict) => None :
Populates PV structure fields from python dictionary.
- Parameter:
valueDict (dict) - dictionary of key:value pairs that correspond to PV structure field names and their values
- Raises:
FieldNotFound - in case PV structure does not have one of the dictionary keys
- Raises:
InvalidDataType - in case PV structure field type does not match type of the corresponding dictionary value
pv = PvObject({'anUInt' : UINT, 'aString' : STRING}) pv.set({'anUInt' : 1, 'aString' : 'my string example'})
- set((PvObject)valueObject) => None :
Populates PV structure fields from PvObject.
- Parameter:
valueObject (PvObject) - object that correspond to PV structure field names and their values
- Raises:
FieldNotFound - in case PV structure does not have one of the dictionary keys
- Raises:
InvalidDataType - in case PV structure field type does not match type of the corresponding dictionary value
pv = PvObject({'anUInt' : UINT, 'aString' : STRING}) pv.set(PvObject({'anUInt' : UINT},{'anUInt' : 1}))
- setBoolean((PvObject)arg1, (bool)value) None : ¶
- setBoolean((bool)value) => None :
Sets boolean value for a single-field structure, or for a structure that has boolean field named ‘value’.
- Parameter:
value (bool) - boolean value
- Raises:
InvalidRequest - when single-field structure has no boolean field or multiple-field structure has no boolean ‘value’ field
pv = PvObject({'aBoolean' : BOOLEAN}) pv.setBoolean(True)
- setBoolean((str)fieldName, (bool)value) => None :
Sets boolean value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (bool) - boolean value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a boolean
pv = PvObject({'aBoolean' : BOOLEAN, 'aString' : STRING}) pv.setBoolean('aBoolean', True)
- setByte((PvObject)arg1, (str)value) None : ¶
- setByte((str)value) => None :
Sets byte (character) value for a single-field structure, or for a structure that has byte field named ‘value’.
- Parameter:
value (str) - byte value
- Raises:
InvalidRequest - when single-field structure has no byte field or multiple-field structure has no byte ‘value’ field
pv = PvObject({'aByte' : BYTE}) pv.setByte('a')
- setByte((str)fieldName, (str)value) => None :
Sets byte (character) value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (str) - byte value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a byte
pv = PvObject({'aByte' : BYTE, 'aString' : STRING}) pv.setByte('aByte', 'a')
- setDouble((PvObject)arg1, (float)value) None : ¶
- setDouble((float)value) => None :
Sets double value for a single-field structure, or for a structure that has double field named ‘value’.
- Parameter:
value (float) - double value
- Raises:
InvalidRequest - when single-field structure has no double field or multiple-field structure has no double ‘value’ field
pv = PvObject({'aDouble' : DOUBLE}) pv.setDouble(10.0)
- setDouble((str)fieldName, (float)value) => None :
Sets short value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (float) - double value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a double
pv = PvObject({'aDouble' : DOUBLE, 'aString' : STRING}) pv.setDouble('aDouble', 10.0)
- setFloat((PvObject)arg1, (float)value) None : ¶
- setFloat((float)value) => None :
Sets float value for a single-field structure, or for a structure that has float field named ‘value’.
- Parameter:
value (float) - float value
- Raises:
InvalidRequest - when single-field structure has no float field or multiple-field structure has no float ‘value’ field
pv = PvObject({'aFloat' : FLOAT}) pv.setFloat(10.0)
- setFloat((str)fieldName, (float)value) => None :
Sets short value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (float) - float value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a short
pv = PvObject({'aFloat' : FLOAT, 'aString' : STRING}) pv.setFloat('aFloat', 10.0)
- setInt((PvObject)arg1, (int)value) None : ¶
- setInt((int)value) => None :
Sets int value for a single-field structure, or for a structure that has int field named ‘value’.
- Parameter:
value (int) - integer value
- Raises:
InvalidRequest - when single-field structure has no int field or multiple-field structure has no int ‘value’ field
pv = PvObject({'anInt' : INT}) pv.setInt(10)
- setInt((str)fieldName, (int)value) => None :
Sets int value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (int) - integer value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an int
pv = PvObject({'anInt' : INT, 'aString' : STRING}) pv.setInt('anInt', 10)
- setLong((PvObject)arg1, (int)value) None : ¶
- setLong((int)value) => None :
Sets long value for a single-field structure, or for a structure that has long field named ‘value’.
- Parameter:
value (long) - long value
- Raises:
InvalidRequest - when single-field structure has no long field or multiple-field structure has no long ‘value’ field
pv = PvObject({'aLong' : LONG}) pv.setLong(10L)
- setLong((str)fieldName, (int)value) => None :
Sets long value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (long) - long value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a long
pv = PvObject({'aLong' : LONG, 'aString' : STRING}) pv.setLong('aLong', 10L)
- setPyObject((PvObject)arg1, (object)value) None : ¶
- setPyObject((object)value) => None :
Sets value for a single-field structure, or for a structure that has field named ‘value’.
- Parameter:
value (object) - value object
- Raises:
InvalidRequest - when single-field structure has no field or multiple-field structure has no ‘value’ field
pv = PvObject({'aString' : STRING}) pv.setPyObject('string value')
- setPyObject((str)fieldPath, (object)value) => None :
Sets value for the PV field specified by the given field path, using ‘.’ as the field name separator.
- Parameter:
fieldPath (str) - field path
- Parameter:
value (object) - value object
- Raises:
FieldNotFound - when a part of the specified field path is not found
- Raises:
InvalidRequest - when specified field does not match provided object type
pv = PvObject({'aString' : STRING, 'aStruct' : {'anInt' : INT, 'aString2' : STRING}}) pv.setPyObject('aString', 'string value') pv.setPyObject('aString.aString2', 'string value2')
- setScalarArray((PvObject)arg1, (object)valueList) None : ¶
- setScalarArray((object)valueList) => None :
Sets scalar array value for a single-field structure, or for a structure that has scalar array field named ‘value’.
- Parameter:
valueList (list) - list of scalar values
- Raises:
InvalidRequest - when single-field structure has no scalar array field or multiple-field structure has no scalar array ‘value’ field
pv = PvObject({'aScalarArray' : [INT]}) pv.setScalarArray([0,1,2,3,4])
- setScalarArray((str)fieldName, (object)valueList) => None :
Sets scalar array value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
valueList (list) - list of scalar values
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a scalar array
pv = PvObject({'aScalarArray' : [INT], 'aString' : STRING}) pv.setScalarArray('aScalarArray', [0,1,2,3,4])
- setShort((PvObject)arg1, (int)value) None : ¶
- setShort((int)value) => None :
Sets short value for a single-field structure, or for a structure that has short field named ‘value’.
- Parameter:
value (int) - short value’
- Raises:
InvalidRequest - when single-field structure has no short field or multiple-field structure has no short ‘value’ field
pv = PvObject({'aShort' : SHORT}) pv.setShort(10)
- setShort((str)fieldName, (int)value) => None :
Sets short value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (int) - short value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a short
pv = PvObject({'aShort' : SHORT, 'aString' : STRING}) pv.setShort('aShort', 10)
- setString((PvObject)arg1, (str)value) None : ¶
- setString((str)value) => None :
Sets string value for a single-field structure, or for a structure that has string field named ‘value’.
- Parameter:
value (str) - string value
- Raises:
InvalidRequest - when single-field structure has no string field or multiple-field structure has no string ‘value’ field
pv = PvObject({'aString' : STRING}) pv.setString('string value')
- setString((str)fieldName, (str)value) => None :
Sets string value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (str) - string value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a string
pv = PvObject({'aString' : STRING, 'anInt' : INT}) pv.setString('aString', 'string value')
- setStructure((PvObject)arg1, (PvObject)valueObject) None : ¶
- setStructure((PvObject)valueObject) => None :
Sets structure value for a single-field structure, or for a structure that has structure field named ‘value’.
- Parameter:
valueObject (PvObject) - PvObject instance
- Raises:
InvalidRequest - when single-field structure has no structure field or multiple-field structure has no structure ‘value’ field
pv = PvObject({'aStruct' : {'anInt':INT, 'aDouble':DOUBLE}}) pv2 = PvObject({'anInt':INT, 'aDouble':DOUBLE}, {'anInt':1, 'aDouble':1.1}) pv.setStructure(pv2)
- setStructure((str)fieldName, (PvObject)valueObject) => None :
Sets structure value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
valueObject (PvObject) - PvObject instance
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a structure
pv = PvObject({'aStruct' : {'anInt':INT, 'aDouble':DOUBLE}, 'aString' : STRING}) pv2 = PvObject({'anInt':INT, 'aDouble':DOUBLE}, {'anInt':1, 'aDouble':1.1}) pv.setStructure('aStruct', pv2)
- setStructure((dict)valueDict) => None :
Sets structure value for a single-field structure, or for a structure that has structure field named ‘value’.
- Parameter:
valueDict (dict) - dictionary of structure key:value pairs
- Raises:
InvalidRequest - when single-field structure has no structure field or multiple-field structure has no structure ‘value’ field
pv = PvObject({'aStruct' : {'anInt':INT, 'aDouble':DOUBLE}}) pv.setStructure({'anInt' : 1, 'aDouble' : 1.1})
- setStructure((str)fieldName, (dict)valueDict) => None :
Sets structure value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
valueDict (dict) - dictionary of structure key:value pairs
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a structure
pv = PvObject({'aStruct' : {'anInt':INT, 'aDouble':DOUBLE}, 'aString' : STRING}) pv.setStructure('aStruct', {'anInt' : 1, 'aDouble' : 1.1})
- setStructureArray((PvObject)arg1, (list)dictList) None : ¶
- setStructureArray((list)dictList) => None :
Sets structure array value for a single-field structure, or for a structure that has structure array field named ‘value’.
- Parameter:
dictList (list) - list of dictionaries
- Raises:
InvalidRequest - when single-field structure has no structure array field or multiple-field structure has no structure array ‘value’ field
pv = PvObject({'aStructArray' : [{'anInt' : INT, 'aFloat' : FLOAT}]}) pv.setStructureArray([{'anInt' : 1, 'aFloat' : 1.1},{'anInt' : 2, 'aFloat' : 2.2},{'anInt' : 3, 'aFloat' : 3.3}])
- setStructureArray((str)fieldName, (list)dictList) => None :
Sets structure array value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
dictList (list) - list of dictionaries
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not a structure array
pv = PvObject({'aStructArray' : [{'anInt' : INT, 'aFloat' : FLOAT}], 'aString' : STRING}) pv.setStructureArray('aStructArray', [{'anInt' : 1, 'aFloat' : 1.1},{'anInt' : 2, 'aFloat' : 2.2},{'anInt' : 3, 'aFloat' : 3.3}])
- setUByte((PvObject)arg1, (int)value) None : ¶
- setUByte((int)value) => None :
Sets unsigned byte (character) value for a single-field structure, or for a structure that has unsigned byte field named ‘value’.
- Parameter:
value (str) - unsigned byte value
- Raises:
InvalidRequest - when single-field structure has no unsigned byte field or multiple-field structure has no unsigned byte ‘value’ field
pv = PvObject({'anUByte' : UBYTE}) pv.setUByte('a')
- setUByte((str)fieldName, (int)value) => None :
Sets unsigned byte (character) value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (str) - unsigned byte value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an unsigned byte
pv = PvObject({'anUByte' : UBYTE, 'aString' : STRING}) pv.setUByte('anUByte', 'a')
- setUInt((PvObject)arg1, (int)value) None : ¶
- setUInt((int)value) => None :
Sets unsigned int value for a single-field structure, or for a structure that has unsigned int field named ‘value’.
- Parameter:
value (int) - unsigned integer value
- Raises:
InvalidRequest - when single-field structure has no unsigned int field or multiple-field structure has no unsigned int ‘value’ field
pv = PvObject({'anUInt' : UINT}) pv.setUInt(10)
- setUInt((str)fieldName, (int)value) => None :
Sets unsigned int value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (int) - unsigned integer value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an unsigned int
pv = PvObject({'anUInt' : UINT, 'aString' : STRING}) pv.setUInt('anInt', 10)
- setULong((PvObject)arg1, (int)value) None : ¶
- setULong((int)value) => None :
Sets unsigned long value for a single-field structure, or for a structure that has unsigned long field named ‘value’.
- Parameter:
value (long) - unsigned long value
- Raises:
InvalidRequest - when single-field structure has no unsigned long field or multiple-field structure has no unsigned long ‘value’ field
pv = PvObject({'anULong' : ULONG}) pv.setULong(10L)
- setULong((str)fieldName, (int)value) => None :
Sets unsigned long value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (long) - unsigned long value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an unsigned long
pv = PvObject({'anULong' : ULONG, 'aString' : STRING}) pv.setULong('anULong', 10L)
- setUShort((PvObject)arg1, (int)value) None : ¶
- setUShort((int)value) => None :
Sets unsigned short value for a single-field structure, or for a structure that has unsigned short field named ‘value’.
- Parameter:
value (int) - unsigned short value
- Raises:
InvalidRequest - when single-field structure has no unsigned short field or multiple-field structure has no unsigned short ‘value’ field
pv = PvObject({'anUShort' : USHORT}) pv.setUShort(10)
- setUShort((str)fieldName, (int)value) => None :
Sets unsigned short value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
value (int) - unsigned short value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidRequest - when specified field is not an unsigned short
pv = PvObject({'anUShort' : USHORT, 'aString' : STRING}) pv.setUShort('anUShort', 10)
- setUnion((PvObject)arg1, (PvObject)valueObject) None : ¶
- setUnion((PvObject)valueObject) => None :
Sets union value for a single-field structure, or for a structure that has union field named ‘value’.
- Parameter:
valueObject (PvObject) - union value
- Raises:
InvalidArgument - when object’s field name/type do not match any of the union’s fields
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) value = PvObject({'anInt' : INT}) value.setInt(10) pv.setUnion(value)
- setUnion((str)fieldName, (PvObject)valueObject) => None :
Sets union value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
valueObject (PvObject) - union value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidArgument - when object’s field name/type do not match any of the union’s fields
- Raises:
InvalidRequest - when specified field is not a union
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},), 'aString' : STRING}) value = PvObject({'anInt' : INT}) value.setInt(10) pv.setUnion('anUnion', value)
- setUnion((dict)valueDict) => None :
Sets union value for a single-field structure, or for a structure that has union field named ‘value’.
- Parameter:
valueDict (dict) - union value
- Raises:
InvalidArgument - when dictionary’s field name/type do not match any of the union’s fields
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) pv.setUnion({'anInt' : 10})
- setUnion((str)fieldName, (dict)valueDict) => None :
Sets union for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
valueDict (dict) - union value
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidArgument - when dictionary’s field name/type do not match any of the union’s fields
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},), 'aString' : STRING}) pv.setUnion('anUnion', {'anInt' : 10})
- setUnion((tuple)valueDict) => None :
Sets union value for a single-field structure, or for a structure that has union field named ‘value’.
- Parameter:
valueTuple (tuple) - union value, must contain dictionary as its only element
- Raises:
InvalidArgument - when dictionary’s field name/type do not match any of the union’s fields
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},)}) pv.setUnion(({'anInt' : 10},))
- setUnion((str)fieldName, (tuple)valueTuple) => None :
Sets union for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
valueTuple (tuple) - union value, must contain dictionary as its only element
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidArgument - when dictionary’s field name/type do not match any of the union’s fields
- Raises:
InvalidRequest - when single-field structure has no union field or multiple-field structure has no union ‘value’ field
pv = PvObject({'anUnion' : ({'anInt' : INT, 'aFloat' : FLOAT},), 'aString' : STRING}) pv.setUnion('anUnion', ({'anInt' : 10},)
- setUnionArray((PvObject)arg1, (list)objectList) None : ¶
- setUnionArray((list)objectList) => None :
Sets union array value for a single-field structure, or for a structure that has union array field named ‘value’.
- Parameter:
objectList (list) - list of PV objects, dictionaries, or tuples representing unions
- Raises:
InvalidArgument - when dictionary’s field name/type do not match any of the union’s fields
- Raises:
InvalidRequest - when single-field structure has no union array field or multiple-field structure has no union array ‘value’ field
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)]}) pv.setUnionArray([{'anInt' : 10}, {'aFloat' : 11.1}])
- setUnionArray((str)fieldName, (list)objectList) => None :
Sets union array value for the given PV field.
- Parameter:
fieldName (str) - field name
- Parameter:
objectList (list) - list of PV objects, dictionaries, or tuples representing unions
- Raises:
FieldNotFound - when PV structure does not have specified field
- Raises:
InvalidArgument - when dictionary’s field name/type do not match any of the union’s fields
- Raises:
InvalidRequest - when specified field is not an union array
pv = PvObject({'anUnionArray' : [({'anInt' : INT, 'aFloat' : FLOAT},)], 'aString' : STRING}) pv.setUnionArray('anUnionArray', [{'anInt' : 10}, {'aFloat' : 11.1}])
- toDict((PvObject)arg1) dict : ¶
- toDict() => dict :
Converts PV structure to python dictionary.
- Returns:
python key:value dictionary representing current PV structure in terms of field names and their values
valueDict = pv.toDict()
Note that one can also convert PvObject instances to dictionaries using the standard dict() constructor:
valueDict = dict(pv)
- toJSON((PvObject)arg1, (bool)multiLine) str : ¶
- toJSON((bool)multiLine) => str :
displays PvObject as a JSON string. :argument multiLine (True or False) - display via multiple lines
- property useNumPyArrays¶
- values((PvObject)arg1) list : ¶
- values() => list :
Returns list of PV object’s dictionary values (top level field values).
- Returns:
list of PV object’s dictionary values
values = pv.values()
PvScalar¶
PvBoolean¶
- class pvaccess.PvBoolean¶
Bases:
PvScalar
PvBoolean represents PV boolean type.
PvBoolean([value=False])
- Parameter:
value (bool) - boolean value
pv = PvBoolean(True)
- get((PvBoolean)arg1) bool : ¶
- get() => bool :
Retrieves boolean PV value.
- Returns:
boolean value
value = pv.get()
- set((PvBoolean)arg1, (bool)value) None : ¶
- set((bool)value) => None :
Sets boolean PV value.
- Parameter:
value (bool) - boolean value
pv.set(False)
PvByte¶
- class pvaccess.PvByte¶
Bases:
PvScalar
PvByte represents PV byte type.
PvByte([value=’’])
- Parameter:
value (str) - byte value
pv = PvByte('a')
- get((PvByte)arg1) str : ¶
- get() => str :
Retrieves byte PV value.
- Returns:
byte value
value = pv.get()
- set((PvByte)arg1, (str)value) None : ¶
- set((str)value) => None :
Sets byte PV value.
- Parameter:
value (str) - byte value
pv.set('a')
PvUByte¶
- class pvaccess.PvUByte¶
Bases:
PvScalar
PvUByte represents PV unsigned byte type.
PvUByte([value=0])
- Parameter:
value (int) - unsigned byte value
pv = PvUByte(10)
- get((PvUByte)arg1) int : ¶
- get() => int :
Retrieves unsigned byte PV value.
- Returns:
unsigned byte value
value = pv.get()
- set((PvUByte)arg1, (int)value) None : ¶
- set((int)value) => None :
Sets unsigned byte PV value.
- Parameter:
value (int) - unsigned byte value
pv.set(10)
PvShort¶
- class pvaccess.PvShort¶
Bases:
PvScalar
PvShort represents PV short type.
PvShort([value=0])
- Parameter:
value (int) - short value
pv = PvShort(-10)
- get((PvShort)arg1) int : ¶
- get() => int :
Retrieves short PV value.
- Returns:
short value
value = pv.get()
- set((PvShort)arg1, (int)value) None : ¶
- set((int)value) => None :
Sets short PV value.
- Parameter:
value (int) - short value
pv.set(-10)
PvUShort¶
- class pvaccess.PvUShort¶
Bases:
PvScalar
PvUShort represents PV unsigned short type.
PvUShort([value=0])
- Parameter:
value (int) - unsigned short value
pv = PvUShort(10)
- get((PvUShort)arg1) int : ¶
- get() => int :
Retrieves unsigned short PV value.
- Returns:
unsigned short value
value = pv.get()
- set((PvUShort)arg1, (int)value) None : ¶
- set((int)value) => None :
Sets unsigned short PV value.
- Parameter:
value (int) - unsigned short value
pv.set(10)
PvInt¶
- class pvaccess.PvInt¶
Bases:
PvScalar
PvInt represents PV integer type.
PvInt([value=0])
- Parameter:
value (int) - integer value
pv = PvInt(-1000)
- get((PvInt)arg1) int : ¶
- get() => int :
Retrieves integer PV value.
- Returns:
integer value
value = pv.get()
- set((PvInt)arg1, (int)value) None : ¶
- set((int)value) => None :
Sets integer PV value.
- Parameter:
value (int) - integer value
pv.set(-1000)
PvUInt¶
- class pvaccess.PvUInt¶
Bases:
PvScalar
PvUInt represents PV unsigned int type.
PvUInt([value=0])
- Parameter:
value (int) - unsigned integer value
pv = PvUInt(1000)
- get((PvUInt)arg1) int : ¶
- get() => int :
Retrieves unsigned integer PV value.
- Returns:
unsigned integer value
value = pv.get()
- set((PvUInt)arg1, (int)value) None : ¶
- set((int)value) => None :
Sets unsigned integer PV value.
- Parameter:
value (int) - unsigned integer value
pv.set(1000)
PvLong¶
- class pvaccess.PvLong¶
Bases:
PvScalar
PvLong represents PV long type.
PvLong([value=0])
- Parameter:
value (long) - long value
pv = PvLong(-100000L)
- get((PvLong)arg1) int : ¶
- get() => int :
Retrieves long PV value.
- Returns:
long value
value = pv.get()
- set((PvLong)arg1, (int)arg2) None : ¶
- set((int)arg2) => None :
Sets long PV value.
- Parameter:
value (long) - long value
pv.set(-100000L)
PvULong¶
- class pvaccess.PvULong¶
Bases:
PvScalar
PvULong represents PV unsigned long type.
PvULong([value=0])
- Parameter:
value (long) - unsigned long value
pv = PvULong(100000L)
- get((PvULong)arg1) int : ¶
- get() => int :
Retrieves unsigned long PV value.
- Returns:
unsigned long value
value = pv.get()
- set((PvULong)arg1, (int)value) None : ¶
- set((int)value) => None :
Sets unsigned long PV value.
- Parameter:
value (long) - unsigned long value
pv.set(100000L)
PvFloat¶
- class pvaccess.PvFloat¶
Bases:
PvScalar
PvFloat represents PV float type.
PvFloat([value=0])
- Parameter:
value (float) - float value
pv = PvFloat(1.1)
- get((PvFloat)arg1) float : ¶
- get() => float :
Retrieves float PV value.
- Returns:
float value
value = pv.get()
- set((PvFloat)arg1, (float)value) None : ¶
- set((float)value) => None :
Sets float PV value.
- Parameter:
value (float) - float value
pv.set(1.1)
PvDouble¶
- class pvaccess.PvDouble¶
Bases:
PvScalar
PvDouble represents PV double type.
PvDouble([value=0])
- Parameter:
value (float) - double value
pv = PvDouble(1.1)
- get((PvDouble)arg1) float : ¶
- get() => float :
Retrieves double PV value.
- Returns:
double value
value = pv.get()
- set((PvDouble)arg1, (float)value) None : ¶
- set((float)value) => None :
Sets double PV value.
- Parameter:
value (float) - double value
pv.set(1.1)
PvString¶
- class pvaccess.PvString¶
Bases:
PvScalar
PvString represents PV string type.
PvString([value=’’])
- Parameter:
value (str) - string value
pv = PvString('stringValue')
- get((PvString)arg1) str : ¶
- get() => str :
Retrieves string PV value.
- Returns:
string value
value = pv.get()
- set((PvString)arg1, (str)value) None : ¶
- set((str)value) => None :
Sets string PV value.
- Parameter:
value (str) - string value
pv.set('stringValue')
PvUnion¶
PvScalarArray¶
- class pvaccess.PvScalarArray¶
Bases:
PvObject
PvScalarArray represents PV scalar array.
PvScalarArray(scalarType)
- Parameter:
scalarType (PVTYPE) - scalar type of array elements
PVTYPE: scalar type, can be BOOLEAN, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, FLOAT, DOUBLE, or STRING
pv = PvScalarArray(INT)
- get((PvScalarArray)arg1) list : ¶
- get() => list :
Retrieves PV value list.
- Returns:
list of scalar values
valueList = pv.get()
- set((PvScalarArray)arg1, (list)valueList) None : ¶
- set((list)valueList) => None :
Sets PV value list.
- Parameter:
valueList (list) - list of scalar values
pv.set([1,2,3,4,5])
- toList((PvScalarArray)arg1) list : ¶
- toList() => list :
Converts PV to value list.
- Returns:
list of scalar values
valueList = pv.toList()
PvTimeStamp¶
- class pvaccess.PvTimeStamp¶
Bases:
PvObject
PvTimeStamp represents PV time stamp structure.
PvTimeStamp()
timestamp1 = PvTimeStamp()
PvTimeStamp(time)
- Parameter:
time (float) - time represented as float, including seconds and fractional seconds
timeStamp2 = PvTimeStamp(1234567890.00123 [, userTag=0])
PvTimeStamp(secondsPastEpoch, nanoseconds [, userTag=0])
- Parameter:
secondsPastEpoch (long) - seconds past epoch
- Parameter:
nanoseconds (int) - nanoseconds
- Parameter:
userTag (int) - user tag
timeStamp3 = PvTimeStamp(1234567890, 10000) timeStamp4 = PvTimeStamp(1234567890, 10000, 1)
- getNanoseconds((PvTimeStamp)arg1) int : ¶
- getNanoseconds() => int :
Retrieves time stamp value for nanoseconds.
- Returns:
nanoseconds
nanoseconds = timeStamp.getNanoseconds()
- getSecondsPastEpoch((PvTimeStamp)arg1) int : ¶
- getSecondsPastEpoch() => int :
Retrieves time stamp value for seconds past epoch.
- Returns:
seconds past epoch
secondsPastEpoch = timeStamp.getSecondsPastEpoch()
- getUserTag((PvTimeStamp)arg1) int : ¶
- getUserTag() => int :
Retrieves user tag.
- Returns:
user tag
userTag = timeStamp.getUserTag()
- property nanoseconds¶
- property secondsPastEpoch¶
- setNanoseconds((PvTimeStamp)arg1, (int)nanoseconds) None : ¶
- setNanoseconds((int)nanoseconds) => None :
Sets time stamp value for nanoseconds.
- Parameter:
nanoseconds (int) - nanoseconds
timeStamp.setNanoseconds(10000)
- setSecondsPastEpoch((PvTimeStamp)arg1, (int)secondsPastEpoch) None : ¶
- setSecondsPastEpoch((int)secondsPastEpoch) => None :
Sets time stamp value for seconds past epoch.
- Parameter:
secondsPastEpoch (long) - seconds past epoch
timeStamp.setSecondsPastEpoch(1234567890)
- setUserTag((PvTimeStamp)arg1, (int)userTag) None : ¶
- setUserTag((int)userTag) => None :
Sets user tag.
- Parameter:
userTag (int) - user tag
timeStamp.setUserTag(1)
- property userTag¶
PvAlarm¶
- class pvaccess.PvAlarm¶
Bases:
PvObject
PvAlarm represents PV alarm structure.
PvAlarm()
alarm1 = PvAlarm()
PvAlarm(severity, status, message)
- Parameter:
severity (int) - alarm severity
- Parameter:
status (int) - status code
- Parameter:
message (str) - alarm message
alarm2 = PvAlarm(5, 1, 'alarm message')
- getMessage((PvAlarm)arg1) str : ¶
- getMessage() => str :
Retrieves alarm message.
- Returns:
alarm message
message = alarm.getMessage()
- getSeverity((PvAlarm)arg1) int : ¶
- getSeverity() => int :
Retrieves alarm severity.
- Returns:
alarm severity
severity = alarm.getSeverity()
- getStatus((PvAlarm)arg1) int : ¶
- getStatus() => int :
Retrieves status code.
- Returns:
status code
status = alarm.getStatusCode()
- setMessage((PvAlarm)arg1, (str)message) None : ¶
- setMessage((str)message) => None :
Sets alarm message.
- Parameter:
message (str) - alarm message
alarm.setMessage('alarm message')
- setSeverity((PvAlarm)arg1, (int)severity) None : ¶
- setSeverity((int)severity) => None :
Sets alarm severity.
- Parameter:
severity (int) - alarm severity
alarm.setSeverity(1)
- setStatus((PvAlarm)arg1, (int)status) None : ¶
- setStatus((int)status) => None :
Sets status code.
- Parameter:
status (int) - status code
alarm.setStatus(1)
PvCodec¶
- class pvaccess.PvCodec¶
Bases:
PvObject
PvCodec represents PV codec structure.
PvCodec()
codec1 = PvCodec()
PvCodec(name, parameters)
- Parameter:
name (str) - codec name
- Parameter:
parameters (PvObject) - codec parameters
codec2 = PvCodec('jpeg', PvObject({'value':{'compressor':STRING,'compressionFactor':FLOAT,'quality': INT}},{'value':{'compressor':'BloscLZ','compressionFactor':1.0,'quality':75}}))
- getName((PvCodec)arg1) str : ¶
- getName() => str :
Retrieves codec name.
- Returns:
codec name
name = codec.getName()
- getParameters((PvCodec)arg1) PvObject : ¶
- getParameters() => PvObject :
Retrieves codec parameters.
- Returns:
codec parameters
p = codec.getParameters()
- setName((PvCodec)arg1, (str)name) None : ¶
- setName((str)name) => None :
Sets codec name.
- Parameter:
name (str) - codec name
codec.setName('codec name')
- setParameters((PvCodec)arg1, (PvObject)valueObject) None : ¶
- setParameters((PvObject)valueObject) => None :
Sets parameters field.
- Parameter:
valueObject (PvObject) - object describing codec parameters
p = PvObject({'value':{'compressor':STRING,'compressionFactor':FLOAT,'quality': INT}},{'value':{'compressor':'BloscLZ','compressionFactor':1.0,'quality':75}})) codec.setParameters(p)
PvControl¶
- class pvaccess.PvControl¶
Bases:
PvObject
PvControl represents PV control structure.
PvControl()
control1 = PvControl()
PvControl(limitLow, limitHigh, description, format, units)
- Parameter:
limitLow (float) - limit low value
- Parameter:
limitHigh (float) - limit high value
- Parameter:
minStep (float) - min step value
control2 = PvControl(-10.0, 10.0, 1.0))
- getLimitHigh((PvControl)arg1) float : ¶
- getLimitHigh() => float :
Retrieves limit high value.
- Returns:
limit high value
limitHigh = control.getLimitHigh()
- getLimitLow((PvControl)arg1) float : ¶
- getLimitLow() => float :
Retrieves limit low value.
- Returns:
limit low value
limitLow = control.getLimitLow()
- getMinStep((PvControl)arg1) float : ¶
- getMinStep() => float :
Retrieves min step.
- Returns:
min step value
minStep = control.getMinStep()
- setLimitHigh((PvControl)arg1, (float)limitHigh) None : ¶
- setLimitHigh((float)limitHigh) => None :
Sets limit high value.
- Parameter:
limitHigh (float) - limit high value
control.setLimitHigh(10.0)
- setLimitLow((PvControl)arg1, (float)limitLow) None : ¶
- setLimitLow((float)limitLow) => None :
Sets limit low value.
- Parameter:
limitLow (float) - limit low value
control.setLimitLow(10.0)
- setMinStep((PvControl)arg1, (float)minStep) None : ¶
- setMinStep((float)minStep) => None :
Sets min step value.
- Parameter:
minStep (float) - min step value
control.setMinStep(1.0)
PvDimension¶
- class pvaccess.PvDimension¶
Bases:
PvObject
PvDimension represents dimension structure used by NtNdArrays.
PvDimension()
dim1 = PvDimension()
PvDimension(size, offset, fullSize, binning, reverse)
- Parameter:
size (int) - number of elements in this dimension
- Parameter:
offset (int) - offset value relative to the origin of the original data source
- Parameter:
fullSize (int) - number of elements in this dimension of the original data source
- Parameter:
binning (int) - binning value (pixel summation, 1=no binning) in this dimension relative to the original data source
- Parameter:
reverse (bool) - orientation flag relative to the original data source (false=normal, true=reversed)
dim2 = PvDimension(1024, 0, 1024, 0, 0))
- getBinning((PvDimension)arg1) int : ¶
- getBinning() => int :
Retrieves dimension binning.
- Returns:
dimension binning
binning = dim.getBinning()
- getFullSize((PvDimension)arg1) int : ¶
- getFullSize() => int :
Retrieves dimension full size.
- Returns:
dimension full size
fullSize = dim.getFullSize()
- getOffset((PvDimension)arg1) int : ¶
- getOffset() => int :
Retrieves dimension offset.
- Returns:
dimension offset
offset = dim.getOffset()
- getReverse((PvDimension)arg1) bool : ¶
- getReverse() => bool :
Retrieves dimension reverse.
- Returns:
dimension reverse
reverse = dim.getReverse()
- getSize((PvDimension)arg1) int : ¶
- getSize() => int :
Retrieves dimension size.
- Returns:
dimension size
size = dim.getSize()
- setBinning((PvDimension)arg1, (int)binning) None : ¶
- setBinning((int)binning) => None :
Sets dimension binning.
- Parameter:
binning (int) - binning value
dim.setBinning(100)
- setFullSize((PvDimension)arg1, (int)fullSize) None : ¶
- setFullSize((int)fullSize) => None :
Sets dimension full size.
- Parameter:
fullSize (int) - full size value
dim.setFullSize(1024)
- setOffset((PvDimension)arg1, (int)offset) None : ¶
- setOffset((int)offset) => None :
Sets dimension offset.
- Parameter:
offset (int) - offset value
dim.setOffset(100)
- setReverse((PvDimension)arg1, (bool)reverse) None : ¶
- setReverse((bool)reverse) => None :
Sets dimension reverse.
- Parameter:
reverse (bool) - reverse value
dim.setReverse(1)
- setSize((PvDimension)arg1, (int)size) None : ¶
- setSize((int)size) => None :
Sets dimension size.
- Parameter:
size (int) - size value
dim.setSize(1024)
PvDisplay¶
- class pvaccess.PvDisplay¶
Bases:
PvObject
PvDisplay represents PV display structure.
PvDisplay()
display1 = PvDisplay()
PvDisplay(limitLow, limitHigh, description, format, units)
- Parameter:
limitLow (float) - limit low value
- Parameter:
limitHigh (float) - limit high value
- Parameter:
description (str) - description string
- Parameter:
format (str) - format string
- Parameter:
units (str) - units string
display2 = PvDisplay(-10.0, 10.0, 'Test Display', 'Test Format', 'amps'))
- getDescription((PvDisplay)arg1) str : ¶
- getDescription() => str :
Retrieves description.
- Returns:
description string
description = display.getDescription()
- getFormat((PvDisplay)arg1) str : ¶
- getFormat() => str :
Retrieves format.
- Returns:
format string
format = display.getFormat()
- getLimitHigh((PvDisplay)arg1) float : ¶
- getLimitHigh() => float :
Retrieves limit high value.
- Returns:
limit high value
limitHigh = display.getLimitHigh()
- getLimitLow((PvDisplay)arg1) float : ¶
- getLimitLow() => float :
Retrieves limit low value.
- Returns:
limit low value
limitLow = display.getLimitLow()
- getUnits((PvDisplay)arg1) str : ¶
- getUnits() => str :
Retrieves units.
- Returns:
units string
units = display.getUnits()
- setDescription((PvDisplay)arg1, (str)description) None : ¶
- setDescription((str)description) => None :
Sets description string.
- Parameter:
description (str) - description string
display.setDescription('Test display')
- setFormat((PvDisplay)arg1, (str)format) None : ¶
- setFormat((str)format) => None :
Sets format string.
- Parameter:
format (str) - format string
display.setFormat('Test format')
- setLimitHigh((PvDisplay)arg1, (float)limitHigh) None : ¶
- setLimitHigh((float)limitHigh) => None :
Sets limit high value.
- Parameter:
limitHigh (float) - limit high value
display.setLimitHigh(10.0)
- setLimitLow((PvDisplay)arg1, (float)limitLow) None : ¶
- setLimitLow((float)limitLow) => None :
Sets limit low value.
- Parameter:
limitLow (float) - limit low value
display.setLimitLow(10.0)
- setUnits((PvDisplay)arg1, (str)units) None : ¶
- setUnits((str)units) => None :
Sets units string.
- Parameter:
units (str) - units string
display.setUnits('seconds')
PvValueAlarm¶
- class pvaccess.PvValueAlarm¶
Bases:
PvObject
PvValueAlarm represents PV value alarm structure.
PvValueAlarm(scalarType)
- Parameter:
scalarType (PVTYPE) - scalar type of array elements
PVTYPE: scalar type, can be BOOLEAN, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, FLOAT, DOUBLE, or STRING
alarm = PvValueAlarm(INT)
- getActive((PvValueAlarm)arg1) bool : ¶
- getActive() => bool :
Retrieves active value.
- Returns:
active value
value = alarm.getActive()
- getHighAlarmLimit((PvValueAlarm)arg1) object : ¶
- getHighAlarmLimit() => object :
Retrieves high alarm limit value.
- Returns:
high alarm limit value
value = alarm.getHighAlarmLimit()
- getHighAlarmSeverity((PvValueAlarm)arg1) int : ¶
- getHighAlarmSeverity() => int :
Retrieves high alarm severity value.
- Returns:
high alarm severity value
value = alarm.getHighAlarmSeverity()
- getHighWarningLimit((PvValueAlarm)arg1) object : ¶
- getHighWarningLimit() => object :
Retrieves high warning limit value.
- Returns:
high warning limit value
value = alarm.getHighWarningLimit()
- getHighWarningSeverity((PvValueAlarm)arg1) int : ¶
- getHighWarningSeverity() => int :
Retrieves high warning severity value.
- Returns:
high warning severity value
value = alarm.getHighWarningSeverity()
- getHysteresis((PvValueAlarm)arg1) str : ¶
- getHysteresis() => str :
Retrieves hysteresis value.
- Returns:
hysteresis value
value = alarm.getHysteresis()
- getLowAlarmLimit((PvValueAlarm)arg1) object : ¶
- getLowAlarmLimit() => object :
Retrieves low alarm limit value.
- Returns:
low alarm limit value
value = alarm.getLowAlarmLimit()
- getLowAlarmSeverity((PvValueAlarm)arg1) int : ¶
- getLowAlarmSeverity() => int :
Retrieves low alarm severity value.
- Returns:
low alarm severity value
value = alarm.getLowAlarmSeverity()
- getLowWarningLimit((PvValueAlarm)arg1) object : ¶
- getLowWarningLimit() => object :
Retrieves low warning limit value.
- Returns:
low warning limit value
value = alarm.getLowWarningLimit()
- getLowWarningSeverity((PvValueAlarm)arg1) int : ¶
- getLowWarningSeverity() => int :
Retrieves low warning severity value.
- Returns:
low warning severity value
value = alarm.getLowWarningSeverity()
- setActive((PvValueAlarm)arg1, (bool)value) None : ¶
- setActive((bool)value) => None :
Sets active value.
- Parameter:
value (boolean) - active value
alarm.setActive(True)
- setHighAlarmLimit((PvValueAlarm)arg1, (object)value) None : ¶
- setHighAlarmLimit((object)value) => None :
Sets high alarm limit value.
- Parameter:
value (scalar_t) - high alarm limit value
alarm.setHighAlarmLimit(10)
- setHighAlarmSeverity((PvValueAlarm)arg1, (int)value) None : ¶
- setHighAlarmSeverity((int)value) => None :
Sets high alarm severity value.
- Parameter:
value (int) - high alarm severity value
alarm.setHighAlarmSeverity(10)
- setHighWarningLimit((PvValueAlarm)arg1, (object)value) None : ¶
- setHighWarningLimit((object)value) => None :
Sets high warning limit value.
- Parameter:
value (scalar_t) - high warning limit value
alarm.setHighWarningLimit(10)
- setHighWarningSeverity((PvValueAlarm)arg1, (int)value) None : ¶
- setHighWarningSeverity((int)value) => None :
Sets high warning severity value.
- Parameter:
value (int) - high warning severity value
alarm.setHighWarningSeverity(10)
- setHysteresis((PvValueAlarm)arg1, (str)value) None : ¶
- setHysteresis((str)value) => None :
Sets hysteresis value.
- Parameter:
value (chr) - hysteresis value
alarm.setHysteresis(True)
- setLowAlarmLimit((PvValueAlarm)arg1, (object)value) None : ¶
- setLowAlarmLimit((object)value) => None :
Sets low alarm limit value.
- Parameter:
value (scalar_t) - low alarm limit value
alarm.setLowAlarmLimit(10)
- setLowAlarmSeverity((PvValueAlarm)arg1, (int)value) None : ¶
- setLowAlarmSeverity((int)value) => None :
Sets low alarm severity value.
- Parameter:
value (int) - low alarm severity value
alarm.setLowAlarmSeverity(10)
- setLowWarningLimit((PvValueAlarm)arg1, (object)value) None : ¶
- setLowWarningLimit((object)value) => None :
Sets low warning limit value.
- Parameter:
value (scalar_t) - low warning limit value
alarm.setLowWarningLimit(10)
- setLowWarningSeverity((PvValueAlarm)arg1, (int)value) None : ¶
- setLowWarningSeverity((int)value) => None :
Sets low warning severity value.
- Parameter:
value (int) - low warning severity value
alarm.setLowWarningSeverity(10)
NtType¶
NtAttribute¶
- class pvaccess.NtAttribute¶
Bases:
PvObject
NtAttribute class represents NTAttribute normative type.
NtAttribute()
attr1 = NtAttribute()
NtAttribute(name, parameters)
- Parameter:
name (str) - attr name
- Parameter:
value (PvObject) - attr value
attr2 = NtAttribute('fileAttr', PvObject({'value':{'size':INT,'crc':STRING}},{'value':{'size':123456,'crc':'ab34cf6123'}}))
- getAlarm((NtAttribute)arg1) PvAlarm : ¶
- getAlarm() => PvAlarm :
Retrieves attribute alarm.
- Returns:
attribute alarm object
alarm = attr.getAlarm()
- getDescriptor((NtAttribute)arg1) str : ¶
- getDescriptor() => str :
Retrieves attribute descriptor.
- Returns:
attribute descriptor
descriptor = attr.getDescriptor()
- getName((NtAttribute)arg1) str : ¶
- getName() => str :
Retrieves attribute name.
- Returns:
attribute name
name = attr.getName()
- getSource((NtAttribute)arg1) str : ¶
- getSource() => str :
Retrieves attribute source.
- Returns:
attribute source
source = attr.getSource()
- getSourceType((NtAttribute)arg1) int : ¶
- getSourceType() => int :
Retrieves attribute source type.
- Returns:
attribute source type
sourceType = attr.getSourceType()
- getTags((NtAttribute)arg1) list : ¶
- getTags() => list :
Retrieves list of tags.
- Returns:
list of tags
tagList = attr.getTags()
- getTimeStamp((NtAttribute)arg1) PvTimeStamp : ¶
- getTimeStamp() => PvTimeStamp :
Retrieves attribute time stamp.
- Returns:
attribute time stamp object
timeStamp = attr.getTimeStamp()
- getValue((NtAttribute)arg1) PvObject : ¶
- getValue() => PvObject :
Retrieves attribute parameters.
- Returns:
attribute parameters
p = attr.getValue()
- setAlarm((NtAttribute)arg1, (PvAlarm)alarm) None : ¶
- setAlarm((PvAlarm)alarm) => None :
Sets attribute alarm.
- Parameter:
alarm (PvAlarm) - attribute alarm object
alarm = PvAlarm(11, 126, 'Server SegFault') attr.setAlarm(alarm)
- setDescriptor((NtAttribute)arg1, (str)descriptor) None : ¶
- setDescriptor((str)descriptor) => None :
Sets attribute descriptor.
- Parameter:
descriptor (str) - attribute descriptor
attr.setDescriptor('myAttr')
- setName((NtAttribute)arg1, (str)name) None : ¶
- setName((str)name) => None :
Sets attribute name.
- Parameter:
name (str) - attribute name
attr.setName('attr name')
- setSource((NtAttribute)arg1, (str)source) None : ¶
- setSource((str)source) => None :
Sets attribute source.
- Parameter:
source (str) - attribute source
attr.setSource('Detector')
- setSourceType((NtAttribute)arg1, (int)sourceType) None : ¶
- setSourceType((int)sourceType) => None :
Sets attribute source type. The following values should be used: 0==NDAttrSourceDriver, 1==NDAttrSourceDriver, 2==NDAttrSourceEPICSPV, 3==NDAttrSourceFunct.
- Parameter:
sourceType (int) - attribute source type
attr.setSourceType(2)
- setTags((NtAttribute)arg1, (list)tagList) None : ¶
- setTags((list)tagList) => None :
Sets attribute tags.
- Parameter:
tagList ([str]) - list of strings attribute tags
attr.setTags(['DatasetA', 'DetectorB'])
- setTimeStamp((NtAttribute)arg1, (PvTimeStamp)timeStamp) None : ¶
- setTimeStamp((PvTimeStamp)timeStamp) => None :
Sets attribute time stamp.
- Parameter:
timeStamp (PvTimeStamp) - attribute time stamp object
timeStamp = PvTimeStamp(1234567890, 10000, 1) attr.setTimeStamp(timeStamp)
- setValue((NtAttribute)arg1, (PvObject)valueObject) None : ¶
- setValue((PvObject)valueObject) => None :
Sets value field.
- Parameter:
valueObject (PvObject) - attribute value object
p = PvObject({'value':{'size':INT,'crc':STRING}},{'value':{'size':123456,'crc':'ab34cf6123'}}) attr.setValue(p)
NtEnum¶
- class pvaccess.NtEnum¶
Bases:
NtType
NtEnum represents NT enum structure.
NtEnum()
enum1 = NtEnum()
NtEnum(choices [, index=0])
- Parameter:
choices ([str]) - list of choices
- Parameter:
index (int) - current choice
enum2 = NtEnum(['a','b','c'], 1)
- getAlarm((NtEnum)arg1) PvAlarm : ¶
- getAlarm() => PvAlarm :
Retrieves enum object alarm.
- Returns:
enum object alarm
alarm = enum.getAlarm()
- getDescriptor((NtEnum)arg1) str : ¶
- getDescriptor() => str :
Retrieves enum descriptor.
- Returns:
enum descriptor
descriptor = enum.getDescriptor()
- getTimeStamp((NtEnum)arg1) PvTimeStamp : ¶
- getTimeStamp() => PvTimeStamp :
Retrieves enum object time stamp.
- Returns:
enum object time stamp
timeStamp = enum.getTimeStamp()
- getValue((NtEnum)arg1) PvEnum : ¶
- getValue() => PvEnum :
Get enum value object.
- Returns:
enum object
pvEnum = enum.getValue()
- setAlarm((NtEnum)arg1, (PvAlarm)alarm) None : ¶
- setAlarm((PvAlarm)alarm) => None :
Sets enum object alarm.
- Parameter:
alarm (PvAlarm) - enum object alarm
alarm = PvAlarm(11, 126, 'Server SegFault') enum.setAlarm(alarm)
- setDescriptor((NtEnum)arg1, (str)descriptor) None : ¶
- setDescriptor((str)descriptor) => None :
Sets enum descriptor.
- Parameter:
descriptor (str) - enum object descriptor
enum.setDescriptor('myEnum')
- setTimeStamp((NtEnum)arg1, (PvTimeStamp)timeStamp) None : ¶
- setTimeStamp((PvTimeStamp)timeStamp) => None :
Sets enum object time stamp.
- Parameter:
timeStamp (PvTimeStamp) - enum object time stamp
timeStamp = PvTimeStamp(1234567890, 10000, 1) enum.setTimeStamp(timeStamp)
- setValue((NtEnum)arg1, (int)index) None : ¶
- setValue((int)index) => None :
Sets enum object index value.
- Parameter:
index (int) - current choice index
enum.setValue(2)
- setValue((dict)value) => None :
Sets enum object value.
- Parameter:
value (dict) - dictionary containing enum fields
enum.setValue({'choices' : ['a','b','c'], 'index' : 1})
- setValue((PvEnum)value) => None :
Sets enum object value.
- Parameter:
value (enum_t) - enum object value
enum.setValue(PvEnum(['a','b','c'],1))
NtNdArray¶
- class pvaccess.NtNdArray¶
Bases:
NtType
NtNdArray represents NT table structure.
NtNdArray()
a1 = NtNdArray()
NtNdArray(extraFieldsDict)
- Parameter:
extraFieldsDict (dict) - dictionary of key:value pairs describing the additional PV structure fields in terms of field names and their types
a2 = NtNdArray({'detectorName' : STRING, 'imageCrc' : STRING})
NtNdArray(pvObject)
- Parameter:
pvObject (PvObject) - PV object that has a structure containing the required NT ND Array elements
a3 = NtNdArray(pvObject)
- getAlarm((NtNdArray)arg1) PvAlarm : ¶
- getAlarm() => PvAlarm :
Retrieves array alarm.
- Returns:
array alarm object
alarm = a.getAlarm()
- getAttribute((NtNdArray)arg1) list : ¶
- getAttribute() => list :
Retrieves array attribute list.
- Returns:
list of array attribute objects
attrs = array.getAttribute()
- getCodec((NtNdArray)arg1) PvCodec : ¶
- getCodec() => PvCodec :
Retrieves array codec.
- Returns:
array codec object
codec = a.getCodec()
- getCompressedSize((NtNdArray)arg1) int : ¶
- getCompressedSize() => int :
Retrieves array compressed size.
- Returns:
array compressed size
cSize = a.getCompressedSize()
- getDataTimeStamp((NtNdArray)arg1) PvTimeStamp : ¶
- getDataTimeStamp() => PvTimeStamp :
Retrieves array data time stamp.
- Returns:
array data time stamp object
dataTimeStamp = a.getDataTimeStamp()
- getDescriptor((NtNdArray)arg1) str : ¶
- getDescriptor() => str :
Retrieves array descriptor.
- Returns:
array descriptor
descriptor = a.getDescriptor()
- getDimension((NtNdArray)arg1) list : ¶
- getDimension() => list :
Retrieves array dimension list.
- Returns:
list of array dimension objects
dims = array.getDimension()
- getDisplay((NtNdArray)arg1) PvDisplay : ¶
- getDisplay() => PvDisplay :
Retrieves array display.
- Returns:
array display object
display = a.getDisplay()
- getTimeStamp((NtNdArray)arg1) PvTimeStamp : ¶
- getTimeStamp() => PvTimeStamp :
Retrieves array time stamp.
- Returns:
array time stamp object
timeStamp = a.getTimeStamp()
- getUncompressedSize((NtNdArray)arg1) int : ¶
- getUncompressedSize() => int :
Retrieves array uncompressed size.
- Returns:
array uncompressed size
ucSize = a.getUncompressedSize()
- getUniqueId((NtNdArray)arg1) int : ¶
- getUniqueId() => int :
Retrieves array id.
- Returns:
array id
id = a.getUniqueId()
- getValue((NtNdArray)arg1) object : ¶
- getValue() => object :
Retrieves array value.
- Returns:
array value
value = a.getValue()
- setAlarm((NtNdArray)arg1, (PvAlarm)alarm) None : ¶
- setAlarm((PvAlarm)alarm) => None :
Sets array alarm.
- Parameter:
alarm (PvAlarm) - array alarm object
alarm = PvAlarm(11, 126, 'Server SegFault') a.setAlarm(alarm)
- setAttribute((NtNdArray)arg1, (list)attrList) None : ¶
- setAttribute((list)attrList) => None :
Sets array attribute list.
- Parameter:
attrList (list) - list of NtAttribute objects
- Raises:
InvalidDataType - when list objects do not match required type
array.setAttribute([NtAttribute('ColorMode', PvInt(0))])
- setCodec((NtNdArray)arg1, (PvCodec)codec) None : ¶
- setCodec((PvCodec)codec) => None :
Sets array codec.
- Parameter:
codec (PvCodec) - array codec object
codec = PvCodec('pvapyc', PvInt(14)) a.setCodec(codec)
- setCompressedSize((NtNdArray)arg1, (int)value) None : ¶
- setCompressedSize((int)value) => None :
Sets array compressedSize.
- Parameter:
value (int) - array compressed size
a.setCompressedSize(123456)
- setDataTimeStamp((NtNdArray)arg1, (PvTimeStamp)timeStamp) None : ¶
- setDataTimeStamp((PvTimeStamp)timeStamp) => None :
Sets array data time stamp.
- Parameter:
timeStamp (PvTimeStamp) - array time stamp object
dataTimeStamp = PvTimeStamp(1234567890, 10000, 1) a.setDataTimeStamp(dataTimeStamp)
- setDescriptor((NtNdArray)arg1, (str)descriptor) None : ¶
- setDescriptor((str)descriptor) => None :
Sets array descriptor.
- Parameter:
descriptor (str) - array descriptor
a.setDescriptor('Test Array')
- setDimension((NtNdArray)arg1, (list)dimList) None : ¶
- setDimension((list)dimList) => None :
Sets array dimension list.
- Parameter:
dimList (list) - list of PvDimension objects
- Raises:
InvalidDataType - when list objects do not match required type
array.setDimension([PvDimension(1024, 0, 1024, 1, False), PvDimension(1024, 0, 1024, 1, False)])
- setDisplay((NtNdArray)arg1, (PvDisplay)display) None : ¶
- setDisplay((PvDisplay)display) => None :
Sets array display.
- Parameter:
display (PvDisplay) - array display object
display = PvDisplay(10, 100, 'Test Display', 'Test Format', 'Seconds') a.setDisplay(display)
- setTimeStamp((NtNdArray)arg1, (PvTimeStamp)timeStamp) None : ¶
- setTimeStamp((PvTimeStamp)timeStamp) => None :
Sets array time stamp.
- Parameter:
timeStamp (PvTimeStamp) - array time stamp object
timeStamp = PvTimeStamp(1234567890, 10000, 1) a.setTimeStamp(timeStamp)
- setUncompressedSize((NtNdArray)arg1, (int)value) None : ¶
- setUncompressedSize((int)value) => None :
Sets array uncompressedSize.
- Parameter:
value (int) - array uncompressed size
a.setUncompressedSize(123456)
- setUniqueId((NtNdArray)arg1, (int)id) None : ¶
- setUniqueId((int)id) => None :
Sets array id.
- Parameter:
id (int) - array id
a.setUniqueId(123456)
- setValue((NtNdArray)arg1, (dict)valueDict) None : ¶
- setValue((dict)valueDict) => None :
Sets array value.
- Parameter:
valueDict (dict) - array value dictionary (must contain array value with one of the allowed field names: booleanValue, byteValue, ubyteValue, shortValue, uShortValue, intValue, uintValue, longValue, ulongValue, floatValue, doubleValue)
- Raises:
InvalidDataType - when object’s field name/type do not match allowed fields
array.setValue({'byteValue' : [34, 56, 77, ... ]})
- setValue((PvObject)valueObject) => None :
Sets array value.
- Parameter:
valueObject (PvObject) - array value object (must contain array value with one of the allowed field names: booleanValue, byteValue, ubyteValue, shortValue, uShortValue, intValue, uintValue, longValue, ulongValue, floatValue, doubleValue)
- Raises:
InvalidDataType - when object’s field name/type do not match allowed fields
array.setValue(PvObject({'byteValue' : [BYTE]}, {'byteValue' : [34, 56, 77, ... ]}))
NtTable¶
- class pvaccess.NtTable¶
Bases:
NtType
NtTable represents NT table structure.
NtTable(nColumns, scalarType)
- Parameter:
nColumns (int) - number of table columns
- Parameter:
scalarType (PVTYPE) - scalar type (BOOLEAN, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, FLOAT, DOUBLE, or STRING)
This example creates NT Table with 3 columns of DOUBLE values:
table1 = NtTable(3, DOUBLE)
NtTable(scalarTypeList)
- Parameter:
scalarTypeList ([PVTYPE]) - list of column scalar types (BOOLEAN, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, FLOAT, DOUBLE, or STRING)
This example creates NT Table with STRING, INT and DOUBLE columns:
table2 = NtTable([STRING, INT, DOUBLE]) table2.setLabels(['String', 'Int', 'Double']) table2.setColumn(0, ['row1', 'row2', 'row3']) table2.setColumn(1, [1, 2, 3]) table2.setColumn(2, [1.1, 2.2, 3.3])
NtTable(pvObject)
- Parameter:
pvObject (PvObject) - PV object that has a structure containing required NT Table elements:
labels ([STRING]) - list of column labels
value (dict) - dictionary of column<index>:[PVTYPE] pairs, where <index> is an integer in range [0,N-1], with N being NT Table dimension
The following example creates NT Table with 3 DOUBLE columns (note that this constructor should not be used for versions of python < 3.7 where the order of dictionary entries is not guaranteed):
pvObject = PvObject({'labels' : [STRING], 'value' : {'column0' : [DOUBLE], 'column1' : [DOUBLE], 'column2' : [DOUBLE]}}) pvObject.setScalarArray('labels', ['x', 'y', 'z']) pvObject.setStructure('value', {'column0' : [0.1, 0.2, 0.3], 'column1' : [1.1, 1.2, 1.3], 'column2' : [2.1, 2.2, 2.3]}) table3 = NtTable(pvObject)
- getAlarm((NtTable)arg1) PvAlarm : ¶
- getAlarm() => PvAlarm :
Retrieves table alarm.
- Returns:
table alarm object
alarm = table.getAlarm()
- getColumn((NtTable)arg1, (int)index) list : ¶
- getColumn((int)index) => list :
Retrieves specified column.
- Parameter:
index (int) - column index (must be in range [0,N-1], where N is the number of table columns)
- Returns:
list of values stored in the specified table column
valueList = table.getColumn(0)
- getDescriptor((NtTable)arg1) str : ¶
- getDescriptor() => str :
Retrieves table descriptor.
- Returns:
table descriptor
descriptor = table.getDescriptor()
- getLabels((NtTable)arg1) list : ¶
- getLabels() => list :
Retrieves list of column labels.
- Returns:
list of column labels
labelList = table.getLabels()
- getNColumns((NtTable)arg1) int : ¶
- getNColumns() => int :
Retrieves number of columns.
- Returns:
number of table columns
nColumns = table.getNColumns()
- getTimeStamp((NtTable)arg1) PvTimeStamp : ¶
- getTimeStamp() => PvTimeStamp :
Retrieves table time stamp.
- Returns:
table time stamp object
timeStamp = table.getTimeStamp()
- setAlarm((NtTable)arg1, (PvAlarm)alarm) None : ¶
- setAlarm((PvAlarm)alarm) => None :
Sets table alarm.
- Parameter:
alarm (PvAlarm) - table alarm object
alarm = PvAlarm(11, 126, 'Server SegFault') table.setAlarm(alarm)
- setColumn((NtTable)arg1, (int)index, (list)valueList) None : ¶
- setColumn((int)index, (list)valueList) => None :
Sets column values.
- Parameter:
index (int) - column index
- Parameter:
valueList (list) - list of column values
table.setColumn(0, ['x', 'y', 'z'])
- setDescriptor((NtTable)arg1, (str)descriptor) None : ¶
- setDescriptor((str)descriptor) => None :
Sets table descriptor.
- Parameter:
descriptor (str) - table descriptor
table.setDescriptor('myTable')
- setLabels((NtTable)arg1, (list)labelList) None : ¶
- setLabels((list)labelList) => None :
Sets column labels.
- Parameter:
labelList ([str]) - list of strings containing column labels (the list length must match number of table columns)
table.setLabels(['String', 'Int', 'Double'])
- setTimeStamp((NtTable)arg1, (PvTimeStamp)timeStamp) None : ¶
- setTimeStamp((PvTimeStamp)timeStamp) => None :
Sets table time stamp.
- Parameter:
timeStamp (PvTimeStamp) - table time stamp object
timeStamp = PvTimeStamp(1234567890, 10000, 1) table.setTimeStamp(timeStamp)
NtScalar¶
- class pvaccess.NtScalar¶
Bases:
NtType
NtScalar represents NT scalar structure.
NtScalar(scalarType)
- Parameter:
scalarType (PVTYPE) - scalar type (BOOLEAN, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, FLOAT, DOUBLE, or STRING)
s1 = NtScalar(DOUBLE)
NtScalar(scalarType, value)
- Parameter:
scalarType (PVTYPE) - scalar type (BOOLEAN, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, FLOAT, DOUBLE, or STRING)
- Parameter:
value (scalar_t) - scalar value
s2 = NtScalar(DOUBLE, 10.0)
NtScalar(pvObject)
- Parameter:
pvObject (PvObject) - PV object that has a structure containing required NT scalar elements:
pvObject = PvInt(3) s3 = NtScalar(pvObject)
- getAlarm((NtScalar)arg1) PvAlarm : ¶
- getAlarm() => PvAlarm :
Retrieves scalar alarm.
- Returns:
scalar alarm object
alarm = scalar.getAlarm()
- getControl((NtScalar)arg1) PvControl : ¶
- getControl() => PvControl :
Retrieves scalar control.
- Returns:
scalar control object
control = scalar.getControl()
- getDescriptor((NtScalar)arg1) str : ¶
- getDescriptor() => str :
Retrieves scalar descriptor.
- Returns:
scalar descriptor
descriptor = scalar.getDescriptor()
- getDisplay((NtScalar)arg1) PvDisplay : ¶
- getDisplay() => PvDisplay :
Retrieves scalar display.
- Returns:
scalar display object
display = scalar.getDisplay()
- getTimeStamp((NtScalar)arg1) PvTimeStamp : ¶
- getTimeStamp() => PvTimeStamp :
Retrieves scalar time stamp.
- Returns:
scalar time stamp object
timeStamp = scalar.getTimeStamp()
- getValue((NtScalar)arg1) object : ¶
- getValue() => object :
Get scalar value.
- Returns:
scalar value
value = scalar.getValue()
- setAlarm((NtScalar)arg1, (PvAlarm)alarm) None : ¶
- setAlarm((PvAlarm)alarm) => None :
Sets scalar alarm.
- Parameter:
alarm (PvAlarm) - scalar alarm object
alarm = PvAlarm(11, 126, 'Server SegFault') scalar.setAlarm(alarm)
- setControl((NtScalar)arg1, (PvControl)control) None : ¶
- setControl((PvControl)control) => None :
Sets scalar control.
- Parameter:
control (PvControl) - scalar control object
control = PvControl() scalar.setControl(control)
- setDescriptor((NtScalar)arg1, (str)descriptor) None : ¶
- setDescriptor((str)descriptor) => None :
Sets scalar descriptor.
- Parameter:
descriptor (str) - scalar descriptor
scalar.setDescriptor('myScalar')
- setDisplay((NtScalar)arg1, (PvDisplay)display) None : ¶
- setDisplay((PvDisplay)display) => None :
Sets scalar display.
- Parameter:
display (PvDisplay) - scalar display object
display = PvDisplay() scalar.setDisplay(display)
- setTimeStamp((NtScalar)arg1, (PvTimeStamp)timeStamp) None : ¶
- setTimeStamp((PvTimeStamp)timeStamp) => None :
Sets scalar time stamp.
- Parameter:
timeStamp (PvTimeStamp) - scalar time stamp object
timeStamp = PvTimeStamp(1234567890, 10000, 1) scalar.setTimeStamp(timeStamp)
- setValue((NtScalar)arg1, (object)value) None : ¶
- setValue((object)value) => None :
Sets scalar value.
- Parameter:
value (scalar_t) - scalar value
scalar.setValue(1)
Channel¶
- class pvaccess.Channel¶
Bases:
instance
This class represents PV channels.
Channel(name [, providerType=PVA])
- Parameter:
name (str) - channel name
- Parameter:
providerType (PROVIDERTYPE) - provider type, either PVA (PV Access) or CA (Channel Access)
Note that PV structures representing objects on CA channels always have a single key ‘value’. The following example creates PVA channel ‘enum01’:
pvaChannel = Channel('enum01')
This example allows access to CA channel ‘CA:INT’:
caChannel = Channel('CA:INT', CA)
- asyncGet((Channel)arg1, (object)arg2, (object)pyCallback, (str)requestDescriptor) None : ¶
- asyncGet((object)arg2, (object)pyCallback, (str)requestDescriptor) => None :
Asynchronously retrieves PV value from the channel and invokes the python callback method.
- Parameter:
pyCallback (object) - reference to python callback object (e.g., python function) that will be invoked after PV value is retrieved
- Parameter:
pyErrorCallback (object) - reference to python callback object (e.g., python function) that will be invoked if error occur during PV value retrieval
- Parameter:
requestDescriptor (str) - describes what PV data should be sent to the client
def echo(pv): print('PV value: %s' % pv) def error(code): print('Returned error code: %s' % code) channel.asyncGet(echo, error, 'field(value,alarm,timeStamp)')
- asyncGet((object)arg2, (object)pyCallback) => None :
Asynchronously retrieves PV value from the channel and invokes the python callback method. The method uses default request descriptor ‘field(value)’.
- Parameter:
pyCallback (object) - reference to python callback object (e.g., python function) that will be invoked after PV value is retrieved
- Parameter:
pyErrorCallback (object) - reference to python callback object (e.g., python function) that will be invoked if error occur during PV value retrieval
def echo(pv): print('PV value: %s' % pv) def error(code): print('Returned error code: %s' % code) channel.asyncGet(echo, error)
- asyncPut((Channel)arg1, (PvObject)arg2, (object)pvObject, (object)pyCallback, (str)requestDescriptor) None : ¶
- asyncPut((PvObject)arg2, (object)pvObject, (object)pyCallback, (str)requestDescriptor) => None :
Asynchronously assigns PV data to the channel process variable.
- Parameter:
pvObject (PvObject) - PV object that will be assigned to channel PV according to the specified request descriptor
- Parameter:
pyCallback (object) - reference to python callback object (e.g., python function) that will be invoked after PV value is set
- Parameter:
pyErrorCallback (object) - reference to python callback object (e.g., python function) that will be invoked if error occur during PV value retrieval
- Parameter:
requestDescriptor (str) - PV request descriptor
def echo(pv): print('PV set to: %s' % pv) def error(code): print('Returned error code: %s' % code) channel.asyncPut(PvInt(10), echo, error, 'field(value)')
- asyncPut((PvObject)arg2, (object)pvObject, (object)pyCallback) => None :
Asynchronously assigns PV data to the channel process variable using the default request descriptor ‘field(value)’.
- Parameter:
pvObject (PvObject) - PV object that will be assigned to the channel process variable
- Parameter:
pyCallback (object) - reference to python callback object (e.g., python function) that will be invoked after PV value is set
- Parameter:
pyErrorCallback (object) - reference to python callback object (e.g., python function) that will be invoked if error occur during PV value retrieval
def echo(pv): print('PV set to: %s' % pv) def error(code): print('Returned error code: %s' % code) channel.asyncPut(PvInt(10), echo, error)
- get((Channel)arg1, (str)requestDescriptor) PvObject : ¶
- get((str)requestDescriptor) => PvObject :
Retrieves PV data from the channel.
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data corresponding to the specified request descriptor
channel = Channel('enum01') pv = channel.get('field(value.index)')
- get() => PvObject :
Retrieves PV data from the channel using the default request descriptor ‘field(value)’.
- Returns:
channel PV data
pv = channel.get()
- getIntrospectionDict((Channel)arg1) dict : ¶
- getIntrospectionDict() => dict :
Retrieves PV structure definition as python dictionary.
- Returns:
python key:value dictionary representing PV structure definition in terms of field names and their types (introspection dictionary)
introspectionDict = channel.getIntrospectionDict()
- getMonitorCounters((Channel)arg1) dict : ¶
- getMonitorCounters() => dict :
Retrieve dictionary with monitor counters, which include number of updates received and number of monitor overruns.
- Returns:
dictionary containing available statistics counters
counterDict = channel.getMonitorCounters()
- getMonitorMaxQueueLength((Channel)arg1) int : ¶
- getMonitorMaxQueueLength() => int :
Retrieves maximum monitor queue length.
- Returns:
maximum monitor queue length
maxQueueLength = channel.getMonitorMaxQueueLength()
- getName((Channel)arg1) str : ¶
- getName() => str :
Get channel name.
- Returns:
channel name
cName = channel.getName()
- getPut((Channel)arg1, (str)requestDescriptor) PvObject : ¶
- getPut((str)requestDescriptor) => PvObject :
Retrieves put PV data from the channel.
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel put PV data corresponding to the specified request descriptor
channel = Channel('enum01') pv = channel.getPut('field(value.index)')
- getPut() => PvObject :
Retrieves put PV data from the channel using the default request descriptor ‘field(value)’.
- Returns:
channel put PV data
pv = channel.getPut()
- getTimeout((Channel)arg1) float : ¶
- getTimeout() => float :
Retrieves channel timeout.
- Returns:
channel timeout in seconds
timeout = channel.getTimeout()
- isConnected((Channel)arg1) bool : ¶
- isConnected() => bool :
Returns channel connection status (boolean).
- Returns:
channel connection status
connected = channel.isConnected()
- isMonitorActive((Channel)arg1) bool : ¶
- isMonitorActive() => bool :
Determines whether or not channel monitor is active.
- Returns:
True if monitor is active, false otherwise
monitorActive = channel.isMonitorActive()
- monitor((Channel)arg1, (object)subscriber[, (str)requestDescriptor=field(value)]) None : ¶
- monitor((object)subscriber [, (str)requestDescriptor=field(value)]) => None :
Subscribes python object to notifications of changes in PV value and starts channel monitor. This method is appropriate when there is only one subscriber.
- Parameter:
subscriber (object) - reference to python subscriber object (e.g., python function) that will be executed when PV value changes
- Parameter:
requestDescriptor (str) - describes what PV data should be sent to subscribed channel clients
def echo(x): print('New PV value: %s' % x) channel.monitor(echo, 'field(value,alarm,timeStamp)')
- parsePut((Channel)arg1, (list)argList, (str)requestDescriptor, (bool)zeroArrayLength) None : ¶
- parsePut((list)argList, (str)requestDescriptor, (bool)zeroArrayLength) => None :
Assigns json args to the channel PV according to the specified request descriptor.
- Parameter:
argList (list) - json args that will be assigned to the channel PV
- Parameter:
requestDescriptor (str) - request to pass to createRequest
- Parameter:
zeroArrayLength (bool) - if true, call zeroArrayLength before parse
- parsePutGet((Channel)arg1, (list)argList, (str)requestDescriptor, (bool)zeroArrayLength) PvObject : ¶
- parsePutGet((list)argList, (str)requestDescriptor, (bool)zeroArrayLength) => PvObject :
Assigns json args to the channel PV according to the specified request descriptor, and returns new value.
- Parameter:
argList (list) - json args that will be assigned to the channel PV
- Parameter:
requestDescriptor (str) - request to pass to createRequest
- Parameter:
zeroArrayLength (bool) - if true, call zeroArrayLength before parse
- returns:
channel PV data corresponding to the specified request descriptor
- put((Channel)arg1, (PvObject)pvObject, (str)requestDescriptor) None : ¶
- put((PvObject)pvObject, (str)requestDescriptor) => None :
Assigns PV data to the channel process variable.
- Parameter:
pvObject (PvObject) - PV object that will be assigned to channel PV according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
channel = Channel('enum01') channel.put(PvInt(1), 'field(value.index)')
- put((PvObject)pvObject) => None :
Assigns PV data to the channel process variable using the default request descriptor ‘field(value)’.
- Parameter:
pvObject (PvObject) - PV object that will be assigned to the channel process variable
channel = Channel('exampleInt') channel.put(PvInt(1))
- put((list)valueList, (str)requestDescriptor) => None :
Assigns scalar array data to the channel PV according to the specified request descriptor.
- Parameter:
valueList (list) - list of scalar values that will be assigned to the channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((list)valueList) => None :
Assigns scalar array data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
valueList (list) - list of scalar values that will be assigned to the channel PV
channel = Channel('intArray01') channel.put([0,1,2,3,4])
- put((float)value, (str)requestDescriptor) => None :
Assigns float data to the channel PV.
- Parameter:
value (float) - float value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((float)value) => None :
Assigns float data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (float) - float value that will be assigned to the channel PV
channel = Channel('exampleFloat') channel.put(1.1)
- put((float)value, (str)requestDescriptor) => None :
Assigns double data to the channel PV.
- Parameter:
value (float) - double value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((float)value) => None :
Puts double data into the channel using the default request descriptor ‘field(value)’.
- Parameter:
value (float) - double value that will be assigned to the channel PV
channel = Channel('double01') channel.put(1.1)
- put((bool)value, (str)requestDescriptor) => None :
Assigns boolean data to the channel PV.
- Parameter:
value (bool) - boolean value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((bool)value) => None :
Assigns boolean data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (bool) - boolean value that will be assigned to the channel PV
channel = Channel('boolean01') channel.put(True)
- put((int)value, (str)requestDescriptor) => None :
Assigns unsigned byte data to the channel PV.
- Parameter:
value (int) - unsigned byte value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((int)value) => None :
Assigns unsigned byte data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - unsigned byte value that will be assigned to the channel PV
channel = Channel('ubyte01') channel.put(10)
- put((str)value, (str)requestDescriptor) => None :
Assigns byte data to the channel PV.
- Parameter:
value (int) - byte value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((str)value) => None :
Assigns byte data to the channel using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - byte value that will be assigned to the channel PV
channel = Channel('byte01') channel.put(-10)
- put((int)value, (str)requestDescriptor) => None :
Assigns unsigned short data to the channel PV.
- Parameter:
value (int) - unsigned short value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((int)value) => None :
Assigns unsigned short data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - unsigned short value that will be assigned to the channel PV
channel = Channel('ushort01') channel.put(10)
- put((int)value, (str)requestDescriptor) => None :
Assigns short data to the channel PV.
- Parameter:
value (int) - short value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((int)value) => None :
Assigns short data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - short value that will be assigned to the channel PV
channel = Channel('short01') channel.put(10)
- put((int)value, (str)requestDescriptor) => None :
Assigns unsigned integer data to the channel PV.
- Parameter:
value (int) - unsigned integer value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((int)value) => None :
Assigns unsigned integer data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - unsigned integer value that will be assigned to the channel PV
channel = Channel('uexampleInt') channel.putUInt(1000)
- put((int)value, (str)requestDescriptor) => None :
Assigns integer data to the channel PV.
- Parameter:
value (int) - integer value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((int)value) => None :
Assigns integer data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - integer value that will be assigned to the channel PV
channel = Channel('exampleInt') channel.put(1000)
- put((int)value, (str)requestDescriptor) => None :
Assigns unsigned long data to the channel PV.
- Parameter:
value (long) - unsigned long value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((int)value) => None :
Assigns unsigned long data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (long) - unsigned long value that will be assigned to the channel PV
channel = Channel('ulong01') channel.put(100000L)
- put((int)value, (str)requestDescriptor) => None :
Assigns long data to the channel PV.
- Parameter:
value (long) - long value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((int)value) => None :
Assigns long data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (long) - long value that will be assigned to the channel PV
channel = Channel('long01') channel.put(100000L)
- put((str)value, (str)requestDescriptor) => None :
Assigns string data to the channel PV.
- Parameter:
value (str) - string value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- put((str)value) => None :
Assigns string data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (str) - string value that will be assigned to the channel PV
channel = Channel('string01') channel.put('string value')
- putBoolean((Channel)arg1, (bool)value, (str)requestDescriptor) None : ¶
- putBoolean((bool)value, (str)requestDescriptor) => None :
Assigns boolean data to the channel PV.
- Parameter:
value (bool) - boolean value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putBoolean((bool)value) => None :
Assigns boolean data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (bool) - boolean value that will be assigned to the channel PV
channel = Channel('boolean01') channel.putBoolean(True)
- putByte((Channel)arg1, (str)value, (str)requestDescriptor) None : ¶
- putByte((str)value, (str)requestDescriptor) => None :
Assigns byte data to the channel PV.
- Parameter:
value (int) - byte value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putByte((str)value) => None :
Assigns byte data to the channel using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - byte value that will be assigned to the channel PV
channel = Channel('byte01') channel.putByte(-10)
- putDouble((Channel)arg1, (float)value, (str)requestDescriptor) None : ¶
- putDouble((float)value, (str)requestDescriptor) => None :
Assigns double data to the channel PV.
- Parameter:
value (float) - double value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putDouble((float)value) => None :
Puts double data into the channel using the default request descriptor ‘field(value)’.
- Parameter:
value (float) - double value that will be assigned to the channel PV
channel = Channel('double01') channel.putDouble(1.1)
- putFloat((Channel)arg1, (float)value, (str)requestDescriptor) None : ¶
- putFloat((float)value, (str)requestDescriptor) => None :
Assigns float data to the channel PV.
- Parameter:
value (float) - float value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putFloat((float)value) => None :
Assigns float data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (float) - float value that will be assigned to the channel PV
channel = Channel('exampleFloat') channel.putFloat(1.1)
- putGet((Channel)arg1, (PvObject)pvObject, (str)requestDescriptor) PvObject : ¶
- putGet((PvObject)pvObject, (str)requestDescriptor) => PvObject :
Assigns PV data to the channel process variable and returns new PV value.
- Parameter:
pvObject (PvObject) - PV object that will be assigned to channel PV according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data corresponding to the specified request descriptor
channel = Channel('exampleInt') pv = channel.putGet(PvInt(1), 'putField(value)getField(value)')
- putGet((PvObject)pvObject) => PvObject :
Assigns PV data to the channel process variable and returns new PV value.
- Parameter:
pvObject (PvObject) - PV object that will be assigned to channel PV according to the default request descriptor ‘putField(value)getField(value)’
- Returns:
channel PV data
channel = Channel('exampleInt') pv = channel.putGet(PvInt(1))
- putGet((list)valueList, (str)requestDescriptor) => PvObject :
Assigns scalar array data to the channel process variable and returns new PV value.
- Parameter:
valueList (list) - list of scalar values that will be assigned to the channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
channel = Channel('exampleIntArray') pv = channel.putGet([0,1,2,3,4], 'putField(value)getField(value)')
- putGet((list)valueList) => PvObject :
Assigns scalar array data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
valueList (list) - list of scalar values that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleIntArray') pv = channel.putGet([0,1,2,3,4], 'putField(value)getField(value)')
- putGet((float)value, (str)requestDescriptor) => PvObject :
Assigns float data to the channel PV and returns new PV value.
- Parameter:
value (float) - float value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((float)value) => PvObject :
Assigns float data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (float) - float value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleFloat') pv = channel.putGet(-1.1)
- putGet((float)value, (str)requestDescriptor) => PvObject :
Assigns double data to the channel PV and returns new PV value.
- Parameter:
value (float) - double value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((float)value) => PvObject :
Assigns double data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (float) - double value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleDouble') pv = channel.putGet(-1.1)
- putGet((bool)value, (str)requestDescriptor) => PvObject :
Assigns boolean data to the channel PV and returns new PV value.
- Parameter:
value (bool) - boolean value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((bool)value) => PvObject :
Assigns boolean data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (bool) - boolean value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleBoolean') pv = channel.putGet(True)
- putGet((int)value, (str)requestDescriptor) => PvObject :
Assigns unsigned byte data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - unsigned byte value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((int)value) => PvObject :
Assigns unsigned byte data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - unsigned byte value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleUByte') pv = channel.putGet(-10)
- putGet((str)value, (str)requestDescriptor) => PvObject :
Assigns byte data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - byte value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((str)value) => PvObject :
Assigns byte data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - byte value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleByte') pv = channel.putGet(-10)
- putGet((int)value, (str)requestDescriptor) => PvObject :
Assigns unsigned short data to the channel PV and returns new PV value.
- Parameter:
value (int) - short value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((int)value) => PvObject :
Assigns unsigned short data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - unsigned short value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleUShort') pv = channel.putGet(1000)
- putGet((int)value, (str)requestDescriptor) => PvObject :
Assigns short data to the channel PV and returns new PV value.
- Parameter:
value (int) - short value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((int)value) => PvObject :
Assigns short data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - short value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleShort') pv = channel.putGet(-1000)
- putGet((int)value, (str)requestDescriptor) => PvObject :
Assigns unsigned int data to the channel PV and returns new PV value.
- Parameter:
value (int) - int value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((int)value) => PvObject :
Assigns unsigned int data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - unsigned int value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleUInt') pv = channel.putGet(1000)
- putGet((int)value, (str)requestDescriptor) => PvObject :
Assigns int data to the channel PV and returns new PV value.
- Parameter:
value (int) - int value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((int)value) => PvObject :
Assigns int data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - int value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleInt') pv = channel.putGet(1000)
- putGet((int)value, (str)requestDescriptor) => PvObject :
Assigns unsigned long data to the channel PV and returns new PV value.
- Parameter:
value (long) - unsigned long value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((int)value) => PvObject :
Assigns unsigned long data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (long) - unsigned long value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleULong') pv = channel.putGet(1000L)
- putGet((int)value, (str)requestDescriptor) => PvObject :
Assigns long data to the channel PV and returns new PV value.
- Parameter:
value (long) - long value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGet((int)value) => PvObject :
Assigns long data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (long) - long value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleLong') pv = channel.putGet(-1000L)
- putGet((str)value, (str)requestDescriptor) => PvObject :
Assigns string data to the channel process variable and returns new PV value.
- Parameter:
value (str) - string value that will be assigned to the channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
channel = Channel('exampleString') pv = channel.putGet('string value', 'putField(value)getField(value)')
- putGet((str)value) => PvObject :
Assigns string data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (str) - string value that will be assigned to the channel PV’
- Returns:
channel PV data
channel = Channel('exampleString') pv = channel.putGet('string value')
- putGetBoolean((Channel)arg1, (bool)value, (str)requestDescriptor) PvObject : ¶
- putGetBoolean((bool)value, (str)requestDescriptor) => PvObject :
Assigns boolean data to the channel PV and returns new PV value.
- Parameter:
value (bool) - boolean value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetBoolean((bool)value) => PvObject :
Assigns boolean data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (bool) - boolean value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleBoolean') pv = channel.putGetBoolean(True)
- putGetByte((Channel)arg1, (str)value, (str)requestDescriptor) PvObject : ¶
- putGetByte((str)value, (str)requestDescriptor) => PvObject :
Assigns byte data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - byte value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetByte((str)value) => PvObject :
Assigns byte data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - byte value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleByte') pv = channel.putGetByte(-10)
- putGetDouble((Channel)arg1, (float)value, (str)requestDescriptor) PvObject : ¶
- putGetDouble((float)value, (str)requestDescriptor) => PvObject :
Assigns double data to the channel PV and returns new PV value.
- Parameter:
value (float) - double value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetDouble((float)value) => PvObject :
Assigns double data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (float) - double value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleDouble') pv = channel.putGetDouble(-1.1)
- putGetFloat((Channel)arg1, (float)value, (str)requestDescriptor) PvObject : ¶
- putGetFloat((float)value, (str)requestDescriptor) => PvObject :
Assigns float data to the channel PV and returns new PV value.
- Parameter:
value (float) - float value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetFloat((float)value) => PvObject :
Assigns float data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (float) - float value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleFloat') pv = channel.putGetFloat(-1.1)
- putGetInt((Channel)arg1, (int)value, (str)requestDescriptor) PvObject : ¶
- putGetInt((int)value, (str)requestDescriptor) => PvObject :
Assigns int data to the channel PV and returns new PV value.
- Parameter:
value (int) - int value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetInt((int)value) => PvObject :
Assigns int data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - int value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleInt') pv = channel.putGetInt(1000)
- putGetLong((Channel)arg1, (int)value, (str)requestDescriptor) PvObject : ¶
- putGetLong((int)value, (str)requestDescriptor) => PvObject :
Assigns long data to the channel PV and returns new PV value.
- Parameter:
value (long) - long value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetLong((int)value) => PvObject :
Assigns long data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (long) - long value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleLong') pv = channel.putGetLong(-1000L)
- putGetScalarArray((Channel)arg1, (list)valueList, (str)requestDescriptor) PvObject : ¶
- putGetScalarArray((list)valueList, (str)requestDescriptor) => PvObject :
Assigns scalar array data to the channel process variable and returns new PV value.
- Parameter:
valueList (list) - list of scalar values that will be assigned to the channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
channel = Channel('exampleIntArray') pv = channel.putGetScalarArray([0,1,2,3,4], 'putField(value)getField(value)')
- putGetScalarArray((list)valueList) => PvObject :
Assigns scalar array data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
valueList (list) - list of scalar values that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleIntArray') pv = channel.putGetScalarArray([0,1,2,3,4], 'putField(value)getField(value)')
- putGetShort((Channel)arg1, (int)value, (str)requestDescriptor) PvObject : ¶
- putGetShort((int)value, (str)requestDescriptor) => PvObject :
Assigns short data to the channel PV and returns new PV value.
- Parameter:
value (int) - short value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetShort((int)value) => PvObject :
Assigns short data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - short value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleShort') pv = channel.putGetShort(-1000)
- putGetString((Channel)arg1, (str)value, (str)requestDescriptor) PvObject : ¶
- putGetString((str)value, (str)requestDescriptor) => PvObject :
Assigns string data to the channel process variable and returns new PV value.
- Parameter:
value (str) - string value that will be assigned to the channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
channel = Channel('exampleString') pv = channel.putGetString('string value', 'putField(value)getField(value)')
- putGetString((str)value) => PvObject :
Assigns string data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (str) - string value that will be assigned to the channel PV’
- Returns:
channel PV data
channel = Channel('exampleString') pv = channel.putGetString('string value')
- putGetUByte((Channel)arg1, (int)value, (str)requestDescriptor) PvObject : ¶
- putGetUByte((int)value, (str)requestDescriptor) => PvObject :
Assigns unsigned byte data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - unsigned byte value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetUByte((int)value) => PvObject :
Assigns unsigned byte data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - unsigned byte value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleUByte') pv = channel.putGetUByte(-10)
- putGetUInt((Channel)arg1, (int)value, (str)requestDescriptor) PvObject : ¶
- putGetUInt((int)value, (str)requestDescriptor) => PvObject :
Assigns unsigned int data to the channel PV and returns new PV value.
- Parameter:
value (int) - unsigned int value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetUInt((int)value) => PvObject :
Assigns unsigned int data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - unsigned int value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleUInt') pv = channel.putGetUInt(1000)
- putGetULong((Channel)arg1, (int)value, (str)requestDescriptor) PvObject : ¶
- putGetULong((int)value, (str)requestDescriptor) => PvObject :
Assigns unsigned long data to the channel PV and returns new PV value.
- Parameter:
value (long) - unsigned long value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetULong((int)value) => PvObject :
Assigns unsigned long data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (long) - unsigned long value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleULong') pv = channel.putGetULong(1000L)
- putGetUShort((Channel)arg1, (int)value, (str)requestDescriptor) PvObject : ¶
- putGetUShort((int)value, (str)requestDescriptor) => PvObject :
Assigns unsigned short data to the channel PV and returns new PV value.
- Parameter:
value (int) - unsigned short value that will be assigned to channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
channel PV data
- putGetUShort((int)value) => PvObject :
Assigns unsigned short data to the channel PV using the default request descriptor ‘putField(value)getField(value)’, and returns new PV value.
- Parameter:
value (int) - unsigned short value that will be assigned to the channel PV
- Returns:
channel PV data
channel = Channel('exampleUShort') pv = channel.putGetUShort(1000)
- putInt((Channel)arg1, (int)value, (str)requestDescriptor) None : ¶
- putInt((int)value, (str)requestDescriptor) => None :
Assigns integer data to the channel PV.
- Parameter:
value (int) - integer value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putInt((int)value) => None :
Assigns integer data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - integer value that will be assigned to the channel PV
channel = Channel('exampleInt') channel.putInt(1000)
- putLong((Channel)arg1, (int)value, (str)requestDescriptor) None : ¶
- putLong((int)value, (str)requestDescriptor) => None :
Assigns long data to the channel PV.
- Parameter:
value (long) - long value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putLong((int)value) => None :
Assigns long data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (long) - long value that will be assigned to the channel PV
channel = Channel('long01') channel.putLong(100000L)
- putScalarArray((Channel)arg1, (list)valueList, (str)requestDescriptor) None : ¶
- putScalarArray((list)valueList, (str)requestDescriptor) => None :
Assigns scalar array data to the channel PV according to the specified request descriptor.
- Parameter:
valueList (list) - list of scalar values that will be assigned to the channel PV
- Parameter:
requestDescriptor (str) - PV request descriptor
- putScalarArray((list)valueList) => None :
Assigns scalar array data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
valueList (list) - list of scalar values that will be assigned to the channel PV
channel = Channel('intArray01') channel.putScalarArray([0,1,2,3,4])
- putShort((Channel)arg1, (int)value, (str)requestDescriptor) None : ¶
- putShort((int)value, (str)requestDescriptor) => None :
Assigns short data to the channel PV.
- Parameter:
value (int) - short value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putShort((int)value) => None :
Assigns short data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - short value that will be assigned to the channel PV
channel = Channel('short01') channel.putShort(10)
- putString((Channel)arg1, (str)value, (str)requestDescriptor) None : ¶
- putString((str)value, (str)requestDescriptor) => None :
Assigns string data to the channel PV.
- Parameter:
value (str) - string value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putString((str)value) => None :
Assigns string data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (str) - string value that will be assigned to the channel PV
channel = Channel('string01') channel.putString('string value')
- putUByte((Channel)arg1, (int)value, (str)requestDescriptor) None : ¶
- putUByte((int)value, (str)requestDescriptor) => None :
Assigns unsigned byte data to the channel PV.
- Parameter:
value (int) - unsigned byte value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putUByte((int)value) => None :
Assigns unsigned byte data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - unsigned byte value that will be assigned to the channel PV
channel = Channel('ubyte01') channel.putUByte(10)
- putUInt((Channel)arg1, (int)value, (str)requestDescriptor) None : ¶
- putUInt((int)value, (str)requestDescriptor) => None :
Assigns unsigned integer data to the channel PV.
- Parameter:
value (int) - unsigned integer value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putUInt((int)value) => None :
Assigns unsigned integer data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - unsigned integer value that will be assigned to the channel PV
channel = Channel('uexampleInt') channel.putUInt(1000)
- putULong((Channel)arg1, (int)value, (str)requestDescriptor) None : ¶
- putULong((int)value, (str)requestDescriptor) => None :
Assigns unsigned long data to the channel PV.
- Parameter:
value (long) - unsigned long value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putULong((int)value) => None :
Assigns unsigned long data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (long) - unsigned long value that will be assigned to the channel PV
channel = Channel('ulong01') channel.putULong(100000L)
- putUShort((Channel)arg1, (int)value, (str)requestDescriptor) None : ¶
- putUShort((int)value, (str)requestDescriptor) => None :
Assigns unsigned short data to the channel PV.
- Parameter:
value (int) - unsigned short value that will be assigned to channel data according to the specified request descriptor
- Parameter:
requestDescriptor (str) - PV request descriptor
- putUShort((int)value) => None :
Assigns unsigned short data to the channel PV using the default request descriptor ‘field(value)’.
- Parameter:
value (int) - unsigned short value that will be assigned to the channel PV
channel = Channel('ushort01') channel.putUShort(10)
- qMonitor((Channel)arg1, (PvObjectQueue)pvObjectQueue, (str)requestDescriptor) None : ¶
- qMonitor((PvObjectQueue)pvObjectQueue, (str)requestDescriptor) => None :
Starts queueing channel monitor. This method results in channel updates being pushed into the provided PvObject queue. PvObjects can be retrieved from the queue and processed separately. This monitor can be stopped using the stopMonitor() method.
- Parameter:
pvObjectQueue (PvObjectQueue) - PvObject queue that will be receive PV value updated
- Parameter:
requestDescriptor (str) - describes what PV data should be sent to the channel monitor
pvq = PvObjectQueue(10000) channel.qMonitor(pvq, 'field(value,alarm,timeStamp)') while True: try: pv = pvq.get() print(pv) except QueueEmpty as ex: # queue is empty pv = pvq.waitForPut(1)
- qMonitor((PvObjectQueue)pvObjectQueue) => None :
Starts queueing channel monitor with the default request descriptor ‘field(value)’. This method results in channel updates being pushed into the provided PvObject queue. PvObjects can be retrieved from the queue and processed separately. This monitor can be stopped using the stopMonitor() method.
- Parameter:
pvObjectQueue (PvObjectQueue) - PvObject queue that will be receive PV value updated
pvq = PvObjectQueue(10000) channel.qMonitor(pvq)
- resetMonitorCounters((Channel)arg1) None : ¶
- resetMonitorCounters() => None :
Reset all monitor counters to zero.
channel.resetMonitorCounters()
- setConnectionCallback((Channel)arg1, (object)callback) None : ¶
- setConnectionCallback((object)callback) => None :
Subscribes python object to notifications of changes in the channel connection status.
- Parameter:
callback (object) - reference to python function that will be executed when connection status changes; the function should take a boolean argument which describes whether channel is connected or not
def connectionCallback(isConnected): print('Channel connected: %s' % (isConnected)) channel = Channel('exampleFloat') channel.setConnectionCallback(connectionCallback)
- setMonitorMaxQueueLength((Channel)arg1, (int)maxQueueLength) None : ¶
- setMonitorMaxQueueLength((int)maxQueueLength) => None :
Sets maximum monitor queue length. Negative number means unlimited length, while the value of zero disables monitor queue. When monitor queue is disabled, incoming data is processed immediately by all python subscribers (i.e., there is no processing thread running in the background). When monitoring queue is full, channel will not be polled for new data. Default monitor queue length is zero.
- Parameter:
maxQueueLength (int) - maximum queue length
channel.setMonitorMaxQueueLength(10)
- setTimeout((Channel)arg1, (float)timeout) None : ¶
- setTimeout((float)timeout) => None :
Sets channel timeout.
- Parameter:
timeout (float) - channel timeout in seconds
channel.setTimeout(10.0)
- startMonitor((Channel)arg1, (str)requestDescriptor) None : ¶
- startMonitor((str)requestDescriptor) => None :
Starts channel monitor for PV value changes.
- Parameter:
requestDescriptor (str) - describes what PV data should be sent to subscribed channel clients
channel.startMonitor('field(value,alarm,timeStamp)')
- startMonitor() => None :
Starts channel monitor for PV value changes using the default request descriptor ‘field(value)’.
channel.startMonitor()
- stopMonitor((Channel)arg1) None : ¶
- stopMonitor() => None :
Stops channel monitor for PV value changes.
channel.stopMonitor()
- subscribe((Channel)arg1, (str)subscriberName, (object)subscriber) None : ¶
- subscribe((str)subscriberName, (object)subscriber) => None :
Subscribes python object to notifications of changes in PV value. Channel can have any number of subscribers that start receiving PV updates after startMonitor() is invoked. Updates stop after channel monitor is stopped via stopMonitor() call, or object is unsubscribed from notifications using unsubscribe() call.
- Parameter:
subscriberName (str) - subscriber object name
- Parameter:
subscriber (object) - reference to python subscriber object (e.g., python function) that will be executed when PV value changes
The following code snippet defines a simple subscriber object, subscribes it to PV value changes, and starts channel monitor:
def echo(x): print('New PV value: %s' % x) channel = Channel('exampleFloat') channel.subscribe('echo', echo) channel.startMonitor()
- unsubscribe((Channel)arg1, (str)subscriberName) None : ¶
- unsubscribe((str)subscriberName) => None :
Unsubscribes subscriber object from notifications of changes in PV value.
- Parameter:
subscriberName (str) - subscriber name
channel.unsubscribe('echo')
MultiChannel¶
- class pvaccess.MultiChannel¶
Bases:
instance
This class is used to communicate with multiple PV channels.
MultiChannel(names [, providerType=PVA])
- Parameter:
names (list) - channel names
- Parameter:
providerType (PROVIDERTYPE) - provider type, either PVA (PV Access) or CA (Channel Access)
The following example allows access to PVA channels ‘int01’ and ‘double01’:
mChannel = MultiChannel(['int01','double01'])
- get((MultiChannel)arg1, (str)requestDescriptor) PvObject : ¶
- get((str)requestDescriptor) => PvObject :
Retrieves PV data from multiple channels.
- Parameter:
requestDescriptor (str) - PV request descriptor
- Returns:
PvObject with NTMultiChannel structure that contains retrieved data from all member channels as a variant union array
pv = mChannel.get('field(value,alarm)')
- get() => PvObject :
Retrieves PV data from multiple channels using the default request descriptor ‘field(value,alarm,timeStamp)’.
- Returns:
PvObject with NTMultiChannel structure that contains retrieved data from all member channels as a variant union array
pv = mChannel.get()
- getAsDoubleArray((MultiChannel)arg1) list : ¶
- getAsDoubleArray() => list :
Retrieves PV data from multiple channels as array of doubles.
- Returns:
list of floats
valueList = mChannel.getAsDoubleArray()
- monitor((MultiChannel)arg1, (object)subscriber) None : ¶
- monitor((object)subscriber) => None :
Starts multi-channel monitor with default poll period and request descriptor ‘field(value,alarm,timeStamp)’.
- Parameter:
subscriber (object) - reference to python function that will be executed when PV value changes; the function should take PvObject instance as its argument
def echo(pvObject): print('New PV values: %s' % pvObject) mChannel.monitor(echo)
- monitor((object)subscriber, (float)pollPeriod) => None :
Starts multi-channel monitor with default request descriptor ‘field(value,alarm,timeStamp)’.
- Parameter:
subscriber (object) - reference to python function that will be executed when PV value changes; the function should take PvObject instance as its argument
- Parameter:
pollPeriod (float) - period in seconds between two multi-channel polls
def echo(pvObject): print('New PV values: %s' % pvObject) mChannel.monitor(echo, 1.0)
- monitor((object)subscriber, (float)pollPeriod, (str)requestDescriptor) => None :
Starts multi-channel monitor.
- Parameter:
subscriber (object) - reference to python function that will be executed when PV value changes; the function should take PvObject instance as its argument
- Parameter:
pollPeriod (float) - period in seconds between two multi-channel polls
- Parameter:
requestDescriptor (str) - describes what PV data should be sent to subscribed channel clients
def echo(pvObject): print('New PV values: %s' % pvObject) mChannel.monitor(echo, 1.0, 'field(value,alarm,timeStamp)')
- monitorAsDoubleArray((MultiChannel)arg1, (object)subscriber) None : ¶
- monitorAsDoubleArray((object)subscriber) => None :
Starts multi-channel monitor for processing list of double values.
- Parameter:
subscriber (object) - reference to python function that will be executed when PV values change; the function should take list of python floats as its argument
def echo(valueList): print('New PV values: %s' % x) mChannel.monitorAsDoubleArray(echo, 1.0)
- monitorAsDoubleArray((object)subscriber, (float)pollPeriod) => None :
Starts multi-channel monitor for processing list of double values.
- Parameter:
subscriber (object) - reference to python function that will be executed when PV values change; the function should take list of python floats as its argument
- Parameter:
pollPeriod (float) - period in seconds between two multi-channel polls
def echo(valueList): print('New PV values: %s' % x) mChannel.monitorAsDoubleArray(echo, 1.0)
- put((MultiChannel)arg1, (list)pvObjectList) None : ¶
- put((list)pvObjectList) => None :
Assigns data to multi-channel member PVs’.
- Parameter:
pvObjectList (list) - list of PvObject instances that will be assigned to the multi-channel PVs
mChannel = MultiChannel(['PVRstringArray', 'PVRdouble']) pv1 = PvObject({'value' : [STRING]}, {'value' : ['ccc', 'ddd']}) pv2 = PvDouble(44.44) mChannel.put([pv1,pv2])
- putAsDoubleArray((MultiChannel)arg1, (list)valueList) None : ¶
- putAsDoubleArray((list)valueList) => None :
Assigns data to multi-channel member PVs’.
- Parameter:
valueList (list) - list of float values that will be assigned to the multi-channel PVs
mChannel = MultiChannel(['PVRdouble01', 'PVRdouble02']) mChannel.put([1.0,2.0])
- stopMonitor((MultiChannel)arg1) None : ¶
- stopMonitor() => None :
Stops multi-channel monitor for PV value changes.
mChannel.stopMonitor()
PvObjectQueue¶
- class pvaccess.PvObjectQueue¶
Bases:
instance
PvObjectQueue is a class that can be used for receiving channel updates.
PvObjectQueue([maxLength])
- Parameter:
maxLength (int) - (optional) maximum queue length; if not provided, queue length will be unlimited
Example:
pvq = PvObjectQueue(10000)
- addToCounter((PvObjectQueue)arg1, (str)key, (int)value) None : ¶
- addToCounter((str)key, (int)value) => None :
Adds value to the statistics counter identified with a given key. Note that manipulating system managed counters (nReceived, nRejected, nDelivered, nQueued) will not work.
- Parameter:
key (str) - counter key
- Parameter:
value (int) - counter value (should be >= 0)
pvq.addToCounter('myCnt', 1)
- cancelWaitForGet((PvObjectQueue)arg1) None : ¶
- cancelWaitForGet() => None :
Cancels wait on queue get.
pvq.cancelWaitForGet()
- cancelWaitForPut((PvObjectQueue)arg1) None : ¶
- cancelWaitForPut() => None :
Cancels wait on queue put.
pvq.cancelWaitForPut()
- clear((PvObjectQueue)arg1) None : ¶
- clear() => None :
Clear queue.
pvq.clear()
- get((PvObjectQueue)arg1) PvObject : ¶
- get() => PvObject :
Retrieves PvObject from the queue.
- Returns:
PvObject from the queue
- Raises:
QueueEmpty - when the queue is empty
pv = pvq.get()
- get((float)arg2) => PvObject :
Retrieves PvObject from the queue with wait if the queue is empty.
- Parameter:
timeout (float) - amount of time to wait for a new PvObject if queue is empty
- Returns:
PvObject from the queue
- Raises:
QueueEmpty - when the queue is empty after the specified timeout
pv = pvq.get(10)
- getCounters((PvObjectQueue)arg1) dict : ¶
- getCounters() => dict :
Retrieve dictionary with all statistics counters, which include number of PvObjects accepted (pushed into the queue), rejected (not pushed into the queue) and retrieved (popped from the queue). The dictionary might also contain user defined counters, or other system counters, such as the number of PVA chanel monitor overruns.
- Returns:
dictionary containing available statistics counters
counterDict = pvq.getCounters()
- getTimeSinceLastGet((PvObjectQueue)arg1) float : ¶
- getTimeSinceLastGet() => float :
Returns number of seconds since last item was popped from the queue.
- Returns:
seconds after last pop
t = pvq.getTimeSinceLastGet()
- getTimeSinceLastPut((PvObjectQueue)arg1) float : ¶
- getTimeSinceLastPut() => float :
Returns number of seconds since last item was pushed into the queue.
- Returns:
seconds after last push
t = pvq.getTimeSinceLastPut()
- property maxLength¶
- put((PvObjectQueue)arg1, (PvObject)pvObject) None : ¶
- put((PvObject)pvObject) => None :
Puts PvObject into the queue.
- Parameter:
pvObject (PvObject) - PV object that will be pushed into the queue
- Raises:
QueueFull - when the queue is full
pvq.put(PvInt(1))
- put((PvObject)pvObject, (float)timeout) => None :
Puts PvObject into the queue with wait if the queue is full.
- Parameter:
pvObject (PvObject) - PV object that will be pushed into the queue
- Parameter:
timeout (float) - amount of time to wait if the queue is full
- Raises:
QueueFull - when the queue is full after the specified timeout
pvq.put(PvInt(1), 10)
- resetCounters((PvObjectQueue)arg1) None : ¶
- resetCounters() => None :
Reset all statistics counters to zero.
pvq.resetCounters()
- setCounter((PvObjectQueue)arg1, (str)key, (int)value) None : ¶
- setCounter((str)key, (int)value) => None :
Sets value for the statistics counter identified with a given key. Note that setting system managed counters (nReceived, nRejected, nDelivered, nQueued) will not work.
- Parameter:
key (str) - counter key
- Parameter:
value (int) - counter value (should be >= 0)
pvq.setCounter('myCnt', 1)
- waitForGet((PvObjectQueue)arg1, (float)timeout) None : ¶
- waitForGet((float)timeout) => None :
Waits until the new PvObject is retrieved from the queue.
pvq.waitForGet(1.0)
- waitForPut((PvObjectQueue)arg1, (float)timeout) None : ¶
- waitForPut((float)timeout) => None :
Waits until the new PvObject is pushed into the queue.
pvq.waitForPut(1.0)
PvaServer¶
- class pvaccess.PvaServer¶
Bases:
instance
PvaServer is a class that wrapps PVA server functionality. Channel data can be retrieved and manipulated using standard PVA command line tools and APIs.
PvaServer():
pvaServer = PvaServer() # Initializes server without any records
PvaServer(channelName, pvObject):
- Parameter:
channelName (str) - channel name
- Parameter:
pvObject (PvObject) - PV object that will be exposed on the specified channel. Any changes to object’s field values will be reflected on the channel.
- Raises:
PvaException - in case of any errors
pv = PvObject({'x': INT, 'y' : INT}) pvaServer = PvaServer('pair', pv) # Initializes server with first record pv['x'] = 3 # The 'pair' channel will now have field 'x' value set to 3
PvaServer(channelName, pvObject, onWriteCallback):
- Parameter:
channelName (str) - channel name
- Parameter:
pvObject (PvObject) - PV object that will be exposed on the specified channel. Any changes to object’s field values will be reflected on the channel.
- Parameter:
onWriteCallback (object) - reference to python object (e.g., python function) that will be executed on channel write.
- Raises:
PvaException - in case of any errors
# Server will call echo() any time clients write new value to the pair channel pv = PvObject({'x': INT, 'y' : INT}) def echo(x): print('New PV value was written: %s' % x) pvaServer = PvaServer('pair', pv, echo)
- addRecord((PvaServer)arg1, (str)channelName, (PvObject)pvObject[, (object)onWriteCallback=None]) None : ¶
- addRecord((str)channelName, (PvObject)pvObject [, (object)onWriteCallback=None]) => None :
Adds PV record to the server database.
- Parameter:
channelName (str) - channel name
- Parameter:
pvObject (PvObject) - PV object that will be exposed on the specified channel. Any changes to object’s field values will be reflected on the channel.
- Parameter:
onWriteCallback (object) - reference to python object (e.g., python function) that will be executed on channel write.
- Raises:
ObjectAlreadyExists - when database already contains record associated with a given channel name
- Raises:
PvaException - in case of any other errors
pv = PvObject({'x' : INT, 'y' : INT}, {'x' : 3, 'y' : 5}) def echo(x): print('New PV value was written: %s' % x) pvaServer.addRecord('pair', pv, echo)
- addRecordWithAs((PvaServer)arg1, (str)channelName, (PvObject)pvObject, (int)asLevel, (str)asGroup[, (object)onWriteCallback=None]) None : ¶
- addRecordWithAs((str)channelName, (PvObject)pvObject, (int)asLevel, (str)asGroup [, (object)onWriteCallback=None]) => None :
Adds PV record with access security to the server database.
- Parameter:
channelName (str) - channel name
- Parameter:
pvObject (PvObject) - PV object that will be exposed on the specified channel. Any changes to object’s field values will be reflected on the channel.
- Parameter:
asLevel (int) - access security level
- Parameter:
asGroup (str) - access security group
- Parameter:
onWriteCallback (object) - reference to python object (e.g., python function) that will be executed on channel write.
- Raises:
ObjectAlreadyExists - when database already contains record associated with a given channel name
- Raises:
PvaException - in case of any other errors
pv = PvObject({'x' : INT, 'y' : INT}, {'x' : 3, 'y' : 5}) def echo(x): print('New PV value was written: %s' % x) pvaServer.addRecordWithAs('pair', pv, 1, 'MyGroup', echo)
- getRecordNames((PvaServer)arg1) list : ¶
- getRecordNames() => list :
Retrieves existing channel names from the server’s database.
- Returns:
list of known channel names
recordNames = pvaServer.getRecordNames()
- hasRecord((PvaServer)arg1, (str)channelName) bool : ¶
- hasRecord((str)channelName) => bool :
Determines if server database contains PV record associated with a given channel name.
- Parameter:
channelName (str) - channel name
- Returns:
True if record exists, false otherwise
if pvaServer.hasRecord('pair'): print('Server contains the pair channel.)'
- initAs((PvaServer)arg1, (str)filePath, (str)substitutions) None : ¶
- initAs((str)filePath, (str)substitutions) => None :
Initialize access security.
- Parameter:
filePath (str) - AS definitions file.
- Parameter:
substitutions (str) - Macro substitutions.
- Raises:
PvaException - in case of any errors
pvaServer.initAs('as.cnf', 'S=S27,P=BPM1')
- isAsActive((PvaServer)arg1) bool : ¶
- isAsActive() => bool :
Is access security active?
- Returns:
true if AS is active
isActive = pvaServer.isAsActive()
- removeAllRecords((PvaServer)arg1) None : ¶
- removeAllRecords() => None :
Removes all PV records from the server database.
- Raises:
PvaException - in case of any errors
pvaServer.removeAllRecords()
- removeRecord((PvaServer)arg1, (str)channelName) None : ¶
- removeRecord((str)channelName) => None :
Removes PV record from the server database.
- Parameter:
channelName (str) - channel name
- Raises:
ObjectNotFound - when database does not contain record associated with a given channel name
- Raises:
PvaException - in case of any other errors
pvaServer.removeRecord('pair')
- start((PvaServer)arg1) None : ¶
- start() => None :
Starts PVA server. This method is called in all constructors automatically, but may be used to restart server if it has been stopped.
- Raises:
PvaException - in case of any errors
pvaServer.start()
- stop((PvaServer)arg1) None : ¶
- stop() => None :
Stops PVA server.
- Raises:
PvaException - in case of any errors
pvaServer.stop()
- update((PvaServer)arg1, (PvObject)pvObject) None : ¶
- update((PvObject)pvObject) => None :
Updates server’s PV object. This method is atomic, but can be used only when there is a single record in the master database.
- Parameter:
pvObject (PvObject) - PV object with a structure equivalent to the structure of the object registered on the server’s PV channel.
- Raises:
InvalidRequest - when there is none or more than one record in the database
pv2 = PvObject({'x' : INT, 'y' : INT}, {'x' : 3, 'y' : 5}) pvaServer.update(pv2)
- update((str)channelName, (PvObject)pvObject) => None :
Updates server’s PV object on a given channel. This method is atomic, and should be used when there are multiple records in the master database.
- Parameter:
pvObject (PvObject) - PV object with a structure equivalent to the structure of the object registered on the server’s PV channel.
- Raises:
ObjectNotFound - when there is no record associated with a given channel
pv = PvObject({'x' : INT, 'y' : INT}, {'x' : 3, 'y' : 5}) pvaServer.update('myChannel', pv)
PvaMirrorServer¶
- class pvaccess.PvaMirrorServer¶
Bases:
PvaServer
PvaMirrorServer is a class that provides PVA mirror (read-only) functionality, i.e. it replicates PVA or CA channel data that can be retrieved using standard PVA command line tools and APIs.
PvaMirrorServer():
pvaMirrorServer = PvaMirrorServer() # Initializes server without any records
- addMirrorRecord((PvaMirrorServer)arg1, (str)mirrorChannelName, (str)srcChannelName, (ProviderType)srcProviderType) None : ¶
- addMirrorRecord((str)mirrorChannelName, (str)srcChannelName, (ProviderType)srcProviderType) => None :
Adds mirror PV record to the server database.
- Parameter:
mirrorChannelName (str) - mirror channel name
- Parameter:
srcChannelName (str) - source channel name
- Parameter:
srcProviderType (PROVIDERTYPE) - provider type, either PVA (PV Access) or CA (Channel Access)
- Raises:
ObjectAlreadyExists - when database already contains record associated with a given mirror channel name
- Raises:
PvaException - in case of any other errors
pvaMirrorServer.addMirrorRecord('mirrorPair', 'pair', PVA)
- addMirrorRecord((str)mirrorChannelName, (str)srcChannelName, (ProviderType)srcProviderType, (int)srcQueueSize) => None :
Adds mirror PV record to the server database.
- Parameter:
mirrorChannelName (str) - mirror channel name
- Parameter:
srcChannelName (str) - source channel name
- Parameter:
srcProviderType (PROVIDERTYPE) - provider type, either PVA (PV Access) or CA (Channel Access)
- Parameter:
srcQueueSize (int) - source queue size (should be >= 0)
- Raises:
ObjectAlreadyExists - when database already contains record associated with a given mirror channel name
- Raises:
PvaException - in case of any other errors
pvaMirrorServer.addMirrorRecord('mirrorPair', 'pair', PVA, 10)
- addRecord((PvaServer)arg1, (str)channelName, (PvObject)pvObject[, (object)onWriteCallback=None]) None : ¶
- addRecord((str)channelName, (PvObject)pvObject [, (object)onWriteCallback=None]) => None :
Adds PV record to the server database.
- Parameter:
channelName (str) - channel name
- Parameter:
pvObject (PvObject) - PV object that will be exposed on the specified channel. Any changes to object’s field values will be reflected on the channel.
- Parameter:
onWriteCallback (object) - reference to python object (e.g., python function) that will be executed on channel write.
- Raises:
ObjectAlreadyExists - when database already contains record associated with a given channel name
- Raises:
PvaException - in case of any other errors
pv = PvObject({'x' : INT, 'y' : INT}, {'x' : 3, 'y' : 5}) def echo(x): print('New PV value was written: %s' % x) pvaServer.addRecord('pair', pv, echo)
- addRecordWithAs((PvaServer)arg1, (str)channelName, (PvObject)pvObject, (int)asLevel, (str)asGroup[, (object)onWriteCallback=None]) None : ¶
- addRecordWithAs((str)channelName, (PvObject)pvObject, (int)asLevel, (str)asGroup [, (object)onWriteCallback=None]) => None :
Adds PV record with access security to the server database.
- Parameter:
channelName (str) - channel name
- Parameter:
pvObject (PvObject) - PV object that will be exposed on the specified channel. Any changes to object’s field values will be reflected on the channel.
- Parameter:
asLevel (int) - access security level
- Parameter:
asGroup (str) - access security group
- Parameter:
onWriteCallback (object) - reference to python object (e.g., python function) that will be executed on channel write.
- Raises:
ObjectAlreadyExists - when database already contains record associated with a given channel name
- Raises:
PvaException - in case of any other errors
pv = PvObject({'x' : INT, 'y' : INT}, {'x' : 3, 'y' : 5}) def echo(x): print('New PV value was written: %s' % x) pvaServer.addRecordWithAs('pair', pv, 1, 'MyGroup', echo)
- getMirrorRecordCounters((PvaMirrorServer)arg1, (str)arg2) dict : ¶
- getMirrorRecordCounters((str)arg2) => dict :
Retrieve dictionary with record counters, which include number of updates received and number of monitor overruns.
- Parameter:
mirrorChannelName (str) - mirror channel name
- Returns:
dictionary containing available statistics counters
counterDict = pvaMirrorServer.getMirrorRecordCounters('pair')
- getMirrorRecordNames((PvaMirrorServer)arg1) list : ¶
- getMirrorRecordNames() => list :
Retrieves existing mirror channel names from the server’s database.
- Returns:
list of known mirror channel names
mirrorRecordNames = pvaMirrorServer.getMirrorRecordNames()
- getRecordNames((PvaServer)arg1) list : ¶
- getRecordNames() => list :
Retrieves existing channel names from the server’s database.
- Returns:
list of known channel names
recordNames = pvaServer.getRecordNames()
- hasMirrorRecord((PvaMirrorServer)arg1, (str)mirrorChannelName) bool : ¶
- hasMirrorRecord((str)mirrorChannelName) => bool :
Determines if server database contains mirror PV record associated with a given channel name.
- Parameter:
mirrorChannelName (str) - mirror channel name
- Returns:
True if record exists, false otherwise
if pvaMirrorServer.hasMirrorRecord('pair'): print('Server contains mirror pair channel.)'
- hasRecord((PvaServer)arg1, (str)channelName) bool : ¶
- hasRecord((str)channelName) => bool :
Determines if server database contains PV record associated with a given channel name.
- Parameter:
channelName (str) - channel name
- Returns:
True if record exists, false otherwise
if pvaServer.hasRecord('pair'): print('Server contains the pair channel.)'
- initAs((PvaServer)arg1, (str)filePath, (str)substitutions) None : ¶
- initAs((str)filePath, (str)substitutions) => None :
Initialize access security.
- Parameter:
filePath (str) - AS definitions file.
- Parameter:
substitutions (str) - Macro substitutions.
- Raises:
PvaException - in case of any errors
pvaServer.initAs('as.cnf', 'S=S27,P=BPM1')
- isAsActive((PvaServer)arg1) bool : ¶
- isAsActive() => bool :
Is access security active?
- Returns:
true if AS is active
isActive = pvaServer.isAsActive()
- removeAllMirrorRecords((PvaMirrorServer)arg1) None : ¶
- removeAllMirrorRecords() => None :
Removes all mirror PV records from the server database.
- Raises:
PvaException - in case of any errors
pvaMirrorServer.removeAllMirrorRecords()
- removeAllRecords((PvaServer)arg1) None : ¶
- removeAllRecords() => None :
Removes all PV records from the server database.
- Raises:
PvaException - in case of any errors
pvaServer.removeAllRecords()
- removeMirrorRecord((PvaMirrorServer)arg1, (str)mirrorChannelName) None : ¶
- removeMirrorRecord((str)mirrorChannelName) => None :
Removes mirror PV record from the server database.
- Parameter:
mirrorChannelName (str) - mirror channel name
- Raises:
ObjectNotFound - when database does not contain record associated with a given channel name
- Raises:
PvaException - in case of any other errors
pvaMirrorServer.removeRecord('mirrorPair')
- removeRecord((PvaServer)arg1, (str)channelName) None : ¶
- removeRecord((str)channelName) => None :
Removes PV record from the server database.
- Parameter:
channelName (str) - channel name
- Raises:
ObjectNotFound - when database does not contain record associated with a given channel name
- Raises:
PvaException - in case of any other errors
pvaServer.removeRecord('pair')
- resetMirrorRecordCounters((PvaMirrorServer)arg1, (str)arg2) None : ¶
- resetMirrorRecordCounters((str)arg2) => None :
Reset all record counters to zero.
- Parameter:
mirrorChannelName (str) - mirror channel name
pvaMirrorServer.resetMirrorRecordCounters('pair')
- start((PvaServer)arg1) None : ¶
- start() => None :
Starts PVA server. This method is called in all constructors automatically, but may be used to restart server if it has been stopped.
- Raises:
PvaException - in case of any errors
pvaServer.start()
- stop((PvaServer)arg1) None : ¶
- stop() => None :
Stops PVA server.
- Raises:
PvaException - in case of any errors
pvaServer.stop()
- update((PvaServer)arg1, (PvObject)pvObject) None : ¶
- update((PvObject)pvObject) => None :
Updates server’s PV object. This method is atomic, but can be used only when there is a single record in the master database.
- Parameter:
pvObject (PvObject) - PV object with a structure equivalent to the structure of the object registered on the server’s PV channel.
- Raises:
InvalidRequest - when there is none or more than one record in the database
pv2 = PvObject({'x' : INT, 'y' : INT}, {'x' : 3, 'y' : 5}) pvaServer.update(pv2)
- update((str)channelName, (PvObject)pvObject) => None :
Updates server’s PV object on a given channel. This method is atomic, and should be used when there are multiple records in the master database.
- Parameter:
pvObject (PvObject) - PV object with a structure equivalent to the structure of the object registered on the server’s PV channel.
- Raises:
ObjectNotFound - when there is no record associated with a given channel
pv = PvObject({'x' : INT, 'y' : INT}, {'x' : 3, 'y' : 5}) pvaServer.update('myChannel', pv)
RpcServer¶
- class pvaccess.RpcServer¶
Bases:
instance
RpcServer is class used for hosting PVA RPC services. One instance of RpcServer can host multiple RPC services.
RpcServer():
rpcServer = RpcServer()
- listen((RpcServer)arg1[, (int)seconds=0]) None : ¶
- listen([(int)seconds=0]) => None :
Start serving RPC requests.
- Parameter:
seconds (int) - specifies the amount of time server should be listening for requests (0 indicates ‘forever’)
rpcServer.listen(60)
- registerService((RpcServer)arg1, (str)serviceName, (object)serviceImpl) None : ¶
- registerService((str)serviceName, (object)serviceImpl) => None :
Registers service implementation with RPC server. Typically, all services are registered before RPC server starts listening for client requests.
- Parameter:
serviceName (str) - service name (name of the PV channel used for RPC client/server communication)
- Parameter:
serviceImpl (object) - reference to service implementation object (e.g., python function) that returns PV Object upon invocation
The following is an example of RPC service that creates NT Table according to client specifications:
import pvaccess import random def createNtTable(pvRequest): nRows = x.getInt('nRows') nColumns = x.getInt('nColumns') print 'Creating table with %d rows and %d columns' % (nRows, nColumns) ntTable = pvaccess.NtTable(nColumns, pvaccess.DOUBLE) labels = [] for j in range (0, nColumns): labels.append('Column%s' % j) column = [] for i in range (0, nRows): column.append(random.uniform(0,1)) ntTable.setColumn(j, column) ntTable.setLabels(labels) ntTable.setDescriptor('Automatically created by pvaPy RPC Server') return ntTable rpcServer = pvaccess.RpcServer() rpcServer.registerService('createNtTable', createNtTable) rpcServer.listen()
- shutdown((RpcServer)arg1) None : ¶
- shutdown() => None :
Stop serving RPC requests. This method is equivalent to stop().
rpcServer.shutdown()
- start((RpcServer)arg1) None : ¶
- start() => None :
Start serving RPC requests. This method is equivalent to listen(), and blocks until either stop() or shutdown() methods are invoked.
rpcServer.start()
- startListener((RpcServer)arg1) None : ¶
- startListener() => None :
Starts RPC listener in its own thread. This method is typically used for multi-threaded programs, or for testing and debugging in python interactive mode. It should be used in conjunction with stopListener() call.
rpcServer.startListener()
- stop((RpcServer)arg1) None : ¶
- stop() => None :
Stop serving RPC requests. This method is equivalent to shutdown().
rpcServer.stop()
- stopListener((RpcServer)arg1) None : ¶
- stopListener() => None :
Stops RPC listener thread. This method is used in conjunction with startListener() call.
rpcServer.stopListener()
- unregisterService((RpcServer)arg1, (str)serviceName) None : ¶
- unregisterService((str)serviceName) => None :
Unregisters given service from RPC server.
- Parameter:
serviceName (str) - service name (name of the PV channel used for RPC client/server communication)
rpcServer.unregisterService('createNtTable')
RpcClient¶
- class pvaccess.RpcClient¶
Bases:
instance
RpcClient is a client class for PVA RPC services.
RpcClient(channelName)
- Parameter:
channelName (str) - RPC service channel name
This example creates RPC client for channel ‘createNtTable’:
rpcClient = RpcClient('createNtTable')
- getChannelName((RpcClient)arg1) str : ¶
- getChannelName() => str :
Retrieves channel name.
- Returns:
channel name
channelName = rpcClient.getChannelName()
- getTimeout((RpcClient)arg1) float : ¶
- getTimeout() => float :
Retrieves client timeout.
- Returns:
client timeout in seconds
timeout = rpcClient.getTimeout()
- invoke((RpcClient)arg1, (PvObject)pvArgument, (float)timeout) PvObject : ¶
- invoke((PvObject)pvArgument, (float)timeout) => PvObject :
Invokes RPC call against service registered on the PV specified channel, and with a specified timeout.
- Parameter:
pvArgument (PvObject) - PV argument object with a structure conforming to requirements of the RPC service registered on the given PV channel
- Parameter:
timeout (float) - RPC client timeout in seconds
- Returns:
PV response object
The following code works with the above RPC service example:
pvArgument = PvObject({'nRows' : INT, 'nColumns' : INT}) pvArgument.set({'nRows' : 10, 'nColumns' : 10}) pvResponse = rpcClient(pvArgument, 10) ntTable = NtTable(pvResponse)
- invoke((PvObject)pvArgument) => PvObject :
Invokes RPC call against service registered on the PV specified channel, with a timeout set previously (if not set, default timeout of 1 second will be used).
- Parameter:
pvArgument (PvObject) - PV argument object with a structure conforming to requirements of the RPC service registered on the given PV channel
- Returns:
PV response object
The following code works with the above RPC service example:
pvArgument = PvObject({'nRows' : INT, 'nColumns' : INT}) pvArgument.set({'nRows' : 10, 'nColumns' : 10}) pvResponse = rpcClient(pvArgument) ntTable = NtTable(pvResponse)
- setTimeout((RpcClient)arg1, (float)timeout) None : ¶
- setTimeout((float)timeout) => None :
Sets client timeout.
- Parameter:
timeout (float) - client timeout in seconds
client.setTimeout(10.0)
CaIoc¶
- class pvaccess.CaIoc¶
Bases:
instance
CaIoc is a class that wrapps CA IOC functionality. Channel data can be retrieved and manipulated using standard CA command line tools and APIs. Typical sequence of calls involves loading a database, registering device driver, loading records, initializing (starting) IOC, and manipulating records.
CaIoc():
caIoc = CaIoc()
- dbLoadDatabase((CaIoc)arg1, (str)file, (str)path, (str)substitutions) int : ¶
- dbLoadDatabase((str)file, (str)path, (str)substitutions) => int :
Load database definition file.
- Parameter:
file (str) - DBD file.
- Parameter:
path (str) - DBD search path. If not provided, the system will use EPICS_DB_INCLUDE_PATH environment variable.
- Parameter:
substitutions (str) - Macro substitutions string.
- Returns:
exit status, where 0 indicates success and all other values indicate failure.
status = caIoc.dbLoadDatabase('base.dbd', '', '')
- dbLoadRecords((CaIoc)arg1, (str)file, (str)substitutions) int : ¶
- dbLoadRecords((str)file, (str)substitutions) => int :
Load DB records from given file and apply specified substitutions.
- Parameter:
file (str) - DB records file.
- Parameter:
substitutions (str) - Macro substitutions string.
- Returns:
exit status, where 0 indicates success and all other values indicate failure.
status = caIoc.dbLoadRecords('calc.db', 'NAME=C1')
- dbgf((CaIoc)arg1, (str)name) int : ¶
- dbgf((str)name) => int :
Print field.
- Parameter:
name (str) - Field name.
- Returns:
exit status, where 0 indicates success and all other values indicate failure.
status = caIoc.dbgf('I1')
- dbl((CaIoc)arg1, (str)recordType, (str)fields) int : ¶
- dbl((str)recordType, (str)fields) => int :
List DB record/field names. If empty strings are provided as argument values, the method will list all record names.
- Parameter:
recordType (str) - DB record type.
- Parameter:
fields (str) - Record fields.
- Returns:
exit status, where 0 indicates success and all other values indicate failure.
status = caIoc.dbl('', '')
- dbpf((CaIoc)arg1, (str)name, (str)value) int : ¶
- dbpf((str)name, (str)value) => int :
Put field.
- Parameter:
name (str) - Field name.
- Parameter:
value (str) - Field value.
- Returns:
exit status, where 0 indicates success and all other values indicate failure.
status = caIoc.dbpf('I1', '5')
- dbpr((CaIoc)arg1, (str)name, (int)level) int : ¶
- dbpr((str)name, (int)level) => int :
Print record.
- Parameter:
name (str) - Record name.
- Parameter:
level (int) - Interest (detail) level.
- Returns:
exit status, where 0 indicates success and all other values indicate failure.
status = caIoc.dbpr('I1', 1)
- getField((CaIoc)arg1, (str)name) object : ¶
- getField((str)name) => object :
Get field.
- Parameter:
name (str) - Field name.
- Returns:
Field value, which may be a list if the number if elements in the record is greater than 1.
- Raises:
InvalidArgument - in case of empty field name.
- Raises:
ObjectNotFound - in case of unknown field name.
- Raises:
InvalidState - in case of attempting to call this method before initializing IOC, out of memory, or any other errors.
value = caIoc.getField('I1')
- getRecordNames((CaIoc)arg1) list : ¶
- getRecordNames() => list :
Get DB record names.
- Returns:
list of record names.
- Raises:
InvalidState - in case of attempting to retrieve record names before loading a database.
recordNames = caIoc.getRecordNames()
- iocInit((CaIoc)arg1) int : ¶
- iocInit() => int :
Starts (initializes) CA IOC.
- Returns:
exit status, where 0 indicates success and all other values indicate failure.
status = caIoc.iocInit()
- iocShutdown((CaIoc)arg1) int : ¶
- iocShutdown() => int :
Shuts down CA IOC.
- Returns:
exit status, where 0 indicates success and all other values indicate failure.
status = caIoc.iocShutdown()
- loadDatabase((CaIoc)arg1, (str)file, (str)path, (str)substitutions) None : ¶
- loadDatabase((str)file, (str)path, (str)substitutions) => None :
Load database definition file. This method is equivalent to dbLoadDatabase(), which does not throw any exceptions.
- Parameter:
file (str) - DBD file.
- Parameter:
path (str) - DBD search path. If not provided, the system will use EPICS_DB_INCLUDE_PATH environment variable.
- Parameter:
substitutions (str) - Macro substitutions string.
- Raises:
InvalidArgument - in case of empty file name.
- Raises:
InvalidState - in case of any other errors.
caIoc.loadDatabase('base.dbd', '', '')
- loadRecords((CaIoc)arg1, (str)file, (str)substitutions) None : ¶
- loadRecords((str)file, (str)substitutions) => None :
Load DB records from given file and apply specified substitutions. This method is equivalent to dbLoadRecords(), which does not throw any exceptions.
- Parameter:
file (str) - DB records file.
- Parameter:
substitutions (str) - Macro substitutions string.
- Raises:
InvalidArgument - in case of empty file.
- Raises:
InvalidState - in case of attempting to load records after IOC was initialized, or any other errors.
caIoc.loadRecords('calc.db', 'NAME=C1')
- printRecord((CaIoc)arg1, (str)name, (int)level) None : ¶
- printRecord((str)name, (int)level) => None :
Print record. This method is equivalent to dbpr(), which does not throw any exceptions.
- Parameter:
name (str) - Record name.
- Parameter:
level (int) - Interest (detail) level.
- Raises:
InvalidArgument - in case of empty record name.
- Raises:
ObjectNotFound - in case of unknown record name.
- Raises:
InvalidState - in case of any other errors.
caIoc.printRecord('I1', 1)
- putField((CaIoc)arg1, (str)name, (object)value) None : ¶
- putField((str)name, (object)value) => None :
Put field. This method is equivalent to dbpf(), which does not throw any exceptions.
- Parameter:
name (str) - Field name.
- Parameter:
value (object) - Field value as a python object.
- Raises:
InvalidArgument - in case of empty field name.
- Raises:
ObjectNotFound - in case of unknown field name.
- Raises:
InvalidState - in case of attempting to call this method before initializing IOC, out of memory, or any other errors.
caIoc.putField('I1', 5)
- putField((str)name, (str)value) => None :
Put field. This method is equivalent to dbpf(), which does not throw any exceptions.
- Parameter:
name (str) - Field name.
- Parameter:
value (str) - Field value as a string.
- Raises:
InvalidArgument - in case of empty field name.
- Raises:
ObjectNotFound - in case of unknown field name.
- Raises:
InvalidState - in case of attempting to call this method before initializing IOC, out of memory, or any other errors.
caIoc.putField('I1', '5')
- pvapyRegisterRecordDeviceDriver((CaIoc)arg1) int : ¶
- pvapyRegisterRecordDeviceDriver() => int :
Register record device driver. This method must be called after databases are loaded.
caIoc.pvapyRegisterRecordDeviceDriver()
- registerRecordDeviceDriver((CaIoc)arg1) None : ¶
- registerRecordDeviceDriver() => None :
Register record device driver. This method must be called after databases are loaded, and is equivalent to pvapyRegisterRecordDeviceDriver(), which does not throw any exceptions.
- Raises:
InvalidState - in case of any errors.
caIoc.registerRecordDeviceDriver()
- start((CaIoc)arg1) None : ¶
- start() => None :
Starts (initializes) CA IOC. This method is equivalent to iocInit(), which does not throw any exceptions.
- Raises:
InvalidState - in case of any errors.
caIoc.start()
- stop((CaIoc)arg1) None : ¶
- stop() => None :
Stops (shuts down) CA IOC. This methid is equivalent to iocShutdown(), which does not throw any exceptions.
- Raises:
InvalidState - in case of any errors.
caIoc.stop()