urtware / doc / activitydiagrams / node / _main.uml @ 155b0443
History | View | Annotate | Download (2.96 KB)
1 | e48e1ccf | 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..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 | e87bd7c7 | Thomas Schöpping | Optional Argument to the thread main function (see ""urt_osThreadFunction_t""). |
33 | dd31cb03 | Thomas Schöpping | This function expects ""arg"" to be of type ""urt_node_t*"". |
34 | e48e1ccf | Thomas Schöpping | ==== |
35 | -- **return** : void -- |
||
36 | endnote |
||
37 | |||
38 | /'### PROCEDURE ##############################################################'/ |
||
39 | |||
40 | start |
||
41 | e87bd7c7 | Thomas Schöpping | 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 | dd31cb03 | Thomas Schöpping | :call ""urtCoreStopNodes(URT_STATUS_NODE_INVALEVTMASK)""; |
50 | e87bd7c7 | Thomas Schöpping | else (no) |
51 | endif |
||
52 | else (no) |
||
53 | dd31cb03 | Thomas Schöpping | :act as if ""setupcallback"" returned 0xF..F; |
54 | e87bd7c7 | Thomas Schöpping | 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 | dd31cb03 | Thomas Schöpping | while (Termination of node thread requested?) is (no) |
64 | e87bd7c7 | Thomas Schöpping | :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 | dd31cb03 | Thomas Schöpping | #EEEEEE:..//URT_CFG_PUBSUB_PROFILING == true || URT_CFG_RPC_PROFILING = true//..\nincrement loop counter; |
72 | e87bd7c7 | Thomas Schöpping | if (Event mask returned by ""loopcallback()"" redefines core event?) then (yes) |
73 | dd31cb03 | Thomas Schöpping | :call ""urtCoreStopNodes(URT_STATUS_NODE_INVALEVTMASK)""; |
74 | e87bd7c7 | Thomas Schöpping | else (no) |
75 | endif |
||
76 | endif |
||
77 | dd31cb03 | Thomas Schöpping | endwhile (yes) |
78 | e87bd7c7 | Thomas Schöpping | } |
79 | partition "outro" { |
||
80 | if (Node's ""shutdowncallback"" is set?) then (yes) |
||
81 | :execute ""shutdowncallback()"" with core's status as argument; |
||
82 | dd31cb03 | Thomas Schöpping | note |
83 | Callback must terminate. |
||
84 | endnote |
||
85 | e87bd7c7 | Thomas Schöpping | else (no) |
86 | endif |
||
87 | :unregister from core event; |
||
88 | :terminate node thread (and all child threads); |
||
89 | } |
||
90 | e48e1ccf | Thomas Schöpping | stop |
91 | |||
92 | /'### OUTRO ##################################################################'/ |
||
93 | |||
94 | @enduml |