Enumerations & other classes#
Enumerations#
- class tango.LockerLanguage(*values)#
An enumeration representing the programming language in which the client application who locked is written.
Added in version 7.0.0.
- CPP = 0#
- JAVA = 1#
- CPP_6 = 2#
- JAVA_6 = 3#
- class tango.CmdArgType(*values)#
An enumeration representing the Tango data types.
- DevVoid = 0#
- DevBoolean = 1#
- DevShort = 2#
- DevLong = 3#
- DevFloat = 4#
- DevDouble = 5#
- DevUShort = 6#
- DevULong = 7#
- DevString = 8#
- DevVarCharArray = 9#
- DevVarShortArray = 10#
- DevVarLongArray = 11#
- DevVarFloatArray = 12#
- DevVarDoubleArray = 13#
- DevVarUShortArray = 14#
- DevVarULongArray = 15#
- DevVarStringArray = 16#
- DevVarLongStringArray = 17#
- DevVarDoubleStringArray = 18#
- DevState = 19#
- ConstDevString = 20#
- DevVarBooleanArray = 21#
- DevUChar = 22#
- DevLong64 = 23#
- DevULong64 = 24#
- DevVarLong64Array = 25#
- DevVarULong64Array = 26#
- DevEncoded = 28#
- DevEnum = 29#
- DevVarStateArray = 31#
- DevVarEncodedArray = 32#
- Unknown = 100#
- class tango.MessBoxType(*values)#
An enumeration representing the MessBoxType
Added in version 7.0.0.
- STOP = 0#
- INFO = 1#
- class tango.PollObjType(*values)#
An enumeration representing the PollObjType
Added in version 7.0.0.
- POLL_CMD = 0#
- POLL_ATTR = 1#
- EVENT_HEARTBEAT = 2#
- STORE_SUBDEV = 3#
- class tango.PollCmdCode(*values)#
An enumeration representing the PollCmdCode
Added in version 7.0.0.
- POLL_ADD_OBJ = 0#
- POLL_REM_OBJ = 1#
- POLL_START = 2#
- POLL_STOP = 3#
- POLL_UPD_PERIOD = 4#
- POLL_REM_DEV = 5#
- POLL_EXIT = 6#
- POLL_REM_EXT_TRIG_OBJ = 7#
- POLL_ADD_HEARTBEAT = 8#
- POLL_REM_HEARTBEAT = 9#
- class tango.SerialModel(*values)#
An enumeration representing the type of serialization performed by the device server
- BY_DEVICE = 0#
- BY_CLASS = 1#
- BY_PROCESS = 2#
- NO_SYNC = 3#
- class tango.AttReqType(*values)#
An enumeration representing the type of attribute request
- READ_REQ = 0#
- WRITE_REQ = 1#
- class tango.LockCmdCode(*values)#
An enumeration representing the LockCmdCode
Added in version 7.0.0.
- LOCK_ADD_DEV = 0#
- LOCK_REM_DEV = 1#
- LOCK_UNLOCK_ALL_EXIT = 2#
- LOCK_EXIT = 3#
- class tango.LogLevel(*values)#
An enumeration representing the LogLevel
Added in version 7.0.0.
- LOG_OFF = 0#
- LOG_FATAL = 1#
- LOG_ERROR = 2#
- LOG_WARN = 3#
- LOG_INFO = 4#
- LOG_DEBUG = 5#
- class tango.LogTarget(*values)#
An enumeration representing the LogTarget
Added in version 7.0.0.
- LOG_CONSOLE = 0#
- LOG_FILE = 1#
- LOG_DEVICE = 2#
- class tango.EventType(*values)#
An enumeration representing event type
Changed in version 7.0.0: Added DATA_READY_EVENT
Changed in version 9.2.2: Added INTERFACE_CHANGE_EVENTn
Changed in version 10.0.0: Added ALARM_EVENT
Changed in version 10.0.0: Removed QUALITY_EVENT
Changed in version 10.1.0: Removed PIPE_EVENT
- CHANGE_EVENT = 0#
- PERIODIC_EVENT = 2#
- ARCHIVE_EVENT = 3#
- USER_EVENT = 4#
- ATTR_CONF_EVENT = 5#
- DATA_READY_EVENT = 6#
- INTERFACE_CHANGE_EVENT = 7#
- ALARM_EVENT = 9#
- class tango.KeepAliveCmdCode(*values)#
An enumeration representing the KeepAliveCmdCode
Added in version 7.1.0.
- EXIT_TH = 0#
- class tango.AccessControlType(*values)#
An enumeration representing the AccessControlType
Added in version 7.0.0.
- ACCESS_READ = 0#
- ACCESS_WRITE = 1#
- class tango.asyn_req_type(*values)#
An enumeration representing the asynchronous request type
- POLLING = 0#
- CALLBACK = 1#
- ALL_ASYNCH = 2#
- class tango.cb_sub_model(*values)#
An enumeration representing callback sub model
- PUSH_CALLBACK = 0#
- PULL_CALLBACK = 1#
- class tango.AttrQuality(*values)#
An enumeration representing the attribute quality
- ATTR_VALID = 0#
- ATTR_INVALID = 1#
- ATTR_ALARM = 2#
- ATTR_CHANGING = 3#
- ATTR_WARNING = 4#
- class tango.AttrWriteType(*values)#
An enumeration representing the attribute type
- READ = 0#
- READ_WITH_WRITE = 1#
- WRITE = 2#
- READ_WRITE = 3#
- WT_UNKNOWN = 4#
- class tango.AttrDataFormat(*values)#
An enumeration representing the attribute format
- SCALAR = 0#
- SPECTRUM = 1#
- IMAGE = 2#
- FMT_UNKNOWN = 3#
- class tango.DevSource(*values)#
An enumeration representing the device source for data
- DEV = 0#
- CACHE = 1#
- CACHE_DEV = 2#
- class tango.ErrSeverity(*values)#
An enumeration representing the error severity
- WARN = 0#
- ERR = 1#
- PANIC = 2#
- class tango.DevState(*values)#
An enumeration representing the device state
- ON = 0#
- OFF = 1#
- CLOSE = 2#
- OPEN = 3#
- INSERT = 4#
- EXTRACT = 5#
- MOVING = 6#
- STANDBY = 7#
- FAULT = 8#
- INIT = 9#
- RUNNING = 10#
- ALARM = 11#
- DISABLE = 12#
- UNKNOWN = 13#
- class tango.DispLevel(*values)#
An enumeration representing the display level
- OPERATOR = 0#
- EXPERT = 1#
- DL_UNKNOWN = 2#
- class tango.GreenMode(*values)#
An enumeration representing the GreenMode
Added in version 8.1.0.
Changed in version 8.1.9: Added Asyncio
- Synchronous = 0#
- Futures = 1#
- Gevent = 2#
- Asyncio = 3#
- class tango.telemetry.TelemetryExporter(*values)[source]#
An enumeration representing the telemetry exporter types.
Added in version 10.3.0.
- GRPC = 0#
- HTTP = 1#
- CONSOLE = 2#
- class tango.telemetry.TelemetryTopic(*values)[source]#
An enumeration representing the telemetry topics.
Note
As of version 10.3.0, the only usable topic is ALL. The DATABASE, EVENTS and POLLING topics are not implemented. The USER topic leads to inconsistent results due to an issue in cppTango A fix is expected in version 10.4.0, which will also bring in a new set of topics.
Added in version 10.3.0.
- DATABASE = 0#
- EVENTS = 1#
- POLLING = 2#
- USER = 3#
- ALL = 4#
- class tango.telemetry.TelemetryType(*values)[source]#
An enumeration representing the telemetry signal types.
Added in version 10.3.0.
- TRACING = 0#
- LOGGING = 1#
- NONE = 2#
- class tango.telemetry.TelemetryEndpoint(exporter: tango._telemetry.TelemetryExporter, endpoint: str)[source]#
- exporter: TelemetryExporter#
- tango.telemetry.get_telemetry_tracer_provider_factory() TracerProviderFactory[source]#
Get the factory that will be used to create tracer providers.
If
endpointsis omitted when calling the returned factory, the current client tracing endpoints derived from the environment variables are used.Added in version 10.3.0.
Other classes#
- class tango.Release[source]#
Summarize release information as class attributes.
- Release information:
name: (
str) package nameversion_info: (
tuple[int,int,int,str,int]) The five components of the version number: major, minor, micro, releaselevel, and serial.version: (
str) package version in format <major>.<minor>.<micro>release: (
str) pre-release, post-release or development release; it is empty for final releases.version_long: (
str) package version in format <major>.<minor>.<micro><releaselevel><serial>version_description: (
str) short description for the current versionversion_number: (
int) <major>*100 + <minor>*10 + <micro>description : (
str) package descriptionlong_description: (
str) longer package descriptionauthors: (dict[str(last name), tuple[str(full name),str(email)]]) package authors
url: (
str) package urldownload_url: (
str) package download urlplatform: (
list[str]) list of available platformskeywords: (
list[str]) list of keywordslicense: (
str) the license
- class tango.TimeVal(a=None, b=None, c=None)#
Time value structure with the following members:
tv_sec : seconds
tv_usec : microseconds
tv_nsec : nanoseconds
Constructors
- __init__(self)
Default constructor; all fields set to 0.
- __init__(self, tv_sec: int, tv_usec: int, tv_nsec: int)
Create a TimeVal by specifying all three members.
- __init__(self, time: float)
Create a TimeVal from time in seconds since epoch (e.g. time.time()).
- __init__(self, time: datetime.datetime)
Create a TimeVal from time in datetime.datetime format (e.g. datetime.datetime.now()).
- static fromdatetime(dt: datetime) TimeVal#
A static method returning a
tango.TimeValobject representing the givendatetime.datetime- Parameters:
dt (
datetime.datetime) – a datetime object
Added in version 7.1.0.
- static fromtimestamp(ts: float) TimeVal#
A static method returning a
tango.TimeValobject representing the given timestamp- Parameters:
ts (float) – a timestamp
Added in version 7.1.0.
- isoformat(sep: str = 'T') str#
Returns a string in ISO 8601 format, YYYY-MM-DDTHH:MM:SS[.mmmmmm][+HH:MM]
- Parameters:
sep (
str) – (str) sep is used to separate the year from the time, and defaults to ‘T’
Added in version 7.1.0.
Added in version 7.1.2: Documented
Changed in version 7.1.2: The sep parameter is not mandatory anymore and defaults to ‘T’ (same as
datetime.datetime.isoformat())
- static now() TimeVal#
A static method returning a
tango.TimeValobject representing the current timeAdded in version 7.1.0.
- strftime(format: str) str#
Convert a time value to a string according to a format specification.
- Parameters:
format (
str) – see the python library reference manual for formatting codes
Added in version 7.1.0.
- todatetime() datetime#
Returns a
datetime.datetimeobject representing the same time valueAdded in version 7.1.0.
- class tango.TimedAttrData(value: Any = None, quality: AttrQuality = AttrQuality.ATTR_VALID, w_value: Any = None, error: Exception | None = None, time_stamp: float | None = None)[source]#
This is pure-Python class, which combines both TimedAttrData and AttributeData cppTango classes, for use with Util.fill_attr_polling_buffer
- Parameters:
value (any type compatible with the Tango attribute's dtype) – value to be inserted in polling history. Default:
Nonequality (
tango.AttrQuality) – quality of value. Default:tango.AttrQuality.ATTR_VALIDw_value (any type compatible with the Tango attribute's dtype) – corresponding written value. Note: should be present only for writable attributes Default:
Noneerror (
Exceptionortango.DevFailed) – if the error reading should be inserted. Note: error has a priority over value! Default:Nonetime_stamp (
float) – value time stamp in seconds passed since epoch. If not provided, the current system time will be used Default:None
- class tango.TimedCmdData(value: Any = None, error: Exception | None = None, time_stamp: float | None = None)[source]#
This is pure-Python class, which mimics the TimedCmdData cppTango class, for use with Util.fill_cmd_polling_buffer
- Parameters:
value (any type compatible with the Tango commands's dtype) – value to be inserted in polling history. Default:
Noneerror (
Exceptionortango.DevFailed) – if the error reading should be inserted. Note: error has a priority over value! Default:Nonetime_stamp (
float) – value time stamp in seconds passed since epoch. If not provided, the current system time will be used Default:None
- class tango.EnsureOmniThread#
Tango servers and clients that start their own additional threads that will interact with Tango must guard these threads within this Python context. This is especially important when working with event subscriptions, and pushing events.
This context handler class ensures a non-omniORB thread will still get a dummy omniORB thread ID - cppTango requires threads to be identifiable in this way. It should only be acquired once for the lifetime of the thread, and must be released before the thread is cleaned up.
tango.utils.PyTangoThread (added in 10.3.0) runs with this context handler automatically active, so it is not necessary to use this context handler when using that class:
Supplying a target:
import tango from time import sleep def thread_task(): eid = dp.subscribe_event( "double_scalar", tango.EventType.PERIODIC_EVENT, cb) while running: print(f"num events stored {len(cb.get_events())}") sleep(1) dp.unsubscribe_event(eid) cb = tango.utils.EventCallback() # print events to stdout dp = tango.DeviceProxy("sys/tg_test/1") dp.poll_attribute("double_scalar", 1000) thread = tango.utils.PyTangoThread(target=thread_task) running = True thread.start() sleep(5) running = False thread.join()
Overriding tango.utils.PyTangoThread.run:
import tango from time import sleep class myPyTangoTask(tango.utils.PyTangoThread): def run(): eid = dp.subscribe_event( "double_scalar", tango.EventType.PERIODIC_EVENT, cb) while running: print(f"num events stored {len(cb.get_events())}") sleep(1) dp.unsubscribe_event(eid) cb = tango.utils.EventCallback() # print events to stdout dp = tango.DeviceProxy("sys/tg_test/1") dp.poll_attribute("double_scalar", 1000) thread = myPyTangoTask() running = True thread.start() sleep(5) running = False thread.join()
Here is an example directly using EnsureOmniThread:
import tango from threading import Thread from time import sleep def my_thread_run(): with tango.EnsureOmniThread(): eid = dp.subscribe_event( "double_scalar", tango.EventType.PERIODIC_EVENT, cb) while running: print(f"num events stored {len(cb.get_events())}") sleep(1) dp.unsubscribe_event(eid) cb = tango.utils.EventCallback() # print events to stdout dp = tango.DeviceProxy("sys/tg_test/1") dp.poll_attribute("double_scalar", 1000) thread = Thread(target=my_thread_run) running = True thread.start() sleep(5) running = False thread.join()
Added in version 9.3.2.