urtware / doc / activitydiagrams / subscriber / urtSubscriberFetchNextMessage.uml @ c22d21ad
History | View | Annotate | Download (3.02 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**\nurtSubscriberFetchNextMessage()\n |
27 |
|
28 |
!include ../../functions.iuml |
29 |
|
30 |
/'### PARAMETERS & START #####################################################'/ |
31 |
|
32 |
start |
33 |
note |
34 |
-- ""**subscriber** : urt_subscriber_t*"" -- |
35 |
The subscriber that shall fetch the message. |
36 |
Must not be ""NULL"". |
37 |
-- ""**payload** : void*"" -- |
38 |
Pointer where to copy the payload to. |
39 |
May be ""NULL"" for messages without payload. |
40 |
-- ""**bytes** : size_t"" -- |
41 |
Payload size in bytes. |
42 |
-- ""**latency** : urt_delay_t*"" -- |
43 |
The latency can be returned by reference. |
44 |
May be ""NULL"". |
45 |
end note |
46 |
|
47 |
/'### PROCEDURE ##############################################################'/ |
48 |
|
49 |
:lock topic; |
50 |
if (Is HRT subscriber?) then (yes) |
51 |
:access next message; |
52 |
else (no) |
53 |
if (Has a message been read before?) then (yes) |
54 |
:access last read message; |
55 |
if (Message timestamp equals local copy?) then (yes) |
56 |
else (no) |
57 |
partition "find oldest valid message" { |
58 |
:access next message; |
59 |
while (Timestamp of next message is younger than of current?) is (yes) |
60 |
:iterate by one message; |
61 |
endwhile (no) |
62 |
} |
63 |
endif |
64 |
else (no) |
65 |
:access message after topic's latest message; |
66 |
endif |
67 |
endif |
68 |
fork |
69 |
:set last fetched message pointer to locked message; |
70 |
fork again |
71 |
fork |
72 |
:copy timestamp of message; |
73 |
fork again |
74 |
if (Optional output argument "latency" given?) then (yes) |
75 |
:set latency value (now - message origin time); |
76 |
else (no) |
77 |
endif |
78 |
endfork |
79 |
fork again |
80 |
:copy message payload; |
81 |
fork again |
82 |
if (Is HRT subscriber?) then (yes) |
83 |
fork |
84 |
:decrement HRT counter of current message; |
85 |
if (HRT counter became 0?) then (yes) |
86 |
:signal topic's condition variable; |
87 |
else (no) |
88 |
endif |
89 |
fork again |
90 |
:update QoS delay timer (@subscriber); |
91 |
endfork |
92 |
else (no) |
93 |
endif |
94 |
endfork |
95 |
:unlock topic; |
96 |
|
97 |
/'### STOP & RETURN ##########################################################'/ |
98 |
|
99 |
stop |
100 |
note |
101 |
-- **return** ""urt_status_t"" -- |
102 |
Returns ""URT_STATUS_OK"". |
103 |
end note |
104 |
|
105 |
/'### OUTRO ##################################################################'/ |
106 |
|
107 |
@enduml |