Device¶
DeviceImpl¶
-
class
PyTango.
DeviceImpl
¶ Base class for all TANGO device. This class inherits from CORBA classes where all the network layer is implemented.
-
add_attribute
(self, attr, r_meth=None, w_meth=None, is_allo_meth=None) → Attr¶ - Add a new attribute to the device attribute list. Please, note that if you add an attribute to a device at device creation time, this attribute will be added to the device class attribute list. Therefore, all devices belonging to the same class created after this attribute addition will also have this attribute.
Parameters: attr: (Attr or AttrData) the new attribute to be added to the list. r_meth: ( callable
) the read method to be called on a read requestw_meth: ( callable
) the write method to be called on a write request (if attr is writable)is_allo_meth: ( callable
) the method that is called to check if it is possible to access the attribute or notReturn: (
Attr
) the newly created attribute.Throws:
-
append_status
(self, status, new_line=False) → None¶ - Appends a string to the device status.
Parameters: status : (str) the string to be appened to the device status new_line : (bool) If true, appends a new line character before the string. Default is False Return: None
-
check_command_exists
(self) → None¶ - This method check that a command is supported by the device and does not need input value. The method throws an exception if the command is not defined or needs an input value
Parameters: cmd_name: ( str
) the command nameReturn: None
Throws: DevFailed
API_IncompatibleCmdArgumentType, API_CommandNotFoundNew in PyTango 7.1.2
-
debug_stream
(self, msg, *args) → None¶ Sends the given message to the tango debug stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_debug)
Parameters: msg: ( str
) the message to be sent to the debug streamReturn: None
-
dev_state
(self) → DevState¶ - Get device state. Default method to get device state. The behaviour of this method depends on the device state. If the device state is ON or ALARM, it reads the attribute(s) with an alarm level defined, check if the read value is above/below the alarm and eventually change the state to ALARM, return the device state. For all th other device state, this method simply returns the state This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.
Parameters: None Return: ( DevState
) the device stateThrows: DevFailed
- If it is necessary to read attribute(s) and a problem occurs during the reading
-
dev_status
(self) → str¶ - Get device status. Default method to get device status. It returns the contents of the device dev_status field. If the device state is ALARM, alarm messages are added to the device status. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.
Parameters: None Return: ( str
) the device statusThrows: DevFailed
- If it is necessary to read attribute(s) and a problem occurs during the reading
-
error_stream
(self, msg, *args) → None¶ Sends the given message to the tango error stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_error)
Parameters: msg: ( str
) the message to be sent to the error streamReturn: None
-
fatal_stream
(self, msg, *args) → None¶ Sends the given message to the tango fatal stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_fatal)
Parameters: msg: ( str
) the message to be sent to the fatal streamReturn: None
-
get_attr_min_poll_period
(self) → seq<str>¶ - Returns the min attribute poll period
Parameters: None Return: ( seq
) the min attribute poll periodNew in PyTango 7.2.0
-
get_attr_poll_ring_depth
(self, attr_name) → int¶ - Returns the attribute poll ring depth
Parameters: attr_name: ( str
) the attribute nameReturn: (
int
) the attribute poll ring depthNew in PyTango 7.1.2
-
get_attribute_poll_period
(self, attr_name) → int¶ - Returns the attribute polling period (ms) or 0 if the attribute is not polled.
Parameters: attr_name: ( str
) attribute nameReturn: (
int
) attribute polling period (ms) or 0 if it is not polledNew in PyTango 8.0.0
-
get_cmd_min_poll_period
(self) → seq<str>¶ - Returns the min command poll period
Parameters: None Return: ( seq
) the min command poll periodNew in PyTango 7.2.0
-
get_cmd_poll_ring_depth
(self, cmd_name) → int¶ - Returns the command poll ring depth
Parameters: cmd_name: ( str
) the command nameReturn: (
int
) the command poll ring depthNew in PyTango 7.1.2
-
get_command_poll_period
(self, cmd_name) → int¶ - Returns the command polling period (ms) or 0 if the command is not polled.
Parameters: cmd_name: ( str
) command nameReturn: (
int
) command polling period (ms) or 0 if it is not polledNew in PyTango 8.0.0
-
get_dev_idl_version
(self) → int¶ - Returns the IDL version
Parameters: None Return: ( int
) the IDL versionNew in PyTango 7.1.2
-
get_device_attr
(self) → MultiAttribute¶ - Get device multi attribute object.
Parameters: None Return: ( MultiAttribute
) the device’s MultiAttribute object
-
get_device_properties
(self, ds_class = None) → None¶ - Utility method that fetches all the device properties from the database and converts them into members of this DeviceImpl.
Parameters: ds_class: ( DeviceClass
) the DeviceClass object. Optional. Default value is None meaning that the corresponding DeviceClass object for this DeviceImpl will be usedReturn: None
Throws:
-
get_exported_flag
(self) → bool¶ - Returns the state of the exported flag
Parameters: None Return: ( bool
) the state of the exported flagNew in PyTango 7.1.2
-
get_logger
(self) → Logger¶ - Returns the Logger object for this device
Parameters: None Return: ( Logger
) the Logger object for this device
-
get_min_poll_period
(self) → int¶ - Returns the min poll period
Parameters: None Return: ( int
) the min poll periodNew in PyTango 7.2.0
-
get_name
(self) -> (str)¶ - Get a COPY of the device name.
Parameters: None Return: ( str
) the device name
-
get_non_auto_polled_attr
(self) → sequence<str>¶ - Returns a COPY of the list of non automatic polled attributes
Parameters: None Return: (sequence< str
>) a COPY of the list of non automatic polled attributesNew in PyTango 7.1.2
-
get_non_auto_polled_cmd
(self) → sequence<str>¶ - Returns a COPY of the list of non automatic polled commands
Parameters: None Return: (sequence< str
>) a COPY of the list of non automatic polled commandsNew in PyTango 7.1.2
-
get_poll_old_factor
(self) → int¶ - Returns the poll old factor
Parameters: None Return: ( int
) the poll old factorNew in PyTango 7.1.2
-
get_poll_ring_depth
(self) → int¶ - Returns the poll ring depth
Parameters: None Return: ( int
) the poll ring depthNew in PyTango 7.1.2
-
get_polled_attr
(self) → sequence<str>¶ - Returns a COPY of the list of polled attributes
Parameters: None Return: (sequence< str
>) a COPY of the list of polled attributesNew in PyTango 7.1.2
-
get_polled_cmd
(self) → sequence<str>¶ - Returns a COPY of the list of polled commands
Parameters: None Return: (sequence< str
>) a COPY of the list of polled commandsNew in PyTango 7.1.2
-
get_prev_state
(self) → DevState¶ - Get a COPY of the device’s previous state.
Parameters: None Return: ( DevState
) the device’s previous state
-
get_state
(self) → DevState¶ - Get a COPY of the device state.
Parameters: None Return: ( DevState
) Current device state
-
get_status
(self) → str¶ - Get a COPY of the device status.
Parameters: None Return: ( str
) the device status
-
info_stream
(self, msg, *args) → None¶ Sends the given message to the tango info stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_info)
Parameters: msg: ( str
) the message to be sent to the info streamReturn: None
-
init_device
(self) → None¶ - Intialise a device.
Parameters: None Return: None
-
is_device_locked
(self) → bool¶ - Returns if this device is locked by a client
Parameters: None Return: ( bool
) True if it is locked or False otherwiseNew in PyTango 7.1.2
-
is_polled
(self) → bool¶ - Returns if it is polled
Parameters: None Return: ( bool
) True if it is polled or False otherwiseNew in PyTango 7.1.2
-
is_there_subscriber
(self, att_name, event_type) → bool¶ Check if there is subscriber(s) listening for the event.
This method returns a boolean set to true if there are some subscriber(s) listening on the event specified by the two method arguments. Be aware that there is some delay (up to 600 sec) between this method returning false and the last subscriber unsubscription or crash...
The device interface change event is not supported by this method.
Parameters: att_name: ( str
) the attribute nameevent_type (EventType): the event type Return: True if there is at least one listener or False otherwise
-
push_archive_event
(self, attr_name) → None¶ push_archive_event (self, attr_name, except) ->
None
push_archive_event (self, attr_name, data, dim_x = 1, dim_y = 0) ->
None
push_archive_event (self, attr_name, str_data, data) ->
None
push_archive_event (self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_archive_event (self, attr_name, str_data, data, time_stamp, quality) ->
None
Push an archive event for the given attribute name. The event is pushed to the notification daemon.Parameters: attr_name: ( str
) attribute namedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.except: ( DevFailed
) Instead of data, you may want to send an exception.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
push_att_conf_event
(self, attr) → None¶ - Push an attribute configuration event.
Parameters: (Attribute) the attribute for which the configuration event will be sent. Return: None New in PyTango 7.2.1
-
push_change_event
(self, attr_name) → None¶ push_change_event (self, attr_name, except) ->
None
push_change_event (self, attr_name, data, dim_x = 1, dim_y = 0) ->
None
push_change_event (self, attr_name, str_data, data) ->
None
push_change_event (self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_change_event (self, attr_name, str_data, data, time_stamp, quality) ->
None
Push a change event for the given attribute name. The event is pushed to the notification daemon.
Parameters: attr_name: ( str
) attribute namedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.except: ( DevFailed
) Instead of data, you may want to send an exception.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
push_data_ready_event
(self, attr_name, counter = 0) → None¶ Push a data ready event for the given attribute name. The event is pushed to the notification daemon.
The method needs only the attribue name and an optional “counter” which will be passed unchanged within the event
Parameters: attr_name: ( str
) attribute namecounter: ( int
) the user counterReturn: None
Throws: DevFailed
If the attribute name is unknown.
-
push_event
(self, attr_name, filt_names, filt_vals) → None¶ push_event (self, attr_name, filt_names, filt_vals, data, dim_x = 1, dim_y = 0) ->
None
push_event (self, attr_name, filt_names, filt_vals, str_data, data) ->
None
push_event (self, attr_name, filt_names, filt_vals, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_event (self, attr_name, filt_names, filt_vals, str_data, data, time_stamp, quality) ->
None
Push a user event for the given attribute name. The event is pushed to the notification daemon.Parameters: attr_name: ( str
) attribute namefilt_names: (sequence< str
>) the filterable fields namefilt_vals: (sequence< double
>) the filterable fields valuedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
register_signal
(self, signo) → None¶ - Register a signal. Register this device as device to be informed when signal signo is sent to to the device server process
Parameters: signo: ( int
) signal identifierReturn: None
-
remove_attribute
(self, attr_name) → None¶ - Remove one attribute from the device attribute list.
Parameters: attr_name: ( str
) attribute nameReturn: None
Throws:
-
set_archive_event
(self, attr_name, implemented, detect=True) → None¶ - Set an implemented flag for the attribute to indicate that the server fires archive events manually, without the polling to be started. If the detect parameter is set to true, the criteria specified for the archive event are verified and the event is only pushed if they are fullfilled. If detect is set to false the event is fired without any value checking!
Parameters: attr_name: ( str
) attribute nameimplemented: ( bool
) True when the server fires change events manually.detect: ( bool
) Triggers the verification of the change event properties when set to true. Default value is true.Return: None
-
set_change_event
(self, attr_name, implemented, detect=True) → None¶ - Set an implemented flag for the attribute to indicate that the server fires change events manually, without the polling to be started. If the detect parameter is set to true, the criteria specified for the change event are verified and the event is only pushed if they are fullfilled. If detect is set to false the event is fired without any value checking!
Parameters: attr_name: ( str
) attribute nameimplemented: ( bool
) True when the server fires change events manually.detect: ( bool
) Triggers the verification of the change event properties when set to true. Default value is true.Return: None
-
set_state
(self, new_state) → None¶ - Set device state.
Parameters: new_state: ( DevState
) the new device stateReturn: None
-
set_status
(self, new_status) → None¶ - Set device status.
Parameters: new_status: ( str
) the new device statusReturn: None
-
stop_polling
(self) → None¶ stop_polling (self, with_db_upd) ->
None
Stop all polling for a device. if the device is polled, call this method before deleting it.Parameters: with_db_upd: ( bool
) Is it necessary to update db ?Return: None
New in PyTango 7.1.2
-
Device_2Impl¶
-
class
PyTango.
Device_2Impl
¶ Bases:
PyTango._PyTango.DeviceImpl
-
add_attribute
(self, attr, r_meth=None, w_meth=None, is_allo_meth=None) → Attr¶ - Add a new attribute to the device attribute list. Please, note that if you add an attribute to a device at device creation time, this attribute will be added to the device class attribute list. Therefore, all devices belonging to the same class created after this attribute addition will also have this attribute.
Parameters: attr: (Attr or AttrData) the new attribute to be added to the list. r_meth: ( callable
) the read method to be called on a read requestw_meth: ( callable
) the write method to be called on a write request (if attr is writable)is_allo_meth: ( callable
) the method that is called to check if it is possible to access the attribute or notReturn: (
Attr
) the newly created attribute.Throws:
-
append_status
(self, status, new_line=False) → None¶ - Appends a string to the device status.
Parameters: status : (str) the string to be appened to the device status new_line : (bool) If true, appends a new line character before the string. Default is False Return: None
-
check_command_exists
(self) → None¶ - This method check that a command is supported by the device and does not need input value. The method throws an exception if the command is not defined or needs an input value
Parameters: cmd_name: ( str
) the command nameReturn: None
Throws: DevFailed
API_IncompatibleCmdArgumentType, API_CommandNotFoundNew in PyTango 7.1.2
-
debug_stream
(self, msg, *args) → None¶ Sends the given message to the tango debug stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_debug)
Parameters: msg: ( str
) the message to be sent to the debug streamReturn: None
-
dev_state
(self) → DevState¶ - Get device state. Default method to get device state. The behaviour of this method depends on the device state. If the device state is ON or ALARM, it reads the attribute(s) with an alarm level defined, check if the read value is above/below the alarm and eventually change the state to ALARM, return the device state. For all th other device state, this method simply returns the state This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.
Parameters: None Return: ( DevState
) the device stateThrows: DevFailed
- If it is necessary to read attribute(s) and a problem occurs during the reading
-
dev_status
(self) → str¶ - Get device status. Default method to get device status. It returns the contents of the device dev_status field. If the device state is ALARM, alarm messages are added to the device status. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.
Parameters: None Return: ( str
) the device statusThrows: DevFailed
- If it is necessary to read attribute(s) and a problem occurs during the reading
-
error_stream
(self, msg, *args) → None¶ Sends the given message to the tango error stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_error)
Parameters: msg: ( str
) the message to be sent to the error streamReturn: None
-
fatal_stream
(self, msg, *args) → None¶ Sends the given message to the tango fatal stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_fatal)
Parameters: msg: ( str
) the message to be sent to the fatal streamReturn: None
-
get_attr_min_poll_period
(self) → seq<str>¶ - Returns the min attribute poll period
Parameters: None Return: ( seq
) the min attribute poll periodNew in PyTango 7.2.0
-
get_attr_poll_ring_depth
(self, attr_name) → int¶ - Returns the attribute poll ring depth
Parameters: attr_name: ( str
) the attribute nameReturn: (
int
) the attribute poll ring depthNew in PyTango 7.1.2
-
get_attribute_poll_period
(self, attr_name) → int¶ - Returns the attribute polling period (ms) or 0 if the attribute is not polled.
Parameters: attr_name: ( str
) attribute nameReturn: (
int
) attribute polling period (ms) or 0 if it is not polledNew in PyTango 8.0.0
-
get_cmd_min_poll_period
(self) → seq<str>¶ - Returns the min command poll period
Parameters: None Return: ( seq
) the min command poll periodNew in PyTango 7.2.0
-
get_cmd_poll_ring_depth
(self, cmd_name) → int¶ - Returns the command poll ring depth
Parameters: cmd_name: ( str
) the command nameReturn: (
int
) the command poll ring depthNew in PyTango 7.1.2
-
get_command_poll_period
(self, cmd_name) → int¶ - Returns the command polling period (ms) or 0 if the command is not polled.
Parameters: cmd_name: ( str
) command nameReturn: (
int
) command polling period (ms) or 0 if it is not polledNew in PyTango 8.0.0
-
get_dev_idl_version
(self) → int¶ - Returns the IDL version
Parameters: None Return: ( int
) the IDL versionNew in PyTango 7.1.2
-
get_device_attr
(self) → MultiAttribute¶ - Get device multi attribute object.
Parameters: None Return: ( MultiAttribute
) the device’s MultiAttribute object
-
get_device_properties
(self, ds_class = None) → None¶ - Utility method that fetches all the device properties from the database and converts them into members of this DeviceImpl.
Parameters: ds_class: ( DeviceClass
) the DeviceClass object. Optional. Default value is None meaning that the corresponding DeviceClass object for this DeviceImpl will be usedReturn: None
Throws:
-
get_exported_flag
(self) → bool¶ - Returns the state of the exported flag
Parameters: None Return: ( bool
) the state of the exported flagNew in PyTango 7.1.2
-
get_logger
(self) → Logger¶ - Returns the Logger object for this device
Parameters: None Return: ( Logger
) the Logger object for this device
-
get_min_poll_period
(self) → int¶ - Returns the min poll period
Parameters: None Return: ( int
) the min poll periodNew in PyTango 7.2.0
-
get_name
(self) -> (str)¶ - Get a COPY of the device name.
Parameters: None Return: ( str
) the device name
-
get_non_auto_polled_attr
(self) → sequence<str>¶ - Returns a COPY of the list of non automatic polled attributes
Parameters: None Return: (sequence< str
>) a COPY of the list of non automatic polled attributesNew in PyTango 7.1.2
-
get_non_auto_polled_cmd
(self) → sequence<str>¶ - Returns a COPY of the list of non automatic polled commands
Parameters: None Return: (sequence< str
>) a COPY of the list of non automatic polled commandsNew in PyTango 7.1.2
-
get_poll_old_factor
(self) → int¶ - Returns the poll old factor
Parameters: None Return: ( int
) the poll old factorNew in PyTango 7.1.2
-
get_poll_ring_depth
(self) → int¶ - Returns the poll ring depth
Parameters: None Return: ( int
) the poll ring depthNew in PyTango 7.1.2
-
get_polled_attr
(self) → sequence<str>¶ - Returns a COPY of the list of polled attributes
Parameters: None Return: (sequence< str
>) a COPY of the list of polled attributesNew in PyTango 7.1.2
-
get_polled_cmd
(self) → sequence<str>¶ - Returns a COPY of the list of polled commands
Parameters: None Return: (sequence< str
>) a COPY of the list of polled commandsNew in PyTango 7.1.2
-
get_prev_state
(self) → DevState¶ - Get a COPY of the device’s previous state.
Parameters: None Return: ( DevState
) the device’s previous state
-
get_state
(self) → DevState¶ - Get a COPY of the device state.
Parameters: None Return: ( DevState
) Current device state
-
get_status
(self) → str¶ - Get a COPY of the device status.
Parameters: None Return: ( str
) the device status
-
info_stream
(self, msg, *args) → None¶ Sends the given message to the tango info stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_info)
Parameters: msg: ( str
) the message to be sent to the info streamReturn: None
-
init_device
(self) → None¶ - Intialise a device.
Parameters: None Return: None
-
is_device_locked
(self) → bool¶ - Returns if this device is locked by a client
Parameters: None Return: ( bool
) True if it is locked or False otherwiseNew in PyTango 7.1.2
-
is_polled
(self) → bool¶ - Returns if it is polled
Parameters: None Return: ( bool
) True if it is polled or False otherwiseNew in PyTango 7.1.2
-
is_there_subscriber
(self, att_name, event_type) → bool¶ Check if there is subscriber(s) listening for the event.
This method returns a boolean set to true if there are some subscriber(s) listening on the event specified by the two method arguments. Be aware that there is some delay (up to 600 sec) between this method returning false and the last subscriber unsubscription or crash...
The device interface change event is not supported by this method.
Parameters: att_name: ( str
) the attribute nameevent_type (EventType): the event type Return: True if there is at least one listener or False otherwise
-
push_archive_event
(self, attr_name) → None¶ push_archive_event (self, attr_name, except) ->
None
push_archive_event (self, attr_name, data, dim_x = 1, dim_y = 0) ->
None
push_archive_event (self, attr_name, str_data, data) ->
None
push_archive_event (self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_archive_event (self, attr_name, str_data, data, time_stamp, quality) ->
None
Push an archive event for the given attribute name. The event is pushed to the notification daemon.Parameters: attr_name: ( str
) attribute namedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.except: ( DevFailed
) Instead of data, you may want to send an exception.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
push_att_conf_event
(self, attr) → None¶ - Push an attribute configuration event.
Parameters: (Attribute) the attribute for which the configuration event will be sent. Return: None New in PyTango 7.2.1
-
push_change_event
(self, attr_name) → None¶ push_change_event (self, attr_name, except) ->
None
push_change_event (self, attr_name, data, dim_x = 1, dim_y = 0) ->
None
push_change_event (self, attr_name, str_data, data) ->
None
push_change_event (self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_change_event (self, attr_name, str_data, data, time_stamp, quality) ->
None
Push a change event for the given attribute name. The event is pushed to the notification daemon.
Parameters: attr_name: ( str
) attribute namedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.except: ( DevFailed
) Instead of data, you may want to send an exception.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
push_data_ready_event
(self, attr_name, counter = 0) → None¶ Push a data ready event for the given attribute name. The event is pushed to the notification daemon.
The method needs only the attribue name and an optional “counter” which will be passed unchanged within the event
Parameters: attr_name: ( str
) attribute namecounter: ( int
) the user counterReturn: None
Throws: DevFailed
If the attribute name is unknown.
-
push_event
(self, attr_name, filt_names, filt_vals) → None¶ push_event (self, attr_name, filt_names, filt_vals, data, dim_x = 1, dim_y = 0) ->
None
push_event (self, attr_name, filt_names, filt_vals, str_data, data) ->
None
push_event (self, attr_name, filt_names, filt_vals, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_event (self, attr_name, filt_names, filt_vals, str_data, data, time_stamp, quality) ->
None
Push a user event for the given attribute name. The event is pushed to the notification daemon.Parameters: attr_name: ( str
) attribute namefilt_names: (sequence< str
>) the filterable fields namefilt_vals: (sequence< double
>) the filterable fields valuedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
register_signal
(self, signo) → None¶ - Register a signal. Register this device as device to be informed when signal signo is sent to to the device server process
Parameters: signo: ( int
) signal identifierReturn: None
-
remove_attribute
(self, attr_name) → None¶ - Remove one attribute from the device attribute list.
Parameters: attr_name: ( str
) attribute nameReturn: None
Throws:
-
set_archive_event
(self, attr_name, implemented, detect=True) → None¶ - Set an implemented flag for the attribute to indicate that the server fires archive events manually, without the polling to be started. If the detect parameter is set to true, the criteria specified for the archive event are verified and the event is only pushed if they are fullfilled. If detect is set to false the event is fired without any value checking!
Parameters: attr_name: ( str
) attribute nameimplemented: ( bool
) True when the server fires change events manually.detect: ( bool
) Triggers the verification of the change event properties when set to true. Default value is true.Return: None
-
set_change_event
(self, attr_name, implemented, detect=True) → None¶ - Set an implemented flag for the attribute to indicate that the server fires change events manually, without the polling to be started. If the detect parameter is set to true, the criteria specified for the change event are verified and the event is only pushed if they are fullfilled. If detect is set to false the event is fired without any value checking!
Parameters: attr_name: ( str
) attribute nameimplemented: ( bool
) True when the server fires change events manually.detect: ( bool
) Triggers the verification of the change event properties when set to true. Default value is true.Return: None
-
set_state
(self, new_state) → None¶ - Set device state.
Parameters: new_state: ( DevState
) the new device stateReturn: None
-
set_status
(self, new_status) → None¶ - Set device status.
Parameters: new_status: ( str
) the new device statusReturn: None
-
stop_polling
(self) → None¶ stop_polling (self, with_db_upd) ->
None
Stop all polling for a device. if the device is polled, call this method before deleting it.Parameters: with_db_upd: ( bool
) Is it necessary to update db ?Return: None
New in PyTango 7.1.2
-
Device_3Impl¶
-
class
PyTango.
Device_3Impl
¶ Bases:
PyTango._PyTango.Device_2Impl
-
add_attribute
(self, attr, r_meth=None, w_meth=None, is_allo_meth=None) → Attr¶ - Add a new attribute to the device attribute list. Please, note that if you add an attribute to a device at device creation time, this attribute will be added to the device class attribute list. Therefore, all devices belonging to the same class created after this attribute addition will also have this attribute.
Parameters: attr: (Attr or AttrData) the new attribute to be added to the list. r_meth: ( callable
) the read method to be called on a read requestw_meth: ( callable
) the write method to be called on a write request (if attr is writable)is_allo_meth: ( callable
) the method that is called to check if it is possible to access the attribute or notReturn: (
Attr
) the newly created attribute.Throws:
-
always_executed_hook
(self) → None¶ - Hook method. Default method to implement an action necessary on a device before any command is executed. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs
Parameters: None Return: None Throws: DevFailed
This method does not throwexception
but a redefined method can.
-
append_status
(self, status, new_line=False) → None¶ - Appends a string to the device status.
Parameters: status : (str) the string to be appened to the device status new_line : (bool) If true, appends a new line character before the string. Default is False Return: None
-
check_command_exists
(self) → None¶ - This method check that a command is supported by the device and does not need input value. The method throws an exception if the command is not defined or needs an input value
Parameters: cmd_name: ( str
) the command nameReturn: None
Throws: DevFailed
API_IncompatibleCmdArgumentType, API_CommandNotFoundNew in PyTango 7.1.2
-
debug_stream
(self, msg, *args) → None¶ Sends the given message to the tango debug stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_debug)
Parameters: msg: ( str
) the message to be sent to the debug streamReturn: None
-
dev_state
(self) → DevState¶ - Get device state. Default method to get device state. The behaviour of this method depends on the device state. If the device state is ON or ALARM, it reads the attribute(s) with an alarm level defined, check if the read value is above/below the alarm and eventually change the state to ALARM, return the device state. For all th other device state, this method simply returns the state This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.
Parameters: None Return: ( DevState
) the device stateThrows: DevFailed
- If it is necessary to read attribute(s) and a problem occurs during the reading
-
dev_status
(self) → str¶ - Get device status. Default method to get device status. It returns the contents of the device dev_status field. If the device state is ALARM, alarm messages are added to the device status. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.
Parameters: None Return: ( str
) the device statusThrows: DevFailed
- If it is necessary to read attribute(s) and a problem occurs during the reading
-
error_stream
(self, msg, *args) → None¶ Sends the given message to the tango error stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_error)
Parameters: msg: ( str
) the message to be sent to the error streamReturn: None
-
fatal_stream
(self, msg, *args) → None¶ Sends the given message to the tango fatal stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_fatal)
Parameters: msg: ( str
) the message to be sent to the fatal streamReturn: None
-
get_attr_min_poll_period
(self) → seq<str>¶ - Returns the min attribute poll period
Parameters: None Return: ( seq
) the min attribute poll periodNew in PyTango 7.2.0
-
get_attr_poll_ring_depth
(self, attr_name) → int¶ - Returns the attribute poll ring depth
Parameters: attr_name: ( str
) the attribute nameReturn: (
int
) the attribute poll ring depthNew in PyTango 7.1.2
-
get_attribute_poll_period
(self, attr_name) → int¶ - Returns the attribute polling period (ms) or 0 if the attribute is not polled.
Parameters: attr_name: ( str
) attribute nameReturn: (
int
) attribute polling period (ms) or 0 if it is not polledNew in PyTango 8.0.0
-
get_cmd_min_poll_period
(self) → seq<str>¶ - Returns the min command poll period
Parameters: None Return: ( seq
) the min command poll periodNew in PyTango 7.2.0
-
get_cmd_poll_ring_depth
(self, cmd_name) → int¶ - Returns the command poll ring depth
Parameters: cmd_name: ( str
) the command nameReturn: (
int
) the command poll ring depthNew in PyTango 7.1.2
-
get_command_poll_period
(self, cmd_name) → int¶ - Returns the command polling period (ms) or 0 if the command is not polled.
Parameters: cmd_name: ( str
) command nameReturn: (
int
) command polling period (ms) or 0 if it is not polledNew in PyTango 8.0.0
-
get_dev_idl_version
(self) → int¶ - Returns the IDL version
Parameters: None Return: ( int
) the IDL versionNew in PyTango 7.1.2
-
get_device_attr
(self) → MultiAttribute¶ - Get device multi attribute object.
Parameters: None Return: ( MultiAttribute
) the device’s MultiAttribute object
-
get_device_properties
(self, ds_class = None) → None¶ - Utility method that fetches all the device properties from the database and converts them into members of this DeviceImpl.
Parameters: ds_class: ( DeviceClass
) the DeviceClass object. Optional. Default value is None meaning that the corresponding DeviceClass object for this DeviceImpl will be usedReturn: None
Throws:
-
get_exported_flag
(self) → bool¶ - Returns the state of the exported flag
Parameters: None Return: ( bool
) the state of the exported flagNew in PyTango 7.1.2
-
get_logger
(self) → Logger¶ - Returns the Logger object for this device
Parameters: None Return: ( Logger
) the Logger object for this device
-
get_min_poll_period
(self) → int¶ - Returns the min poll period
Parameters: None Return: ( int
) the min poll periodNew in PyTango 7.2.0
-
get_name
(self) -> (str)¶ - Get a COPY of the device name.
Parameters: None Return: ( str
) the device name
-
get_non_auto_polled_attr
(self) → sequence<str>¶ - Returns a COPY of the list of non automatic polled attributes
Parameters: None Return: (sequence< str
>) a COPY of the list of non automatic polled attributesNew in PyTango 7.1.2
-
get_non_auto_polled_cmd
(self) → sequence<str>¶ - Returns a COPY of the list of non automatic polled commands
Parameters: None Return: (sequence< str
>) a COPY of the list of non automatic polled commandsNew in PyTango 7.1.2
-
get_poll_old_factor
(self) → int¶ - Returns the poll old factor
Parameters: None Return: ( int
) the poll old factorNew in PyTango 7.1.2
-
get_poll_ring_depth
(self) → int¶ - Returns the poll ring depth
Parameters: None Return: ( int
) the poll ring depthNew in PyTango 7.1.2
-
get_polled_attr
(self) → sequence<str>¶ - Returns a COPY of the list of polled attributes
Parameters: None Return: (sequence< str
>) a COPY of the list of polled attributesNew in PyTango 7.1.2
-
get_polled_cmd
(self) → sequence<str>¶ - Returns a COPY of the list of polled commands
Parameters: None Return: (sequence< str
>) a COPY of the list of polled commandsNew in PyTango 7.1.2
-
get_prev_state
(self) → DevState¶ - Get a COPY of the device’s previous state.
Parameters: None Return: ( DevState
) the device’s previous state
-
get_state
(self) → DevState¶ - Get a COPY of the device state.
Parameters: None Return: ( DevState
) Current device state
-
get_status
(self) → str¶ - Get a COPY of the device status.
Parameters: None Return: ( str
) the device status
-
info_stream
(self, msg, *args) → None¶ Sends the given message to the tango info stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_info)
Parameters: msg: ( str
) the message to be sent to the info streamReturn: None
-
is_device_locked
(self) → bool¶ - Returns if this device is locked by a client
Parameters: None Return: ( bool
) True if it is locked or False otherwiseNew in PyTango 7.1.2
-
is_polled
(self) → bool¶ - Returns if it is polled
Parameters: None Return: ( bool
) True if it is polled or False otherwiseNew in PyTango 7.1.2
-
is_there_subscriber
(self, att_name, event_type) → bool¶ Check if there is subscriber(s) listening for the event.
This method returns a boolean set to true if there are some subscriber(s) listening on the event specified by the two method arguments. Be aware that there is some delay (up to 600 sec) between this method returning false and the last subscriber unsubscription or crash...
The device interface change event is not supported by this method.
Parameters: att_name: ( str
) the attribute nameevent_type (EventType): the event type Return: True if there is at least one listener or False otherwise
-
push_archive_event
(self, attr_name) → None¶ push_archive_event (self, attr_name, except) ->
None
push_archive_event (self, attr_name, data, dim_x = 1, dim_y = 0) ->
None
push_archive_event (self, attr_name, str_data, data) ->
None
push_archive_event (self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_archive_event (self, attr_name, str_data, data, time_stamp, quality) ->
None
Push an archive event for the given attribute name. The event is pushed to the notification daemon.Parameters: attr_name: ( str
) attribute namedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.except: ( DevFailed
) Instead of data, you may want to send an exception.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
push_att_conf_event
(self, attr) → None¶ - Push an attribute configuration event.
Parameters: (Attribute) the attribute for which the configuration event will be sent. Return: None New in PyTango 7.2.1
-
push_change_event
(self, attr_name) → None¶ push_change_event (self, attr_name, except) ->
None
push_change_event (self, attr_name, data, dim_x = 1, dim_y = 0) ->
None
push_change_event (self, attr_name, str_data, data) ->
None
push_change_event (self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_change_event (self, attr_name, str_data, data, time_stamp, quality) ->
None
Push a change event for the given attribute name. The event is pushed to the notification daemon.
Parameters: attr_name: ( str
) attribute namedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.except: ( DevFailed
) Instead of data, you may want to send an exception.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
push_data_ready_event
(self, attr_name, counter = 0) → None¶ Push a data ready event for the given attribute name. The event is pushed to the notification daemon.
The method needs only the attribue name and an optional “counter” which will be passed unchanged within the event
Parameters: attr_name: ( str
) attribute namecounter: ( int
) the user counterReturn: None
Throws: DevFailed
If the attribute name is unknown.
-
push_event
(self, attr_name, filt_names, filt_vals) → None¶ push_event (self, attr_name, filt_names, filt_vals, data, dim_x = 1, dim_y = 0) ->
None
push_event (self, attr_name, filt_names, filt_vals, str_data, data) ->
None
push_event (self, attr_name, filt_names, filt_vals, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_event (self, attr_name, filt_names, filt_vals, str_data, data, time_stamp, quality) ->
None
Push a user event for the given attribute name. The event is pushed to the notification daemon.Parameters: attr_name: ( str
) attribute namefilt_names: (sequence< str
>) the filterable fields namefilt_vals: (sequence< double
>) the filterable fields valuedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
read_attr_hardware
(self, attr_list) → None¶ - Read the hardware to return attribute value(s). Default method to implement an action necessary on a device to read the hardware involved in a a read attribute CORBA call. This method must be redefined in sub-classes in order to support attribute reading
Parameters: - attr_list : (sequence<int>) list of indices in the device object attribute vector
of an attribute to be read.
Return: None
Throws: DevFailed
This method does not throwexception
but a redefined method can.
-
register_signal
(self, signo) → None¶ - Register a signal. Register this device as device to be informed when signal signo is sent to to the device server process
Parameters: signo: ( int
) signal identifierReturn: None
-
remove_attribute
(self, attr_name) → None¶ - Remove one attribute from the device attribute list.
Parameters: attr_name: ( str
) attribute nameReturn: None
Throws:
-
set_archive_event
(self, attr_name, implemented, detect=True) → None¶ - Set an implemented flag for the attribute to indicate that the server fires archive events manually, without the polling to be started. If the detect parameter is set to true, the criteria specified for the archive event are verified and the event is only pushed if they are fullfilled. If detect is set to false the event is fired without any value checking!
Parameters: attr_name: ( str
) attribute nameimplemented: ( bool
) True when the server fires change events manually.detect: ( bool
) Triggers the verification of the change event properties when set to true. Default value is true.Return: None
-
set_change_event
(self, attr_name, implemented, detect=True) → None¶ - Set an implemented flag for the attribute to indicate that the server fires change events manually, without the polling to be started. If the detect parameter is set to true, the criteria specified for the change event are verified and the event is only pushed if they are fullfilled. If detect is set to false the event is fired without any value checking!
Parameters: attr_name: ( str
) attribute nameimplemented: ( bool
) True when the server fires change events manually.detect: ( bool
) Triggers the verification of the change event properties when set to true. Default value is true.Return: None
-
set_state
(self, new_state) → None¶ - Set device state.
Parameters: new_state: ( DevState
) the new device stateReturn: None
-
set_status
(self, new_status) → None¶ - Set device status.
Parameters: new_status: ( str
) the new device statusReturn: None
-
signal_handler
(self, signo) → None¶ - Signal handler. The method executed when the signal arrived in the device server process. This method is defined as virtual and then, can be redefined following device needs.
Parameters: signo: ( int
) the signal numberReturn: None
Throws: DevFailed
This method does not throwexception
but a redefined method can.
-
stop_polling
(self) → None¶ stop_polling (self, with_db_upd) ->
None
Stop all polling for a device. if the device is polled, call this method before deleting it.Parameters: with_db_upd: ( bool
) Is it necessary to update db ?Return: None
New in PyTango 7.1.2
-
unregister_signal
(self, signo) → None¶ - Unregister a signal. Unregister this device as device to be informed when signal signo is sent to to the device server process
Parameters: signo: ( int
) signal identifierReturn: None
-
warn_stream
(self, msg, *args) → None¶ Sends the given message to the tango warn stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_warn)
Parameters: msg: ( str
) the message to be sent to the warn streamReturn: None
-
write_attr_hardware
(self) → None¶ - Write the hardware for attributes. Default method to implement an action necessary on a device to write the hardware involved in a a write attribute. This method must be redefined in sub-classes in order to support writable attribute
Parameters: - attr_list : (sequence<int>) list of indices in the device object attribute vector
of an attribute to be written.
Return: None
Throws: DevFailed
This method does not throwexception
but a redefined method can.
-
Device_4Impl¶
-
class
PyTango.
Device_4Impl
¶ Bases:
PyTango._PyTango.Device_3Impl
-
add_attribute
(self, attr, r_meth=None, w_meth=None, is_allo_meth=None) → Attr¶ - Add a new attribute to the device attribute list. Please, note that if you add an attribute to a device at device creation time, this attribute will be added to the device class attribute list. Therefore, all devices belonging to the same class created after this attribute addition will also have this attribute.
Parameters: attr: (Attr or AttrData) the new attribute to be added to the list. r_meth: ( callable
) the read method to be called on a read requestw_meth: ( callable
) the write method to be called on a write request (if attr is writable)is_allo_meth: ( callable
) the method that is called to check if it is possible to access the attribute or notReturn: (
Attr
) the newly created attribute.Throws:
-
always_executed_hook
(self) → None¶ - Hook method. Default method to implement an action necessary on a device before any command is executed. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs
Parameters: None Return: None Throws: DevFailed
This method does not throwexception
but a redefined method can.
-
append_status
(self, status, new_line=False) → None¶ - Appends a string to the device status.
Parameters: status : (str) the string to be appened to the device status new_line : (bool) If true, appends a new line character before the string. Default is False Return: None
-
check_command_exists
(self) → None¶ - This method check that a command is supported by the device and does not need input value. The method throws an exception if the command is not defined or needs an input value
Parameters: cmd_name: ( str
) the command nameReturn: None
Throws: DevFailed
API_IncompatibleCmdArgumentType, API_CommandNotFoundNew in PyTango 7.1.2
-
debug_stream
(self, msg, *args) → None¶ Sends the given message to the tango debug stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_debug)
Parameters: msg: ( str
) the message to be sent to the debug streamReturn: None
-
dev_state
(self) → DevState¶ - Get device state. Default method to get device state. The behaviour of this method depends on the device state. If the device state is ON or ALARM, it reads the attribute(s) with an alarm level defined, check if the read value is above/below the alarm and eventually change the state to ALARM, return the device state. For all th other device state, this method simply returns the state This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.
Parameters: None Return: ( DevState
) the device stateThrows: DevFailed
- If it is necessary to read attribute(s) and a problem occurs during the reading
-
dev_status
(self) → str¶ - Get device status. Default method to get device status. It returns the contents of the device dev_status field. If the device state is ALARM, alarm messages are added to the device status. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.
Parameters: None Return: ( str
) the device statusThrows: DevFailed
- If it is necessary to read attribute(s) and a problem occurs during the reading
-
error_stream
(self, msg, *args) → None¶ Sends the given message to the tango error stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_error)
Parameters: msg: ( str
) the message to be sent to the error streamReturn: None
-
fatal_stream
(self, msg, *args) → None¶ Sends the given message to the tango fatal stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_fatal)
Parameters: msg: ( str
) the message to be sent to the fatal streamReturn: None
-
get_attr_min_poll_period
(self) → seq<str>¶ - Returns the min attribute poll period
Parameters: None Return: ( seq
) the min attribute poll periodNew in PyTango 7.2.0
-
get_attr_poll_ring_depth
(self, attr_name) → int¶ - Returns the attribute poll ring depth
Parameters: attr_name: ( str
) the attribute nameReturn: (
int
) the attribute poll ring depthNew in PyTango 7.1.2
-
get_attribute_poll_period
(self, attr_name) → int¶ - Returns the attribute polling period (ms) or 0 if the attribute is not polled.
Parameters: attr_name: ( str
) attribute nameReturn: (
int
) attribute polling period (ms) or 0 if it is not polledNew in PyTango 8.0.0
-
get_cmd_min_poll_period
(self) → seq<str>¶ - Returns the min command poll period
Parameters: None Return: ( seq
) the min command poll periodNew in PyTango 7.2.0
-
get_cmd_poll_ring_depth
(self, cmd_name) → int¶ - Returns the command poll ring depth
Parameters: cmd_name: ( str
) the command nameReturn: (
int
) the command poll ring depthNew in PyTango 7.1.2
-
get_command_poll_period
(self, cmd_name) → int¶ - Returns the command polling period (ms) or 0 if the command is not polled.
Parameters: cmd_name: ( str
) command nameReturn: (
int
) command polling period (ms) or 0 if it is not polledNew in PyTango 8.0.0
-
get_dev_idl_version
(self) → int¶ - Returns the IDL version
Parameters: None Return: ( int
) the IDL versionNew in PyTango 7.1.2
-
get_device_attr
(self) → MultiAttribute¶ - Get device multi attribute object.
Parameters: None Return: ( MultiAttribute
) the device’s MultiAttribute object
-
get_device_properties
(self, ds_class = None) → None¶ - Utility method that fetches all the device properties from the database and converts them into members of this DeviceImpl.
Parameters: ds_class: ( DeviceClass
) the DeviceClass object. Optional. Default value is None meaning that the corresponding DeviceClass object for this DeviceImpl will be usedReturn: None
Throws:
-
get_exported_flag
(self) → bool¶ - Returns the state of the exported flag
Parameters: None Return: ( bool
) the state of the exported flagNew in PyTango 7.1.2
-
get_logger
(self) → Logger¶ - Returns the Logger object for this device
Parameters: None Return: ( Logger
) the Logger object for this device
-
get_min_poll_period
(self) → int¶ - Returns the min poll period
Parameters: None Return: ( int
) the min poll periodNew in PyTango 7.2.0
-
get_name
(self) -> (str)¶ - Get a COPY of the device name.
Parameters: None Return: ( str
) the device name
-
get_non_auto_polled_attr
(self) → sequence<str>¶ - Returns a COPY of the list of non automatic polled attributes
Parameters: None Return: (sequence< str
>) a COPY of the list of non automatic polled attributesNew in PyTango 7.1.2
-
get_non_auto_polled_cmd
(self) → sequence<str>¶ - Returns a COPY of the list of non automatic polled commands
Parameters: None Return: (sequence< str
>) a COPY of the list of non automatic polled commandsNew in PyTango 7.1.2
-
get_poll_old_factor
(self) → int¶ - Returns the poll old factor
Parameters: None Return: ( int
) the poll old factorNew in PyTango 7.1.2
-
get_poll_ring_depth
(self) → int¶ - Returns the poll ring depth
Parameters: None Return: ( int
) the poll ring depthNew in PyTango 7.1.2
-
get_polled_attr
(self) → sequence<str>¶ - Returns a COPY of the list of polled attributes
Parameters: None Return: (sequence< str
>) a COPY of the list of polled attributesNew in PyTango 7.1.2
-
get_polled_cmd
(self) → sequence<str>¶ - Returns a COPY of the list of polled commands
Parameters: None Return: (sequence< str
>) a COPY of the list of polled commandsNew in PyTango 7.1.2
-
get_prev_state
(self) → DevState¶ - Get a COPY of the device’s previous state.
Parameters: None Return: ( DevState
) the device’s previous state
-
get_state
(self) → DevState¶ - Get a COPY of the device state.
Parameters: None Return: ( DevState
) Current device state
-
get_status
(self) → str¶ - Get a COPY of the device status.
Parameters: None Return: ( str
) the device status
-
info_stream
(self, msg, *args) → None¶ Sends the given message to the tango info stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_info)
Parameters: msg: ( str
) the message to be sent to the info streamReturn: None
-
is_device_locked
(self) → bool¶ - Returns if this device is locked by a client
Parameters: None Return: ( bool
) True if it is locked or False otherwiseNew in PyTango 7.1.2
-
is_polled
(self) → bool¶ - Returns if it is polled
Parameters: None Return: ( bool
) True if it is polled or False otherwiseNew in PyTango 7.1.2
-
is_there_subscriber
(self, att_name, event_type) → bool¶ Check if there is subscriber(s) listening for the event.
This method returns a boolean set to true if there are some subscriber(s) listening on the event specified by the two method arguments. Be aware that there is some delay (up to 600 sec) between this method returning false and the last subscriber unsubscription or crash...
The device interface change event is not supported by this method.
Parameters: att_name: ( str
) the attribute nameevent_type (EventType): the event type Return: True if there is at least one listener or False otherwise
-
push_archive_event
(self, attr_name) → None¶ push_archive_event (self, attr_name, except) ->
None
push_archive_event (self, attr_name, data, dim_x = 1, dim_y = 0) ->
None
push_archive_event (self, attr_name, str_data, data) ->
None
push_archive_event (self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_archive_event (self, attr_name, str_data, data, time_stamp, quality) ->
None
Push an archive event for the given attribute name. The event is pushed to the notification daemon.Parameters: attr_name: ( str
) attribute namedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.except: ( DevFailed
) Instead of data, you may want to send an exception.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
push_att_conf_event
(self, attr) → None¶ - Push an attribute configuration event.
Parameters: (Attribute) the attribute for which the configuration event will be sent. Return: None New in PyTango 7.2.1
-
push_change_event
(self, attr_name) → None¶ push_change_event (self, attr_name, except) ->
None
push_change_event (self, attr_name, data, dim_x = 1, dim_y = 0) ->
None
push_change_event (self, attr_name, str_data, data) ->
None
push_change_event (self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_change_event (self, attr_name, str_data, data, time_stamp, quality) ->
None
Push a change event for the given attribute name. The event is pushed to the notification daemon.
Parameters: attr_name: ( str
) attribute namedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.except: ( DevFailed
) Instead of data, you may want to send an exception.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
push_data_ready_event
(self, attr_name, counter = 0) → None¶ Push a data ready event for the given attribute name. The event is pushed to the notification daemon.
The method needs only the attribue name and an optional “counter” which will be passed unchanged within the event
Parameters: attr_name: ( str
) attribute namecounter: ( int
) the user counterReturn: None
Throws: DevFailed
If the attribute name is unknown.
-
push_event
(self, attr_name, filt_names, filt_vals) → None¶ push_event (self, attr_name, filt_names, filt_vals, data, dim_x = 1, dim_y = 0) ->
None
push_event (self, attr_name, filt_names, filt_vals, str_data, data) ->
None
push_event (self, attr_name, filt_names, filt_vals, data, time_stamp, quality, dim_x = 1, dim_y = 0) ->
None
push_event (self, attr_name, filt_names, filt_vals, str_data, data, time_stamp, quality) ->
None
Push a user event for the given attribute name. The event is pushed to the notification daemon.Parameters: attr_name: ( str
) attribute namefilt_names: (sequence< str
>) the filterable fields namefilt_vals: (sequence< double
>) the filterable fields valuedata: the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type str_data: ( str
) special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.dim_x: ( int
) the attribute x length. Default value is 1dim_y: ( int
) the attribute y length. Default value is 0time_stamp: ( double
) the time stampquality: ( AttrQuality
) the attribute quality factorThrows: DevFailed
If the attribute data type is not coherent.
-
read_attr_hardware
(self, attr_list) → None¶ - Read the hardware to return attribute value(s). Default method to implement an action necessary on a device to read the hardware involved in a a read attribute CORBA call. This method must be redefined in sub-classes in order to support attribute reading
Parameters: - attr_list : (sequence<int>) list of indices in the device object attribute vector
of an attribute to be read.
Return: None
Throws: DevFailed
This method does not throwexception
but a redefined method can.
-
register_signal
(self, signo) → None¶ - Register a signal. Register this device as device to be informed when signal signo is sent to to the device server process
Parameters: signo: ( int
) signal identifierReturn: None
-
remove_attribute
(self, attr_name) → None¶ - Remove one attribute from the device attribute list.
Parameters: attr_name: ( str
) attribute nameReturn: None
Throws:
-
set_archive_event
(self, attr_name, implemented, detect=True) → None¶ - Set an implemented flag for the attribute to indicate that the server fires archive events manually, without the polling to be started. If the detect parameter is set to true, the criteria specified for the archive event are verified and the event is only pushed if they are fullfilled. If detect is set to false the event is fired without any value checking!
Parameters: attr_name: ( str
) attribute nameimplemented: ( bool
) True when the server fires change events manually.detect: ( bool
) Triggers the verification of the change event properties when set to true. Default value is true.Return: None
-
set_change_event
(self, attr_name, implemented, detect=True) → None¶ - Set an implemented flag for the attribute to indicate that the server fires change events manually, without the polling to be started. If the detect parameter is set to true, the criteria specified for the change event are verified and the event is only pushed if they are fullfilled. If detect is set to false the event is fired without any value checking!
Parameters: attr_name: ( str
) attribute nameimplemented: ( bool
) True when the server fires change events manually.detect: ( bool
) Triggers the verification of the change event properties when set to true. Default value is true.Return: None
-
set_state
(self, new_state) → None¶ - Set device state.
Parameters: new_state: ( DevState
) the new device stateReturn: None
-
set_status
(self, new_status) → None¶ - Set device status.
Parameters: new_status: ( str
) the new device statusReturn: None
-
signal_handler
(self, signo) → None¶ - Signal handler. The method executed when the signal arrived in the device server process. This method is defined as virtual and then, can be redefined following device needs.
Parameters: signo: ( int
) the signal numberReturn: None
Throws: DevFailed
This method does not throwexception
but a redefined method can.
-
stop_polling
(self) → None¶ stop_polling (self, with_db_upd) ->
None
Stop all polling for a device. if the device is polled, call this method before deleting it.Parameters: with_db_upd: ( bool
) Is it necessary to update db ?Return: None
New in PyTango 7.1.2
-
unregister_signal
(self, signo) → None¶ - Unregister a signal. Unregister this device as device to be informed when signal signo is sent to to the device server process
Parameters: signo: ( int
) signal identifierReturn: None
-
warn_stream
(self, msg, *args) → None¶ Sends the given message to the tango warn stream.
Since PyTango 7.1.3, the same can be achieved with:
print(msg, file=self.log_warn)
Parameters: msg: ( str
) the message to be sent to the warn streamReturn: None
-
write_attr_hardware
(self) → None¶ - Write the hardware for attributes. Default method to implement an action necessary on a device to write the hardware involved in a a write attribute. This method must be redefined in sub-classes in order to support writable attribute
Parameters: - attr_list : (sequence<int>) list of indices in the device object attribute vector
of an attribute to be written.
Return: None
Throws: DevFailed
This method does not throwexception
but a redefined method can.
-