|
ESP SDK C API
|
| enum ESP_BLOCKING_MODE_T |
Specifies the way data rows will be batched when sent to the server. This setting has effect only if the publishing is buffered, that is if there is an internal publishing thread that picks up the formatted data and sends it to the project.
| NO_BLOCKING |
Records are sent singly. |
| EXPLICIT_BLOCKING |
Transaction/envelop blocks need to be set explicitly by the user using esp_message_writer_start_transaction() or esp_message_writer_start_envelope() calls. Potentially this option provides the best throughput.
|
| AUTO_BLOCKING |
In this blocking mode, the internal publishing thread picks up all queued data and batches them together. The size of the blocks may vary depending on the amount of data that has accumulated. Potentially this provides the best latency, especially if the data is not available at a constant rate. |
Functions | |
| ESPAPICALL EspPublisherOptions * | esp_publisher_options_create (EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_free (EspPublisherOptions *options, EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_set_access_mode (EspPublisherOptions *options, const ESP_ACCESS_MODE_T mode, EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_set_blockmode (EspPublisherOptions *options, const ESP_BLOCKING_MODE_T mode, EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_set_buffersize (EspPublisherOptions *options, const uint32_t size, EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_set_exit_on_close (EspPublisherOptions *options, const int32_t close, EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_set_exit_on_timeout (EspPublisherOptions *options, const int32_t timeout, EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_set_timeout_finalizer (EspPublisherOptions *options, const int32_t timeout, const char *finalizer, EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_set_async (EspPublisherOptions *options, const int32_t async, EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_set_dispatcher (EspPublisherOptions *options, const EspDispatcher *dispatcher, EspError *error) |
| ESPAPICALL int32_t | esp_publisher_options_set_updater (EspPublisherOptions *options, const EspUpdater *updater, EspError *error) |
| ESPAPICALL EspPublisherOptions* esp_publisher_options_create | ( | EspError * | error | ) |
Create an EspPublisherOptions object. This will need to be freed using esp_publisher_options_free()\.
| ESPAPICALL int32_t esp_publisher_options_free | ( | EspPublisherOptions * | options, |
| EspError * | error | ||
| ) |
Free an EspPublisherOptions object.
| options | EspPublisherOptions object to free |
| ESPAPICALL int32_t esp_publisher_options_set_access_mode | ( | EspPublisherOptions * | options, |
| const ESP_ACCESS_MODE_T | mode, | ||
| EspError * | error | ||
| ) |
Set the access mode with which the EspPublisher will be accessed. Default is DIRECT_ACCESS.
| options | The options object to modify |
| mode | The access mode to use |
| ESPAPICALL int32_t esp_publisher_options_set_async | ( | EspPublisherOptions * | options, |
| const int32_t | async, | ||
| EspError * | error | ||
| ) |
If set to true, EspPublisher publishes to the platform in 'synchronous' mode. In this mode, each time data is written to the platform, EspPublisher waits for an acknowledgement from the platform before the next data are sent.
This slows down throughput but ensures that the data being written has reached the platform. Note - the acknowledgement only guarantees that the data has physically reached the platform.
By default asynchronous publishing is set to true.
| options | The options object to modify |
| async | Non-zero - enables sync mode publishing |
| ESPAPICALL int32_t esp_publisher_options_set_blockmode | ( | EspPublisherOptions * | options, |
| const ESP_BLOCKING_MODE_T | mode, | ||
| EspError * | error | ||
| ) |
Set the blocking mode to use for this publisher. Default is NO_BLOCKING
| options | The options object to modify |
| mode | The blocking mode to use |
| ESPAPICALL int32_t esp_publisher_options_set_buffersize | ( | EspPublisherOptions * | options, |
| const uint32_t | size, | ||
| EspError * | error | ||
| ) |
Sets the internal buffer size. If set to a positive value, all data published is queued to the buffer. EspPublisher creates an internal thread that picks up the data from the buffer and publishes it.
Buffering is enabled only in DIRECT_ACCESS modes. In other access modes this flag is ignored. Note that synchronous publishing cannot be done when buffering is enabled. By default buffering is not enabled.
| options | The options object to modify |
| size | Maximum number of data records/blocks to queue up |
| ESPAPICALL int32_t esp_publisher_options_set_dispatcher | ( | EspPublisherOptions * | options, |
| const EspDispatcher * | dispatcher, | ||
| EspError * | error | ||
| ) |
Not used. Sets a custom EspDispatcher object to use.
| options | The options object to modify |
| ESPAPICALL int32_t esp_publisher_options_set_exit_on_close | ( | EspPublisherOptions * | options, |
| const int32_t | close, | ||
| EspError * | error | ||
| ) |
If set to true, the project will exit if the publisher drops its connection. Default is false.
| options | The options object to modify |
| close | Non-zero to have the project exit |
| ESPAPICALL int32_t esp_publisher_options_set_exit_on_timeout | ( | EspPublisherOptions * | options, |
| const int32_t | timeout, | ||
| EspError * | error | ||
| ) |
Set the time in milliseconds that a project will wait to exit if no data is being published. By default timeout is disabled.
| options | The options object to modify |
| timeout | value in milliseconds (0 or less means no timeout) |
| ESPAPICALL int32_t esp_publisher_options_set_timeout_finalizer | ( | EspPublisherOptions * | options, |
| const int32_t | timeout, | ||
| const char * | finalizer, | ||
| EspError * | error | ||
| ) |
Sets the command the project will execute if the publisher does not publish data for the specified amount of time. By default timeout is disabled.
| options | The options object to modify |
| timeout | Time in milliseconds to wait before running the finalizer |
| finalizer | Finalize command to run |
| ESPAPICALL int32_t esp_publisher_options_set_updater | ( | EspPublisherOptions * | options, |
| const EspUpdater * | updater, | ||
| EspError * | error | ||
| ) |
Not used. Sets a custom EspUpdater object to use.
| options | The options object to modify |
1.7.5