Class definition
Device
Bases: PviObject
class representing a device
Typical usage example:
line = Line( pviConnection.root, 'LNANSL', CD='LNANSL')
device = Device( line, 'TCP', CD='/IF=TcpIp' )
cpu = Cpu( device, 'myArsim', CD='/IP=127.0.0.1' )
Source code in pvi\Device.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
descriptor: dict
property
object descriptor example:
temperature = Variable( task1, 'gHeating.status.actTemp' )
...
print( "descriptor=", temperature.name)
results in:
descriptor= {'CD': 'gHeating.status.actTemp', 'RF': 0}
errorChanged: Callable
property
writable
callback for 'error changed'
It is advisable to always check the error status '0' before accessing an object.
Args:
cb: callback( PviObject, int ) or callback( int )
typical example:
cpu = Cpu( device, 'myArsim', CD='/IP=127.0.0.1' )
...
def cpuErrorChanged( error : int ):
if error != 0:
raise PviError(error)
cpu.errorChanged = cpuErrorChanged
name: str
property
hierarchical PVI object name
example:
name= @Pvi/LNANSL/TCP/myArsim/mainlogic/gHeating.status.actTemp
objectName: str
property
object name
example:
temperature = Variable( task1, 'gHeating.status.actTemp' )
...
print( "oname=", temperature.name)
results in:
oname= gHeating.status.actTemp
status: dict
property
writable
PviObject.status read the object's status
example:
cpu = Cpu( device, 'myArsim', CD='/IP=127.0.0.1' )
task1 = Task( cpu, 'mainlogic')
temperature = Variable( task1, 'gHeating.status.actTemp' )
...
print("status=", cpu.status )
results in:
cpu.status= {'ST': 'WarmStart', 'RunState': 'RUN'}
task1.status {'ST': 'Running'}
temperature.status= {'ST': 'Var', 'SC': 'g'}
type: T_POBJ_TYPE
property
object type
example:
temperature = Variable( task1, 'gHeating.status.actTemp' )
...
print( "type=", temperature.type)
results in:
type= T_POBJ_TYPE.POBJ_PVAR
__init__(parent, name, **objectDescriptor)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent |
line object |
required | |
name |
the device's name in PVI hierarchy, e.g. 'TCP' |
required | |
objectDescriptor |
see PVI documentation for details ANSL : CD='/IF=TcpIp' INA2000 : e.g. CD='/IF=com1' or CD='/IF='tcpip /SA=113' or CD='inacan1' SNMP : CD='/IF=snmp' |
{}
|
Source code in pvi\Device.py
39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
kill()
PviObject.kill: kills this object this should be called when object is not beeing used anymore to save PVI resources
Source code in pvi\Object.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
|