RemoteCommand

The RemoteCommand class …

A RemoteCommand is a command which has a 1:1 associated with a hardware element

  • Subclass of RemoteVariable

  • Used to generate a set of writes to the associated hardware element

A number of commonly used commands and sequence generators are provided to support RemoteCommand operations. These functions can generally be grouped into two categories:

  • True functions, which will perform simple operations.

  • Function creators, which return another function when called.

See the class documentation for Base Command or Remote Command for more information on these functions.

Python RemoteCommand Examples

Basic Usage

import pyrogue

command = RemoteCommand(
   name='demo', description='', value=None,
   disp='{}', enum=None, minimum=None,
   maximum=None, base=pyrogue.UInt,
   offset=None, bitSize=32,
   bitOffset=0, function=None)

Important things to note:

  • Passed attributes are the same as for BaseCommand and RemoteVariable

  • Value is optionally used to set an initial value in the underlying Block

  • Base is used to determine the arg type

Below is an example of creating a RemoteCommand which …

import pyrogue
   self.add(pyrogue.RemoteCommand(
      name = 'CountReset',
      offset = 0x00,
      bitSize = 1,
      bitOffset = 0,
      function = pr.BaseCommand.toggle,
   ))

   self.add(pyrouge.RemoteCommand(
      name = "ResetRx",
      offset = 0x04,
      bitSize = 1,
      bitOffset = 0,
      function = pr.BaseCommand.toggle,
   ))
import pyrogue

# Create a subclass of a RemoteCommand
class MyRemoteCommand(...):

RemoteCommand Class Definition

class pyrogue.RemoteCommand(*, name, description='', value=None, retValue=None, enum=None, hidden=False, groups=None, minimum=None, maximum=None, function=None, base=<class 'pyrogue._Model.UInt'>, offset=None, bitSize=32, bitOffset=0, overlapEn=False, guiGroup=None, **kwargs)[source]
set(value, *, index=-1, write=True)[source]
Parameters:
  • value

  • *

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

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

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

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

  • read (bool) – (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

call(arg=None)
Parameters:

arg (str) – (Default value = None)

callDisp(arg=None)
Parameters:

arg (str) – (Default value = None)

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

static createPostedTouch(value)
Parameters:

value

static createToggle(sets)
Parameters:

sets

static createTouch(value)
Parameters:

value

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

post(value, *, index=-1)

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)

static postedTouch(cmd, arg)
Parameters:
  • cmd

  • arg

static postedTouchOne(cmd)
Parameters:

cmd

static postedTouchZero(cmd)
Parameters:

cmd

static read(cmd)
Parameters:

cmd

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

replaceFunction(function)
Parameters:

function

static setAndVerifyArg(cmd, arg)
Parameters:
  • cmd

  • arg

static setArg(cmd, arg)
Parameters:
  • cmd

  • arg

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

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

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

static toggle(cmd)
Parameters:

cmd

static touch(cmd, arg)
Parameters:
  • cmd

  • arg

static touchOne(cmd)
Parameters:

cmd

static touchZero(cmd)
Parameters:

cmd

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

write(*, verify=True, check=True)

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)

C++ RemoteCommand Example

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

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

// Create a subclass of a RemoteCommand
class MyRemoteCommand : public rogue:: ... {
   public:

   protected:

};

A few notes on the above examples …