Diffusion C API
6.1.5
|
Functions | |
DEPRECATED (BUF_T *cbor_to_json(const char *cbor, size_t len)) | |
Convert binary (CBOR) data to a JSON string. More... | |
void | fetch (SESSION_T *session, const FETCH_PARAMS_T params) |
Fetch state for a topic (or many topics). More... | |
TOPIC_HANDLER_T | subscribe (SESSION_T *session, const SUBSCRIPTION_PARAMS_T params) |
Subscribe to topics. More... | |
void | unsubscribe (SESSION_T *session, const UNSUBSCRIPTION_PARAMS_T params) |
Unsubscribe from one or more topics. More... | |
DEPRECATED | ( | BUF_T * | cbor_to_jsonconst char *cbor, size_t len | ) |
Convert binary (CBOR) data to a JSON string.
This function is useful for converting data received on a JSON topic from CBOR representation to a JSON string suitable for passing to a 3rd party JSON parser.
Note that this is introducing an extra step (i.e., CBOR -> string -> JSON) and if possible, you should read the CBOR tokens and convert them directly to JSON representation using facilities provided by your JSON library.
cbor | A pointer to memory containing CBOR-encoded data. |
len | The length of the CBOR-encoded data. |
void fetch | ( | SESSION_T * | session, |
const FETCH_PARAMS_T | params | ||
) |
Fetch state for a topic (or many topics).
session | The session handle. If NULL, the function returns immediately. |
params | Parameters and callback handlers to be invoked to process the results of the fetch() call. |
TOPIC_HANDLER_T subscribe | ( | SESSION_T * | session, |
const SUBSCRIPTION_PARAMS_T | params | ||
) |
Subscribe to topics.
This function has the roles of subscribing to the topics specified by the selector and installing handlers for received TOPIC_MESSAGE_T messages which match that selector and also any other service messages related to subscription. These handlers are called before (and in addition to) any handlers installed using add_message_handler() for MESSAGE_TYPE_TOPIC_LOAD or MESSAGE_TYPE_DELTA messages.
If a topic handler was already registered for the supplied selector, it is replaced and the old handlers are returned.
session | The session handle. If NULL, the function returns immediately. |
params | Parameters describing the subscription request and callbacks handlers which may be invoked in response. |
void unsubscribe | ( | SESSION_T * | session, |
const UNSUBSCRIPTION_PARAMS_T | params | ||
) |
Unsubscribe from one or more topics.
This function has the roles of subscribing to the topics specified by the selector and installing handlers for received TOPIC_MESSAGE_T messages which match that selector and also any other service messages related to unsubscription.
session | The session handle. If NULL, this function returns immediately. |
params | Parameters describing the unsubscription request and callback handlers which may be invoked in response. |