/' µRtWare is a lightweight publish/subscribe middleware for real-time applications. It was developed as part of the software habitat for the Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well. Copyright (C) 2018..2020 Thomas Schöpping et al. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . '/ /'### INTRO ##################################################################'/ @startuml title **µRtWare**\nurtHrtSubscriberSubscribe()\n !include ../../functions.iuml /'### PARAMETERS & RETURN ####################################################'/ note -- **subscriber** : urt_hrtsubscriber_t* -- The HRT subscriber which shall subscribe to a topic. Must not be ""NULL"". -- **topic** : urt_topic_t* -- The topic to subscribe to. Must not be ""NULL"". -- **messages** : urt_message_t* -- ""NULL"" terminated list of messages to contribute to the topic. Messages must not be associated to another topic. Once a message has been contributed, it cannot be removed later. May be ""NULL"" (no messages to contribute). -- **deadline** : urt_delay_t -- Maximum latency to consume messages. A value of 0 indicates that latency is of no concern. -- **jitter** : urt_delay_t -- Maximum allowed jitter (difference between maximum and minimum latency) when consuming messages. A value of 0 indicates that jitter is of no concern. -- **rate** : urt_delay_t -- Expected minimum rate of new messages (= mamximum time between consecutive messages). A value of 0 indicates, that rate is of no concern. ==== -- **return** : urt_status_t -- Returns ""URT_STATUS_OK"" on success. Returns ""URT_STATUS_SUBSCRIBE_TOPICSET"" if the subscriber is already associated to a topic. endnote /'### PROCEDURE ##############################################################'/ start if (Is topic already set?) then (yes) stop note Returns ""URT_STATUS_SUBSCRIBE_TOPICSET"". endnote else (no) fork :set topic; fork again #EEEEEE:initialize members; note #EEEEEE -- urt_basesubscriber_t -- .. URT_CFG_PUBSUB_PROFILING == true .. * **sumLatencies** ← 0 * **numMessagesReceived** ← 0 -- urt_hrtsubscriber_t -- .. URT_CFG_PUBSUB_QOS_DEADLINECHECKS == true .. * **deadlineOffset** ← deadline .. URT_CFG_PUBSUB_QOS_JITTERCHECKS == true .. * **maxJitter** ← jitter .. URT_CFG_PUBSUB_QOS_JITTERCHECKS == true || URT_CFG_PUBSUB_PROFILING == true .. * **minLatency** ← 0xF..F * **maxLatency** ← 0 .. URT_CFG_PUBSUB_QOS_RATECHECKS == true .. * **expectedRate** ← rate endnote endfork :lock topic; fork if (Messages to contribute?) then (yes) $contribute_messages() else (no) endif fork again fork :set message pointer to topic's latest message; fork again :copy timestamp from topic's latest message; endfork fork again :register to topic's event source; fork again fork partition "//URT_CFG_PUBSUB_QOS_RATECHECKS = true//" #EEEEEE { #EEEEEE:access first element of topic's list of HRT subscribers; while (Subscriber is not ""NULL""\nand its ""expectedRate"" is lower?) is (yes) #EEEEEE:proceed to next subscriber; endwhile (no) if (Current subscriber is ""NULL""?) then (yes) #EEEEEE:append self to topic's list of HRT subscribers; else (no) #EEEEEE:insert self in fron of current HRT subscriber; endif } fork again :increment topic's counter of HRT subscribers; endfork fork again #EEEEEE:..//URT_CFG_PUBSUB_PROFILING == true//..\nincrement counter of subscribers (@topic); endfork :unlock topic; stop note Returns ""URT_STATUS_OK"". endnote endif /'### OUTRO ##################################################################'/ @enduml