/*
µ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 .
*/
#ifndef URTWARE_NODE_H
#define URTWARE_NODE_H
#include
/******************************************************************************/
/* CONSTANTS */
/******************************************************************************/
/******************************************************************************/
/* SETTINGS */
/******************************************************************************/
/******************************************************************************/
/* CHECKS */
/******************************************************************************/
/******************************************************************************/
/* DATA STRUCTURES AND TYPES */
/******************************************************************************/
/*
* forward declarations
*/
typedef struct urt_node urt_node_t;
/**
* @brief
*
* @param[in] node .
* @param[in] cause .
* @param[in] arg .
*
* @return .
*
*/
typedef void (*urt_nodeShutdownCallback_t)(urt_node_t* node, urt_status_t cause, void* arg);
/**
* @brief
*
* @param[in] node .
* @param[in] arg .
*
* @return .
*
*/
typedef urt_osEventMask_t (*urt_nodeSetupCallback_t)(urt_node_t* node, void* arg);
/**
* @brief
*
* @param[in] node .
* @param[in] events .
* @param[in] arg .
*
* @return .
*/
typedef urt_osEventMask_t (*urt_nodeLoopCallback_t)(urt_node_t* node, urt_osEventMask_t events, void* arg);
/**
* @brief node
*/
struct urt_node
{
struct urt_node* next;
urt_osThread_t* thread;
urt_nodeSetupCallback_t setupcallback;
void* setupparams;
urt_nodeLoopCallback_t loopcallback;
void* loopparams;
urt_nodeShutdownCallback_t shutdowncallback;
void* shutdownparams;
urt_nodestage_t stage;
urt_osEventListener_t listener;
#if (URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING)
uint64_t loops;
#endif /* URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING */
};
/******************************************************************************/
/* MACROS */
/******************************************************************************/
/******************************************************************************/
/* EXTERN DECLARATIONS */
/******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif /* defined(__cplusplus) */
void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_osThreadPrio_t prio, urt_nodeSetupCallback_t setupcallback,
void* setupparams, urt_nodeLoopCallback_t loopcallback, void* loopparams,
urt_nodeShutdownCallback_t shutdowncallback, void* shutdownparams);
#if defined(__cplusplus)
}
#endif /* defined(__cplusplus) */
/******************************************************************************/
/* INLINE FUNCTIONS */
/******************************************************************************/
#endif /* URTWARE_NODE_H */