urtware / doc / activitydiagrams / node / _main.uml @ 408b49ce
History | View | Annotate | Download (2.96 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 |
/'### INTRO ##################################################################'/ |
23 |
|
24 |
@startuml |
25 |
|
26 |
title **µRtWare**\n_main()\n |
27 |
|
28 |
/'### PARAMETERS & RETURN ####################################################'/ |
29 |
|
30 |
note |
31 |
-- **arg** : void* -- |
32 |
Optional Argument to the thread main function (see ""urt_osThreadFunction_t""). |
33 |
This function expects ""arg"" to be of type ""urt_node_t*"". |
34 |
==== |
35 |
-- **return** : void -- |
36 |
endnote |
37 |
|
38 |
/'### PROCEDURE ##############################################################'/ |
39 |
|
40 |
start |
41 |
partition "setup" { |
42 |
:register to core event; |
43 |
if (Node's ""setupcallback"" is set?) then (yes) |
44 |
:execute ""setupcallback()""; |
45 |
note |
46 |
Callback must not loop. |
47 |
endnote |
48 |
if (Event mask returned by ""setupcallback()"" redefines core event?) then (yes) |
49 |
:call ""urtCoreStopNodes(URT_STATUS_NODE_INVALEVTMASK)""; |
50 |
else (no) |
51 |
endif |
52 |
else (no) |
53 |
:act as if ""setupcallback"" returned 0xF..F; |
54 |
endif |
55 |
if (Core status is ""URT_STATUS_OK""?) then (yes) |
56 |
:suspend all child threads (recursively); |
57 |
:synchronize by calling ""urtCoreSynchronizeNodes(1)""; |
58 |
:resume all child threads (recursively); |
59 |
else (no) |
60 |
endif |
61 |
} |
62 |
partition "loop" { |
63 |
while (Termination of node thread requested?) is (no) |
64 |
:Wait for a specified or a core event; |
65 |
if (Core event received?) then (yes) |
66 |
else (no) |
67 |
:execute ""loopcallback()""; |
68 |
note |
69 |
Callback must not loop. |
70 |
endnote |
71 |
#EEEEEE:..//URT_CFG_PUBSUB_PROFILING == true || URT_CFG_RPC_PROFILING = true//..\nincrement loop counter; |
72 |
if (Event mask returned by ""loopcallback()"" redefines core event?) then (yes) |
73 |
:call ""urtCoreStopNodes(URT_STATUS_NODE_INVALEVTMASK)""; |
74 |
else (no) |
75 |
endif |
76 |
endif |
77 |
endwhile (yes) |
78 |
} |
79 |
partition "outro" { |
80 |
if (Node's ""shutdowncallback"" is set?) then (yes) |
81 |
:execute ""shutdowncallback()"" with core's status as argument; |
82 |
note |
83 |
Callback must terminate. |
84 |
endnote |
85 |
else (no) |
86 |
endif |
87 |
:unregister from core event; |
88 |
:terminate node thread (and all child threads); |
89 |
} |
90 |
stop |
91 |
|
92 |
/'### OUTRO ##################################################################'/ |
93 |
|
94 |
@enduml |
95 |
|