urtware / doc / statediagrams / publisher / urtPublisherPublish.uml @ e48e1ccf
History | View | Annotate | Download (2.04 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 | 509d44c4 | Thomas Schöpping | Copyright (C) 2018..2019 Thomas Schöpping et al. |
7 | 6ebd2388 | Thomas Schöpping | |
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**\nurtPublisherPublish()\n |
||
25 | |||
26 | |||
27 | |||
28 | start |
||
29 | :lock topic; |
||
30 | :lock next message; |
||
31 | while (HRT consumers left for the message & no timeout?) is (yes) |
||
32 | :wait for condition variable to be signaled or timeout; |
||
33 | endwhile (no) |
||
34 | if (Timeout occurred?) then (yes) |
||
35 | :unlock message; |
||
36 | :unlock topic; |
||
37 | :return error; |
||
38 | stop |
||
39 | else (no) |
||
40 | fork |
||
41 | fork |
||
42 | :iterate topic pointer to this message; |
||
43 | fork again |
||
44 | :copy payload; |
||
45 | fork again |
||
46 | :set origin time; |
||
47 | fork again |
||
48 | :set number of HRT consumers (from topic); |
||
49 | endfork |
||
50 | :unlock message; |
||
51 | fork again |
||
52 | 35c9457f | Thomas Schöpping | :set QoS rate timer (@topic) wrt. most critical HRT subscriber; |
53 | 6ebd2388 | Thomas Schöpping | fork again |
54 | while (HRT subscribers left?) is (yes) |
||
55 | 35c9457f | Thomas Schöpping | if (QoS delay timer (@subscriber) is not armed?) then (yes) |
56 | :set QoS delay timer (@subscriber) wrt. origin time of the message; |
||
57 | 6ebd2388 | Thomas Schöpping | note |
58 | no lock required since this timer is only accessed when the topic is locked |
||
59 | endnote |
||
60 | else (no) |
||
61 | endif |
||
62 | 35c9457f | Thomas Schöpping | :iterate to next HRT subscriber; |
63 | 6ebd2388 | Thomas Schöpping | endwhile (no) |
64 | endfork |
||
65 | :fire event; |
||
66 | note |
||
67 | must be within lock because of HRT counter |
||
68 | endnote |
||
69 | :unlock topic; |
||
70 | :return success; |
||
71 | stop |
||
72 | endif |
||
73 | |||
74 | @enduml |