malcolm.modules.builtin.controllers

class malcolm.modules.builtin.controllers.BasicController(mri: Anno(name='AMri', typ=<class 'str'>, description='The Malcolm Resource Identifier for the Block produced'), description: Anno(name='ADescription', typ=<class 'str'>, description='Description of the Block produced by the controller') = '')[source]

Basic Controller with Health and Title updating

Parameters
  • mri (str) – The Malcolm Resource Identifier for the Block produced

  • description (str) – Description of the Block produced by the controller

update_label(_: object, info: malcolm.modules.builtin.infos.LabelInfo) None[source]

Set the label of the Block Meta object

update_health(reporter: object, info: malcolm.modules.builtin.infos.HealthInfo) None[source]

Set the health attribute. Called from part

class malcolm.modules.builtin.controllers.ClientComms(mri: Anno(name='AMri', typ=<class 'str'>, description='The Malcolm Resource Identifier for the Block produced'), description: Anno(name='ADescription', typ=<class 'str'>, description='Description of the Block produced by the controller') = '')[source]

Abstract class for dispatching requests to a server and responses to a method

Parameters
  • mri (str) – The Malcolm Resource Identifier for the Block produced

  • description (str) – Description of the Block produced by the controller

sync_proxy(mri, block)[source]

Abstract method telling the ClientComms to sync this proxy Block with its remote counterpart. Should wait until it is connected

Parameters
  • mri (str) – The mri for the remote block

  • block (BlockModel) – The local proxy Block to keep in sync

send_put(mri, attribute_name, value)[source]

Abstract method to dispatch a Put to the server

Parameters
  • mri (str) – The mri of the Block

  • attribute_name (str) – The name of the Attribute within the Block

  • value – The value to put

send_post(mri, method_name, **params)[source]

Abstract method to dispatch a Post to the server

Parameters
  • mri (str) – The mri of the Block

  • method_name (str) – The name of the Method within the Block

  • params – The parameters to send

Returns

The return results from the server

class malcolm.modules.builtin.controllers.ManagerController(mri: Anno(name='AMri', typ=<class 'str'>, description='The Malcolm Resource Identifier for the Block produced'), config_dir: Anno(name='AConfigDir', typ=<class 'str'>, description='Directory to write save/load config to'), template_designs: Anno(name='ATemplateDesigns', typ=<class 'str'>, description='A directory of templates with which to initially populate designs Attribute. These cannot be saved over.') = '', initial_design: Anno(name='AInitialDesign', typ=<class 'str'>, description='Design to load at init') = '', description: Anno(name='ADescription', typ=<class 'str'>, description='Description of the Block produced by the controller') = '')[source]

RunnableDevice implementer that also exposes GUI for child parts

Parameters
  • mri (str) – The Malcolm Resource Identifier for the Block produced

  • config_dir (str) – Directory to write save/load config to

  • template_designs (str) – A directory of templates with which to initially populate designs Attribute. These cannot be saved over.

  • initial_design (str) – Design to load at init

  • description (str) – Description of the Block produced by the controller

set_layout(value)[source]

Set the layout table value. Called on attribute put

save(designName: Anno(name='ASaveDesign', typ=<class 'str'>, description='Name of design to save, if different from current design') = '') None[source]

Save the current design to file

Parameters

designName (str) – Name of design to save, if different from current design

do_load(design: str, init: bool = False) None[source]

Load a design name, running the child LoadHooks.

Parameters
  • design – Name of the design json file, without extension

  • init – Passed to the LoadHook to tell the children if this is being run at Init or not

class malcolm.modules.builtin.controllers.ProxyController(mri: Anno(name='AMri', typ=<class 'str'>, description='The Malcolm Resource Identifier for the Block produced'), comms: Anno(name='AComms', typ=<class 'str'>, description='Malcolm resource id of client comms'), publish: Anno(name='APublish', typ=<class 'bool'>, description='Whether to re-publish this block via server comms') = False)[source]

Sync a local block with a given remote block

Parameters
  • mri (str) – The Malcolm Resource Identifier for the Block produced

  • comms (str) – Malcolm resource id of client comms

  • publish (bool) – Whether to re-publish this block via server comms

class malcolm.modules.builtin.controllers.ServerComms(mri: Anno(name='AMri', typ=<class 'str'>, description='The Malcolm Resource Identifier for the Block produced'), description: Anno(name='ADescription', typ=<class 'str'>, description='Description of the Block produced by the controller') = '')[source]

Abstract class for dealing with requests from outside

Parameters
  • mri (str) – The Malcolm Resource Identifier for the Block produced

  • description (str) – Description of the Block produced by the controller

class malcolm.modules.builtin.controllers.StatefulController(mri: Anno(name='AMri', typ=<class 'str'>, description='The Malcolm Resource Identifier for the Block produced'), description: Anno(name='ADescription', typ=<class 'str'>, description='Description of the Block produced by the controller') = '')[source]

A controller that implements StatefulStates

Parameters
  • mri (str) – The Malcolm Resource Identifier for the Block produced

  • description (str) – Description of the Block produced by the controller

transition(state, message='')[source]

Change to a new state if the transition is allowed

Parameters
  • state (str) – State to transition to

  • message (str) – Message if the transition is to a fault state