eap_timer_queue_c Class Reference
User of the timer queue must be inherited from abs_eap_base_timer_c. The abs_eap_base_timer_c class is the call back interface from timer queue to the user. Note the timer queue interface is used through abs_eap_am_tools_c. Functions are abs_eap_am_tools_c::get_timer_resolution_ms(), abs_eap_am_tools_c::set_timer(), abs_eap_am_tools_c::cancel_timer(), abs_eap_am_tools_c::cancel_all_timers() and abs_eap_am_tools_c::pulse_timer()In the following figure m_timer_queue is pointer to the first timer event in the list. The timer list is horizontal list right from m_timer_queue. Each timer event in the list represents one time segment that must elapse to zero before event is active. Timer event - the square box in the figure - is type of eap_timer_queue_event_c. Each time segment includes list of the same time values, the vertical lists.
Place for new timer event is found by stepping the the horizontal timer list and adding the time values sum until the list ends or time sum is equal or greater than time of the new timer event. If time sum is equal to the time of the new timer event, the new timer event is added to the second in the vertical list. If time sum is greater than the time of the new timer event, the new timer event is added before the existing time event. In this case a new vertical list is created. If the list ends the new time event is added to the end of the timer queue.
+---------------+ +---------------+ +---------------+
m_timer_queue->| m_time_ms 0 |->| m_time_ms 2000|->| m_time_ms 500 | // This horizontal list is the timer queue.
+---------------+ +---------------+ +---------------+
| | |
V V V
+---------------+ +---------------+ +---------------+
| m_time_ms 0 | | m_time_ms 0 | | m_time_ms 0 |
+---------------+ +---------------+ +---------------+
| |
V V
+---------------+ +---------------+
| m_time_ms 0 | | m_time_ms 0 |
+---------------+ +---------------+
|
V
+---------------+
| m_time_ms 0 |
+---------------+
// Each vertical list includes the timer events that have the same time.
Constructor & Destructor Documentation
eap_timer_queue_c(abs_eap_am_tools_c *const, const u32_t)
Constructor initializes the timer queue.
Parameters
abs_eap_am_tools_c *const tools | |
const u32_t timer_resolution_ms | is the resolution in milli seconds of this timer. The pulse() member function is assumed to be called using timer_resolution_ms interval. |
~eap_timer_queue_c()
~eap_timer_queue_c | ( | ) | [virtual] |
Destructor does nothing special. Note user is assumed to call cancel_all_timers() before timer queue is deleted.
Member Functions Documentation
add_end_of_vertical_list(eap_timer_queue_event_c *, eap_timer_queue_event_c *)
add_hash_of_timer_event(eap_timer_queue_event_c *const, const abs_eap_base_timer_c *const, const u32_t)
add_new_pending_timer(eap_timer_queue_event_c *)
add_pending_timer()
New timer events are added with this function because the next pulse might be very long, and the long pulse will cause the new event expire immediately. By using this function the shortest timer events in the timer queue are handled and after that the new timer events are added to timer queue.
add_timer(eap_timer_queue_event_c *)
This function adds the timer event immediately to timer queue.
cancel_all_timers()
This function cancels all timer events from this timer queue. This is called before the timer queue is deleted.
cancel_pending_timer(abs_eap_base_timer_c *const, const u32_t)
This function cancels all pending timer events.
cancel_timer(abs_eap_base_timer_c *const, const u32_t)
This function cancels the timer event.
Parameters
abs_eap_base_timer_c *const initializer | is the caller of this function. Call backs are directed to initializer. |
const u32_t id | is selected by caller. Caller could separate timer events by this value. |
deactivate_timer_queue()
void | deactivate_timer_queue | ( | ) | [private] |
This function deactivate this timer queue. This is called before the timer queue is deleted. Inactive timer queue does not accept new timer events.
get_hashed_timer_event(const abs_eap_base_timer_c *const, const u32_t)
get_is_valid()
The get_is_valid() function returns the status of the eap_core object. True indicates the object is initialized succesfully.
get_timer_queue_is_empty()
bool | get_timer_queue_is_empty | ( | ) | |
get_timer_resolution_ms()
u32_t
| get_timer_resolution_ms | ( | ) | |
get_use_eap_milli_second_timer()
bool | get_use_eap_milli_second_timer | ( | ) | |
This function returns flag whether millisecond timer is in use (true) or not (false).
hash(const u32_t, const abs_eap_base_timer_c *const, const u32_t)
pulse_timer(const u32_t, const bool)
u32_t
| pulse_timer | ( | const u32_t | elapsed_time_in_ms, |
| const bool | can_call_timer_expired_when_true |
| ) | |
The pulse() member function is assumed to be called using timer_resolution_ms interval. This function decreases the remaining time of the first timer event. When remaining time reaches zero the timer queue calls the timer_expired() function. Function returns the next sleep time in milli seconds.
Parameters
const u32_t elapsed_time_in_ms | |
const bool can_call_timer_expired_when_true | |
re_activate_timer_queue()
This function re-activates timer queue. Symbian AM call this function when AM-tools object is re-used. This can be called after cancel_all_timers() function. cancel_all_timers() function de-activated timer queue.
remove_hash_of_timer_event(eap_timer_queue_event_c *const)
set_timer(abs_eap_base_timer_c *const, const u32_t, void *const, const u32_t)
This function initializes a new timer event.
Parameters
abs_eap_base_timer_c *const initializer | is the caller of this function. Call backs are directed to initializer. |
const u32_t id | is selected by caller. Caller could separate timer events by this value. |
void *const data | is pointer to any data. After timer is alapsed or cancelled timer queue calls timer_delete_data() function. The initializer could delete possible allocated data. |
const u32_t time_ms | |
set_timer_resolution_ms(const u32_t)
void | set_timer_resolution_ms | ( | const u32_t | timer_resolution_ms | ) | |
Parameters
const u32_t timer_resolution_ms | |
set_use_eap_milli_second_timer(const bool)
void | set_use_eap_milli_second_timer | ( | const bool | use_eap_millisecond_timer | ) | |
This function activates millisecond timer with true value.
Parameters
const bool use_eap_millisecond_timer | |
trace_timer()
void | trace_timer | ( | ) | [private] |
This function traces all initialized timer events.
trace_timer_event(const eap_const_string, const eap_timer_queue_event_c *const)
this function traces one timer event.
Member Data Documentation
abs_eap_am_tools_c *const m_am_tools
eap_timer_queue_hash_c * m_map
eap_timer_queue_event_c * m_new_event_begin
These are begin and end of the list of new events that are will be added to timer queue during the next pulse_timer() function call.
eap_timer_queue_event_c * m_new_event_end
eap_timer_queue_event_c * m_timer_queue
u32_t
m_timer_resolution_ms
u32_t
| m_timer_resolution_ms | [private] |
This is the resolution of this timer queue. Each pulse is assumed to be this length. This is also the minimum timer value.
bool m_use_eap_millisecond_timer
bool | m_use_eap_millisecond_timer | [private] |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.