Revision e7056e1b src/urt_core.c
| src/urt_core.c | ||
|---|---|---|
| 234 | 234 |
* @brief Prepend node to core's list of nodes. |
| 235 | 235 |
* |
| 236 | 236 |
* @param[in] node The node to prepend. Must not be NULL. |
| 237 |
* |
|
| 238 |
* @return URT_STATUS_OK on success. |
|
| 237 | 239 |
*/ |
| 238 |
void urtCoreAddNode(urt_node_t* node)
|
|
| 240 |
urt_status_t urtCoreAddNode(urt_node_t* node)
|
|
| 239 | 241 |
{
|
| 240 | 242 |
urtDebugAssert(node); |
| 241 | 243 |
|
| 244 |
urtMutexLock(&core._lock); |
|
| 242 | 245 |
node->next = core._nodes; |
| 243 | 246 |
core._nodes = node; |
| 244 |
return; |
|
| 247 |
urtMutexUnlock(&core._lock); |
|
| 248 |
return URT_STATUS_OK; |
|
| 245 | 249 |
} |
| 246 | 250 |
|
| 247 | 251 |
|
| ... | ... | |
| 257 | 261 |
/** |
| 258 | 262 |
* @brief Append topic to core's list of topics. |
| 259 | 263 |
* |
| 260 |
* @param[in] node The topic to append. |
|
| 264 |
* @param[in] node The topic to append. Must not be NULL.
|
|
| 261 | 265 |
*/ |
| 262 |
void urtCoreAddTopic(urt_topic_t* topic)
|
|
| 266 |
urt_status_t urtCoreAddTopic(urt_topic_t* topic)
|
|
| 263 | 267 |
{
|
| 268 |
urtDebugAssert(topic); |
|
| 269 |
|
|
| 270 |
urtMutexLock(&core._lock); |
|
| 264 | 271 |
urt_topic_t* lastTopic = core._topics; |
| 265 | 272 |
while (lastTopic->next != NULL) |
| 266 | 273 |
{
|
| 267 | 274 |
lastTopic = lastTopic->next; |
| 268 | 275 |
} |
| 269 | 276 |
lastTopic->next = topic; |
| 270 |
return; |
|
| 277 |
urtMutexUnlock(&core._lock); |
|
| 278 |
return URT_STATUS_OK; |
|
| 271 | 279 |
} |
| 272 | 280 |
|
| 273 | 281 |
/** |
| ... | ... | |
| 292 | 300 |
|
| 293 | 301 |
# if (URT_CFG_RPC_ENABLED) |
| 294 | 302 |
/** |
| 303 |
* @brief Prepend service to core's list of services. |
|
| 304 |
* |
|
| 305 |
* @param[in] service The service to prepend. Must not be NULL. |
|
| 306 |
* |
|
| 307 |
* @return URT_STATUS_OK on success. |
|
| 308 |
*/ |
|
| 309 |
urt_status_t urtCoreAddService(urt_service_t* service) |
|
| 310 |
{
|
|
| 311 |
urtDebugAssert(service); |
|
| 312 |
|
|
| 313 |
urtMutexLock(&core._lock); |
|
| 314 |
service->next = core._services; |
|
| 315 |
core._services = service; |
|
| 316 |
urtMutexUnlock(&core._lock); |
|
| 317 |
return URT_STATUS_OK; |
|
| 318 |
} |
|
| 319 |
|
|
| 320 |
/** |
|
| 295 | 321 |
* @brief Get the service of the Core. |
| 296 | 322 |
* |
| 297 | 323 |
* @param[in] id Identifier of the service to retrieve. |
| 298 | 324 |
* |
| 299 | 325 |
* @return Returns a pointer to the requested service. Returns NULL if no service matches the given ID. |
| 300 | 326 |
*/ |
| 301 |
urt_service_t urtCoreGetService(urt_serviceid_t id) {return urt_service_t;}
|
|
| 327 |
urt_service_t* urtCoreGetService(urt_serviceid_t id) {return urt_service_t;}
|
|
| 302 | 328 |
# endif /* URT_CFG_RPC_ENABLED */ |
| 303 | 329 |
|
| 330 |
#if (URT_CFG_PUBSUB_QOS_DEADLINECHECKS) |
|
| 331 |
urt_osTimerCallback_t urtCoreCallbackDefault(void* params) |
|
| 332 |
{
|
|
| 333 |
urtMutexLock(&core._lock); |
|
| 334 |
while (params) {
|
|
| 335 |
urtPrintf("Danger");
|
|
| 336 |
urtThreadSleep(1); |
|
| 337 |
} |
|
| 338 |
urtMutexUnlock(&core._lock); |
|
| 339 |
return |
|
| 340 |
} |
|
| 341 |
#endif /* URT_CFG_PUBSUB_QOS_DEADLINECHECKS */ |
|
| 342 |
|
|
| 304 | 343 |
|
Also available in: Unified diff