TMC Common Tango Server

This is the Tango Server Helper module of Tango Interface Layer. This module implements a class TangoServerHelper which helps in operations like getting and setting attributes and properties of the Tango device.

class ska_tmc_common.tango_server_helper.TangoServerHelper

This class provides APIs to help performing role of Tango device server.

static get_instance()

Return instance object of TangoServerHelper class. Creates one if the object does not exist.

Param

None.

return:

object of TangoServerHelper class

set_tango_class(device)

Set the Tango class object as a device

Parameters

device – Tango class object

Returns

None

read_property(property_name)

Returns the value of given Tango device property :param property_name: String. Name of the Tango device property

:return

List of strings containing value(s) of the device property

:throws

Devfailed exception in case of error

write_property(property_name, value)

Sets the value to a given device property

Parameters
  • property_name – String. Name of the Tango device property

  • value – Value of the property to be set

Returns

None

Throws

Devfailed exception in case command failed error. ValueError exception in case value error. KeyError exception in case key error

get_status()

Returns value of the Status attribute of the Tango device.

Param

None

Returns

String. The Status value of the Tango device.

Throws

DevFailed on failure in getting device status.

set_status(new_status)

Sets the Status attribute of the Tango device with given value.

Parameters

new_status – String. New value for Status attribute.

Returns

None.

Throws

DevFailed on failure in setting device status.

get_state()

Returns value of the State attribute of the Tango device.

Param

None

Returns

(DevState). The State value of the Tango device.

Throws

DevFailed on failure in getting device state.

set_state(new_state)

Sets the State attribute of the Tango device with given value.

Parameters

new_state – (DevState). New value for State attribute.

Returns

None.

Throws

DevFailed on failure in setting device state.

write_attr(attr_name, value, push_change_event=True)

Updates the value of device server’s attribute

Parameters

attr_name – String.

Name of the attribute which should be updated.

Parameters
  • value – New value of the attribute.

  • push_change_event – Change event value.

Returns

None.

Throws

ValueError exception in case of error.

read_attr(attr_name)

Returns the value of device server’s attribute

Parameters

attr_name – String. Name of the attribute which should be updated.

Returns

value: Value of the attribute

Throws

ValueEror exception in case of error.