|
ESP SDK C API
|
| Subscription Flags | |
| Subscription Options | |
| Subscription Events | |
| Message Reader | |
Entities/Objects | |
| typedef struct EspSubscriberOptions | EspSubscriberOptions |
| typedef struct EspSubscriberEvent | EspSubscriberEvent |
| typedef struct EspSubscriber | EspSubscriber |
| typedef void(* | SUBSCRIBER_CALLBACK_T )(const EspSubscriberEvent *event, void *user_data) |
| typedef struct EspMessageReader | EspMessageReader |
| typedef struct EspRowReader | EspRowReader |
Functions | |
| ESPAPICALL EspSubscriber * | esp_subscriber_create (const EspUri *uri, const EspCredentials *credentials, const EspSubscriberOptions *options, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_free (EspSubscriber *subscriber, EspError *error) |
| ESPAPICALL EspProject * | esp_subscriber_get_project (EspSubscriber *subscriber, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_connect (EspSubscriber *subscriber, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_disconnect (EspSubscriber *subscriber, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_close (EspSubscriber *subscriber, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_subscribe (EspSubscriber *subscriber, const EspStream *stream, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_subscribe_streamname (EspSubscriber *subscriber, const char *stream_name, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_subscribe_sql (EspSubscriber *subscriber, const char *sql, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_get_subscribed_streams (EspSubscriber *subscriber, EspList *stream_list, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_set_callback (EspSubscriber *subscriber, uint32_t events, SUBSCRIBER_CALLBACK_T callback, void *user_data, EspError *error) |
| ESPAPICALL int32_t | esp_subscriber_select_with (EspSubscriber *subscriber, EspSelector *selector, uint32_t events, EspError *error) |
| ESPAPICALL EspSubscriberEvent * | esp_subscriber_get_next_event (EspSubscriber *subscriber, EspError *error) |
| ESPAPICALL int32_t esp_subscriber_close | ( | EspSubscriber * | subscriber, |
| EspError * | error | ||
| ) |
Closes this instance of EspSubscriber. In DIRECT access mode returns when the entity is closed. In CALLBACK/SELECT will generate an ESP_SUBSCRIBER_EVENT_CLOSED event.
| subscriber | EspSubscriber to close |
| ESPAPICALL int32_t esp_subscriber_connect | ( | EspSubscriber * | subscriber, |
| EspError * | error | ||
| ) |
Connect to the backend project. In DIRECT access mode returns when connected. In CALLBACK/SELECT will generate an ESP_SUBSCRIBER_EVENT_CONNECTED event.
| subscriber | EspSubscriber to connect |
| ESPAPICALL EspSubscriber* esp_subscriber_create | ( | const EspUri * | uri, |
| const EspCredentials * | credentials, | ||
| const EspSubscriberOptions * | options, | ||
| EspError * | error | ||
| ) |
Creates an EspSubscriber object. The created object must be freed using esp_subscriber_free().
| uri | URI of the project to which subscription is to be established |
| credentials | EspCredentials object for authentication, NULL if no authentication is needed |
| options | Options to use for the EspSubscriber |
| ESPAPICALL int32_t esp_subscriber_disconnect | ( | EspSubscriber * | subscriber, |
| EspError * | error | ||
| ) |
Disconnect from the project. In DIRECT access mode returns when disconnected. In CALLBACK/SELECT will generate an ESP_SUBSCRIBER_EVENT_DISCONNECTED event.
| subscriber | EspSubscriber to disconnect |
| ESPAPICALL int32_t esp_subscriber_free | ( | EspSubscriber * | subscriber, |
| EspError * | error | ||
| ) |
Frees an EspSubscriber created using esp_subscriber_create().
| subscriber | EspSubscriber to free |
| ESPAPICALL EspSubscriberEvent* esp_subscriber_get_next_event | ( | EspSubscriber * | subscriber, |
| EspError * | error | ||
| ) |
Determine the next event pending at the subscriber. This call should be made in DIRECT ACCESS mode only. In other access modes, the events are retrieved by the SDK and are either passed to the callback handler or returned from esp_selector_select() call.
The event retrieved by this call must be freed using esp_subscriber_event_free(). This is the only instance where an event needs to be explicitly freed by user code.
| subscriber | EspSubscriber to query |
| ESPAPICALL EspProject* esp_subscriber_get_project | ( | EspSubscriber * | subscriber, |
| EspError * | error | ||
| ) |
Retrieve the parent EspProject.
| ESPAPICALL int32_t esp_subscriber_get_subscribed_streams | ( | EspSubscriber * | subscriber, |
| EspList * | stream_list, | ||
| EspError * | error | ||
| ) |
Retrieves a list of streams currently subscribed to. If this is an SQL subscription, the list will contain a single EspStream with the type SQL_QUERY and a schema that corresponds to the SQL statement that was used to subscribe.
| subscriber | EspSubscriber to query |
| stream_list | Pointer to EspList in which to return the stream list |
| ESPAPICALL int32_t esp_subscriber_select_with | ( | EspSubscriber * | subscriber, |
| EspSelector * | selector, | ||
| uint32_t | events, | ||
| EspError * | error | ||
| ) |
Use the specified esp_selector to monitor events for this EspSubscriber.
| subscriber | EspSubscriber to monitor |
| selector | EspSelector with which to monitor |
| events | events to monitor for - bitwise OR'd values of ESP_SUBSCRIBER_EVENT_xxx values |
| ESPAPICALL int32_t esp_subscriber_set_callback | ( | EspSubscriber * | subscriber, |
| uint32_t | events, | ||
| SUBSCRIBER_CALLBACK_T | callback, | ||
| void * | user_data, | ||
| EspError * | error | ||
| ) |
Registers a callback handler.
| subscriber | a valid EspSubscriber object |
| events | bitwise OR'd values of ESP_SUBSCRIBER_EVENT_xxx values |
| callback | callback pointer to the handler function |
| user_data | pointer to user data that will be passed back by the SDK |
| ESPAPICALL int32_t esp_subscriber_subscribe | ( | EspSubscriber * | subscriber, |
| const EspStream * | stream, | ||
| EspError * | error | ||
| ) |
Subscribe to the specified stream. This call must be made after the subscriber has connected.
| subscriber | EspSubscriber to use for the subscription |
| stream | Stream to which to subscribe |
| ESPAPICALL int32_t esp_subscriber_subscribe_sql | ( | EspSubscriber * | subscriber, |
| const char * | sql, | ||
| EspError * | error | ||
| ) |
Subscribes using the provided SQL statement.
| subscriber | EspSubscriber to use for the subscription |
| sql | SQL statement to use as a projection for the data |
| ESPAPICALL int32_t esp_subscriber_subscribe_streamname | ( | EspSubscriber * | subscriber, |
| const char * | stream_name, | ||
| EspError * | error | ||
| ) |
Not in R5. Subscriber to the stream named by stream_name.
| subscriber | EspSubscriber to use for the subscription |
| stream_name | Name of the stream to subscribe to |
1.7.5