Revision 7d9678db
inc/urt_core.h | ||
---|---|---|
22 | 22 |
#ifndef URTWARE_CORE_H |
23 | 23 |
#define URTWARE_CORE_H |
24 | 24 |
|
25 |
#include <urt_types.h> |
|
26 |
#include <urtware.h> |
|
27 |
|
|
25 | 28 |
/******************************************************************************/ |
26 | 29 |
/* CONSTANTS */ |
27 | 30 |
/******************************************************************************/ |
... | ... | |
38 | 41 |
/* DATA STRUCTURES AND TYPES */ |
39 | 42 |
/******************************************************************************/ |
40 | 43 |
|
44 |
/** |
|
45 |
* @brief core |
|
46 |
*/ |
|
47 |
typedef struct urt_core |
|
48 |
{ |
|
49 |
urt_node_t* _nodes; |
|
50 |
urt_osEventSource_t* _evtSource; |
|
51 |
urt_osMutex_t _lock; |
|
52 |
urt_status_t _status; |
|
53 |
#if (URT_CFG_PUBSUB_ENABLED) |
|
54 |
urt_topic_t* _topics; |
|
55 |
#endif /* URT_CFG_PUBSUB_ENABLED */ |
|
56 |
#if (URT_CFG_RPC_ENABLED) |
|
57 |
urt_service_t* _services; |
|
58 |
#endif /* URT_CFG_RPC_ENABLED */ |
|
59 |
}urt_core_t; |
|
60 |
|
|
41 | 61 |
/******************************************************************************/ |
42 | 62 |
/* MACROS */ |
43 | 63 |
/******************************************************************************/ |
... | ... | |
46 | 66 |
/* EXTERN DECLARATIONS */ |
47 | 67 |
/******************************************************************************/ |
48 | 68 |
|
69 |
#if defined(__cplusplus) |
|
70 |
extern "C" { |
|
71 |
#endif /* defined(__cplusplus) */ |
|
72 |
|
|
73 |
void urtCoreInit(void); |
|
74 |
urt_status_t urtCoreGetStatus(void); |
|
75 |
void urtCoreStartNodes(void); |
|
76 |
urt_status_t urtCoreSynchronize(urt_node_t* node); |
|
77 |
urt_status_t urtCoreStopNodes(urt_status_t reason); |
|
78 |
|
|
79 |
#if (URT_CFG_PUBSUB_ENABLED) |
|
80 |
urt_topic_t* urtCoreGetTopic(urt_topicid_t id); |
|
81 |
#endif /* URT_CFG_PUBSUB_ENABLED */ |
|
82 |
|
|
83 |
#if (URT_CFG_RPC_ENABLED) |
|
84 |
urt_service_t urtCoreGetService(urt_serviceid_t id); |
|
85 |
#endif /* URT_CFG_RPC_ENABLED */ |
|
86 |
|
|
87 |
#if defined(__cplusplus) |
|
88 |
} |
|
89 |
#endif /* defined(__cplusplus) */ |
|
90 |
|
|
49 | 91 |
/******************************************************************************/ |
50 | 92 |
/* INLINE FUNCTIONS */ |
51 | 93 |
/******************************************************************************/ |
inc/urt_message.h | ||
---|---|---|
22 | 22 |
#ifndef URTWARE_MESSAGE_H |
23 | 23 |
#define URTWARE_MESSAGE_H |
24 | 24 |
|
25 |
#include <urtware.h> |
|
26 |
|
|
25 | 27 |
/******************************************************************************/ |
26 | 28 |
/* CONSTANTS */ |
27 | 29 |
/******************************************************************************/ |
... | ... | |
38 | 40 |
/* DATA STRUCTURES AND TYPES */ |
39 | 41 |
/******************************************************************************/ |
40 | 42 |
|
43 |
/** |
|
44 |
* @brief message |
|
45 |
*/ |
|
46 |
typedef struct urt_message |
|
47 |
{ |
|
48 |
urt_message_t* next; |
|
49 |
void* payload; |
|
50 |
urt_osTime_t originTime; |
|
51 |
unsigned int numHrtConsumersLeft; |
|
52 |
#if (URT_CFG_PUBSUB_PROFILING) |
|
53 |
unsigned int numConsumersLeft; |
|
54 |
#endif /* URT_CFG_PUBSUB_PROFILING */ |
|
55 |
}urt_message_t; |
|
56 |
|
|
41 | 57 |
/******************************************************************************/ |
42 | 58 |
/* MACROS */ |
43 | 59 |
/******************************************************************************/ |
... | ... | |
46 | 62 |
/* EXTERN DECLARATIONS */ |
47 | 63 |
/******************************************************************************/ |
48 | 64 |
|
65 |
#if defined(__cplusplus) |
|
66 |
extern "C" { |
|
67 |
#endif /* defined(__cplusplus) */ |
|
68 |
|
|
69 |
void urtMessageInit(urt_message_t* message, void* payload); |
|
70 |
#if defined(__cplusplus) |
|
71 |
} |
|
72 |
#endif /* defined(__cplusplus) */ |
|
73 |
|
|
49 | 74 |
/******************************************************************************/ |
50 | 75 |
/* INLINE FUNCTIONS */ |
51 | 76 |
/******************************************************************************/ |
inc/urt_node.h | ||
---|---|---|
22 | 22 |
#ifndef URTWARE_NODE_H |
23 | 23 |
#define URTWARE_NODE_H |
24 | 24 |
|
25 |
#include <urt_types.h> |
|
26 |
#include <urtware.h> |
|
27 |
|
|
25 | 28 |
/******************************************************************************/ |
26 | 29 |
/* CONSTANTS */ |
27 | 30 |
/******************************************************************************/ |
... | ... | |
38 | 41 |
/* DATA STRUCTURES AND TYPES */ |
39 | 42 |
/******************************************************************************/ |
40 | 43 |
|
44 |
/** |
|
45 |
* @brief node |
|
46 |
*/ |
|
47 |
typedef struct urt_node |
|
48 |
{ |
|
49 |
urt_node_t* next; |
|
50 |
urt_osThread_t* thread; |
|
51 |
urt_nodeSetupCallback_t* setupcallback; |
|
52 |
void* setupparams; |
|
53 |
urt_nodeLoopCallback_t* loopcallback; |
|
54 |
void* loopparams; |
|
55 |
urt_nodeShutdownCallback_t* shutdowncallback; |
|
56 |
void* shutdownparams; |
|
57 |
urt_nodestage_t stage; |
|
58 |
urt_osEventListener_t listener; |
|
59 |
#if (URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING) |
|
60 |
uint64_t loops; |
|
61 |
#endif /* URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING */ |
|
62 |
}urt_node_t; |
|
63 |
|
|
41 | 64 |
/******************************************************************************/ |
42 | 65 |
/* MACROS */ |
43 | 66 |
/******************************************************************************/ |
... | ... | |
46 | 69 |
/* EXTERN DECLARATIONS */ |
47 | 70 |
/******************************************************************************/ |
48 | 71 |
|
72 |
#if defined(__cplusplus) |
|
73 |
extern "C" { |
|
74 |
#endif /* defined(__cplusplus) */ |
|
75 |
|
|
76 |
void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback_t* setupcallback, void* setupparams, urt_nodeLoopCallback_t* loopcallback, void* loopparams, urt_nodeShutdownCallback_t* shutdowncallback, void* shutodwnparams); |
|
77 |
#if defined(__cplusplus) |
|
78 |
} |
|
79 |
#endif /* defined(__cplusplus) */ |
|
80 |
|
|
49 | 81 |
/******************************************************************************/ |
50 | 82 |
/* INLINE FUNCTIONS */ |
51 | 83 |
/******************************************************************************/ |
inc/urt_publisher.h | ||
---|---|---|
22 | 22 |
#ifndef URTWARE_PUBLISHER_H |
23 | 23 |
#define URTWARE_PUBLISHER_H |
24 | 24 |
|
25 |
#include <urt_types.h> |
|
26 |
#include <urtware.h> |
|
27 |
|
|
25 | 28 |
/******************************************************************************/ |
26 | 29 |
/* CONSTANTS */ |
27 | 30 |
/******************************************************************************/ |
... | ... | |
38 | 41 |
/* DATA STRUCTURES AND TYPES */ |
39 | 42 |
/******************************************************************************/ |
40 | 43 |
|
44 |
/** |
|
45 |
* @brief publisher |
|
46 |
*/ |
|
47 |
typedef struct urt_publisher |
|
48 |
{ |
|
49 |
urt_topic_t* topic; |
|
50 |
#if (URT_CFG_PUBSUB_PROFILING) |
|
51 |
uint64_t publishAttempts; |
|
52 |
uint64_t publishFails; |
|
53 |
#endif /* URT_CFG_PUBSUB_PROFILING */ |
|
54 |
}urt_publisher_t; |
|
55 |
|
|
41 | 56 |
/******************************************************************************/ |
42 | 57 |
/* MACROS */ |
43 | 58 |
/******************************************************************************/ |
... | ... | |
46 | 61 |
/* EXTERN DECLARATIONS */ |
47 | 62 |
/******************************************************************************/ |
48 | 63 |
|
64 |
#if defined(__cplusplus) |
|
65 |
extern "C" { |
|
66 |
#endif /* defined(__cplusplus) */ |
|
67 |
|
|
68 |
void urtPublisherInit(urt_publisher_t* publisher, urt_topic_t* topic, urt_message_t* message); |
|
69 |
urt_status_t urtPublisherPublish(urt_publisher_t* publisher, void* payload, size_t bytes, urt_osTime_t t, urt_delay_t timeout); |
|
70 |
#if defined(__cplusplus) |
|
71 |
} |
|
72 |
#endif /* defined(__cplusplus) */ |
|
73 |
|
|
49 | 74 |
/******************************************************************************/ |
50 | 75 |
/* INLINE FUNCTIONS */ |
51 | 76 |
/******************************************************************************/ |
inc/urt_service.h | ||
---|---|---|
22 | 22 |
#ifndef URTWARE_SERVICE_H |
23 | 23 |
#define URTWARE_SERVICE_H |
24 | 24 |
|
25 |
#include <urt_types.h> |
|
26 |
#include <urtware.h> |
|
27 |
|
|
25 | 28 |
/******************************************************************************/ |
26 | 29 |
/* CONSTANTS */ |
27 | 30 |
/******************************************************************************/ |
... | ... | |
38 | 41 |
/* DATA STRUCTURES AND TYPES */ |
39 | 42 |
/******************************************************************************/ |
40 | 43 |
|
44 |
/** |
|
45 |
* @brief service |
|
46 |
*/ |
|
47 |
typedef struct urt_service |
|
48 |
{ |
|
49 |
urt_service_t* next; |
|
50 |
urt_serviceid_t id; |
|
51 |
urt_osMutex_t lock; |
|
52 |
urt_servicefunc_t* callback; |
|
53 |
#if (URT_CFG_RPC_PROFILING) |
|
54 |
uint64_t sumDurations; |
|
55 |
uint64_t numCalls; |
|
56 |
uint64_t numTimeouts; |
|
57 |
urt_delay_t minDuration; |
|
58 |
urt_delay_t maxDuration; |
|
59 |
#endif /* URT_CFG_RPC_PROFILING */ |
|
60 |
}urt_service_t; |
|
61 |
|
|
41 | 62 |
/******************************************************************************/ |
42 | 63 |
/* MACROS */ |
43 | 64 |
/******************************************************************************/ |
... | ... | |
46 | 67 |
/* EXTERN DECLARATIONS */ |
47 | 68 |
/******************************************************************************/ |
48 | 69 |
|
70 |
#if defined(__cplusplus) |
|
71 |
extern "C" { |
|
72 |
#endif /* defined(__cplusplus) */ |
|
73 |
|
|
74 |
urt_status_t urtServiceInit(urt_service_t* service, urt_serviceid_t id, urt_servicefunc_t* callback); |
|
75 |
urt_status_t urtServiceCall(urt_service_t* service, void* arg, void* ret, urt_delay_t timeout); |
|
76 |
#if defined(__cplusplus) |
|
77 |
} |
|
78 |
#endif /* defined(__cplusplus) */ |
|
79 |
|
|
49 | 80 |
/******************************************************************************/ |
50 | 81 |
/* INLINE FUNCTIONS */ |
51 | 82 |
/******************************************************************************/ |
inc/urt_subscriber.h | ||
---|---|---|
23 | 23 |
#define URTWARE_SUBSCRIBER_H |
24 | 24 |
|
25 | 25 |
#include <urt_types.h> |
26 |
#include <urtware.h> |
|
26 | 27 |
|
27 | 28 |
/******************************************************************************/ |
28 | 29 |
/* CONSTANTS */ |
... | ... | |
134 | 135 |
extern "C" { |
135 | 136 |
#endif /* defined(__cplusplus) */ |
136 | 137 |
|
137 |
void urtNrtSubscriberInit(); |
|
138 |
urt_status_t urtNrtSubscriberSubscribe(); |
|
139 |
urt_status_t urtNrtSubscriberFetchNextMessage(); |
|
140 |
urt_status_t urtNrtSubscriberFetchLatestMessage(); |
|
141 |
urt_status_t urtNrtSubscriberUnsubscribe(); |
|
142 |
|
|
143 |
void urtSrtSubscriberInit(); |
|
144 |
urt_status_t urtSrtSubscriberSubscribe(); |
|
145 |
urt_status_t urtSrtSubscriberFetchNextMessage(); |
|
146 |
urt_status_t urtSrtSubscriberFetchLatestMessage(); |
|
147 |
urt_status_t urtSrtSubscriberCalculateUsefulness(); |
|
148 |
urt_status_t urtSrtSubscriberUnsubscribe(); |
|
149 |
|
|
150 |
void urtFrtSubscriberInit(); |
|
151 |
urt_status_t urtFrtSubscriberSubscribe(); |
|
152 |
urt_status_t urtFrtSubscriberFetchNextMessage(); |
|
153 |
urt_status_t urtFrtSubscriberFetchLatestMessage(); |
|
154 |
bool urtFrtSubscriberCalculateValidity(); |
|
155 |
urt_status_t urtFrtSubscriberUnsubscribe(); |
|
156 |
|
|
157 |
void urtHrtSubscriberInit(); |
|
158 |
urt_status_t urtHrtSubscriberSubscribe(); |
|
159 |
urt_status_t urtHrtSubscriberFetchNextMessage(); |
|
160 |
urt_status_t urtHrtSubscriberFetchLatestMessage(); |
|
161 |
urt_status_t urtHrtSubscriberUnsubscribe(); |
|
162 |
|
|
163 |
float urt_srtusefulnessfunc_t(); |
|
138 |
void urtNrtSubscriberInit(urt_nrtsubscriber_t* subscriber); |
|
139 |
urt_status_t urtNrtSubscriberSubscribe(urt_nrtsubscriber_t* subscriber, urt_topic_t* topic, urt_message_t* messages); |
|
140 |
urt_status_t urtNrtSubscriberFetchNextMessage(urt_nrtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency); |
|
141 |
urt_status_t urtNrtSubscriberFetchLatestMessage(urt_nrtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency); |
|
142 |
urt_status_t urtNrtSubscriberUnsubscribe(urt_nrtsubscriber_t* subscriber); |
|
143 |
|
|
144 |
void urtSrtSubscriberInit(urt_srtsubscriber_t* subscriber); |
|
145 |
urt_status_t urtSrtSubscriberSubscribe(urt_srtsubscriber_t* subscriber, urt_topic_t* topic, urt_message_t* message, urt_srtusefulnessfunc_t* usefulnesscb, void* cbparams); |
|
146 |
urt_status_t urtSrtSubscriberFetchNextMessage(urt_srtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency); |
|
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); |
|
149 |
urt_status_t urtSrtSubscriberUnsubscribe(urt_srtsubscriber_t* subscriber); |
|
150 |
|
|
151 |
void urtFrtSubscriberInit(urt_frtsubscriber_t* subscriber); |
|
152 |
urt_status_t urtFrtSubscriberSubscribe(urt_frtsubscriber_t* subscriber, urt_topic_t* topic, urt_message_t* messages, urt_delay_t deadline, urt_delay_t jitter); |
|
153 |
urt_status_t urtFrtSubscriberFetchNextMessage(urt_frtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency); |
|
154 |
urt_status_t urtFrtSubscriberFetchLatestMessage(urt_frtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency); |
|
155 |
bool urtFrtSubscriberCalculateValidity(urt_frtsubscriber_t* subscriber, urt_delay_t latency); |
|
156 |
urt_status_t urtFrtSubscriberUnsubscribe(urt_frtsubscriber_t* subscriber); |
|
157 |
|
|
158 |
void urtHrtSubscriberInit(urt_hrtsubscriber_t* subscriber); |
|
159 |
urt_status_t urtHrtSubscriberSubscribe(urt_hrtsubscriber_t* subscriber, urt_topic_t* topic, urt_message_t* message, urt_delay_t deadline, urt_delay_t rate, urt_delay_t jitter); |
|
160 |
urt_status_t urtHrtSubscriberFetchNextMessage(urt_hrtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency); |
|
161 |
urt_status_t urtHrtSubscriberFetchLatestMessage(urt_hrtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency); |
|
162 |
urt_status_t urtHrtSubscriberUnsubscribe(urt_hrtsubscriber_t* subscriber); |
|
164 | 163 |
#if defined(__cplusplus) |
165 | 164 |
} |
166 | 165 |
#endif /* defined(__cplusplus) */ |
inc/urt_topic.h | ||
---|---|---|
22 | 22 |
#ifndef URTWARE_TOPIC_H |
23 | 23 |
#define URTWARE_TOPIC_H |
24 | 24 |
|
25 |
#include <urt_types.h> |
|
26 |
#include <urtware.h> |
|
27 |
|
|
25 | 28 |
/******************************************************************************/ |
26 | 29 |
/* CONSTANTS */ |
27 | 30 |
/******************************************************************************/ |
... | ... | |
38 | 41 |
/* DATA STRUCTURES AND TYPES */ |
39 | 42 |
/******************************************************************************/ |
40 | 43 |
|
44 |
/** |
|
45 |
* @brief topic |
|
46 |
*/ |
|
47 |
typedef struct urt_topic |
|
48 |
{ |
|
49 |
urt_topic_t* next; |
|
50 |
urt_topicid_t id; |
|
51 |
urt_osMutex_t lock; |
|
52 |
urt_osEventSource_t evtSource; |
|
53 |
unsigned int numHrtSubscribers; |
|
54 |
urt_osCondvar_t hrtReleased; |
|
55 |
urt_message_t mandatoryMessage; |
|
56 |
urt_message_t* latestMessage; |
|
57 |
#if (URT_CFG_PUBSUB_QOS_RATECHECKS) |
|
58 |
urt_hrtsubscriber_t* hrtSubscribers; |
|
59 |
urt_osTimer_t qosRateTimer; |
|
60 |
#endif /* URT_CFG_PUBSUB_QOS_RATECHECKS */ |
|
61 |
#if (URT_CFG_PUBSUB_PROFILING) |
|
62 |
uint64_t numMessagesPublished; |
|
63 |
uint64_t numMessagesDiscarded; |
|
64 |
unsigned int numSubscribers; |
|
65 |
#endif /* URT_CFG_PUBSUB_PROFILING */ |
|
66 |
}urt_topic_t; |
|
67 |
|
|
41 | 68 |
/******************************************************************************/ |
42 | 69 |
/* MACROS */ |
43 | 70 |
/******************************************************************************/ |
... | ... | |
46 | 73 |
/* EXTERN DECLARATIONS */ |
47 | 74 |
/******************************************************************************/ |
48 | 75 |
|
76 |
#if defined(__cplusplus) |
|
77 |
extern "C" { |
|
78 |
#endif /* defined(__cplusplus) */ |
|
79 |
|
|
80 |
urt_status_t urtTopicInit(urt_topic_t* topic, urt_topicid_t id); |
|
81 |
#if defined(__cplusplus) |
|
82 |
} |
|
83 |
#endif /* defined(__cplusplus) */ |
|
84 |
|
|
49 | 85 |
/******************************************************************************/ |
50 | 86 |
/* INLINE FUNCTIONS */ |
51 | 87 |
/******************************************************************************/ |
src/urt_core.c | ||
---|---|---|
19 | 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 20 |
*/ |
21 | 21 |
|
22 |
#include <urtware.h> |
|
23 |
|
|
22 | 24 |
/******************************************************************************/ |
23 | 25 |
/* LOCAL DEFINITIONS */ |
24 | 26 |
/******************************************************************************/ |
... | ... | |
42 | 44 |
/******************************************************************************/ |
43 | 45 |
/* EXPORTED FUNCTIONS */ |
44 | 46 |
/******************************************************************************/ |
47 |
|
|
48 |
/** |
|
49 |
* @brief Initialize the Core. |
|
50 |
*/ |
|
51 |
void urtCoreInit(void) {return;} |
|
52 |
|
|
53 |
/** |
|
54 |
* @brief Get Core status. |
|
55 |
* |
|
56 |
* @return A status value. |
|
57 |
*/ |
|
58 |
urt_status_t urtCoreGetStatus(void) {return URT_STATUS_OK;} |
|
59 |
|
|
60 |
/** |
|
61 |
* @brief Start Nodes... . |
|
62 |
*/ |
|
63 |
void urtCoreStartNodes(void) {return;} |
|
64 |
|
|
65 |
/** |
|
66 |
* @brief Synchronize ... |
|
67 |
* |
|
68 |
* @param[in] node The node to... . |
|
69 |
* |
|
70 |
* @return A status value. |
|
71 |
*/ |
|
72 |
urt_status_t urtCoreSynchronize(urt_node_t* node) {return URT_STATUS_OK;} |
|
73 |
|
|
74 |
/** |
|
75 |
* @brief Stop nodes... . |
|
76 |
* |
|
77 |
* @param[in] reason Reason why nodes should be stopped. |
|
78 |
* |
|
79 |
* @return A status value. |
|
80 |
*/ |
|
81 |
urt_status_t urtCoreStopNodes(urt_status_t reason) {return URT_STATUS_OK;} |
|
82 |
|
|
83 |
/** |
|
84 |
* @brief Get the topic of the Core. |
|
85 |
* |
|
86 |
* @param[in] id The id of the topic. |
|
87 |
* |
|
88 |
* @return . |
|
89 |
*/ |
|
90 |
urt_topic_t* urtCoreGetTopic(urt_topicid_t id) {return urt_topic_t;} |
|
91 |
|
|
92 |
/** |
|
93 |
* @brief Get the service of the Core. |
|
94 |
* |
|
95 |
* @param[in] id The id of the service. |
|
96 |
* |
|
97 |
* @return . |
|
98 |
*/ |
|
99 |
urt_service_t urtCoreGetService(urt_serviceid_t id) {return urt_service_t;} |
|
100 |
|
src/urt_message.c | ||
---|---|---|
19 | 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 20 |
*/ |
21 | 21 |
|
22 |
#include <urtware.h> |
|
23 |
|
|
22 | 24 |
/******************************************************************************/ |
23 | 25 |
/* LOCAL DEFINITIONS */ |
24 | 26 |
/******************************************************************************/ |
... | ... | |
42 | 44 |
/******************************************************************************/ |
43 | 45 |
/* EXPORTED FUNCTIONS */ |
44 | 46 |
/******************************************************************************/ |
47 |
|
|
48 |
/** |
|
49 |
* @brief Initalize the messages. |
|
50 |
* |
|
51 |
* @param[in] message Message to initalize. |
|
52 |
* @param[in] payload . |
|
53 |
*/ |
|
54 |
void urtMessageInit(urt_message_t* message, void* payload) {return;} |
src/urt_node.c | ||
---|---|---|
19 | 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 20 |
*/ |
21 | 21 |
|
22 |
#include <urtware.h> |
|
23 |
|
|
22 | 24 |
/******************************************************************************/ |
23 | 25 |
/* LOCAL DEFINITIONS */ |
24 | 26 |
/******************************************************************************/ |
... | ... | |
42 | 44 |
/******************************************************************************/ |
43 | 45 |
/* EXPORTED FUNCTIONS */ |
44 | 46 |
/******************************************************************************/ |
47 |
|
|
48 |
/** |
|
49 |
* @brief Initalize the node. |
|
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 . |
|
59 |
*/ |
|
60 |
void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback_t* setupcallback, |
|
61 |
void* setupparams, urt_nodeLoopCallback_t* loopcallback, void* loopparams, |
|
62 |
urt_nodeShutdownCallback_t* shutdowncallback, void* shutdownparams) {return;} |
src/urt_publisher.c | ||
---|---|---|
19 | 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 20 |
*/ |
21 | 21 |
|
22 |
#include <urtware.h> |
|
23 |
|
|
22 | 24 |
/******************************************************************************/ |
23 | 25 |
/* LOCAL DEFINITIONS */ |
24 | 26 |
/******************************************************************************/ |
... | ... | |
42 | 44 |
/******************************************************************************/ |
43 | 45 |
/* EXPORTED FUNCTIONS */ |
44 | 46 |
/******************************************************************************/ |
47 |
|
|
48 |
/** |
|
49 |
* @brief Initalize the publisher. |
|
50 |
* |
|
51 |
* @param[in] publisher Publisher to initalize. |
|
52 |
* @param[in] topic . |
|
53 |
* @param[in] message . |
|
54 |
*/ |
|
55 |
void urtPublisherInit(urt_publisher_t* publisher, urt_topic_t* topic, urt_message_t* message) {return;} |
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* @brief Initalize the node. |
|
60 |
* |
|
61 |
* @param[in] publisher Publisher to . |
|
62 |
* @param[in] payload . |
|
63 |
* @param[in] bytes . |
|
64 |
* @param[in] t . |
|
65 |
* @param[in] timeout . |
|
66 |
* |
|
67 |
* @return A status value. |
|
68 |
*/ |
|
69 |
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 | ||
---|---|---|
19 | 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 20 |
*/ |
21 | 21 |
|
22 |
#include <urtware.h> |
|
23 |
|
|
22 | 24 |
/******************************************************************************/ |
23 | 25 |
/* LOCAL DEFINITIONS */ |
24 | 26 |
/******************************************************************************/ |
... | ... | |
42 | 44 |
/******************************************************************************/ |
43 | 45 |
/* EXPORTED FUNCTIONS */ |
44 | 46 |
/******************************************************************************/ |
47 |
|
|
48 |
/** |
|
49 |
* @brief Initalize the service. |
|
50 |
* |
|
51 |
* @param[in] service Service to intialize. |
|
52 |
* @param[in] id . |
|
53 |
* @param[in] callback . |
|
54 |
* |
|
55 |
* @return A status value. |
|
56 |
*/ |
|
57 |
urt_status_t urtServiceInit(urt_service_t* service, urt_serviceid_t id, urt_servicefunc_t* callback) {return URT_STATUS_OK;} |
|
58 |
|
|
59 |
/** |
|
60 |
* @brief Call the Service . |
|
61 |
* |
|
62 |
* @param[in] service Service to . |
|
63 |
* @param[in] arg . |
|
64 |
* @param[in] ret . |
|
65 |
* @param[in] timeout . |
|
66 |
* |
|
67 |
* @return A status value. |
|
68 |
*/ |
|
69 |
urt_status_t urtServiceCall(urt_service_t* service, void* arg, void* ret, urt_delay_t timeout) {return URT_STATUS_OK;} |
src/urt_subscriber.c | ||
---|---|---|
19 | 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 20 |
*/ |
21 | 21 |
|
22 |
#include <urtware.h> |
|
23 |
|
|
22 | 24 |
/******************************************************************************/ |
23 | 25 |
/* LOCAL DEFINITIONS */ |
24 | 26 |
/******************************************************************************/ |
... | ... | |
42 | 44 |
/******************************************************************************/ |
43 | 45 |
/* EXPORTED FUNCTIONS */ |
44 | 46 |
/******************************************************************************/ |
45 |
#include "subscriber.h" |
|
46 | 47 |
|
47 |
void urtNrtSubscriberInit (urt_nrtsubscriber_t* subscriber) {} |
|
48 |
/** |
|
49 |
* @brief Initialize the nrt Subscriber. |
|
50 |
* |
|
51 |
* @param[in] subscriber Subscriber to initalize. |
|
52 |
*/ |
|
53 |
void urtNrtSubscriberInit (urt_nrtsubscriber_t* subscriber) {return;} |
|
48 | 54 |
|
55 |
/** |
|
56 |
* @brief . |
|
57 |
* |
|
58 |
* @param[in] subscriber Subscriber to . |
|
59 |
* @param[in] topic . |
|
60 |
* @param[in] messages . |
|
61 |
* |
|
62 |
* @return A status value. |
|
63 |
*/ |
|
49 | 64 |
urt_status_t urtNrtSubscriberSubscribe (urt_nrtsubscriber_t* subscriber, urt_topic_t* topic, urt_message_t* messages) { |
50 |
return 1;
|
|
65 |
return URT_STATUS_OK;
|
|
51 | 66 |
} |
52 | 67 |
|
68 |
/** |
|
69 |
* @brief . |
|
70 |
* |
|
71 |
* @param[in] subscriber . |
|
72 |
* @param[in] payload . |
|
73 |
* @param[in] bytes . |
|
74 |
* @param[in] latency . |
|
75 |
* |
|
76 |
* @return A status value. |
|
77 |
*/ |
|
53 | 78 |
urt_status_t urtNrtSubscriberFetchNextMessage (urt_nrtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency) { |
54 |
return 0;
|
|
79 |
return URT_STATUS_OK;
|
|
55 | 80 |
} |
56 | 81 |
|
82 |
/** |
|
83 |
* @brief . |
|
84 |
* |
|
85 |
* @param[in] subscriber . |
|
86 |
* @param[in] payload . |
|
87 |
* @param[in] bytes . |
|
88 |
* @param[in] latency . |
|
89 |
* |
|
90 |
* @return A status value. |
|
91 |
*/ |
|
57 | 92 |
urt_status_t urtNrtSubscriberFetchLatestMessage (urt_nrtsubscriber_t* subscriber, void* payload, size_t bytes, urt_delay_t* latency) { |
58 |
return 0;
|
|
93 |
return URT_STATUS_OK;
|
|
59 | 94 |
} |
60 | 95 |
|
96 |
/** |
|
97 |
* @brief . |
|
98 |
* |
|
99 |
* @param[in] subscriber |
|
100 |
* |
|
101 |
* @return A status value. |
|
102 |
*/ |
|
61 | 103 |
urt_status_t urtNrtSubscriberUnsubscribe (urt_nrtsubscriber_t* subscriber) { |
62 |
return 0;
|
|
104 |
return URT_STATUS_OK;
|
|
63 | 105 |
} |
64 | 106 |
|
65 |
int main () { |
|
66 |
return 0; |
|
67 |
} |
|
107 |
|
|
108 |
/** |
|
109 |
* @brief . |
|
110 |
* |
|
111 |
* @param[in] subscriber . |
|
112 |
*/ |
|
113 |
void urtSrtSubscriberInit(urt_srtsubscriber_t* subscriber) {return;} |
|
114 |
|
|
115 |
/** |
|
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 |
*/ |
|
126 |
urt_status_t urtSrtSubscriberSubscribe(urt_srtsubscriber_t* subscriber, urt_topic_t* topic, |
|
127 |
urt_message_t* message, urt_srtusefulnessfunc_t* usefulnesscb, void* cbparams) {return URT_STATUS_OK;} |
|
128 |
|
|
129 |
/** |
|
130 |
* @brief . |
|
131 |
* |
|
132 |
* @param[in] subscriber . |
|
133 |
* @param[in] payload . |
|
134 |
* @param[in] latency . |
|
135 |
* |
|
136 |
* @return A status value. |
|
137 |
*/ |
|
138 |
urt_status_t urtSrtSubscriberFetchNextMessage(urt_srtsubscriber_t* subscriber, void* payload, |
|
139 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
|
140 |
|
|
141 |
/** |
|
142 |
* @brief . |
|
143 |
* |
|
144 |
* @param[in] subscriber . |
|
145 |
* @param[in] payload . |
|
146 |
* @param[in] bytes . |
|
147 |
* @param[in] latency . |
|
148 |
* |
|
149 |
* @return A status value. |
|
150 |
*/ |
|
151 |
urt_status_t urtSrtSubscriberFetchLatestMessage(urt_srtsubscriber_t* subscriber, void* payload, |
|
152 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
|
153 |
|
|
154 |
/** |
|
155 |
* @brief . |
|
156 |
* |
|
157 |
* @param[in] subscriber . |
|
158 |
* @param[in] latency . |
|
159 |
* |
|
160 |
* @return A status value. |
|
161 |
*/ |
|
162 |
urt_status_t urtSrtSubscriberCalculateUsefulness(urt_srtsubscriber_t* subscriber, urt_delay_t latency){return URT_STATUS_OK;} |
|
163 |
|
|
164 |
/** |
|
165 |
* @brief . |
|
166 |
* |
|
167 |
* @param[in] subscriber . |
|
168 |
* |
|
169 |
* @return A status value. |
|
170 |
*/ |
|
171 |
urt_status_t urtSrtSubscriberUnsubscribe(urt_srtsubscriber_t* subscriber){return URT_STATUS_OK;} |
|
172 |
|
|
173 |
|
|
174 |
/** |
|
175 |
* @brief . |
|
176 |
* |
|
177 |
* @param[in] subscriber . |
|
178 |
* |
|
179 |
* @return A status value. |
|
180 |
*/ |
|
181 |
void urtFrtSubscriberInit(urt_frtsubscriber_t* subscriber){return URT_STATUS_OK;} |
|
182 |
|
|
183 |
/** |
|
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. |
|
193 |
*/ |
|
194 |
urt_status_t urtFrtSubscriberSubscribe(urt_frtsubscriber_t* subscriber, urt_topic_t* topic, |
|
195 |
urt_message_t* messages, urt_delay_t deadline, urt_delay_t jitter){return URT_STATUS_OK;} |
|
196 |
|
|
197 |
/** |
|
198 |
* @brief . |
|
199 |
* |
|
200 |
* @param[in] subscriber . |
|
201 |
* @param[in] payload . |
|
202 |
* @param[in] bytes . |
|
203 |
* @param[in] latency . |
|
204 |
* |
|
205 |
* @return A status value. |
|
206 |
*/ |
|
207 |
urt_status_t urtFrtSubscriberFetchNextMessage(urt_frtsubscriber_t* subscriber, void* payload, |
|
208 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
|
209 |
|
|
210 |
/** |
|
211 |
* @brief . |
|
212 |
* |
|
213 |
* @param[in] subscriber . |
|
214 |
* @param[in] payload . |
|
215 |
* @param[in] bytes . |
|
216 |
* @param[in] latency . |
|
217 |
* |
|
218 |
* @return A status value. |
|
219 |
*/ |
|
220 |
urt_status_t urtFrtSubscriberFetchLatestMessage(urt_frtsubscriber_t* subscriber, void* payload, |
|
221 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
|
222 |
|
|
223 |
/** |
|
224 |
* @brief . |
|
225 |
* |
|
226 |
* @param[in] subscriber . |
|
227 |
* @param[in] latency . |
|
228 |
* |
|
229 |
* @return A status value. |
|
230 |
*/ |
|
231 |
bool urtFrtSubscriberCalculateValidity(urt_frtsubscriber_t* subscriber, urt_delay_t latency){return true;} |
|
232 |
|
|
233 |
/** |
|
234 |
* @brief . |
|
235 |
* |
|
236 |
* @param[in] subscriber . |
|
237 |
* |
|
238 |
* @return A status value. |
|
239 |
*/ |
|
240 |
urt_status_t urtFrtSubscriberUnsubscribe(urt_frtsubscriber_t* subscriber){return URT_STATUS_OK;} |
|
241 |
|
|
242 |
|
|
243 |
/** |
|
244 |
* @brief . |
|
245 |
* |
|
246 |
* @param[in] subscriber . |
|
247 |
*/ |
|
248 |
void urtHrtSubscriberInit(urt_hrtsubscriber_t* subscriber){return;} |
|
249 |
|
|
250 |
/** |
|
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. |
|
261 |
*/ |
|
262 |
urt_status_t urtHrtSubscriberSubscribe(urt_hrtsubscriber_t* subscriber, urt_topic_t* topic, |
|
263 |
urt_message_t* message, urt_delay_t deadline, urt_delay_t rate, urt_delay_t jitter){return URT_STATUS_OK;} |
|
264 |
|
|
265 |
|
|
266 |
/** |
|
267 |
* @brief . |
|
268 |
* |
|
269 |
* @param[in] subscriber . |
|
270 |
* @param[in] payload . |
|
271 |
* @param[in] bytes . |
|
272 |
* @param[in] latency . |
|
273 |
* |
|
274 |
* @return A status value. |
|
275 |
*/ |
|
276 |
urt_status_t urtHrtSubscriberFetchNextMessage(urt_hrtsubscriber_t* subscriber, void* payload, |
|
277 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
|
278 |
|
|
279 |
|
|
280 |
/** |
|
281 |
* @brief . |
|
282 |
* |
|
283 |
* @param[in] subscriber . |
|
284 |
* @param[in] payload . |
|
285 |
* @param[in] bytes . |
|
286 |
* @param[in] latency . |
|
287 |
* |
|
288 |
* @return A status value. |
|
289 |
*/ |
|
290 |
urt_status_t urtHrtSubscriberFetchLatestMessage(urt_hrtsubscriber_t* subscriber, void* payload, |
|
291 |
size_t bytes, urt_delay_t* latency){return URT_STATUS_OK;} |
|
292 |
|
|
293 |
/** |
|
294 |
* @brief . |
|
295 |
* |
|
296 |
* @param[in] subscriber . |
|
297 |
* |
|
298 |
* @return A status value. |
|
299 |
*/ |
|
300 |
urt_status_t urtHrtSubscriberUnsubscribe(urt_hrtsubscriber_t* subscriber){return URT_STATUS_OK;} |
src/urt_topic.c | ||
---|---|---|
19 | 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 20 |
*/ |
21 | 21 |
|
22 |
#include <urtware.h> |
|
23 |
|
|
22 | 24 |
/******************************************************************************/ |
23 | 25 |
/* LOCAL DEFINITIONS */ |
24 | 26 |
/******************************************************************************/ |
... | ... | |
42 | 44 |
/******************************************************************************/ |
43 | 45 |
/* EXPORTED FUNCTIONS */ |
44 | 46 |
/******************************************************************************/ |
47 |
|
|
48 |
/** |
|
49 |
* @brief Initialize the topic. |
|
50 |
* |
|
51 |
* @param[in] topic Topic to initialize. |
|
52 |
* @param[in] id . |
|
53 |
* |
|
54 |
* @return A status value. |
|
55 |
*/ |
|
56 |
urt_status_t urtTopicInit(urt_topic_t* topic, urt_topicid_t id) {return URT_STATUS_OK;} |
urt_types.h | ||
---|---|---|
3 | 3 |
applications. It was developed as part of the software habitat for the |
4 | 4 |
Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well. |
5 | 5 |
|
6 |
Copyright (C) 2018..2019 Thomas Schöpping et al.
|
|
6 |
Copyright (C) 2018..2020 Thomas Schöpping et al.
|
|
7 | 7 |
|
8 | 8 |
This program is free software: you can redistribute it and/or modify |
9 | 9 |
it under the terms of the GNU General Public License as published by |
urtware.h | ||
---|---|---|
3 | 3 |
applications. It was developed as part of the software habitat for the |
4 | 4 |
Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well. |
5 | 5 |
|
6 |
Copyright (C) 2018..2019 Thomas Schöpping et al.
|
|
6 |
Copyright (C) 2018..2020 Thomas Schöpping et al.
|
|
7 | 7 |
|
8 | 8 |
This program is free software: you can redistribute it and/or modify |
9 | 9 |
it under the terms of the GNU General Public License as published by |
... | ... | |
69 | 69 |
|
70 | 70 |
/** @} */ |
71 | 71 |
|
72 |
/******************************************************************************/ |
|
73 |
/* CONFIGURATION */ |
|
74 |
/******************************************************************************/ |
|
75 |
|
|
72 | 76 |
#include <urtwareconf.h> |
73 | 77 |
#if !defined(_URTWARE_CFG_) |
74 | 78 |
#error "invalid µRtWare configuration file" |
... | ... | |
86 | 90 |
#error "incompatible µRt-OSAL implementation" |
87 | 91 |
#endif |
88 | 92 |
|
93 |
/******************************************************************************/ |
|
94 |
/* AMiRo-OS.URTWARE INC */ |
|
95 |
/******************************************************************************/ |
|
96 |
|
|
97 |
#include "inc/urt_confcheck.h" |
|
98 |
|
|
99 |
#include "inc/urt_core.h" |
|
100 |
#include "inc/urt_message.h" |
|
101 |
#include "inc/urt_node.h" |
|
102 |
#include "inc/urt_publisher.h" |
|
103 |
#include "inc/urt_service.h" |
|
104 |
#include "inc/urt_subscriber.h" |
|
105 |
#include "inc/urt_topic.h" |
|
106 |
|
|
107 |
|
|
89 | 108 |
#endif /* _URTWARE_H_ */ |
Also available in: Unified diff