vidhubcontrol.backends

vidhubcontrol.backends.base

class vidhubcontrol.backends.base.BackendBase(*args, **kwargs)[source]

Bases: pydispatch.dispatch.Dispatcher

Base class for communicating with devices

Events
on_preset_added(backend: BackendBase = self, preset: Preset = preset)

This Event is emitted when a new Preset has been added.

on_preset_stored(backend: BackendBase = self, preset: Preset = preset)

This Event is emitted when an existing Preset has been recorded (updated).

on_preset_active(backend: BackendBase, preset: Preset = preset, value: bool = value)

This Event is emitted when an existing Preset has determined that its stored routing information is currently active on the switcher.

connection_manager: vidhubcontrol.common.ConnectionManager

Manager for the device’s ConnectionState

property connection_state: vidhubcontrol.common.ConnectionState

The current state of the connection_manager

device_id: str

The unique id as reported by the device

device_model: str

The model name as reported by the device

device_version: str

Firmware version reported by the device

class vidhubcontrol.backends.base.Preset(*args, **kwargs)[source]

Bases: pydispatch.dispatch.Dispatcher

Stores and recalls routing information

name

The name of the preset. This is a pydispatch.Property

Type

str

index

The index of the preset as it is stored in the presets container.

Type

int

crosspoints

The crosspoints that this preset has stored. This is a DictProperty

Type

Dict[int, int]

active

A flag indicating whether all of the crosspoints stored in this preset are currently active on the switcher. This is a pydispatch.Property

Type

bool

Events
on_preset_stored(preset: Preset = self)

Dispatched after the preset stores its state.

class vidhubcontrol.backends.base.SmartScopeBackendBase(*args, **kwargs)[source]

Bases: vidhubcontrol.backends.base.SmartViewBackendBase

class vidhubcontrol.backends.base.SmartScopeMonitor(*args, **kwargs)[source]

Bases: vidhubcontrol.backends.base.SmartViewMonitor

A single instance of a monitor within a SmartScope device

scope_mode

The type of scope to display. Choices are: ‘audio_dbfs’, ‘audio_dbvu’, ‘histogram’, ‘parade_rgb’, ‘parade_yuv’, ‘video’, ‘vector_100’, ‘vector_75’, ‘waveform’.

Type

str

class vidhubcontrol.backends.base.SmartViewBackendBase(*args, **kwargs)[source]

Bases: vidhubcontrol.backends.base.BackendBase

Base class for SmartView devices

num_monitors

Number of physical monitors as reported by the device

Type

Optional[int]

inverted

True if the device has been mounted in an inverted configuration (to optimize viewing angle).

Type

bool

monitors

A list containing instances of SmartViewMonitor or SmartScopeMonitor, depending on device type.

Type

List[vidhubcontrol.backends.base.SmartViewMonitor]

Events
on_monitor_property_change(self: SmartViewBackendBase, name: str, value: Any, monitor: SmartViewMonitor = monitor)

Dispatched when any Property value changes. The event signature for callbacks is (smartview_device, property_name, value, **kwargs) containing a keyword argument “monitor” containing the SmartViewMonitor instance.

async set_monitor_property(monitor, name, value)[source]

Set a property value for the given SmartViewMonitor instance

Parameters
  • monitor – The SmartViewMonitor instance to set

  • name (str) – Property name

  • value – The new value to set

This method is a coroutine.

class vidhubcontrol.backends.base.SmartViewMonitor(*args, **kwargs)[source]

Bases: pydispatch.dispatch.Dispatcher

A single instance of a monitor within a SmartView device

index

Index of the monitor (zero-based)

Type

int

name

The name of the monitor (can be user-defined)

Type

str

brightness

The brightness value of the monitor (0-255)

Type

int

contrast

The contrast value of the monitor (0-255)

Type

int

saturation

The saturation value of the monitor (0-255)

Type

int

widescreen_sd

Aspect ratio setting for SD format. Choices can be: True (stretching enabled), False (pillar-box), or None (auto-detect).

Type

Optional[bool]

identify

If set to True, the monitor’s border will be white for a brief duration to physically locate the device.

Type

bool

border

Sets the border of the monitor to the given color. Choices are: ‘red’, ‘green’, ‘blue’, ‘white’, or None.

Type

Optional[str]

audio_channel

The audio channel pair (Embedded in the SDI input) used when scope_mode is set to audio monitoring. Values are from 0 to 7 (0 == Channels 1&2, etc).

Type

int

class vidhubcontrol.backends.base.VidhubBackendBase(*args, **kwargs)[source]

Bases: vidhubcontrol.backends.base.BackendBase

Base class for Videohub devices

num_outputs

The number of outputs as reported by the switcher.

Type

int

num_inputs

The number of inputs as reported by the switcher.

Type

int

crosspoints

This represents the currently active routing of the switcher. Each element in the list represents an output (the zero-based index of the list) with its selected index as the value (also zero-based). This is a pydispatch.properties.ListProperty and can be observed using the bind() method.

Type

List[int]

output_labels

A list containing the names of each output as reported by the switcher This is a pydispatch.properties.ListProperty and can be observed using the bind() method.

Type

List[str]

input_labels

A list containing the names of each input as reported by the switcher This is a pydispatch.properties.ListProperty and can be observed using the bind() method.

Type

List[str]

crosspoint_control

This is similar to crosspoints but if modified from outside code, the crosspoint changes will be set on the device (no method calls required). pydispatch.properties.ListProperty

Type

List[int]

output_label_control

This is similar to output_labels but if modified from outside code, the label changes will be written to the device (no method calls required). pydispatch.properties.ListProperty

Type

List[str]

input_label_control

This is similar to input_labels but if modified from outside code, the label changes will be written to the device (no method calls required). pydispatch.properties.ListProperty

