urtware / doc / classdiagrams / overview.uml @ 6ebd2388
History | View | Annotate | Download (22.302 KB)
1 | 6ebd2388 | Thomas Schöpping | /' |
---|---|---|---|
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..2018 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 | @startuml |
||
23 | |||
24 | title **µRtWare**\nOverview\n |
||
25 | |||
26 | |||
27 | |||
28 | package "primitives" { |
||
29 | |||
30 | /' Temporal delay in microseconds. '/ |
||
31 | class urt_delay_t <<(T,lightblue)>> { |
||
32 | .. either .. |
||
33 | uint32_t |
||
34 | .. or .. |
||
35 | uint64_t |
||
36 | } |
||
37 | |||
38 | /' Well defined error codes. '/ |
||
39 | enum urt_status_t { |
||
40 | URT_STATUS_OK = 0 |
||
41 | URT_STATUS_WARNING = 1 |
||
42 | URT_STATUS_ERROR = -1 |
||
43 | } |
||
44 | |||
45 | /' Topic ID type. '/ |
||
46 | class urt_topicid_t <<(T,lightblue)>> { |
||
47 | 'configurable |
||
48 | uin8_t |
||
49 | .. or .. |
||
50 | uint16_t |
||
51 | .. or .. |
||
52 | uint32_t |
||
53 | .. or .. |
||
54 | uint64_t |
||
55 | } |
||
56 | |||
57 | } /' package "primitives" '/ |
||
58 | |||
59 | |||
60 | |||
61 | package "interfaces" { |
||
62 | |||
63 | /' OS time type with arbitrary resolution. '/ |
||
64 | class urt_osTime_t <<(T,lightblue)>> { |
||
65 | 'Converts an OS time to 64 bit microsecond precise value. |
||
66 | + urtTime2Us (t : urt_osTime_t*) : uint64_t |
||
67 | 'Retrieves the current time. |
||
68 | + urtTimeNow (void) : urt_osTime_t |
||
69 | } |
||
70 | |||
71 | /' OS mutex lock interface. '/ |
||
72 | class urt_osMutex_t <<(T,lightblue)>> { |
||
73 | 'Initializes a urt_osMutex_t object. |
||
74 | + urtMutexInit (mutex : urt_osmutex_t*) : void |
||
75 | 'Block the thread until the mutex could be locked. |
||
76 | + urtMutexLock (mutex : urt_osmutex_t*) : void |
||
77 | 'Tries to lock the mutex, but does not block but immediately returns an indicator. |
||
78 | + urtMutexTryLock (mutex : urt_osmutex_t*) : bool |
||
79 | 'Unlocks a previously locked mutex. |
||
80 | + urtMutexUnlock (mutex : urt_osmutex_t*) : void |
||
81 | } |
||
82 | |||
83 | package "condition variable" { |
||
84 | |||
85 | /' Return type for the wait function on condition variables. '/ |
||
86 | enum urt_condvarStatus_t { |
||
87 | 'The condition variable has been signaled. |
||
88 | + URT_CONDVAR_STATUS_SIGNAL = 0 |
||
89 | 'The condition variable has been broadcasted. |
||
90 | + URT_CONDVAR_STATUS_BROADCAST = 1 |
||
91 | 'The wait function timed out. |
||
92 | + URT_CONDVAR_STATUS_TIMEOUT = 2 |
||
93 | } |
||
94 | |||
95 | /' Condition variable interface. '/ |
||
96 | class urt_osCondvar_t <<(T,lightblue)>> { |
||
97 | 'Initializes a urt_osCondvar_t object. |
||
98 | + urtCondvarInit (condvar : urt_osCondvar_t*) : void |
||
99 | 'Signals one thread that is waiting for the condition variable. |
||
100 | + urtConvarSignal (condvar : urt_osCondvar_t*) : void |
||
101 | 'Signals all threads that are waiting for the condition variable. |
||
102 | + urtCondvarBroadcast (condvar : urt_osCondvar_t*) : void |
||
103 | 'Waits for the condition variable. |
||
104 | + urtCondvarWait (condvar : urt_osCondvar_t*, mutex : urt_osMutex_t*, timeout : urt_delay_t) : urt_condvarStatus_t |
||
105 | } |
||
106 | urt_osCondvar_t ..> urt_osMutex_t |
||
107 | urt_osCondvar_t ..> urt_delay_t |
||
108 | urt_osCondvar_t ..> urt_condvarStatus_t |
||
109 | |||
110 | } /' package "condition variable" '/ |
||
111 | |||
112 | package "timer" { |
||
113 | |||
114 | /' Timer callback definition. '/ |
||
115 | class urt_osTimerCallback_t <<(T,lightblue)>> { |
||
116 | urt_osTimerCallback_t (parameter : void*) : void |
||
117 | } |
||
118 | |||
119 | /' OS timer interface. '/ |
||
120 | class urt_osTimer_t <<(T,lightblue)>> { |
||
121 | 'Initializes an urt_osTimer_t object. |
||
122 | + urtTimerInit (timer : urt_osTimer_t*) : void |
||
123 | 'Sets the timer to a specified delay with specified callback and arguments. |
||
124 | + urtTimerSet (timer : urt_osTimer_t*, delay : urt_delay_t, callback : urt_osTimerCallback_t*, parameter : void*) : urt_status_t |
||
125 | 'Resets the timer. |
||
126 | + urtTimerReset (timer : urt_osTimer_t*) : urt_status_t |
||
127 | 'Check whether the timer is already armed. |
||
128 | + urtTimerIsArmed (timer : urt_timer_t*) : bool |
||
129 | } |
||
130 | urt_osTimer_t ..> urt_delay_t |
||
131 | urt_osTimer_t ..> urt_status_t |
||
132 | urt_osTimer_t ..> urt_osTimerCallback_t |
||
133 | |||
134 | } /' package "timer" '/ |
||
135 | |||
136 | package "thread" { |
||
137 | |||
138 | /' Thread priority type. '/ |
||
139 | class urt_osThreadPrio_t <<(T,lightblue)>> |
||
140 | |||
141 | /' Thread main function type. '/ |
||
142 | class urt_osThreadFunction_t <<(T,lightblue)>> { |
||
143 | urt_osThreadFunction_t (arg : void*) : void |
||
144 | } |
||
145 | |||
146 | /' Thread terminate signals. '/ |
||
147 | enum urt_osThreadTerminateSignal_t { |
||
148 | 'Signal to request termination asap. |
||
149 | URT_THREAD_TERMINATE_REQUEST = 15 |
||
150 | 'Signal to kill a thread immediately. |
||
151 | URT_THREAD_TERMINATE_KILL = 9 |
||
152 | } |
||
153 | |||
154 | /' OS thread interface. '/ |
||
155 | class urt_osThread_t <<(T,lightblue)>> { |
||
156 | 'Minimum priority for low priority threads. |
||
157 | + URT_THREAD_PRIO_LOW_MIN : urt_osThreadPrio_t |
||
158 | 'Maximum priority for low priority threads. |
||
159 | + URT_THREAD_PRIO_LOW_MAX : urt_osThreadPrio_t |
||
160 | 'Minimum priority for normal priority threads. |
||
161 | + URT_THREAD_PRIO_NORMAL_MIN : urt_osThreadPrio_t |
||
162 | 'Maximum priority for normal priority threads. |
||
163 | + URT_THREAD_PRIO_NORMAL_MAX : urt_osThreadPrio_t |
||
164 | 'Minimum priority for high priority threads. |
||
165 | + URT_THREAD_PRIO_HIGH_MIN : urt_osThreadPrio_t |
||
166 | 'Maximum priority for high priority threads. |
||
167 | + URT_THREAD_PRIO_HIGH_MAX : urt_osThreadPrio_t |
||
168 | 'Minimum priority for real-time threads. |
||
169 | + URT_THREAD_PRIO_RT_MIN : urt_osThreadPrio_t |
||
170 | 'Maximum priority for real-time threads. |
||
171 | + URT_THREAD_PRIO_RT_MAX : urt_osThreadPrio_t |
||
172 | .. |
||
173 | 'Maximum sleep interval in seconds (as float). |
||
174 | + URT_THREAD_MAX_SLEEP : float |
||
175 | 'Maximum sleep interval in seconds. |
||
176 | + URT_THREAD_MAX_SSLEP : unsigned int |
||
177 | 'Maximum sleep interval in milliseconds. |
||
178 | + URT_THREAD_MAX_MSLEEP : unsigned int |
||
179 | 'Maximum sleep interval in microseconds. |
||
180 | + URT_THREAD_MAX_USLEEP : unsigned int |
||
181 | __ |
||
182 | 'Macro to setup working area as static variable (handles alignment if required). |
||
183 | + URT_THREAD_WORKING_AREA (var : varname, stacksize : size_t) |
||
184 | .. |
||
185 | 'Initializes an urt_osThread_t object. |
||
186 | + urtThreadInit (wa : void*, wasize : size_t, func : urt_osThreadFunction_t*, arg : void*) : urt_osThread_t* |
||
187 | 'Starts a thread. |
||
188 | + urtThreadStart (thread : urt_osThread_t*, prio : urt_osThreadPrio_t, arg : void*) : void |
||
189 | 'The calling threads yields. |
||
190 | + urtThreadYield (void) : void |
||
191 | 'Retrieves the priority of a thread. |
||
192 | + urtThreadGetPriority (thread : urt_osThread_t*) : urt_osThreadPrio_t |
||
193 | 'Sets the priority of a thread. |
||
194 | + urtThreadSetPriority (thread : urt_osThread_t*, prio : urt_osThreadPrio_t) : void |
||
195 | 'Retrieves the first thread in the list of children. |
||
196 | + urtThreadGetChildren (thread : urt_osThread_t*) : urt_osThread_t* |
||
197 | 'Retrieves the parent thread. |
||
198 | + urtThreadGetParent (thread : urt_osThread_t*) : urt_osThread_t* |
||
199 | 'The calling threads suspends execution until it is woken up by calling urtTheadResume(). |
||
200 | + urtThreadSuspend (void) : void |
||
201 | 'Retrieves whether a thread is currently suspended. |
||
202 | + urtThreadIsSuspended (thread : urt_osThread_t*) : bool |
||
203 | 'Wakes a suspended thread. |
||
204 | + urtThreadResume (thread : urt_osThread_t*) : urt_status_t |
||
205 | 'Suspends the calling thread for the specified time. |
||
206 | + urtThreadSleep (seconds : float) : void |
||
207 | 'Suspends the calling thread for the specified time. |
||
208 | + urtThreadSSleep (seconds : usnigned int) : void |
||
209 | 'Suspends the calling thread for the specified time. |
||
210 | + urtThreadMSleep (milliseconds : unsigned int) : void |
||
211 | 'Suspends the calling thread for the specified time. |
||
212 | + urtThreadUSleep (microseconds : unsigned int) : void |
||
213 | 'Suspends the calling thread until the specified time. |
||
214 | + urtThreadSleepUntil (time : urt_osTime_t) : void |
||
215 | 'The calling thread exits execution (terminates). |
||
216 | + urtThreadExit (void) : void |
||
217 | 'Terminates a specified thread. |
||
218 | + urtThreadTerminate (thread : urt_osThread_t*, sig : urt_osThreadTerminateSignal_t) : void |
||
219 | 'Waits until the specified thread terminates. |
||
220 | + urtThreadJoin (thread : urt_osThread_t*) : void |
||
221 | } |
||
222 | urt_osThread_t ..> urt_osThreadPrio_t |
||
223 | urt_osThread_t ..> urt_osThreadFunction_t |
||
224 | urt_osThread_t ..> urt_osTime_t |
||
225 | urt_osThread_t ..> urt_osThreadTerminateSignal_t |
||
226 | |||
227 | } /' package "thread" '/ |
||
228 | |||
229 | package "events" { |
||
230 | |||
231 | /' OS event mask type. '/ |
||
232 | class urt_osEventMask_t <<(T,lightblue)>> |
||
233 | |||
234 | /' OS event flag type. '/ |
||
235 | class urt_osEventFlags_t <<(T,lightblue)>> |
||
236 | |||
237 | enum urt_osEventWaitType_t { |
||
238 | URT_EVENT_WAIT_ONE = 0 |
||
239 | URT_EVENT_WAIT_ANY = 1 |
||
240 | URT_EVENT_WAIT_ALL = 2 |
||
241 | } |
||
242 | |||
243 | /' OS event listener interface. '/ |
||
244 | class urt_osEventListener_t <<(T,lightblue)>> { |
||
245 | 'Initializes an urt_osEventListener_t object. |
||
246 | + urtEventListenerInit (listener : urt_osEventListener_t*) : void |
||
247 | 'Retrieves the flags of the event listener. |
||
248 | + urtEventListenerGetFlags (listener : urt_osEventListener_t*) : urt_osEventFlags_t |
||
249 | 'Retrieves and clears the flags of the event listener. |
||
250 | + urtEventListenerClearFlags (listener : urt_osEventListener_t*) : urt_osEventFlags_t |
||
251 | } |
||
252 | urt_osEventListener_t ..> urt_osEventFlags_t |
||
253 | |||
254 | /' OS event source interface. '/ |
||
255 | class urt_osEventSource_t <<(T,lightblue)>> { |
||
256 | 'Initializes an urt_osEventSource_t object. |
||
257 | + urtEventSourceInit (source : urt_osEventSource_t*) : void |
||
258 | 'Emits an event. |
||
259 | + urtEventSourceBroadcast (source : urt_osEventSource_t*, flags : urt_osEventFlags_t) : void |
||
260 | } |
||
261 | urt_osEventSource_t ..> urt_osEventFlags_t |
||
262 | |||
263 | /' Not a class/type but a set of static event-related functions. '/ |
||
264 | class urt_events <<(F,white)>> { |
||
265 | 'Registers a lister to a source. |
||
266 | + urtEventRegister (source : urt_osEventSource_t*, listener : urt_osEventListener_t*, mask : urt_osEventMask_t) : urt_status_t |
||
267 | 'Unregisters a listener from a source. |
||
268 | + urtEventUnregister (source _ urt_osEventSource_t*, listener : urt_osEventListener_t*) : urt_status_t |
||
269 | 'Blocks the thread until any event occurs or the timeout expires. |
||
270 | + urtEventWait (type : urt_osEventWaitType_t, timeout : urt_delay_t) : urt_osEventMask_t |
||
271 | } |
||
272 | urt_events ..> urt_osEventSource_t |
||
273 | urt_events ..> urt_osEventListener_t |
||
274 | urt_events ..> urt_osEventMask_t |
||
275 | urt_events ..> urt_status_t |
||
276 | urt_events ..> urt_osEventWaitType_t |
||
277 | urt_events ..> urt_delay_t |
||
278 | |||
279 | } /' package "events" '/ |
||
280 | |||
281 | } /' package "interfaces" '/ |
||
282 | |||
283 | package "middleware" { |
||
284 | |||
285 | package "real-time class" { |
||
286 | |||
287 | /' The top level RT class structure. '/ |
||
288 | class urt_rtclass_t <<(S,lightgrey)>> { |
||
289 | 'The actual RT class. |
||
290 | + class : urt_rtclasstype_t |
||
291 | 'Parameters of the RT class. |
||
292 | + params : urt_rtclassparams_t |
||
293 | } |
||
294 | urt_rtclass_t "1" *-- "1" urt_rtclasstype_t |
||
295 | urt_rtclass_t "1" *-- "1" urt_rtclassparams_t |
||
296 | |||
297 | /' Descriptor to distinguish the four RT classes. '/ |
||
298 | enum urt_rtclasstype_t { |
||
299 | 'Hard real-time. |
||
300 | URT_RTCLASS_HARD = 0 |
||
301 | 'Firm real-time. |
||
302 | URT_RTCLASS_FIRM = 1 |
||
303 | 'Soft real-time. |
||
304 | URT_RTCLASS_SOFT = 2 |
||
305 | 'No real-time at all. |
||
306 | URT_RTCLASS_NONE = 3 |
||
307 | } |
||
308 | |||
309 | /' Union structure, holding RT class parameters. '/ |
||
310 | class urt_rtclassparams_t <<(U,lightgreen)>> { |
||
311 | 'Parameters for hard real-time. |
||
312 | + hrt : urt_hrtparams_t |
||
313 | 'Parameters for firm real-time. |
||
314 | + frt : urt_frtparams_t |
||
315 | 'Parameters for soft real-time. |
||
316 | + srt : urt_srtparans_t |
||
317 | 'Parameters for non-real-time. |
||
318 | + nrt : urt_nrtparams_t |
||
319 | } |
||
320 | urt_rtclassparams_t "1" *-- "0..1" urt_hrtparams_t |
||
321 | urt_rtclassparams_t "1" *-- "0..1" urt_frtparams_t |
||
322 | urt_rtclassparams_t "1" *-- "0..1" urt_srtparams_t |
||
323 | urt_rtclassparams_t "1" *-- "0..1" urt_nrtparams_t |
||
324 | |||
325 | /' Parameters for hard real-time. '/ |
||
326 | class urt_hrtparams_t <<(S,lightgrey)>> { |
||
327 | 'Maximum temporal offset between creation and consumption of messages. |
||
328 | + deadlineOffset : urt_delay_t |
||
329 | 'Expected rate at which data is published. |
||
330 | + expectedRate : urt_delay_t |
||
331 | 'QoS timer to detected missed deadlines. |
||
332 | + qosTimer : urt_osTimer_t |
||
333 | } |
||
334 | urt_hrtparams_t ..> urt_delay_t |
||
335 | urt_hrtparams_t "1" *-- "1" urt_osTimer_t |
||
336 | |||
337 | /' Parameters for firm real-time. '/ |
||
338 | class urt_frtparams_t <<(S,lightgrey)>> { |
||
339 | 'Maximum temporal offset between creation and consumption of messages. |
||
340 | + deadlineOffset : urt_delay_t |
||
341 | 'Expected rate at which data is published. |
||
342 | + expectedRate : urt_delay_t |
||
343 | 'QoS Timer to detect missed deadlines. |
||
344 | + qosTimer : urt_osTimer_t |
||
345 | 'Callback function for the QoS timer. |
||
346 | + callback : urt_osTimerCallback_t |
||
347 | 'Parameters for the callback function. |
||
348 | + cbparams : void* |
||
349 | } |
||
350 | urt_frtparams_t ..> urt_delay_t |
||
351 | urt_frtparams_t "1" *-- "1" urt_osTimer_t |
||
352 | urt_frtparams_t "1" *-- "1" urt_osTimerCallback_t |
||
353 | |||
354 | /' Parameters for soft real-time. '/ |
||
355 | class urt_srtparams_t <<(S,lightgrey)>> { |
||
356 | 'Callback function to calculate usefulness given a dleay. |
||
357 | + *usefulness (dt : urt_delay_t, params : void*) : float |
||
358 | 'Optional parameters for the callback function. |
||
359 | + params : void* |
||
360 | } |
||
361 | urt_srtparams_t ..> urt_delay_t |
||
362 | |||
363 | /' Parameters for non-real-time. '/ |
||
364 | class urt_nrtparams_t <<(S,lightgrey)>> { |
||
365 | 'There are nor parameters in this case. |
||
366 | } |
||
367 | |||
368 | } /' package "real-time class" '/ |
||
369 | |||
370 | |||
371 | |||
372 | /' Message type. '/ |
||
373 | class urt_message_t <<(S,lightgrey)>> { |
||
374 | 'Pointer to the next message in a list. |
||
375 | + next : urt_message_t* |
||
376 | 'Pointer to some arbitrary (reusable) payload object. |
||
377 | + payload : void* |
||
378 | 'Origin time of the message. |
||
379 | + originTime : urt_osTime_t |
||
380 | 'Mutex lock for exclusive access. |
||
381 | + lock : urt_osMutex_t |
||
382 | 'Counter of HRT subscribers that did not consume the message yet. |
||
383 | + numHrtConsumersLeft : unsigned int |
||
384 | 'Condition variable to inform waiting publishers when the message is available again. |
||
385 | + hrtConsumersLeft : urt_osCondvar_t |
||
386 | -- evaluation data -- |
||
387 | 'Counter of overall subscribers that did not consume the message yet. |
||
388 | + numConsumersLeft : unsigned int |
||
389 | __ |
||
390 | 'Initializes a urt_message_t object. |
||
391 | + urtMessageInit (message : urt_message_t*, payload : void*) : urt_status_t |
||
392 | } |
||
393 | urt_message_t "1" o-- "0..1" urt_message_t |
||
394 | urt_message_t "1" *-- "1" urt_osTime_t |
||
395 | urt_message_t "1" *-- "1" urt_osMutex_t |
||
396 | urt_message_t "1" *-- "1" urt_osCondvar_t |
||
397 | |||
398 | /' Subscriber type. '/ |
||
399 | class urt_subscriber_t <<(S,lightgrey)>> { |
||
400 | 'Pointer to the next subscriber in a list. |
||
401 | + next : urt_subscriber_t* |
||
402 | 'Pointer to the topic, this subscriber subscribed to. |
||
403 | + topic : urt_topic_t* |
||
404 | 'Event listener to notify the node about new messages. |
||
405 | + evtListener : urt_osEventListener_t |
||
406 | 'Real-time class descriptor. |
||
407 | + rtclass : urt_rtclass_t |
||
408 | 'Pointer to the message consumed most recently. |
||
409 | + lastMessage : urt_message_t* |
||
410 | 'Copy of the origin time of the message consumed most recently. |
||
411 | + lastMessageTime : urt_osTime_t |
||
412 | -- evaluation data -- |
||
413 | 'Minimum latency ever detected. |
||
414 | + minLatency : urt_delay_t |
||
415 | 'Maximum latency ever detected. |
||
416 | + maxLatency : urt_delay_t |
||
417 | 'Sum of all latencies. |
||
418 | + sumLatencies : uint64_t |
||
419 | 'Number of messages received. |
||
420 | + numMessagesReceived : unsigned int |
||
421 | __ |
||
422 | 'Initializes a urt_subscriber_t object. |
||
423 | + urtSubscriberInit (subscriber : urt_subscriber_t*) : urt_status_t |
||
424 | 'Tries to subscribe to a topic and contributes an optional list of messages. |
||
425 | + urtSubscriberSubscribe (subscriber : urt_subscriber_t*, topic : urt_topic_t*, rtclass : urt_rtclass_t*, messages : urt_messages_t*) : urt_status_t |
||
426 | 'Unsubscribes from a topic. |
||
427 | + urtSubscriberUnsubscribe (subscriber : urt_subscriber_t*) : urt_status_t |
||
428 | 'Fetches either the next or the latest message. |
||
429 | + urtSubscriberFetchMessage (subscriber : urt_subscriber_t*, latest : bool) : urt_status_t |
||
430 | } |
||
431 | urt_subscriber_t "1" o-- "0..1" urt_subscriber_t |
||
432 | urt_subscriber_t "1" o-- "0..1" urt_topic_t |
||
433 | urt_subscriber_t "1" *-- "1" urt_osEventListener_t |
||
434 | urt_subscriber_t "1" *-- "1" urt_rtclass_t |
||
435 | urt_subscriber_t "1" o-- "0..1" urt_message_t |
||
436 | urt_subscriber_t "1" *-- "1" urt_osTime_t |
||
437 | urt_subscriber_t "1" *-- "2" urt_delay_t |
||
438 | urt_subscriber_t ..> urt_status_t |
||
439 | urt_subscriber_t ..> urt_topicid_t |
||
440 | |||
441 | /' Publisher type. '/ |
||
442 | class urt_publisher_t <<(S,lightgrey)>> { |
||
443 | 'Pointer to the topic for publishing. |
||
444 | + topic : urt_topic_t* |
||
445 | -- evaluation data -- |
||
446 | 'Counter of attempts to publish a message. |
||
447 | + publishAttempts : unsigned int |
||
448 | 'Counter of failed attempts to publish a message. |
||
449 | + publishFails : unsigned int |
||
450 | __ |
||
451 | 'Initializes a urt_publisher_t object and contributes an optional list of messages. |
||
452 | + urtPublisherInit (publisher : urt_publisher_t*, topic : urt_topic_t*, messages : urt_message_t*) : urt_status_t |
||
453 | 'Publishes a message via the associated topic. |
||
454 | + urtPublisherPublish (publisher : urt_publisher_t*, payload : void*, n : size_t, t : urt_osTime_t, timeout : urt_delay_t) : urt_status_t |
||
455 | } |
||
456 | urt_publisher_t "1" o-- "1" urt_topic_t |
||
457 | urt_publisher_t ..> urt_message_t |
||
458 | urt_publisher_t ..> urt_osTime_t |
||
459 | urt_publisher_t ..> urt_delay_t |
||
460 | urt_publisher_t ..> urt_status_t |
||
461 | |||
462 | /' Topic type. '/ |
||
463 | class urt_topic_t <<(S,lightgrey)>> { |
||
464 | 'Pointer to the next topic in a list. |
||
465 | + next : urt_topic_t* |
||
466 | 'Mutex lock for exclusive access. |
||
467 | + mutex : urt_osMutex_t |
||
468 | 'Event source to inform all subscribers when a new message is published. |
||
469 | + evtSource : urt_osEventSource_t |
||
470 | 'Number of HRT subscribers. |
||
471 | + numHrtSubscribers : unsigned int |
||
472 | 'List of HRT subscribers, orderd by their expected rate (most critical first). |
||
473 | + hrtSubscribers : urt_subscriber_t* |
||
474 | 'Timer to check for missed rates. |
||
475 | + qosTimer : urt_osTimer_t |
||
476 | 'Mandatory message, each Topic holds. |
||
477 | + mandatoryMessage : urt_message_t |
||
478 | 'Pointer to the latest message. |
||
479 | + latestMessage : urt_message_t* |
||
480 | 'Identifier of the topic. |
||
481 | + id : urt_topicid_t |
||
482 | -- evaluation data -- |
||
483 | 'Variable to count how many (non-hrt) subscribers did not fetch a message before it was reused. |
||
484 | + numDiscardedMessages : unsigned int |
||
485 | 'Number of overall subscribers. |
||
486 | + numSubscribers : unsigned int |
||
487 | __ |
||
488 | 'Initializes an urt_topic_t object. |
||
489 | + urtTopicInit (topic : urt_topic_t*, id : urt_topicid_t) : urt_status_t |
||
490 | 'Appends the given list of messages to the topic's buffer. |
||
491 | + urtTopicContributeMessages (topic : urt_topic_t*, messages : urt_message_t*) : void |
||
492 | } |
||
493 | urt_topic_t "1" o-- "0..1" urt_topic_t |
||
494 | urt_topic_t "1" *-- "1" urt_osMutex_t |
||
495 | urt_topic_t "1" *-- "1" urt_osEventSource_t |
||
496 | urt_topic_t "1" o-- "0..*" urt_subscriber_t |
||
497 | urt_topic_t "1" *-- "1" urt_osTimer_t |
||
498 | urt_topic_t "1" o-- "1..*" urt_message_t |
||
499 | urt_topic_t "1" *-- "1" urt_message_t |
||
500 | urt_topic_t "1" *-- "1" urt_topicid_t |
||
501 | urt_topic_t ..> urt_osTime_t |
||
502 | urt_topic_t ..> urt_status_t |
||
503 | |||
504 | /' uRtWare core type. '/ |
||
505 | class urt_core_t <<(S,lightgrey)>> { |
||
506 | 'List of nodes ordered by their (initial) priority. |
||
507 | - {static} _nodes : urt_node_t* |
||
508 | 'List of topics ordered by their identifiers. |
||
509 | - {static} _topics : urt_topic_t* |
||
510 | __ |
||
511 | 'Initializes the urt_core_t object. |
||
512 | + urtCoreInit (void) : urt_status_t |
||
513 | 'Starts all nodes. |
||
514 | + urtCoreStartAll (void) : urt_status_t |
||
515 | 'Stops all nodes. |
||
516 | + urtCoreStopAll (void) : urt_status_t |
||
517 | 'Retrieves a topic given an identifier. |
||
518 | + urtCoreRetrieveTopic (id : urt_topicid_t) : urt_topic_t* |
||
519 | } |
||
520 | urt_core_t "1" o-- "0..*" urt_topic_t |
||
521 | urt_core_t "1" o-- "0..*" urt_node_t |
||
522 | urt_core_t ..> urt_status_t |
||
523 | urt_core_t ..> urt_topicid_t |
||
524 | |||
525 | package "node" { |
||
526 | |||
527 | /' Function type to be called during setup phase of node threads. '/ |
||
528 | class urt_nodeSetupCallback_t <<(T,lightblue)>> { |
||
529 | 'Takes the node and optional parameters as arguments. |
||
530 | urt_nodeSetupCallback_t (node : urt_node_t*, arg : void*) : urt_status_t |
||
531 | } |
||
532 | urt_nodeSetupCallback_t ..> urt_node_t |
||
533 | urt_nodeSetupCallback_t ..> urt_status_t |
||
534 | |||
535 | /' Function type to be called during loop phase of node threads. '/ |
||
536 | class urt_nodeLoopCallback_t <<(T,lightblue)>> { |
||
537 | 'Takes the node, a mask of occurred events and optional parameters as arguments. |
||
538 | urt_nodeLoopCallback_t (node : urt_node_t*, events : urt_osEventMask_t, arg : void*) : urt_status_t |
||
539 | } |
||
540 | urt_nodeLoopCallback_t ..> urt_node_t |
||
541 | urt_nodeLoopCallback_t ..> urt_osEventMask_t |
||
542 | urt_nodeLoopCallback_t ..> urt_status_t |
||
543 | |||
544 | /' Node type. '/ |
||
545 | class urt_node_t <<(S,lightgrey)>> { |
||
546 | 'Pointer to the next node in a list. |
||
547 | + next : urt_node_t* |
||
548 | 'Pointer to the nore thread. |
||
549 | + thread : urt_osThread_t* |
||
550 | 'Callback function to be called during the setup phase. |
||
551 | + setupcallback : urt_nodeSetupCallback_t* |
||
552 | 'Optional parameters for the setup callback function. |
||
553 | + setupparams : void* |
||
554 | 'Callback function to be called in each loop iteration. |
||
555 | + loopcallback : urt_nodeLoopCallback_t* |
||
556 | 'Optional parameters for the loop callback function. |
||
557 | + loopparams : void* |
||
558 | 'A mask for which events to wait. |
||
559 | + waitmask : urt_osEventMask_t |
||
560 | 'How the node will wait for events. |
||
561 | + waittype : urt_osEventWaitType_t |
||
562 | __ |
||
563 | 'The main() function of the node thread. |
||
564 | - {static} _main : urt_osThreadFunction_t |
||
565 | 'Initializes an urt_node_t object. |
||
566 | + urtNodeInit (node : urt_node_t*, stacksize : size_t, setupcallback : urt_nodeSetupCallback_t*, setupparams : void*, loopcallback : urt_nodeLoopCallback_t*, loopparams : void*) : urt_status_t |
||
567 | 'Terminate a node thread and all its child threads (if any). |
||
568 | + urtNodeTerminateRecusively (node : urt_node_t*, sig : urt_osThreadTerminateSignal_t) : void |
||
569 | 'Wait for a node thread an all its child threads (if any) to terminate. |
||
570 | + urtNodeJoinRecursively (node : urt_node_t*) : void |
||
571 | } |
||
572 | urt_node_t "1" o-- "0..1" urt_node_t |
||
573 | urt_node_t "1" o-- "1" urt_osThread_t |
||
574 | urt_node_t "1" o-- "1" urt_nodeSetupCallback_t |
||
575 | urt_node_t "1" o-- "1" urt_nodeLoopCallback_t |
||
576 | urt_node_t "1" *-- "1" urt_osEventMask_t |
||
577 | urt_node_t "1" *-- "1" urt_osEventWaitType_t |
||
578 | urt_node_t ..> urt_osThreadTerminateSignal_t |
||
579 | |||
580 | } /' package "node" '/ |
||
581 | |||
582 | } /' package "middleware" '/ |
||
583 | |||
584 | @enduml |