Telematics SDK - Interface Specification  v1.38.19
TCU Activity Manager

Data Structures

class  telux::power::PowerFactory
 PowerFactory allows creation of TCU-activity manager instance. More...
 
class  telux::power::ITcuActivityListener
 Listener class for getting notifications related to TCU-activity state and also the updates related to TCU-activity service status. The client needs to implement these methods as briefly as possible and avoid blocking calls in it. The methods in this class can be invoked from multiple different threads. Client needs to make sure that the implementation is thread-safe. More...
 
class  telux::power::ITcuActivityManager
 ITcuActivityManager provides interface to register and de-register listeners (to get TCU-activity state updates). And also API to initiate TCU-activity state transition. More...
 

Enumerations

enum  telux::power::TcuActivityState { telux::power::TcuActivityState::UNKNOWN, telux::power::TcuActivityState::SUSPEND, telux::power::TcuActivityState::RESUME, telux::power::TcuActivityState::SHUTDOWN }
 
enum  telux::power::TcuActivityStateAck { telux::power::TcuActivityStateAck::SUSPEND_ACK, telux::power::TcuActivityStateAck::SHUTDOWN_ACK }
 
enum  telux::power::ClientType { telux::power::ClientType::SLAVE, telux::power::ClientType::MASTER }
 

Detailed Description

This section contains APIs related to TCU activity state management.


Data Structure Documentation

class telux::power::PowerFactory

PowerFactory allows creation of TCU-activity manager instance.

Public Member Functions

std::shared_ptr< ITcuActivityManagergetTcuActivityManager (ClientType clientType=ClientType::SLAVE)
 

Static Public Member Functions

static PowerFactorygetInstance ()
 

Member Function Documentation

static PowerFactory& telux::power::PowerFactory::getInstance ( )
static

API to get the factory instance for TCU-activity management

std::shared_ptr<ITcuActivityManager> telux::power::PowerFactory::getTcuActivityManager ( ClientType  clientType = ClientType::SLAVE)

API to get the TCU-activity Manager instance

Parameters
[in]typeType of the client that is going to access ITcuActivityManager APIs ClientType
Returns
Pointer of ITcuActivityManager object.
class telux::power::ITcuActivityListener

Listener class for getting notifications related to TCU-activity state and also the updates related to TCU-activity service status. The client needs to implement these methods as briefly as possible and avoid blocking calls in it. The methods in this class can be invoked from multiple different threads. Client needs to make sure that the implementation is thread-safe.

Public Member Functions

virtual void onTcuActivityStateUpdate (TcuActivityState state)
 
virtual void onSlaveAckStatusUpdate (telux::common::Status status)
 
virtual ~ITcuActivityListener ()
 

Constructor & Destructor Documentation

virtual telux::power::ITcuActivityListener::~ITcuActivityListener ( )
virtual

Destructor of ITcuActivityListener

Member Function Documentation

virtual void telux::power::ITcuActivityListener::onTcuActivityStateUpdate ( TcuActivityState  state)
virtual

This function is called when the TCU-activity state is going to change.

Parameters
[in]stateTCU-activity state that system is about to enter
virtual void telux::power::ITcuActivityListener::onSlaveAckStatusUpdate ( telux::common::Status  status)
virtual

This function is called with the overall acknowledgement status from all the SLAVE clients, for state change triggered previously by MASTER client.

This API will be invoked only for the MASTER client. If at least one SLAVE client does not acknowledge within the configured timeout, then Status::EXPIRED would be reported.

Parameters
[in]statusstatus of the SLAVE clients acknowledgements
class telux::power::ITcuActivityManager

ITcuActivityManager provides interface to register and de-register listeners (to get TCU-activity state updates). And also API to initiate TCU-activity state transition.

Public Member Functions

virtual bool isReady ()=0
 
virtual std::future< bool > onReady ()=0
 
virtual telux::common::Status registerListener (std::weak_ptr< ITcuActivityListener > listener)=0
 
virtual telux::common::Status deregisterListener (std::weak_ptr< ITcuActivityListener > listener)=0
 
virtual telux::common::Status registerServiceStateListener (std::weak_ptr< telux::common::IServiceStatusListener > listener)=0
 
virtual telux::common::Status deregisterServiceStateListener (std::weak_ptr< telux::common::IServiceStatusListener > listener)=0
 
virtual telux::common::Status setActivityState (TcuActivityState state, telux::common::ResponseCallback callback=nullptr)=0
 
virtual TcuActivityState getActivityState ()=0
 
virtual telux::common::Status sendActivityStateAck (TcuActivityStateAck ack)=0
 