Type

List[str]

presets

The currently available (stored) list of Preset instances pydispatch.properties.ListProperty

Type

List[vidhubcontrol.backends.base.Preset]

async add_preset(name=None)[source]

Adds a new Preset instance

This method is used internally and should not normally be called outside of this module. Instead, see store_preset()

async set_crosspoint(out_idx, in_idx)[source]

Set a single crosspoint on the switcher

Parameters
  • out_idx (int) – The output to be set (zero-based)

  • in_idx (int) – The input to switch the output (out_idx) to (zero-based)

async set_crosspoints(*args)[source]

Set multiple crosspoints in one method call

This is useful for setting many routing changes as it reduces the number of commands sent to the switcher.

Parameters

*args – Any number of output/input pairs to set. These should be given as tuples of (out_idx, in_idx) as defined in set_crosspoint(). They can be discontinuous and unordered.

async set_input_label(in_idx, label)[source]

Set the label (name) of an input

Parameters
  • in_idx (int) – The input to be set (zero-based)

  • label (str) – The label for the input

async set_input_labels(*args)[source]

Set multiple input labels in one method call

This is useful for setting many labels as it reduces the number of commands sent to the switcher.

Parameters

*args – Any number of input/label pairs to set. These should be given as tuples of (in_idx, label) as defined in set_input_label(). They can be discontinuous and unordered.

async set_output_label(out_idx, label)[source]

Set the label (name) of an output

Parameters
  • out_idx (int) – The output to be set (zero-based)

  • label (str) – The label for the output

async set_output_labels(*args)[source]

Set multiple output labels in one method call

This is useful for setting many labels as it reduces the number of commands sent to the switcher.

Parameters

*args – Any number of output/label pairs to set. These should be given as tuples of (out_idx, label) as defined in set_output_label(). They can be discontinuous and unordered.

async store_preset(outputs_to_store=None, name=None, index=None, clear_current=True)[source]

Store the current switcher state to a Preset

Parameters
  • outputs_to_store (optional) – An iterable of the output numbers (zero-based) that should be saved in the preset. If given, only these outputs will be recorded and when recalled, any output not in this argument will be unchanged. If not given or None, all outputs will be recorded.

  • name (optional) – The name to be given to the preset. If not provided or None the preset will be given a name based off of its index.

  • index (optional) – The index for the preset. If given and the preset exists in the presets list, that preset will be updated. If there is no preset found with the index, a new one will be created. If not given or None, the next available index will be used and a new preset will be created.

  • clear_current (bool) – If True, any previously existing data will be removed from the preset (if it exists). If False, the data (if existing) will be merged with the current switcher state. Default is True

Returns

The Preset instance that was created or updated

This method is a coroutine

vidhubcontrol.backends.telnet

class vidhubcontrol.backends.telnet.SmartScopeTelnetBackend(*args, **kwargs)[source]

Bases: vidhubcontrol.backends.telnet.SmartViewTelnetBackendBase, vidhubcontrol.backends.base.SmartScopeBackendBase

class vidhubcontrol.backends.telnet.SmartViewTelnetBackend(*args, **kwargs)[source]

Bases: vidhubcontrol.backends.telnet.SmartViewTelnetBackendBase, vidhubcontrol.backends.base.SmartViewBackendBase

class vidhubcontrol.backends.telnet.SmartViewTelnetBackendBase[source]

Bases: vidhubcontrol.backends.telnet.TelnetBackendBase

class vidhubcontrol.backends.telnet.TelnetBackend(*args, **kwargs)[source]

Bases: vidhubcontrol.backends.telnet.TelnetBackendBase, vidhubcontrol.backends.base.VidhubBackendBase

Base class for backends implementing telnet

async set_crosspoint(out_idx, in_idx)[source]

Set a single crosspoint on the switcher

Parameters
  • out_idx (int) – The output to be set (zero-based)

  • in_idx (int) – The input to switch the output (out_idx) to (zero-based)

async set_crosspoints(*args)[source]

Set multiple crosspoints in one method call

This is useful for setting many routing changes as it reduces the number of commands sent to the switcher.

Parameters

*args – Any number of output/input pairs to set. These should be given as tuples of (out_idx, in_idx) as defined in set_crosspoint(). They can be discontinuous and unordered.

async set_input_label(in_idx, label)[source]

Set the label (name) of an input

Parameters
  • in_idx (int) – The input to be set (zero-based)

  • label (str) – The label for the input

async set_input_labels(*args)[source]

Set multiple input labels in one method call

This is useful for setting many labels as it reduces the number of commands sent to the switcher.

Parameters

*args – Any number of input/label pairs to set. These should be given as tuples of (in_idx, label) as defined in set_input_label(). They can be discontinuous and unordered.

async set_output_label(out_idx, label)[source]

Set the label (name) of an output

Parameters
  • out_idx (int) – The output to be set (zero-based)

  • label (str) – The label for the output

async set_output_labels(*args)[source]

Set multiple output labels in one method call

This is useful for setting many labels as it reduces the number of commands sent to the switcher.

Parameters

*args – Any number of output/label pairs to set. These should be given as tuples of (out_idx, label) as defined in set_output_label(). They can be discontinuous and unordered.

class vidhubcontrol.backends.telnet.TelnetBackendBase[source]

Bases: object

Mix-in class for backends implementing telnet

hostaddr

IPv4 address of the device

Type

str

hostport

Port address of the device

Type

int

read_enabled

Internal flag to keep the read_loop() running

Type

bool

rx_bfr

Data received from the device to be parsed

Type

bytes

client

Instance of vidhubcontrol.aiotelnetlib._Telnet

Type

vidhubcontrol.aiotelnetlib._Telnet