pvaccess module is a python wrapper for EPICS PV Access and other C++ libraries.

PvObject

class pvaccess.PvObject

Bases: Boost.Python.instance

PvObject represents a generic PV structure.

PvObject(structureDict [,valueDict][,typeId])

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

Raises

InvalidArgument - in case structure dictionary cannot be parsed

Parameter

typeId (str) - (optional) The type ID string of the PV structure

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')

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]
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()
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) → list :
getScalarArray() => list :

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) => list :

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'})
setBoolean((PvObject)arg1, (object)value) → None :
setBoolean((object)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, (object)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, (object)value) → None :
setDouble((object)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, (object)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, (object)value) → None :
setFloat((object)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, (object)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, (object)value) → None :
setInt((object)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, (object)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, (list)valueList) → None :
setScalarArray((list)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, (list)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, (object)value) → None :
setShort((object)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, (object)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, (dict)valueDict) → None :
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, (object)value) → None :
setUByte((object)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, (object)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, (object)value) → None :
setUInt((object)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, (object)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, (object)value) → None :
setUShort((object)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, (object)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)
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

class pvaccess.PvScalar

Bases: pvaccess.PvObject

PvScalar is a base class for all scalar PV types. It cannot be instantiated directly from python.

PvBoolean

class pvaccess.PvBoolean

Bases: pvaccess.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, (object)value) → None :
set((object)value) => None :

Sets boolean PV value.

Parameter

value (bool) - boolean value

pv.set(False)

PvByte

class pvaccess.PvByte

Bases: pvaccess.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: pvaccess.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, (object)value) → None :
set((object)value) => None :

Sets unsigned byte PV value.

Parameter

value (int) - unsigned byte value

pv.set(10)

PvShort

class pvaccess.PvShort

Bases: pvaccess.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, (object)value) → None :
set((object)value) => None :

Sets short PV value.

Parameter

value (int) - short value

pv.set(-10)

PvUShort

class pvaccess.PvUShort

Bases: pvaccess.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, (object)value) → None :
set((object)value) => None :

Sets unsigned short PV value.

Parameter

value (int) - unsigned short value

pv.set(10)

PvInt

class pvaccess.PvInt

Bases: pvaccess.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, (object)value) → None :
set((object)value) => None :

Sets integer PV value.

Parameter

value (int) - integer value

pv.set(-1000)

PvUInt

class pvaccess.PvUInt

Bases: pvaccess.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, (object)value) → None :
set((object)value) => None :

Sets unsigned integer PV value.

Parameter

value (int) - unsigned integer value

pv.set(1000)

PvLong

class pvaccess.PvLong

Bases: pvaccess.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: pvaccess.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: pvaccess.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, (object)value) → None :
set((object)value) => None :

Sets float PV value.

Parameter

value (float) - float value

pv.set(1.1)

PvDouble

class pvaccess.PvDouble

Bases: pvaccess.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, (object)value) → None :
set((object)value) => None :

Sets double PV value.

Parameter

value (float) - double value

pv.set(1.1)

PvString

class pvaccess.PvString

Bases: pvaccess.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')

PvScalarArray

class pvaccess.PvScalarArray

Bases: pvaccess.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: pvaccess.PvObject

PvTimeStamp represents PV time stamp structure.

PvTimeStamp()

timestamp1 = PvTimeStamp()

PvTimeStamp(secondsPastEpoch, nanoseconds [, userTag=-1])

Parameter

secondsPastEpoch (long) - seconds past epoch

Parameter

nanoseconds (int) - nanoseconds

Parameter

userTag (int) - user tag

timeStamp2 = PvTimeStamp(1234567890, 10000)

timeStamp3 = 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()
setNanoseconds((PvTimeStamp)arg1, (object)nanoseconds) → None :
setNanoseconds((object)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, (object)userTag) → None :
setUserTag((object)userTag) => None :

Sets user tag.

Parameter

userTag (int) - user tag

timeStamp.setUserTag(1)

PvAlarm

class pvaccess.PvAlarm

Bases: pvaccess.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, (object)severity) → None :
setSeverity((object)severity) => None :

Sets alarm severity.

Parameter

severity (int) - alarm severity

alarm.setSeverity(1)
setStatus((PvAlarm)arg1, (object)status) → None :
setStatus((object)status) => None :

Sets status code.

Parameter

status (int) - status code

alarm.setStatus(1)

NtType

class pvaccess.NtType

Bases: pvaccess.PvObject

NtType is a base class for all NT structures. It cannot be instantiated directly from python.

NtTable

class pvaccess.NtTable

Bases: pvaccess.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])

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:

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, (object)index) → list :
getColumn((object)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, (object)index, (list)valueList) → None :
setColumn((object)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)

Channel

class pvaccess.Channel

Bases: Boost.Python.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)
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()
getMonitorMaxQueueLength((Channel)arg1) → int :
getMonitorMaxQueueLength() => int :

Retrieves maximum monitor queue length.

Returns

maximum monitor queue length

maxQueueLength = channel.getMonitorMaxQueueLength()
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()
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: ', x

channel.monitor(echo, 'field(value,alarm,timeStamp)')
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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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, (object)value, (str)requestDescriptor) → None :
putBoolean((object)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((object)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, (object)value, (str)requestDescriptor) → None :
putDouble((object)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((object)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, (object)value, (str)requestDescriptor) → None :
putFloat((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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((object)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, (object)value, (str)requestDescriptor) → PvObject :
putGetBoolean((object)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((object)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, (object)value, (str)requestDescriptor) → PvObject :
putGetDouble((object)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((object)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, (object)value, (str)requestDescriptor) → PvObject :
putGetFloat((object)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((object)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, (object)value, (str)requestDescriptor) → PvObject :
putGetInt((object)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((object)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, (object)value, (str)requestDescriptor) → PvObject :
putGetShort((object)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((object)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, (object)value, (str)requestDescriptor) → PvObject :
putGetUByte((object)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((object)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, (object)value, (str)requestDescriptor) → PvObject :
putGetUInt((object)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((object)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, (object)value, (str)requestDescriptor) → PvObject :
putGetUShort((object)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((object)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, (object)value, (str)requestDescriptor) → None :
putInt((object)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((object)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, (object)value, (str)requestDescriptor) → None :
putShort((object)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((object)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, (object)value, (str)requestDescriptor) → None :
putUByte((object)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((object)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, (object)value, (str)requestDescriptor) → None :
putUInt((object)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((object)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, (object)value, (str)requestDescriptor) → None :
putUShort((object)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((object)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)
setMonitorMaxQueueLength((Channel)arg1, (object)maxQueueLength) → None :
setMonitorMaxQueueLength((object)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.setMonitorMaxQueueLengthTimeout(10)
setTimeout((Channel)arg1, (object)timeout) → None :
setTimeout((object)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: ', 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')

PvaServer

class pvaccess.PvaServer

Bases: Boost.Python.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)
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.)'
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)

RpcServer

class pvaccess.RpcServer

Bases: Boost.Python.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[, (object)seconds=0]) → None :
listen([(object)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: Boost.Python.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, (object)timeout) → PvObject :
invoke((PvObject)pvArgument, (object)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, (object)timeout) → None :
setTimeout((object)timeout) => None :

Sets client timeout.

Parameter

timeout (float) - client timeout in seconds

client.setTimeout(10.0)