QtMobility Reference Documentation

QSystemAlignedTimer Class Reference

The QSystemAlignedTimer class provides a service for applications to synchronize their activity. More...

 #include <QSystemAlignedTimer>

Inherits: QObject.

This class was introduced in Qt Mobility 1.2.

Public Types

enum AlignedTimerError { NoError, AlignedTimerNotSupported, InvalidArgument, TimerFailed, InternalError }


  • 1 property inherited from QObject

Public Functions

QSystemAlignedTimer ( QObject * parent = 0 )
~QSystemAlignedTimer ()
bool isActive () const
bool isSingleShot () const
AlignedTimerError lastError () const
int maximumInterval () const
int minimumInterval () const
void setMaximumInterval ( int seconds )
void setMinimumInterval ( int seconds )
void setSingleShot ( bool singleShot )
void wokeUp ()
  • 29 public functions inherited from QObject

Public Slots

void start ( int minimumTime, int maximumTime )
void start ()
void stop ()
  • 1 public slot inherited from QObject


void error ( QSystemAlignedTimer::AlignedTimerError error )
void timeout ()

Static Public Members

void singleShot ( int minimumTime, int maximumTime, QObject * receiver, const char * member )
  • 4 static public members inherited from QObject

Additional Inherited Members

  • 1 public variable inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QSystemAlignedTimer class provides a service for applications to synchronize their activity.

QSystemAlignedTimer is a fuzzy timer that allows applications that must do periodic activity like after being in sleep mode a certain period, to synchronize their activities in the same window of time.

For example send network "alive" messages at the same time (i.e. turn the wireless radio on at the same time).

The service is not only for network-aware applications, it is for use by any applications that need to periodic wake-ups.

The recommended use case is when app uses single-shot timer only: set mintime 0 for the first call 'to jump to the train' and mintime > 0 after 1st wakeup.

Member Type Documentation

enum QSystemAlignedTimer::AlignedTimerError

This enum describes the last known AlignedTimerError

QSystemAlignedTimer::NoError0No error.
QSystemAlignedTimer::AlignedTimerNotSupported1The aligned timer is not support on this platform
QSystemAlignedTimer::InvalidArgument2Interval arguments are invalid.
QSystemAlignedTimer::TimerFailed3General timer failure.
QSystemAlignedTimer::InternalError4Internal error.

Property Documentation

active : const bool

Returns true if the timer is running; otherwise false.

Access functions:

bool isActive () const

maximumInterval : int

This property holds the timer's maximumInterval.

Returns this current timer maximum interval.

Access functions:

int maximumInterval () const
void setMaximumInterval ( int seconds )

minimumInterval : int

This property holds the timers's minimumInterval.

Returns this current timer minimum interval.

Access functions:

int minimumInterval () const
void setMinimumInterval ( int seconds )

singleShot : bool

Whether the timer is single shot.

Access functions:

bool isSingleShot () const
void setSingleShot ( bool singleShot )

Member Function Documentation

QSystemAlignedTimer::QSystemAlignedTimer ( QObject * parent = 0 )

Constructs a QSystemAlignedTimer object with the given parent.

QSystemAlignedTimer::~QSystemAlignedTimer ()

Destructs the QSystemAlignedTimer

void QSystemAlignedTimer::error ( QSystemAlignedTimer::AlignedTimerError error ) [signal]

This signal is emitted when an error happens.

AlignedTimerError QSystemAlignedTimer::lastError () const

Returns the last AlignedTimerError.

void QSystemAlignedTimer::singleShot ( int minimumTime, int maximumTime, QObject * receiver, const char * member ) [static]

This static function starts a timer to call a slot after a minimumTime interval has elapsed, and ensures that it will be called before the maximumTime has elapsed.

These values are specified in seconds.

The receiver is the receiver object and the member is the slot.

See also setSingleShot().

void QSystemAlignedTimer::start ( int minimumTime, int maximumTime ) [slot]

Starts the timer with the minimal interval of minimumTime, and maximum interval maximumTime in seconds.

This is not a guaranteed interval, and the timeout signal may be fired at any time, depending on other clients attached to this timer.

In the case of minimalInterval of 0, it means 'wake me up when someone else is woken up'.

If you need a window of time in which your timer should fire, use QSystemAlignedTimer::setWindow

void QSystemAlignedTimer::start () [slot]

Starts the alignedtimer.

void QSystemAlignedTimer::stop () [slot]

Stops this timer request.

void QSystemAlignedTimer::timeout () [signal]

This signal is emitted when the timer times out.

void QSystemAlignedTimer::wokeUp ()

This should be called when the application wakes up via other means than QSystemAlignedTimer timeout.

Other applications that are in their wakeup window *may* be woken up. Single-shot timer is canceled, and reoccuring timer interval will restart.

Symbian does not support this wokeUp call for reoccuring timers and will simply ignore it.


Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.