Statistics
| Branch: | Revision:

urtware / doc / statediagrams / publisher / publish.uml @ 6ebd2388

History | View | Annotate | Download (1.972 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..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**\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
    :set QoS timer (rate) wrt. most critical HRT subscriber;
53
  fork again
54
    while (HRT subscribers left?) is (yes)
55
      if (QoS timer (delay) is not armed?) then (yes)
56
        :set QoS timer (delay) wrt. origin time of the message;
57
        note
58
          no lock required since this timer is only accessed when the topic is locked
59
        endnote
60
      else (no)
61
      endif
62
    endwhile (no)
63
  endfork
64
  :fire event;
65
  note
66
    must be within lock because of HRT counter
67
  endnote
68
  :unlock topic;
69
  :return success;
70
  stop
71
endif
72

    
73
@enduml