urtware / inc / urt_node.h @ 1f7ffcff
History | View | Annotate | Download (4.122 KB)
1 |
/*
|
---|---|
2 |
µRtWare is a lightweight publish/subscribe middleware for real-time
|
3 |
applications. It was developed as part of the software habitat for the
|
4 |
Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well.
|
5 |
|
6 |
Copyright (C) 2018..2020 Thomas Schöpping et al.
|
7 |
|
8 |
This program is free software: you can redistribute it and/or modify
|
9 |
it under the terms of the GNU General Public License as published by
|
10 |
the Free Software Foundation, either version 3 of the License, or
|
11 |
(at your option) any later version.
|
12 |
|
13 |
This program is distributed in the hope that it will be useful,
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
GNU General Public License for more details.
|
17 |
|
18 |
You should have received a copy of the GNU General Public License
|
19 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20 |
*/
|
21 |
|
22 |
#ifndef URTWARE_NODE_H
|
23 |
#define URTWARE_NODE_H
|
24 |
|
25 |
#include <urt_types.h> |
26 |
#include <urtware.h> |
27 |
|
28 |
/******************************************************************************/
|
29 |
/* CONSTANTS */
|
30 |
/******************************************************************************/
|
31 |
|
32 |
/******************************************************************************/
|
33 |
/* SETTINGS */
|
34 |
/******************************************************************************/
|
35 |
|
36 |
/******************************************************************************/
|
37 |
/* CHECKS */
|
38 |
/******************************************************************************/
|
39 |
|
40 |
/******************************************************************************/
|
41 |
/* DATA STRUCTURES AND TYPES */
|
42 |
/******************************************************************************/
|
43 |
|
44 |
/**
|
45 |
* @brief node
|
46 |
*/
|
47 |
typedef struct urt_node |
48 |
{ |
49 |
urt_node_t* next; |
50 |
urt_osThread_t* thread; |
51 |
urt_nodeSetupCallback_t* setupcallback; |
52 |
void* setupparams;
|
53 |
urt_nodeLoopCallback_t* loopcallback; |
54 |
void* loopparams;
|
55 |
urt_nodeShutdownCallback_t* shutdowncallback; |
56 |
void* shutdownparams;
|
57 |
urt_nodestage_t stage; |
58 |
urt_osEventListener_t listener; |
59 |
#if (URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING)
|
60 |
uint64_t loops; |
61 |
#endif /* URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING */ |
62 |
}urt_node_t; |
63 |
|
64 |
|
65 |
/**
|
66 |
* @brief
|
67 |
*
|
68 |
* @param[in] node .
|
69 |
* @param[in] cause .
|
70 |
* @param[in] arg .
|
71 |
*
|
72 |
* @return .
|
73 |
*
|
74 |
*/
|
75 |
typedef void (*urt_nodeShutdownCallback_t)(urt_node_t* node, urt_status_t cause, void* arg); |
76 |
|
77 |
|
78 |
/**
|
79 |
* @brief
|
80 |
*
|
81 |
* @param[in] node .
|
82 |
* @param[in] arg .
|
83 |
*
|
84 |
* @return .
|
85 |
*
|
86 |
*/
|
87 |
typedef urt_osEventMask_t (*urt_nodeSetupCallback_t)(urt_node_t* node, void* arg); |
88 |
|
89 |
|
90 |
/**
|
91 |
* @brief
|
92 |
*
|
93 |
* @param[in] node .
|
94 |
* @param[in] events .
|
95 |
* @param[in] arg .
|
96 |
*
|
97 |
* @return .
|
98 |
*/
|
99 |
typedef urt_osEventMask_t (*urt_nodeLoopCallback_t)(urt_node_t* node, urt_osEventMask_t events, void* arg); |
100 |
|
101 |
/******************************************************************************/
|
102 |
/* MACROS */
|
103 |
/******************************************************************************/
|
104 |
|
105 |
/******************************************************************************/
|
106 |
/* EXTERN DECLARATIONS */
|
107 |
/******************************************************************************/
|
108 |
|
109 |
#if defined(__cplusplus)
|
110 |
extern "C" { |
111 |
#endif /* defined(__cplusplus) */ |
112 |
|
113 |
void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback_t* setupcallback, void* setupparams, urt_nodeLoopCallback_t* loopcallback, void* loopparams, urt_nodeShutdownCallback_t* shutdowncallback, void* shutodwnparams); |
114 |
#if defined(__cplusplus)
|
115 |
} |
116 |
#endif /* defined(__cplusplus) */ |
117 |
|
118 |
/******************************************************************************/
|
119 |
/* INLINE FUNCTIONS */
|
120 |
/******************************************************************************/
|
121 |
|
122 |
#endif /* URTWARE_NODE_H */ |