Maemo System listener class, checks for system state changes in Maemo environment.
Inheritance:
Public Methods
-
CMaemoSystemListener()
- Default constructor - not used
-
CMaemoSystemListener(MAbstractStateConverter* aConverter)
- Constructor, initializes necessary variables.
-
~CMaemoSystemListener()
- Destructor, closes connection to DBUS
-
bool Connect()
- Connects listener into defined DBUS-interface
-
void Disconnect()
- Disconnects the listener from DBUS
-
void CheckInitialState()
- Checks the system state at startup
-
void CheckState()
- Checks the system state
-
const std::string& GetName()
- Returns the name of this listener
-
bool SetupConnection()
- Sets up the connection to DBUS
-
bool RegisterSignals()
- Registers listener to signal(s) and interface(s)
-
void HandleMessage(DBusMessage* message)
- Handles the message (signal) from D-Bus
Documentation
The purpose of this class is to check and listen for system state changes in
Maemo via DBUS. Usage: periodically calls to CheckState()-function which every
time checks the first message in the message queue, if the state can be read from
the message appropriate function of owner component is called. Uses a private
connection to DBUS for listening messages, registers to com.nokia.mce.signal and
com.nokia.bme.signal for listening. System state is requested from com.nokia.mce.request
interface at start. This is meant to be used by PeerHood daemon only.
CMaemoSystemListener()
-
Cannot be used.
CMaemoSystemListener(MAbstractStateConverter* aConverter)
-
Constructor sets the name (hardcoded..) of the listener and registers
itself with given component.
- Parameters:
- aConverter - Component that will own this listener, cannot be NULL!
~CMaemoSystemListener()
-
Destructor only closes the connection to DBUS if it seems to be active.
If iConnection isn't NULL it will be closed - closing cannot be checked.
bool Connect()
-
A facade for conneting the listener to DBUS-interface, actually calls
internal functions to set up the connection and to register listener.
- Returns:
- bool, true if success
void Disconnect()
-
Disconnects the connection to DBUS (required by private DBUS connection)
if the connection wasn't closed earlier.
void CheckInitialState()
-
Checks the Maemo environment state at startup by sending a pending call
(request) into the interface of mce requesting the current state of the system.
Function then waits for the answer and sets the state of the daemon corresponding
to the state returned by DBUS. Possible states are NORMAL and FLIGHT modes,
if the mode is unknown daemon is set to offline/passive mode. Doesn't check the
battery state.
void CheckState()
-
Called periodically by daemon. This function pops the first message from the
queue and checks the message for state changes, the queue isn't going to be long
because listener has a private connection to DBUS and listens only one interface
that sends only messages regarding the system state change. HandleMessage()-
function is called to check the message if there is a message in the queue, otherwise
nothing is done.
const std::string& GetName()
-
Returns the name that was set in constructor.
bool SetupConnection()
-
Sets up the private connection to DBUS.
- Returns:
- true when success, false in case of connection error
bool RegisterSignals()
-
Registers this listener to com.nokia.mce.signal and com.nokia.bme.signal
interfaces for listening system and battery state change messages.
- Returns:
- true if success, false in case of error
void HandleMessage(DBusMessage* message)
-
Handles the given message, reacts to signals from com.nokia.mce.signal
and com.nokia.bme.signal interfaces. From mce FLIGHT and NORMAL signals are
recognized and the state of the connected component is changed accordingly.
From bme signals related to battery state changes (battery low, charging) are
recognized and reacted. When the battery is on low charge connected component
(PeerHood daemon) is set to passive mode.
- Parameters:
- message - The message to be handled.
- This class has no child classes.
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.