Windows implementation of High-precision periodic timer (MultiMedia timer).
More...
#include <MpMMTimerWnt.h>
|
static const char *const | TYPE = "Windows Multimedia" |
|
|
static void CALLBACK | timeProcCallback (UINT uID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) |
| Callback used by Windows Multimedia Timers. More...
|
|
Windows implementation of High-precision periodic timer (MultiMedia timer).
This timer is implemented using Microsoft Multimedia timers (W95+, CE). Other possible choices, which have yet to be implemented: 1) Microsoft Waitable Timers (W98/NT+) 2) Microsoft Queue Timers (W2k+) Queue timers would be good to support though! They have less overhead, and similar high resolution. See http://www.codeproject.com/system/timers_intro.asp
OsStatus setNotification |
( |
OsNotification * |
notification | ) |
|
|
virtual |
Set notification for the OsNotification timer type.
Signals will be sent to this notification when the timer ticks. Pointer to this timer instance will be set in eventData
member.
- Parameters
-
[in] | notification | - object to notify when timer fires/ticks. |
- Return values
-
OS_SUCCESS | Returned when notification is set. |
OS_INVALID_STATE | Returned when calling this function for non-Notification timer type. |
OS_FAILED | Returned when mandatory initialization failed (maybe in the constructor) and later calls will fail for this instance also. |
Reimplemented from MpMMTimer.
OsStatus run |
( |
unsigned |
usecPeriodic | ) |
|
|
virtual |
Start periodical firing.
Start periodical firing with given period and fire type.
- Parameters
-
[in] | usecPeriodic | timer period in microseconds. |
- Return values
-
OS_SUCCESS | Returns when timer has been created and ran. |
OS_INVALID_ARGUMENT | Returns when either value of uAlgorithm doesn't support in current realization or running OS couldn't create timer with specified usecPeriodic , but with another value of it, it could. |
OS_INVALID_STATE | Returns when timer has already been started or if the timer type is not supported. |
OS_LIMIT_REACHED | Returns when timer couldn't run due the resource limitation. |
OS_FAILED | Returns when mandatories initializations failed (maybe in constructor) and later calls will also fail for this instance. |
Implements MpMMTimer.
Stop periodical firing.
Stop periodical timer.
- Return values
-
OS_SUCCESS | Returns when timer has been stopped. |
OS_FAILED | Returns when mandatory initialization failed (maybe in constructor) and later calls for this instance will fail. |
OS_INVALID_STATE | Returns when timer has not been started. |
Implements MpMMTimer.
OsStatus waitForNextTick |
( |
| ) |
|
|
virtual |
Block this thread until the next tick occurs
- Return values
-
OS_SUCCESS | Returns when next tick period occurs. |
OS_INVALID_STATE | Returns when calling this function for non-Linear timer type. |
OS_FAILED | Returns when mandatory initialization failed (maybe in constructor) and later calls for this instance will fail too. |
Reimplemented from MpMMTimer.
OsStatus getResolution |
( |
unsigned & |
resolution | ) |
|
|
virtual |
Get resolution of timer in microseconds.
- Parameters
-
[out] | resolution | - set to the finest resolution timer we can generate. |
- Return values
-
OS_SUCCESS | - the resolution was able to be retrieved. |
OS_FAILED | - the resolution wasn't able to be retrieved. |
Reimplemented from MpMMTimer.
OsStatus getPeriodRange |
( |
unsigned * |
pMinUSecs, |
|
|
unsigned * |
pMaxUSecs = NULL |
|
) |
| |
|
virtual |
Get the range of timer periods that can be generated.
- Parameters
-
[out] | pMinUSecs | - set to the smallest period we can generate. |
[out] | pMaxUSecs | - set to the largest period we can generate. |
- Return values
-
OS_SUCCESS | - the min and max periods were able to be retrieved. |
OS_FAILED | - the min and max periods weren't able to be retrieved. |
Reimplemented from MpMMTimer.
void CALLBACK timeProcCallback |
( |
UINT |
uID, |
|
|
UINT |
uMsg, |
|
|
DWORD_PTR |
dwUser, |
|
|
DWORD_PTR |
dw1, |
|
|
DWORD_PTR |
dw2 |
|
) |
| |
|
staticprotected |
Callback used by Windows Multimedia Timers.
const char *const TYPE = "Windows Multimedia" |
|
static |
Whether we're fully initialized or not, or are in some failure state.
Indicator of timer started or not.
The current millisecond period being used. 0 when no timer.
Cached timer resolution in ms, queried for and stored at startup.
Only valid in Linear mode, holds handle to an event.
OsNotification* mpNotification |
|
protected |
Notification object used to signal a tick of the timer.
The ID of the MM timer we're using.