RKH
|
Specifies the publish-subscribe interface. More...
#include "rkhitl.h"
Go to the source code of this file.
Functions | |
void | rkh_pubsub_init (void) |
Encapsulates the initialization of publish-subscribe module. More... | |
void | rkh_pubsub_subscribe (rui8_t channel, const RKH_SMA_T *ao) |
Adds an active object to the notification list of an event channel. Each subscription registers a client's interest in one event channel (topic). This module posts published events to the registered clients in order to forward events that were published to channel that match this subscription. More... | |
void | rkh_pubsub_unsubscribe (rui8_t channel, const RKH_SMA_T *ao) |
Unsubscribes an active object from topic. More... | |
void | rkh_pubsub_unsubscribeAll (const RKH_SMA_T *ao) |
Unsubscribes an active object from all topics. More... | |
rui8_t | rkh_pubsub_publish (rui8_t channel, RKH_EVT_T *event, const void *const sender) |
More... | |
Specifies the publish-subscribe interface.
This module addresses the specific issue of how to notify a set of interested active objects (clients) in a timely way that a value that they care about has changed, especially when the notification process is to be repeated for a relatively long period of time. It does this without requiring the data server to have any a priori knowledge about its clients. The basic solution offered by PubSub module is to have the clients "subscribe" to the server to be notified about the value in question according to the policy: "when the value changes", receiving a proper event carrying the value of interest. This means, for example, that sensor data can be easily shared to elements that may not even exist when the sensor proxies are written. Also, minimizes computational effort for notification of clients and across a communications bus and minimizes the bus bandwidth required for notification of the appropriate clients.
Definition in file rkhfwk_pubsub.h.
void rkh_pubsub_init | ( | void | ) |
Encapsulates the initialization of publish-subscribe module.
void rkh_pubsub_subscribe | ( | rui8_t | channel, |
const RKH_SMA_T * | ao | ||
) |
Adds an active object to the notification list of an event channel. Each subscription registers a client's interest in one event channel (topic). This module posts published events to the registered clients in order to forward events that were published to channel that match this subscription.
[in] | channel | indicates the topic to which the active object (client) wants to subscribe. |
[in] | ao | pointer to previously created active object to subscribe. |
void rkh_pubsub_unsubscribe | ( | rui8_t | channel, |
const RKH_SMA_T * | ao | ||
) |
Unsubscribes an active object from topic.
[in] | channel | indicates the topic that the active object wishes to unsubscribe from. |
[in] | ao | pointer to previously created active object to unsubscribe. |
void rkh_pubsub_unsubscribeAll | ( | const RKH_SMA_T * | ao | ) |
Unsubscribes an active object from all topics.
[in] | ao | pointer to previously created active object to unsubscribe. |
rui8_t rkh_pubsub_publish | ( | rui8_t | channel, |
RKH_EVT_T * | event, | ||
const void *const | sender | ||
) |
[in] | channel | identifies the information channel to which event is published. |
[in] | event | pointer to event to publish |
[in] | sender | pointer to the sender object. It is not necessarily a pointer to an active object. In fact, if rkh_pubsub_publish() is called from an interrupt or other context, it can create a unique object just to unambiguously identify the publisher of the event. |