virtual ~ITcuActivityManager ()
 

Constructor & Destructor Documentation

virtual telux::power::ITcuActivityManager::~ITcuActivityManager ( )
virtual

Destructor of ITcuActivityManager

Member Function Documentation

virtual bool telux::power::ITcuActivityManager::isReady ( )
pure virtual

Checks the status of TCU-activity services and if the other APIs are ready for use, and returns the result.

Returns
True if the services are ready otherwise false.
virtual std::future<bool> telux::power::ITcuActivityManager::onReady ( )
pure virtual

Wait for TCU-activity services to be ready.

Returns
A future that caller can wait on to be notified when TCU-activity services are ready.
virtual telux::common::Status telux::power::ITcuActivityManager::registerListener ( std::weak_ptr< ITcuActivityListener listener)
pure virtual

Register a listener for updates on TCU-activity state changes.

Parameters
[in]listenerPointer of ITcuActivityListener object that processes the notification
Returns
Status of registerListener i.e success or suitable status code.
virtual telux::common::Status telux::power::ITcuActivityManager::deregisterListener ( std::weak_ptr< ITcuActivityListener listener)
pure virtual

Remove a previously registered listener.

Parameters
[in]listenerPreviously registered ITcuActivityListener that needs to be removed
Returns
Status of deregisterListener, success or suitable status code
virtual telux::common::Status telux::power::ITcuActivityManager::registerServiceStateListener ( std::weak_ptr< telux::common::IServiceStatusListener listener)
pure virtual

Register a listener for updates on TCU-activity management service status.

Parameters
[in]listenerPointer of IServiceStatusListener object that processes the notification
Returns
Status of registerServiceStateListener i.e success or suitable status code.
virtual telux::common::Status telux::power::ITcuActivityManager::deregisterServiceStateListener ( std::weak_ptr< telux::common::IServiceStatusListener listener)
pure virtual

Remove a previously registered listener for service status updates.

Parameters
[in]listenerPreviously registered IServiceStatusListener that needs to be removed
Returns
Status of deregisterServiceStateListener, success or suitable status code
virtual telux::common::Status telux::power::ITcuActivityManager::setActivityState ( TcuActivityState  state,
telux::common::ResponseCallback  callback = nullptr 
)
pure virtual

Initiate a TCU-activity state transition.

This API needs to be used cautiously, as it could change the power-state of the system and may affect other processes.

This API is meant for clients that have instantiated the ITcuActivityManager instance using ClientType::MASTER

Parameters
[in]stateTCU-activity state that the System is intended to enter
[in]callbackOptional callback to get the response for the TCU-activity state transition command
Returns
Status of setActivityState i.e. success or suitable status code.
virtual TcuActivityState telux::power::ITcuActivityManager::getActivityState ( )
pure virtual

Get the current TCU-activity state.

Returns
TcuActivityState
virtual telux::common::Status telux::power::ITcuActivityManager::sendActivityStateAck ( TcuActivityStateAck  ack)
pure virtual

API to send the acknowledgement, after processing a TCU-activity state notification. This indicates that the client is prepared for state transition.Only one acknowledgement is expected from a single client process(may have multiple listeners).

Parameters
[in]ackAcknowledgement for a TCU-activity state notification.
Returns
Status of sendActivityStateAck i.e. success or suitable status code.

Enumeration Type Documentation

Defines the supported TCU-activity states that the listeners will be notified about.

Enumerator
UNKNOWN 

To indicate that system state information is not available

SUSPEND 

System is going to SUSPEND state

RESUME 

System is going to RESUME state

SHUTDOWN 

System is going to SHUTDOWN

Defines the acknowledgements to TCU-activity states.The client process sends this after processing the TcuActivityState notification, indicating that it is prepared for state transition

Acknowledgement for TcuActivityState::RESUME is not required, as the state transition has already happened.

Enumerator
SUSPEND_ACK 

processed TcuActivityState::SUSPEND notification

SHUTDOWN_ACK 

processed TcuActivityState::SHUTDOWN notification

Defines the type of the client that would be using the ITcuActivityManager APIs. Client that just needs the TcuActivityState notifications needs to choose ClientType::SLAVE. And the client that determines the TcuActivityState would choose ClientType::MASTER. Only a Master client can set the TcuActivityState. In a system, there should be a single Master client.

The ClientType needs to be chosen while instantiating the ITcuActivityManager, using the API PowerFactory::getTcuActivityManager

Enumerator
SLAVE 

Client is a slave and interested in state change notification

MASTER 

Client makes the decision on when the TcuActivityState should change