S2OPC OPCUA Toolkit
sopc_event_handler.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 
20 #ifndef SOPC_EVENT_HANDLER_H_
21 #define SOPC_EVENT_HANDLER_H_
22 
23 #include <stdint.h>
24 
25 #include "sopc_enums.h"
26 
35 typedef struct _SOPC_EventHandler SOPC_EventHandler;
36 
43 typedef struct _SOPC_Looper SOPC_Looper;
44 
48 typedef struct
49 {
50  int32_t event;
51  uint32_t eltId;
52  uintptr_t params;
53  uintptr_t auxParam;
55 
59 typedef void SOPC_SetListenerFunc(SOPC_EventHandler* handler);
60 
68  int32_t event,
69  uint32_t eltId,
70  uintptr_t params,
71  uintptr_t auxParam);
72 
84 
97  int32_t event,
98  uint32_t eltId,
99  uintptr_t params,
100  uintptr_t auxParam);
101 
114  int32_t event,
115  uint32_t eltId,
116  uintptr_t params,
117  uintptr_t auxParam);
118 
127 SOPC_Looper* SOPC_Looper_Create(const char* threadName);
128 
138 
139 #endif // SOPC_EVENT_HANDLER_H_
SOPC_LooperEvent
Struct describing the various parts of an event.
Definition: sopc_event_handler.h:49
SOPC_LooperEvent::params
uintptr_t params
Definition: sopc_event_handler.h:52
SOPC_EventHandler_Create
SOPC_EventHandler * SOPC_EventHandler_Create(SOPC_Looper *looper, SOPC_EventHandler_Callback *callback)
Creates a new event handler and attaches it to an existing looper.
SOPC_EventHandler_PostAsNext
SOPC_ReturnStatus SOPC_EventHandler_PostAsNext(SOPC_EventHandler *handler, int32_t event, uint32_t eltId, uintptr_t params, uintptr_t auxParam)
Posts an event to the front of the event handler's message queue.
SOPC_Looper_Create
SOPC_Looper * SOPC_Looper_Create(const char *threadName)
Creates a new looper and attaches it to a new thread.
sopc_enums.h
SOPC_SetListenerFunc
void SOPC_SetListenerFunc(SOPC_EventHandler *handler)
Function prototype for connecting an event emitter to a listener.
Definition: sopc_event_handler.h:59
SOPC_Looper_Delete
void SOPC_Looper_Delete(SOPC_Looper *looper)
Stops a looper and releases all resources allocated to it.
SOPC_Looper
struct _SOPC_Looper SOPC_Looper
Manages the processing of events on a given thread.
Definition: sopc_event_handler.h:43
SOPC_LooperEvent::event
int32_t event
Definition: sopc_event_handler.h:50
SOPC_EventHandler_Post
SOPC_ReturnStatus SOPC_EventHandler_Post(SOPC_EventHandler *handler, int32_t event, uint32_t eltId, uintptr_t params, uintptr_t auxParam)
Posts an event to the back of the event handler's message queue.
SOPC_LooperEvent::auxParam
uintptr_t auxParam
Definition: sopc_event_handler.h:53
SOPC_LooperEvent::eltId
uint32_t eltId
Definition: sopc_event_handler.h:51
SOPC_EventHandler_Callback
void SOPC_EventHandler_Callback(SOPC_EventHandler *handler, int32_t event, uint32_t eltId, uintptr_t params, uintptr_t auxParam)
Function prototype for message processing callbacks.
Definition: sopc_event_handler.h:67
SOPC_EventHandler
struct _SOPC_EventHandler SOPC_EventHandler
Processes messages from a queue.
Definition: sopc_event_handler.h:35
SOPC_ReturnStatus
SOPC_ReturnStatus
Definition: libs2opc_client.h:64