Revision 5198dfae
inc/urt_debug.h | ||
---|---|---|
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 |
#ifndef URT_DEBUG_H |
|
23 |
#define URT_DEBUG_H |
|
24 |
|
|
25 |
/******************************************************************************/ |
|
26 |
/* CONSTANTS */ |
|
27 |
/******************************************************************************/ |
|
28 |
|
|
29 |
/******************************************************************************/ |
|
30 |
/* SETTINGS */ |
|
31 |
/******************************************************************************/ |
|
32 |
|
|
33 |
/******************************************************************************/ |
|
34 |
/* CHECKS */ |
|
35 |
/******************************************************************************/ |
|
36 |
|
|
37 |
/******************************************************************************/ |
|
38 |
/* DATA STRUCTURES AND TYPES */ |
|
39 |
/******************************************************************************/ |
|
40 |
|
|
41 |
/******************************************************************************/ |
|
42 |
/* MACROS */ |
|
43 |
/******************************************************************************/ |
|
44 |
|
|
45 |
/******************************************************************************/ |
|
46 |
/* EXTERN DECLARATIONS */ |
|
47 |
/******************************************************************************/ |
|
48 |
|
|
49 |
#if defined(__cplusplus) |
|
50 |
extern "C" { |
|
51 |
#endif /* defined(__cplusplus) */ |
|
52 |
|
|
53 |
void urtDebugAssert (bool condition); |
|
54 |
|
|
55 |
#if defined(__cplusplus) |
|
56 |
} |
|
57 |
#endif /* defined(__cplusplus) */ |
|
58 |
|
|
59 |
/******************************************************************************/ |
|
60 |
/* INLINE FUNCTIONS */ |
|
61 |
/******************************************************************************/ |
|
62 |
|
|
63 |
#endif /* URT_DEBUG_H */ |
inc/urt_subscriber.h | ||
---|---|---|
145 | 145 |
urt_status_t urtSrtSubscriberSubscribe(urt_srtsubscriber_t* subscriber, urt_topic_t* topic, urt_message_t* message, urt_srtusefulnessfunc_t* usefulnesscb, void* cbparams); |
146 | 146 |
urt_status_t urtSrtSubscriberFetchNextMessage(urt_srtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency); |
147 | 147 |
urt_status_t urtSrtSubscriberFetchLatestMessage(urt_srtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency); |
148 |
urt_status_t urtSrtSubscriberCalculateUsefulness(urt_srtsubscriber_t* subscriber, urt_delay_t latency);
|
|
148 |
float urtSrtSubscriberCalculateUsefulness(urt_srtsubscriber_t* subscriber, urt_delay_t latency);
|
|
149 | 149 |
urt_status_t urtSrtSubscriberUnsubscribe(urt_srtsubscriber_t* subscriber); |
150 | 150 |
|
151 | 151 |
void urtFrtSubscriberInit(urt_frtsubscriber_t* subscriber); |
src/urt_core.c | ||
---|---|---|
53 | 53 |
/** |
54 | 54 |
* @brief Get Core status. |
55 | 55 |
* |
56 |
* @return A status value.
|
|
56 |
* @return Current system status.
|
|
57 | 57 |
*/ |
58 | 58 |
urt_status_t urtCoreGetStatus(void) {return URT_STATUS_OK;} |
59 | 59 |
|
60 | 60 |
/** |
61 |
* @brief Start Nodes... .
|
|
61 |
* @brief Start threads of all nodes of the Core.
|
|
62 | 62 |
*/ |
63 | 63 |
void urtCoreStartNodes(void) {return;} |
64 | 64 |
|
65 | 65 |
/** |
66 |
* @brief Synchronize ...
|
|
66 |
* @brief Synchronize all nodes of the core.
|
|
67 | 67 |
* |
68 |
* @param[in] node The node to... .
|
|
68 |
* @param[in] node Pointer to a node to synchronize. Must not be NULL.
|
|
69 | 69 |
* |
70 |
* @return A status value. |
|
70 |
* @return Returns URT_STATUS_OK if all nodes are synchronized and proceed. |
|
71 |
* Returns URT_STATUS_SYNC_ERROR if an exception occurred (faulty stage value detected). |
|
72 |
* Returns URT_STATUS_SYNC_PENDING if there are nodes left to synchronize. |
|
73 |
* In the latter case, the node thread must still wait for the control event (proceed) to synchronize. |
|
71 | 74 |
*/ |
72 | 75 |
urt_status_t urtCoreSynchronize(urt_node_t* node) {return URT_STATUS_OK;} |
73 | 76 |
|
74 | 77 |
/** |
75 |
* @brief Stop nodes... .
|
|
78 |
* @brief Stop threads of all nodes of the Core.
|
|
76 | 79 |
* |
77 |
* @param[in] reason Reason why nodes should be stopped.
|
|
80 |
* @param[in] reason The reason why the function was called. For normal shutdown URT_STATUS_OK should be used.
|
|
78 | 81 |
* |
79 |
* @return A status value. |
|
82 |
* @return Returns URT_STATUS_OK if there was no call with another reason than URT_STATUS_OK before. |
|
83 |
* If the function has been called before with a different reason, that reason is returned. |
|
80 | 84 |
*/ |
81 | 85 |
urt_status_t urtCoreStopNodes(urt_status_t reason) {return URT_STATUS_OK;} |
82 | 86 |
|
83 | 87 |
/** |
84 | 88 |
* @brief Get the topic of the Core. |
85 | 89 |
* |
86 |
* @param[in] id The id of the topic.
|
|
90 |
* @param[in] id Identifier of the topic to retrieve.
|
|
87 | 91 |
* |
88 |
* @return . |
|
92 |
* @return Returns a pointer to the requested service. Returns NULL if no service matches the given ID.
|
|
89 | 93 |
*/ |
90 | 94 |
urt_topic_t* urtCoreGetTopic(urt_topicid_t id) {return urt_topic_t;} |
91 | 95 |
|
92 | 96 |
/** |
93 | 97 |
* @brief Get the service of the Core. |
94 | 98 |
* |
95 |
* @param[in] id The id of the service.
|
|
99 |
* @param[in] id Identifier of the service to retrieve.
|
|
96 | 100 |
* |
97 |
* @return . |
|
101 |
* @return Returns a pointer to the requested service. Returns NULL if no service matches the given ID.
|
|
98 | 102 |
*/ |
99 | 103 |
urt_service_t urtCoreGetService(urt_serviceid_t id) {return urt_service_t;} |
100 | 104 |
|
src/urt_message.c | ||
---|---|---|
48 | 48 |
/** |
49 | 49 |
* @brief Initalize the messages. |
50 | 50 |
* |
51 |
* @param[in] message Message to initalize. |
|
52 |
* @param[in] payload .
|
|
51 |
* @param[in] message Message to initalize. Must not be NULL.
|
|
52 |
* @param[in] payload May be NULL for messages without payload.
|
|
53 | 53 |
*/ |
54 | 54 |
void urtMessageInit(urt_message_t* message, void* payload) {return;} |
src/urt_node.c | ||
---|---|---|
48 | 48 |
/** |
49 | 49 |
* @brief Initalize the node. |
50 | 50 |
* |
51 |
* @param[in] node Node to initalize. |
|
52 |
* @param[in] thread . |
|
53 |
* @param[in] setupcallback . |
|
54 |
* @param[in] setupparams . |
|
55 |
* @param[in] loopcallback . |
|
56 |
* @param[in] loopparams . |
|
57 |
* @param[in] shutdowncallback . |
|
58 |
* @param[in] shutdownparams . |
|
51 |
* @param[in] node The node to initialize. Must not be NULL. |
|
52 |
* @param[in] thread The already initialized, exclusive thread for the node. Must not be NULL. |
|
53 |
* @param[in] setupcallback Callback function to be executed during setup. |
|
54 |
* May be NULL if no custom setup is required. |
|
55 |
* @param[in] setupparams Parameters for the setup callback function. |
|
56 |
* Must be NULLif no setup callback is specified. |
|
57 |
* May be NULLif the specified setup callback does not expect parameters. |
|
58 |
* @param[in] loopcallback Callback function to be executed in a loop. |
|
59 |
* Must not be NULL. |
|
60 |
* @param[in] loopparams Parameters for the loop callback function. |
|
61 |
* May be NULL if the specified loop callback does not expect parameters. |
|
62 |
* @param[in] shutdowncallback Callback function to be executed during shutdown. |
|
63 |
* May be NULL if no custom shutdown is required. |
|
64 |
* @param[in] shutdownparams Parameters for the loop callback function. |
|
65 |
* Must be NULL if no shutdown callback is specified. |
|
66 |
* May be NULL if the specified shutdown callback does not expect parameters. |
|
59 | 67 |
*/ |
60 | 68 |
void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback_t* setupcallback, |
61 | 69 |
void* setupparams, urt_nodeLoopCallback_t* loopcallback, void* loopparams, |
src/urt_publisher.c | ||
---|---|---|
48 | 48 |
/** |
49 | 49 |
* @brief Initalize the publisher. |
50 | 50 |
* |
51 |
* @param[in] publisher Publisher to initalize. |
|
52 |
* @param[in] topic . |
|
53 |
* @param[in] message . |
|
51 |
* @param[in] publisher The publisher to initialize. Must not be NULL. |
|
52 |
* @param[in] topic The topic, this publisher is associated to. Must not be NULL. |
|
53 |
* @param[in] message NULL terminated list of messages to contribute to the topic. |
|
54 |
* Messages must not be associated to another topic. |
|
55 |
* Once a message has been contributed, it cannot be removed later. |
|
56 |
* May be NULL (no messages to contribute). |
|
54 | 57 |
*/ |
55 | 58 |
void urtPublisherInit(urt_publisher_t* publisher, urt_topic_t* topic, urt_message_t* message) {return;} |
56 | 59 |
|
57 | 60 |
|
58 | 61 |
/** |
59 |
* @brief Initalize the node.
|
|
62 |
* @brief Publish data.
|
|
60 | 63 |
* |
61 |
* @param[in] publisher Publisher to .
|
|
62 |
* @param[in] payload .
|
|
63 |
* @param[in] bytes .
|
|
64 |
* @param[in] t .
|
|
65 |
* @param[in] timeout .
|
|
64 |
* @param[in] publisher Pointer to the publisher to use. Must not be NULL.
|
|
65 |
* @param[in] payload Pointer to the data to be published. May be NULL for messages without payload.
|
|
66 |
* @param[in] bytes Size of the payload in bytes.
|
|
67 |
* @param[in] t Timestamp to be set for the message.
|
|
68 |
* @param[in] timeout Timeout delay in case the message cannot be published.
|
|
66 | 69 |
* |
67 |
* @return A status value.
|
|
70 |
* @return Returns URT_STATUS_OK on success. Returns URT_STATUS_PUBLISH_TIMEOUT on timeout.
|
|
68 | 71 |
*/ |
69 | 72 |
urt_status_t urtPublisherPublish(urt_publisher_t* publisher, void* payload, size_t bytes, urt_osTime_t t, urt_delay_t timeout) {return URT_STATUS_OK;} |
src/urt_service.c | ||
---|---|---|
48 | 48 |
/** |
49 | 49 |
* @brief Initalize the service. |
50 | 50 |
* |
51 |
* @param[in] service Service to intialize.
|
|
52 |
* @param[in] id .
|
|
53 |
* @param[in] callback .
|
|
51 |
* @param[in] service The service to initialize. Must not be NULL.
|
|
52 |
* @param[in] id Unique, numeric identifier of the service.
|
|
53 |
* @param[in] callback Callback function to be executed by this service. Must not be NULL.
|
|
54 | 54 |
* |
55 |
* @return A status value. |
|
55 |
* @return Returns URT_STATUS_OK on success. |
|
56 |
* Returns URT_STATUS_SERVICE_DUPLICATE if another service with the same identifier already exists. |
|
56 | 57 |
*/ |
57 | 58 |
urt_status_t urtServiceInit(urt_service_t* service, urt_serviceid_t id, urt_servicefunc_t* callback) {return URT_STATUS_OK;} |
58 | 59 |
|
59 | 60 |
/** |
60 |
* @brief Call the Service .
|
|
61 |
* @brief Calls a service.
|
|
61 | 62 |
* |
62 |
* @param[in] service Service to . |
|
63 |
* @param[in] arg . |
|
64 |
* @param[in] ret . |
|
65 |
* @param[in] timeout . |
|
63 |
* @param[in] service The service to call. Must not be NULL. |
|
64 |
* @param[in] arg Optional argument for the service call. May be NULL if the service expects no arguments. |
|
65 |
* @param[in] ret Pointer to an optional output value. May be NULL. |
|
66 |
* @param[in] timeout Timeout delay to be propagated to the callback function. |
|
67 |
* Whether timeout is considered depends on the callback function. |
|
66 | 68 |
* |
67 |
* @return A status value.
|
|
69 |
* @return Returns the exact output status of the service call.
|
|
68 | 70 |
*/ |
69 | 71 |
urt_status_t urtServiceCall(urt_service_t* service, void* arg, void* ret, urt_delay_t timeout) {return URT_STATUS_OK;} |
src/urt_subscriber.c | ||
---|---|---|
48 | 48 |
/** |
49 | 49 |
* @brief Initialize the nrt Subscriber. |
50 | 50 |
* |
51 |
* @param[in] subscriber Subscriber to initalize.
|
|
51 |
* @param[in] subscriber The NRT subscriber to initialize. Must not be NULL.
|
|
52 | 52 |
*/ |
53 | 53 |
void urtNrtSubscriberInit (urt_nrtsubscriber_t* subscriber) {return;} |
54 | 54 |
|
55 | 55 |
/** |
56 |
* @brief .
|
|
56 |
* @brief Subscribes the subscriber to a topic.
|
|
57 | 57 |
* |
58 |
* @param[in] subscriber Subscriber to . |
|
59 |
* @param[in] topic . |
|
60 |
* @param[in] messages . |
|
58 |
* @param[in] subscriber The NRT subscriber which shall subscribe to a topic. Must not be NULL. |
|
59 |
* @param[in] topic The topic to subscribe to. Must not be NULL. |
|
60 |
* @param[in] messages NULL terminated list of messages to contribute to the topic. |
|
61 |
* Messages must not be associated to another topic. |
|
62 |
* Once a message has been contributed, it cannot be removed later. |
|
63 |
* May be NULL(no messages to contribute). |
|
61 | 64 |
* |
62 |
* @return A status value. |
|
65 |
* @return Returns URT_STATUS_OK on success. |
|
66 |
* Returns URT_STATUS_SUBSCRIBE_TOPICSET if the subscriber is already associated to a topic. |
|
63 | 67 |
*/ |
64 | 68 |
urt_status_t urtNrtSubscriberSubscribe (urt_nrtsubscriber_t* subscriber, urt_topic_t* topic, urt_message_t* messages) { |
65 | 69 |
return URT_STATUS_OK; |
66 | 70 |
} |
67 | 71 |
|
68 | 72 |
/** |
69 |
* @brief .
|
|
73 |
* @brief Fetches the next message.
|
|
70 | 74 |
* |
71 |
* @param[in] subscriber .
|
|
72 |
* @param[in] payload .
|
|
73 |
* @param[in] bytes .
|
|
74 |
* @param[in] latency .
|
|
75 |
* @param[in] subscriber The NRT subscriber that shall fetch the message. Must not be NULL.
|
|
76 |
* @param[in] payload Pointer where to copy the payload to. May be NULL for messages without payload.
|
|
77 |
* @param[in] bytes Payload size in bytes.
|
|
78 |
* @param[in] latency The latency can be returned by reference. May be NULL.
|
|
75 | 79 |
* |
76 |
* @return A status value. |
|
80 |
* @return Returns URT_STATUS_OK on success. |
|
81 |
* Returns URT_STATUS_FETCH_NOTOPIC if the subscriber is not associated to a topic. |
|
82 |
* Retruns URT_STATUS_FETCH_NOMESSAGE if there is no new message to fetch. |
|
77 | 83 |
*/ |
78 | 84 |
urt_status_t urtNrtSubscriberFetchNextMessage (urt_nrtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency) { |
79 | 85 |
return URT_STATUS_OK; |
80 | 86 |
} |
81 | 87 |
|
82 | 88 |
/** |
83 |
* @brief .
|
|
89 |
* @brief Fetches the lates message.
|
|
84 | 90 |
* |
85 |
* @param[in] subscriber .
|
|
86 |
* @param[in] payload .
|
|
87 |
* @param[in] bytes .
|
|
88 |
* @param[in] latency .
|
|
91 |
* @param[in] subscriber The NRT subscriber that shall fetch the message. Must not be NULL.
|
|
92 |
* @param[in] payload Pointer where to copy the payload to. May be NULL for messages without payload.
|
|
93 |
* @param[in] bytes Payload size in bytes.
|
|
94 |
* @param[in] latency The latency can be returned by reference. May be NULL.
|
|
89 | 95 |
* |
90 |
* @return A status value. |
|
96 |
* @return Returns URT_STATUS_OK on success. |
|
97 |
* Returns URT_STATUS_FETCH_NOTOPIC if the subscriber is not associated to a topic. |
|
98 |
* Returns URT_STATUS_FETCH_NOMESSAGE if there is no new message to fetch. |
|
91 | 99 |
*/ |
92 | 100 |
urt_status_t urtNrtSubscriberFetchLatestMessage (urt_nrtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency) { |
93 | 101 |
return URT_STATUS_OK; |
94 | 102 |
} |
95 | 103 |
|
96 | 104 |
/** |
97 |
* @brief .
|
|
105 |
* @brief Unsubscribes from a subscriber.
|
|
98 | 106 |
* |
99 |
* @param[in] subscriber |
|
107 |
* @param[in] subscriber The NRT subscriber to be unsubscribed. Must not be NULL.
|
|
100 | 108 |
* |
101 |
* @return A status value. |
|
109 |
* @return Returns URT_STATUS_OK on sucess. |
|
110 |
* Returns URT_STATUS_UNSUBSCRIBE_NOTOPIC if the subscriber is not associated to a topic. |
|
102 | 111 |
*/ |
103 | 112 |
urt_status_t urtNrtSubscriberUnsubscribe (urt_nrtsubscriber_t* subscriber) { |
104 | 113 |
return URT_STATUS_OK; |
... | ... | |
106 | 115 |
|
107 | 116 |
|
108 | 117 |
/** |
109 |
* @brief .
|
|
118 |
* @brief Initialize the srt Subscriber.
|
|
110 | 119 |
* |
111 |
* @param[in] subscriber . |
|
120 |
* @param[in] subscriber The SRT subscriber to initialize. Must not be NULL.
|
|
112 | 121 |
*/ |
113 | 122 |
void urtSrtSubscriberInit(urt_srtsubscriber_t* subscriber) {return;} |
114 | 123 |
|
115 | 124 |
/** |
116 |
* @brief . |
|
117 |
* |
|
118 |
* @param[in] subscriber . |
|
119 |
* @param[in] topic . |
|
120 |
* @param[in] message . |
|
121 |
* @param[in] usefulnesscb . |
|
122 |
* @param[in] cbparams . |
|
123 |
* |
|
124 |
* @return A status value. |
|
125 |
* @brief Subscribes the subscriber to a topic. |
|
126 |
* |
|
127 |
* @param[in] subscriber The SRT subscriber which shall subscribe to a topic. Must not be NULL. |
|
128 |
* @param[in] topic The topic to subscribe to. Must not be NULL. |
|
129 |
* @param[in] message NULL terminated list of messages to contribute to the topic. |
|
130 |
* Messages must not be associated to another topic. |
|
131 |
* Once a message has been contributed, it cannot be removed later. |
|
132 |
* May be NULL (no messages to contribute) |
|
133 |
* @param[in] usefulnesscb Pointer to a function to calculate usefulness of a message. Must not be NULL. |
|
134 |
* @param[in] cbparams Optional parameters for the usefulness callback. |
|
135 |
* May be NULL if the callback expects no parameters. |
|
136 |
* |
|
137 |
* @return Returns URT_STATUS_OK on success. |
|
138 |
* Returns URT_STATUS_SUBSCRIBE_TOPICSET if the subscriber is already associated to a topic. |
|
125 | 139 |
*/ |
126 | 140 |
urt_status_t urtSrtSubscriberSubscribe(urt_srtsubscriber_t* subscriber, urt_topic_t* topic, |
127 | 141 |
urt_message_t* message, urt_srtusefulnessfunc_t* usefulnesscb, void* cbparams) {return URT_STATUS_OK;} |
128 | 142 |
|
129 | 143 |
/** |
130 |
* @brief .
|
|
144 |
* @brief Fetches the next message.
|
|
131 | 145 |
* |
132 |
* @param[in] subscriber . |
|
133 |
* @param[in] payload . |
|
134 |
* @param[in] latency . |
|
146 |
* @param[in] subscriber The SRT subscriber that shall fetch the message. Must not be NULL. |
|
147 |
* @param[in] payload Pointer where to copy the payload to. May be NULL for messages without payload. |
|
148 |
* @param[in] bytes Payload size in bytes. |
|
149 |
* @param[in] latency The latency can be returned by reference. May be NULL. |
|
135 | 150 |
* |
136 |
* @return A status value. |
|
151 |
* @return Returns URT_STATUS_OK on success. |
|
152 |
* Returns URT_STATUS_FETCH_NOTOPIC if the subscriber is not associated to a topic. |
|
153 |
* Returns URT_STATUS_FETCH_NOMESSAGE if there is no new message to fetch. |
|
137 | 154 |
*/ |
138 | 155 |
urt_status_t urtSrtSubscriberFetchNextMessage(urt_srtsubscriber_t* subscriber, void* payload, |
139 | 156 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
140 | 157 |
|
141 | 158 |
/** |
142 |
* @brief .
|
|
159 |
* @brief Fetches the latest message.
|
|
143 | 160 |
* |
144 |
* @param[in] subscriber . |
|
145 |
* @param[in] payload . |
|
146 |
* @param[in] bytes . |
|
147 |
* @param[in] latency . |
|
161 |
* @param[in] subscriber The SRT subscriber that shall fetch the message. Must not be NULL.
|
|
162 |
* @param[in] payload Pointer where to copy the payload to. May be NULL for messages without payload.
|
|
163 |
* @param[in] bytes Payload size in bytes.
|
|
164 |
* @param[in] latency The latency can be returned by reference. May be NULL.
|
|
148 | 165 |
* |
149 |
* @return A status value. |
|
166 |
* @return Returns URT_STATUS_OK on success. |
|
167 |
* Returns URT_STATUS_FETCH_NOTOPIC if the subscriber is not associated to a topic. |
|
168 |
* Returns URT_STATUS_FETCH_NOMESSAGE if there is no new message to fetch. |
|
150 | 169 |
*/ |
151 | 170 |
urt_status_t urtSrtSubscriberFetchLatestMessage(urt_srtsubscriber_t* subscriber, void* payload, |
152 | 171 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
153 | 172 |
|
154 | 173 |
/** |
155 |
* @brief .
|
|
174 |
* @brief Calculates the usefulness of the subscriber.
|
|
156 | 175 |
* |
157 |
* @param[in] subscriber . |
|
158 |
* @param[in] latency . |
|
176 |
* @param[in] subscriber The SRT subscriber that shall fetch the message. Must not be NULL.
|
|
177 |
* @param[in] latency Latency (of a message) as argument to calculate usefulness.
|
|
159 | 178 |
* |
160 |
* @return A status value.
|
|
179 |
* @return Returns the usefulness as a value within [0,1].
|
|
161 | 180 |
*/ |
162 |
urt_status_t urtSrtSubscriberCalculateUsefulness(urt_srtsubscriber_t* subscriber, urt_delay_t latency){return URT_STATUS_OK;}
|
|
181 |
float urtSrtSubscriberCalculateUsefulness(urt_srtsubscriber_t* subscriber, urt_delay_t latency){return 0;}
|
|
163 | 182 |
|
164 | 183 |
/** |
165 |
* @brief .
|
|
184 |
* @brief Unsubscribes from a subscriber.
|
|
166 | 185 |
* |
167 |
* @param[in] subscriber . |
|
186 |
* @param[in] subscriber The NRT subscriber to be unsubscribed. Must not be NULL.
|
|
168 | 187 |
* |
169 |
* @return A status value. |
|
188 |
* @return Returns URT_STATUS_OK on sucess. |
|
189 |
* Returns URT_STATUS_UNSUBSCRIBE_NOTOPIC if the subscriber is not associated to a topic. |
|
170 | 190 |
*/ |
171 | 191 |
urt_status_t urtSrtSubscriberUnsubscribe(urt_srtsubscriber_t* subscriber){return URT_STATUS_OK;} |
172 | 192 |
|
173 | 193 |
|
174 | 194 |
/** |
175 |
* @brief .
|
|
195 |
* @brief Initialize the FRT Subscriber.
|
|
176 | 196 |
* |
177 |
* @param[in] subscriber . |
|
178 |
* |
|
179 |
* @return A status value. |
|
197 |
* @param[in] subscriber The SRT subscriber to initialize. Must not be NULL. |
|
180 | 198 |
*/ |
181 | 199 |
void urtFrtSubscriberInit(urt_frtsubscriber_t* subscriber){return URT_STATUS_OK;} |
182 | 200 |
|
183 | 201 |
/** |
184 |
* @brief . |
|
185 |
* |
|
186 |
* @param[in] subscriber . |
|
187 |
* @param[in] topic . |
|
188 |
* @param[in] messages . |
|
189 |
* @param[in] deadline . |
|
190 |
* @param[in] jitter . |
|
191 |
* |
|
192 |
* @return A status value. |
|
202 |
* @brief Subscribes the subscriber to a topic. |
|
203 |
* |
|
204 |
* @param[in] subscriber The NRT subscriber which shall subscribe to a topic. Must not be NULL. |
|
205 |
* @param[in] topic The topic to subscribe to. Must not be NULL. |
|
206 |
* @param[in] messages NULL terminated list of messages to contribute to the topic. |
|
207 |
* Messages must not be associated to another topic. |
|
208 |
* Once a message has been contributed, it cannot be removed later. |
|
209 |
* May be NULL(no messages to contribute). |
|
210 |
* @param[in] deadline Maximum latency to consume messages. A value of 0 indicates that latency is of no concern. |
|
211 |
* @param[in] jitter Maximum allowed jitter (difference between maximum and minimum latency) when consuming messages. |
|
212 |
* A value of 0 indicates that jitter is of no concern. |
|
213 |
* |
|
214 |
* @return Returns URT_STATUS_OK on success. |
|
215 |
* Returns URT_STATUS_SUBSCRIBE_TOPICSET if the subscriber is already associated to a topic. |
|
193 | 216 |
*/ |
194 | 217 |
urt_status_t urtFrtSubscriberSubscribe(urt_frtsubscriber_t* subscriber, urt_topic_t* topic, |
195 | 218 |
urt_message_t* messages, urt_delay_t deadline, urt_delay_t jitter){return URT_STATUS_OK;} |
196 | 219 |
|
197 | 220 |
/** |
198 |
* @brief .
|
|
221 |
* @brief Fetches the next message.
|
|
199 | 222 |
* |
200 |
* @param[in] subscriber . |
|
201 |
* @param[in] payload . |
|
202 |
* @param[in] bytes . |
|
203 |
* @param[in] latency . |
|
223 |
* @param[in] subscriber The SRT subscriber that shall fetch the message. Must not be NULL.
|
|
224 |
* @param[in] payload Pointer where to copy the payload to. May be NULL for messages without payload.
|
|
225 |
* @param[in] bytes Payload size in bytes.
|
|
226 |
* @param[in] latency The latency can be returned by reference. May be NULL.
|
|
204 | 227 |
* |
205 |
* @return A status value. |
|
228 |
* @return Returns URT_STATUS_OK on success. |
|
229 |
* Returns URT_STATUS_FETCH_NOTOPIC if the subscriber is not associated to a topic. |
|
230 |
* Returns URT_STATUS_FETCH_NOMESSAGE if there is no new message to fetch. |
|
206 | 231 |
*/ |
207 | 232 |
urt_status_t urtFrtSubscriberFetchNextMessage(urt_frtsubscriber_t* subscriber, void* payload, |
208 | 233 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
209 | 234 |
|
210 | 235 |
/** |
211 |
* @brief .
|
|
236 |
* @brief Fetches the latest message.
|
|
212 | 237 |
* |
213 |
* @param[in] subscriber . |
|
214 |
* @param[in] payload . |
|
215 |
* @param[in] bytes . |
|
216 |
* @param[in] latency . |
|
238 |
* @param[in] subscriber The SRT subscriber that shall fetch the message. Must not be NULL.
|
|
239 |
* @param[in] payload Pointer where to copy the payload to. May be NULL for messages without payload.
|
|
240 |
* @param[in] bytes Payload size in bytes.
|
|
241 |
* @param[in] latency The latency can be returned by reference. May be NULL.
|
|
217 | 242 |
* |
218 |
* @return A status value. |
|
243 |
* @return Returns URT_STATUS_OK on success. |
|
244 |
* Returns URT_STATUS_FETCH_NOTOPIC if the subscriber is not associated to a topic. |
|
245 |
* Returns URT_STATUS_FETCH_NOMESSAGE if there is no new message to fetch. |
|
219 | 246 |
*/ |
220 | 247 |
urt_status_t urtFrtSubscriberFetchLatestMessage(urt_frtsubscriber_t* subscriber, void* payload, |
221 | 248 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
222 | 249 |
|
223 | 250 |
/** |
224 |
* @brief .
|
|
251 |
* @brief Calculates the validity from the subscriber.
|
|
225 | 252 |
* |
226 |
* @param[in] subscriber . |
|
227 |
* @param[in] latency . |
|
253 |
* @param[in] subscriber The FRT subscriber to calculate a validity for. Must not be NULL.
|
|
254 |
* @param[in] latency Latency (of a message) as argument to calculate validity.
|
|
228 | 255 |
* |
229 |
* @return A status value.
|
|
256 |
* @return Returns a boolean indicator whether the latency is fine.
|
|
230 | 257 |
*/ |
231 | 258 |
bool urtFrtSubscriberCalculateValidity(urt_frtsubscriber_t* subscriber, urt_delay_t latency){return true;} |
232 | 259 |
|
233 | 260 |
/** |
234 |
* @brief .
|
|
261 |
* @brief Unsubscribes from a subscriber.
|
|
235 | 262 |
* |
236 |
* @param[in] subscriber . |
|
263 |
* @param[in] subscriber The NRT subscriber to be unsubscribed. Must not be NULL.
|
|
237 | 264 |
* |
238 |
* @return A status value. |
|
265 |
* @return Returns URT_STATUS_OK on sucess. |
|
266 |
* Returns URT_STATUS_UNSUBSCRIBE_NOTOPIC if the subscriber is not associated to a topic. |
|
239 | 267 |
*/ |
240 | 268 |
urt_status_t urtFrtSubscriberUnsubscribe(urt_frtsubscriber_t* subscriber){return URT_STATUS_OK;} |
241 | 269 |
|
242 | 270 |
|
243 | 271 |
/** |
244 |
* @brief .
|
|
272 |
* @brief Initialize the HRT Subscriber.
|
|
245 | 273 |
* |
246 |
* @param[in] subscriber . |
|
274 |
* @param[in] subscriber The HRT subscriber to initialize. Must not be NULL.
|
|
247 | 275 |
*/ |
248 | 276 |
void urtHrtSubscriberInit(urt_hrtsubscriber_t* subscriber){return;} |
249 | 277 |
|
250 | 278 |
/** |
251 |
* @brief . |
|
252 |
* |
|
253 |
* @param[in] subscriber . |
|
254 |
* @param[in] topic . |
|
255 |
* @param[in] message . |
|
256 |
* @param[in] deadline . |
|
257 |
* @param[in] rate . |
|
258 |
* @param[in] jitter . |
|
259 |
* |
|
260 |
* @return A status value. |
|
279 |
* @brief Subscribes the subscriber to a topic. |
|
280 |
* |
|
281 |
* @param[in] subscriber The NRT subscriber which shall subscribe to a topic. Must not be NULL. |
|
282 |
* @param[in] topic The topic to subscribe to. Must not be NULL. |
|
283 |
* @param[in] messages NULL terminated list of messages to contribute to the topic. |
|
284 |
* Messages must not be associated to another topic. |
|
285 |
* Once a message has been contributed, it cannot be removed later. |
|
286 |
* May be NULL(no messages to contribute). |
|
287 |
* @param[in] deadline Maximum latency to consume messages. A value of 0 indicates that latency is of no concern. |
|
288 |
* @param[in] rate Expected minimum rate of new messages (= maximum time between consecutive messages). |
|
289 |
* A value of 0 indicates, that rate is of no concern. |
|
290 |
* @param[in] jitter Maximum allowed jitter (difference between maximum and minimum latency) when consuming messages. |
|
291 |
* A value of 0 indicates that jitter is of no concern. |
|
292 |
* |
|
293 |
* @return Returns URT_STATUS_OK on success. |
|
294 |
* Returns URT_STATUS_SUBSCRIBE_TOPICSET if the subscriber is already associated to a topic. |
|
261 | 295 |
*/ |
262 | 296 |
urt_status_t urtHrtSubscriberSubscribe(urt_hrtsubscriber_t* subscriber, urt_topic_t* topic, |
263 | 297 |
urt_message_t* message, urt_delay_t deadline, urt_delay_t rate, urt_delay_t jitter){return URT_STATUS_OK;} |
264 | 298 |
|
265 | 299 |
|
266 | 300 |
/** |
267 |
* @brief .
|
|
301 |
* @brief Fetches the next message.
|
|
268 | 302 |
* |
269 |
* @param[in] subscriber . |
|
270 |
* @param[in] payload . |
|
271 |
* @param[in] bytes . |
|
272 |
* @param[in] latency . |
|
303 |
* @param[in] subscriber The SRT subscriber that shall fetch the message. Must not be NULL.
|
|
304 |
* @param[in] payload Pointer where to copy the payload to. May be NULL for messages without payload.
|
|
305 |
* @param[in] bytes Payload size in bytes.
|
|
306 |
* @param[in] latency The latency can be returned by reference. May be NULL.
|
|
273 | 307 |
* |
274 |
* @return A status value. |
|
308 |
* @return Returns URT_STATUS_OK on success. |
|
309 |
* Returns URT_STATUS_FETCH_NOTOPIC if the subscriber is not associated to a topic. |
|
310 |
* Returns URT_STATUS_FETCH_NOMESSAGE if there is no new message to fetch. |
|
275 | 311 |
*/ |
276 | 312 |
urt_status_t urtHrtSubscriberFetchNextMessage(urt_hrtsubscriber_t* subscriber, void* payload, |
277 | 313 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
278 | 314 |
|
279 | 315 |
|
280 | 316 |
/** |
281 |
* @brief .
|
|
317 |
* @brief Fetches the latest message.
|
|
282 | 318 |
* |
283 |
* @param[in] subscriber . |
|
284 |
* @param[in] payload . |
|
285 |
* @param[in] bytes . |
|
286 |
* @param[in] latency . |
|
319 |
* @param[in] subscriber The SRT subscriber that shall fetch the message. Must not be NULL.
|
|
320 |
* @param[in] payload Pointer where to copy the payload to. May be NULL for messages without payload.
|
|
321 |
* @param[in] bytes Payload size in bytes.
|
|
322 |
* @param[in] latency The latency can be returned by reference. May be NULL.
|
|
287 | 323 |
* |
288 |
* @return A status value. |
|
324 |
* @return Returns URT_STATUS_OK on success. |
|
325 |
* Returns URT_STATUS_FETCH_NOTOPIC if the subscriber is not associated to a topic. |
|
326 |
* Returns URT_STATUS_FETCH_NOMESSAGE if there is no new message to fetch. |
|
289 | 327 |
*/ |
290 | 328 |
urt_status_t urtHrtSubscriberFetchLatestMessage(urt_hrtsubscriber_t* subscriber, void* payload, |
291 | 329 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
292 | 330 |
|
293 | 331 |
/** |
294 |
* @brief .
|
|
332 |
* @brief Unsubscribes from a subscriber.
|
|
295 | 333 |
* |
296 |
* @param[in] subscriber . |
|
334 |
* @param[in] subscriber The HRT subscriber to be unsubscribed. Must not be NULL.
|
|
297 | 335 |
* |
298 |
* @return A status value. |
|
336 |
* @return Returns URT_STATUS_OK on sucess. |
|
337 |
* Returns URT_STATUS_UNSUBSCRIBE_NOTOPIC if the subscriber is not associated to a topic. |
|
299 | 338 |
*/ |
300 | 339 |
urt_status_t urtHrtSubscriberUnsubscribe(urt_hrtsubscriber_t* subscriber){return URT_STATUS_OK;} |
src/urt_topic.c | ||
---|---|---|
48 | 48 |
/** |
49 | 49 |
* @brief Initialize the topic. |
50 | 50 |
* |
51 |
* @param[in] topic Topic to initialize.
|
|
52 |
* @param[in] id .
|
|
51 |
* @param[in] topic The topic to initialize. Must not be NULL.
|
|
52 |
* @param[in] id Unique, numeric identifier of the topic.
|
|
53 | 53 |
* |
54 |
* @return A status value. |
|
54 |
* @return Returns URT_STATUS_OK on success. |
|
55 |
* Returns URT_STATUS_TOPIC_DUPLICATE if another topic with the same identifier already exists. |
|
55 | 56 |
*/ |
56 | 57 |
urt_status_t urtTopicInit(urt_topic_t* topic, urt_topicid_t id) {return URT_STATUS_OK;} |
Also available in: Unified diff