Revision ee83a495 doc/activitydiagrams/publisher/urtPublisherPublish.uml
doc/activitydiagrams/publisher/urtPublisherPublish.uml | ||
---|---|---|
25 | 25 |
|
26 | 26 |
title **µRtWare**\nurtPublisherPublish()\n |
27 | 27 |
|
28 |
!include ../../functions.iuml
|
|
28 |
/'### PARAMETERS & RETURN ####################################################'/
|
|
29 | 29 |
|
30 |
/'### PARAMETERS & START #####################################################'/ |
|
31 |
|
|
32 |
start |
|
33 | 30 |
note |
34 |
-- ""**publisher** : urt_publisher_t*"" --
|
|
31 |
-- **publisher** : urt_publisher_t* --
|
|
35 | 32 |
Pointer to the publisher to use. |
36 | 33 |
Must not be ""NULL"". |
37 |
-- ""**payload** : void*"" --
|
|
34 |
-- **payload** : void* --
|
|
38 | 35 |
Pointer to the data to be published. |
39 | 36 |
May be ""NULL"" for messages without payload. |
40 |
-- ""**n** : size_t"" --
|
|
37 |
-- **n** : size_t --
|
|
41 | 38 |
Size of the payload in bytes. |
42 |
-- ""**t** : urt_osTime_t"" --
|
|
39 |
-- **t** : urt_osTime_t --
|
|
43 | 40 |
Timestamp to be set for the message. |
44 |
-- ""**timeout** : urt_delay_t"" --
|
|
41 |
-- **timeout** : urt_delay_t --
|
|
45 | 42 |
Timeout delay in case the message cannot be published. |
46 |
end note |
|
43 |
==== |
|
44 |
-- **return** : urt_status_t -- |
|
45 |
Returns ""URT_STATUS_OK"" on success. |
|
46 |
Returns ""URT_STATUS_ERROR"" on timeout. |
|
47 |
endnote |
|
47 | 48 |
|
48 | 49 |
/'### PROCEDURE ##############################################################'/ |
49 | 50 |
|
51 |
start |
|
50 | 52 |
:lock topic; |
51 |
:access next message; |
|
52 |
while (HRT consumers left for the message\nor the message timestamp was modified\nand a timeout occurred?) is (yes) |
|
53 |
if (Message timestamp was modified?) the (yes) |
|
54 |
:iterate to next message; |
|
53 |
:access topic's next message; |
|
54 |
while (HRT consumers left for the message?) is (yes) |
|
55 |
:wait for topic's condition variable (using topic's mutex) to be signaled or timeout; |
|
56 |
if (Timeout occurred?) then (yes) |
|
57 |
:unlock topic; |
|
58 |
stop |
|
59 |
note |
|
60 |
Returns ""URT_STATUS_ERROR"". |
|
61 |
endnote |
|
55 | 62 |
else (no) |
56 |
:wait for topic's condition variable (using topic's mutex) to be signaled or timeout; |
|
63 |
if (Message timestamp was modified?) then (yes) |
|
64 |
:access topic's next message; |
|
65 |
else (no) |
|
66 |
endif |
|
57 | 67 |
endif |
58 | 68 |
endwhile (no) |
59 |
if (Timeout occurred?) then (yes) |
|
60 |
:unlock topic; |
|
61 |
:return ""URT_STATUS_ERROR""; |
|
62 |
else (no) |
|
69 |
fork |
|
63 | 70 |
fork |
64 |
fork |
|
65 |
:iterate topic pointer to this message; |
|
66 |
fork again |
|
67 |
:copy payload to message; |
|
68 |
fork again |
|
69 |
:set origin time of message; |
|
70 |
fork again |
|
71 |
:set number of HRT consumers (from topic); |
|
72 |
endfork |
|
71 |
:iterate topic pointer to this message; |
|
73 | 72 |
fork again |
74 |
:set QoS rate timer (@topic) wrt. most critical HRT subscriber;
|
|
73 |
:copy payload to message;
|
|
75 | 74 |
fork again |
76 |
while (HRT subscribers left?) is (yes) |
|
77 |
if (QoS delay timer (@subscriber) is not armed?) then (yes) |
|
78 |
:set QoS delay timer (@subscriber) wrt. origin time of the message; |
|
79 |
note: No lock required since this timer is only accessed when the topic is locked. |
|
80 |
else (no) |
|
81 |
endif |
|
82 |
:iterate to next HRT subscriber; |
|
83 |
endwhile (no) |
|
75 |
:set origin time of message; |
|
76 |
fork again |
|
77 |
:set number of HRT consumers (from topic); |
|
84 | 78 |
endfork |
85 |
:fire event; |
|
86 |
note: Msut be within topic lock because of HRT counter. |
|
87 |
:unlock topic; |
|
88 |
:return ""URT_STATUS_OK""; |
|
89 |
endif |
|
90 |
|
|
91 |
/'### STOP & RETURN ##########################################################'/ |
|
92 |
|
|
79 |
fork again |
|
80 |
:set QoS rate timer (@topic) wrt. most critical HRT subscriber; |
|
81 |
fork again |
|
82 |
while (HRT subscribers left?) is (yes) |
|
83 |
if (QoS delay timer (@subscriber) is not armed?) then (yes) |
|
84 |
:set QoS delay timer (@subscriber) wrt. origin time of the message; |
|
85 |
note: No lock required since this timer is only accessed when the topic is locked. |
|
86 |
else (no) |
|
87 |
endif |
|
88 |
:iterate to next HRT subscriber; |
|
89 |
endwhile (no) |
|
90 |
endfork |
|
91 |
:fire event; |
|
92 |
note: Msut be within topic lock because of HRT counter. |
|
93 |
:unlock topic; |
|
93 | 94 |
stop |
94 | 95 |
note |
95 |
-- **return** ""urt_status_t"" -- |
|
96 |
Returns ""URT_STATUS_ERROR"" on timeout. |
|
97 |
end note |
|
96 |
Returns ""URT_STATUS_OK"". |
|
97 |
endnote |
|
98 | 98 |
|
99 | 99 |
/'### OUTRO ##################################################################'/ |
100 | 100 |
|
Also available in: Unified diff