S2OPC OPCUA Toolkit
sopc_event_timer_manager.h
Go to the documentation of this file.
1 /*
2  * Licensed to Systerel under one or more contributor license
3  * agreements. See the NOTICE file distributed with this work
4  * for additional information regarding copyright ownership.
5  * Systerel licenses this file to you under the Apache
6  * License, Version 2.0 (the "License"); you may not use this
7  * file except in compliance with the License. You may obtain
8  * a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
30 #ifndef SOPC_EVENT_TIMER_MANAGER_H_
31 #define SOPC_EVENT_TIMER_MANAGER_H_
32 
33 #include "sopc_event_handler.h"
34 #include "sopc_time.h"
35 
40 #ifndef SOPC_TIMER_RESOLUTION_MS
41 #define SOPC_TIMER_RESOLUTION_MS 50
42 #endif
43 
44 #if SOPC_TIMER_RESOLUTION_MS <= 0
45 #error "Timer resolution cannot be <= 0"
46 #endif
47 
53 
60 
66 
78 uint32_t SOPC_EventTimer_Create(SOPC_EventHandler* eventHandler, SOPC_LooperEvent event, uint64_t msDelay);
79 
90 uint32_t SOPC_EventTimer_CreatePeriodic(SOPC_EventHandler* eventHandler, SOPC_LooperEvent event, uint64_t msPeriod);
91 
102 bool SOPC_EventTimer_ModifyPeriodic(uint32_t timerId, uint64_t msPeriod);
103 
110 void SOPC_EventTimer_Cancel(uint32_t timerId);
111 
112 #endif /* SOPC_EVENT_TIMER_MANAGER_H_ */
SOPC_LooperEvent
Struct describing the various parts of an event.
Definition: sopc_event_handler.h:49
SOPC_EventTimer_Clear
void SOPC_EventTimer_Clear(void)
Clear the event timer manager (cancel all timers not already triggered) SOPC_EventTimer_PreClear is a...
sopc_event_handler.h
SOPC_EventTimer_Initialize
void SOPC_EventTimer_Initialize(void)
Initialize the event timer manager (necessary to create timers)
SOPC_EventTimer_Cancel
void SOPC_EventTimer_Cancel(uint32_t timerId)
Cancel a started timer.
SOPC_EventTimer_PreClear
void SOPC_EventTimer_PreClear(void)
PreClear the event timer manager: thread triggering timers is stopped. It might be called prior to SO...
sopc_time.h
SOPC_EventTimer_ModifyPeriodic
bool SOPC_EventTimer_ModifyPeriodic(uint32_t timerId, uint64_t msPeriod)
Modifies an existing periodic timer period.
SOPC_EventTimer_Create
uint32_t SOPC_EventTimer_Create(SOPC_EventHandler *eventHandler, SOPC_LooperEvent event, uint64_t msDelay)
Create a timer which will raise the given event parameters to the given event dispatch manager.
SOPC_EventTimer_CreatePeriodic
uint32_t SOPC_EventTimer_CreatePeriodic(SOPC_EventHandler *eventHandler, SOPC_LooperEvent event, uint64_t msPeriod)
Creates a periodic timer raising an event on a dispatch manager every msPeriod milliseconds.
SOPC_EventHandler
struct _SOPC_EventHandler SOPC_EventHandler
Processes messages from a queue.
Definition: sopc_event_handler.h:35