RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
comms.oldb.OldbClient Class Reference

Wrapper to wait for an OLDB Client connection to be ready using Qt signals. More...

Inheritance diagram for comms.oldb.OldbClient:

Public Member Functions

 __init__ (self, QObject parent=None)
 Initialises object and logger.
 
bool is_connected (self)
 Returns true is the connection state is connected.
 
 sync_connect (self)
 Connects to OLDB synchronously.
 

Static Public Attributes

 connection_changed = Signal(int)
 
 connected = Signal(bool)
 
 disconnected = Signal(bool)
 
 error_detected = Signal(str)
 

Protected Member Functions

CiiOldb _get_oldb_instance (self)
 Static method that returns the CiiOldb object reference.
 
 _set_oldb_instance (self, CiiOldb oldb_instance)
 Static method that returns the CiiOldb object reference.
 

Protected Attributes

 _logger = CiiLogManager.get_logger(__name__)
 
int _connection_state = 0
 
str _error_msg = ""
 
CiiOldb _oldb_instance = None
 
RLock _oldb_mutex = RLock()
 
Task _task = None
 
 _oldb_factory = CiiOldbFactory
 

Detailed Description

Wrapper to wait for an OLDB Client connection to be ready using Qt signals.

The developer calls OldbClient().sync_connect(), and when the OldbClient instance has been successfully obtained, signals connection_changed(2) and connected(True) are emitted. This allows UI to wait for the OLDB Client connection.

In case of error, connection_changed(0), disconnected(True) and error_detected(str) are emitted.

While connecting, signal connection_changed(1) is emitted.

IMPORTANT   OldbClient().async_connect() is not usable at the moment due to limitation

on CiiOldbFactory.get_instance. It is commented for the time being.

Constructor & Destructor Documentation

◆ __init__()

comms.oldb.OldbClient.__init__ ( self,
QObject parent = None )

Initialises object and logger.

Member Function Documentation

◆ _get_oldb_instance()

CiiOldb comms.oldb.OldbClient._get_oldb_instance ( self)
protected

Static method that returns the CiiOldb object reference.

Since many widget start at the same time, this ensures that only one connection attempt is done, while the rest will automatically block and get the cached reference.

◆ _set_oldb_instance()

comms.oldb.OldbClient._set_oldb_instance ( self,
CiiOldb oldb_instance )
protected

Static method that returns the CiiOldb object reference.

Since many widget start at the same time, this ensures that only one connection attempt is done, while the rest will automatically block and get the cached reference.

◆ is_connected()

bool comms.oldb.OldbClient.is_connected ( self)

Returns true is the connection state is connected.

◆ sync_connect()

comms.oldb.OldbClient.sync_connect ( self)

Connects to OLDB synchronously.

This method will block.

Connected to the OLDB, and notifies using signals of the result of the connection attempt.

Returns
CiiOldb reference or None if not successful.
Note
This is a workaround. This should be moved to TaurusCiiAttribute implementation later. Also, a static method needs to be provided that can do the same.

Member Data Documentation

◆ _connection_state

int comms.oldb.OldbClient._connection_state = 0
protected

◆ _error_msg

comms.oldb.OldbClient._error_msg = ""
protected

◆ _logger

comms.oldb.OldbClient._logger = CiiLogManager.get_logger(__name__)
protected

◆ _oldb_factory

comms.oldb.OldbClient._oldb_factory = CiiOldbFactory
protected

◆ _oldb_instance

CiiOldb comms.oldb.OldbClient._oldb_instance = None
protected

◆ _oldb_mutex

RLock comms.oldb.OldbClient._oldb_mutex = RLock()
protected

◆ _task

Task comms.oldb.OldbClient._task = None
protected

◆ connected

comms.oldb.OldbClient.connected = Signal(bool)
static

◆ connection_changed

comms.oldb.OldbClient.connection_changed = Signal(int)
static

◆ disconnected

comms.oldb.OldbClient.disconnected = Signal(bool)
static

◆ error_detected

comms.oldb.OldbClient.error_detected = Signal(str)
static

The documentation for this class was generated from the following file: