RemoteVariable

The RemoteVariable class … See the Variable documentation page for more information.

In this example …

RemoteVariable Class Documentation

class pyrogue.RemoteVariable(*, name, description='', mode='RW', value=None, disp=None, enum=None, units=None, hidden=False, groups=None, minimum=None, maximum=None, lowWarning=None, lowAlarm=None, highWarning=None, highAlarm=None, base=<class 'pyrogue._Model.UInt'>, offset, numValues=0, valueBits=0, valueStride=0, bitSize=32, bitOffset=0, pollInterval=0, updateNotify=True, overlapEn=False, bulkOpEn=True, verify=True, retryCount=0, guiGroup=None, **kwargs)[source]
set(value, *, index=-1, write=True, verify=True, check=True)[source]

Set the value and write to hardware if applicable Writes to hardware are blocking if check=True, otherwise non-blocking. A verify will be performed according to self.verifyEn if verify=True A verify will not be performed if verify=False An error will result in a logged exception.

Parameters:
  • value

    • :

  • index (int) – (Default value = -1)

  • write (bool) – (Default value = True)

  • verify (bool) – (Default value = True)

  • check (bool) – (Default value = True)

post(value, *, index=-1)[source]

Set the value and write to hardware if applicable using a posted write. This method does not call through parent.writeBlocks(), but rather calls on self._block directly.

Parameters:
  • value

    • :

  • index (int) – (Default value = -1)

get(*, index=-1, read=True, check=True)[source]
Parameters:

*

indexint

(Default value = -1)

readbool

(Default value = True)

checkbool

(Default value = True)

Returns:

Hardware read is blocking if check=True, otherwise non-blocking. An error will result in a logged exception. Listeners will be informed of the update.

Return type:

type

write(*, verify=True, check=True)[source]

Force a write of the variable. Hardware write is blocking if check=True. A verify will be performed according to self.verifyEn if verify=True A verify will not be performed if verify=False An error will result in a logged exception

Parameters:

*

verifybool

(Default value = True)

checkbool

(Default value = True)

add(node)

Add node as sub-node

Parameters:

node

addDependency(dep)
Parameters:

dep

addListener(listener)

Add a listener Variable or function to call when variable changes. This is useful when chaining variables together. (ADC conversions, etc) The variable and value class are passed as an arg: func(path,varValue)

Parameters:

listener

addNode(nodeClass, **kwargs)
Parameters:
  • nodeClass

  • **kwargs

addNodes(nodeClass, number, stride, **kwargs)
Parameters:
  • nodeClass

  • number

  • stride

  • **kwargs

addToGroup(group)

Add this node to the passed group, recursive to children

Parameters:

group – variable denoting a node that has not been passed

callRecursive(func, nodeTypes=None, **kwargs)
Parameters:
  • func

  • nodeTypes – (Default value = None)

  • **kwargs

commandsByGroup(incGroups=None, excGroups=None)
Parameters:
  • incGroups – (Default value = None)

  • excGroups – (Default value = None)

Returns:

Pass list of include and / or exclude groups

Return type:

type

delListener(listener)

Remove a listener Variable or function

Parameters:

listener

property description

assigns and returns description attribute to class variable

property deviceList

Get a recursive list of devices

devicesByGroup(incGroups=None, excGroups=None)
Parameters:
  • incGroups – (Default value = None)

  • excGroups – (Default value = None)

Returns:

Pass list of include and / or exclude groups

Return type:

type

filterByGroup(incGroups, excGroups)

Filter by the passed list of inclusion and exclusion groups

Parameters:
  • incGroups – list of passed inclusion groups

  • excGroups – list of passed exclusion groups

find(*, recurse=True, typ=None, **kwargs)

Find all child nodes that are a base class of ‘typ’ and whose properties match all of the kwargs. For string properties, accepts regexes.

Parameters:
  • *

  • recurse – (Default value = True)

  • typ – (Default value = None)

  • **kwargs

genDisp(value, *, useDisp=None)
Parameters:

value

getDisp(read=True, index=-1)
Parameters:
  • read (bool) – (Default value = True)

  • index (int) – (Default value = -1)

getNodes(typ, excTyp=None, incGroups=None, excGroups=None)

Get a filtered ordered dictionary of nodes. pass a class type to receive a certain type of node class type may be a string when called over Pyro4 exc is a class type to exclude, incGroups is an optional group or list of groups that this node must be part of excGroups is an optional group or list of groups that this node must not be part of

Parameters:
  • typ

  • excTyp – (Default value = None)

  • incGroups – (Default value = None)

  • excGroups – (Default value = None)

Return type:

ordered dictionary of nodes

getVariableValue(read=True, index=-1)

Return the value after performing a read from hardware if applicable. Hardware read is blocking. An error will result in a logged exception. Listeners will be informed of the update.

Parameters:
  • read (bool) – (Default value = True)

  • index (int) – (Default value = -1)

Returns:

Hardware read is blocking. An error will result in a logged exception. Listeners will be informed of the update.

Return type:

type

getYaml(readFirst=False, modes=['RW', 'RO', 'WO'], incGroups=None, excGroups=['Hidden'], recurse=True)

Get current values as yaml data. modes is a list of variable modes to include. If readFirst=True a full read from hardware is performed.

property groups

assigns and returns groups attribute to class variable

property hidden

assigns and returns hidden attribute to class variable

inGroup(group)
Parameters:

group

isinstance(typ)
Parameters:

typ

makeRecursive(func, nodeTypes=None)
Parameters:
  • func

  • nodeTypes – (Default value = None)

property name

assigns and returns name attribute to class variable

node(name)
Parameters:

name

property nodeList

Get a recursive list of nodes.

nodeMatch(name)
Parameters:

name

Returns:

be a single value or a list accessor: value value[9] value[0:1] value[*] value[:] Variables will only match if their depth matches the passed lookup and wildcard: value[*] will match a variable named value[1] but not a variable named value[2][3] value[*][*] will match a variable named value[2][3]. The second return field will contain the array information if the base name matches an item in the non list array.

Return type:

type

property nodes

Get a ordered dictionary of all nodes.

parseDisp(sValue)
Parameters:

sValue

removeFromGroup(group)

Remove this node from the passed group, not recursive

Parameters:

group – variable denoting a node that is in the passed group

Return type:

if in group, remove from group

setDisp(sValue, write=True, index=-1)
Parameters:
  • sValue

  • write (bool) – (Default value = True)

  • index (int) – (Default value = -1)

valueDisp(index=-1)
Parameters:
  • read (bool) – (Default value = True)

  • index (int) – (Default value = -1)

property variableList

Get a recursive list of variables and commands.

variablesByGroup(incGroups=None, excGroups=None)
Parameters:
  • incGroups – (Default value = None)

  • excGroups – (Default value = None)

Returns:

Pass list of include and / or exclude groups

Return type:

type

Python RemoteVariable Example

Below is an example of creating a RemoteVariable which …

import pyrogue

# Create a subclass of a RemoteVariable
class MyRemoteVariable(...):

C++ RemoteVariable Example

Below is an example of creating a RemoteVariable device in C++.

#include <rogue/interfaces/memory/Constants.h>
#include <boost/thread.hpp>

// Create a subclass of a RemoteVariable
class MyRemoteVariable : public rogue:: ... {
   public:

   protected:

};

A few notes on the above examples …