Revision 5198dfae src/urt_subscriber.c
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;} |
Also available in: Unified diff