ESP SDK C API
Functions
Publisher Options
Publishing

Enumeration Types

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.

Enumerator:
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.

See also:
esp_message_writer_end_block()
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 EspPublisherOptionsesp_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)

Function Documentation

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.

Parameters:
optionsEspPublisherOptions 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.

Returns:
0 on success.
Parameters:
optionsThe options object to modify
modeThe 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.

Returns:
0 on success.
Parameters:
optionsThe options object to modify
asyncNon-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

Returns:
0 on success.
Parameters:
optionsThe options object to modify
modeThe 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.

Returns:
0 on success.
Parameters:
optionsThe options object to modify
sizeMaximum 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.

Parameters:
optionsThe 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.

Parameters:
optionsThe options object to modify
closeNon-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.

Parameters:
optionsThe options object to modify
timeoutvalue 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.

Parameters:
optionsThe options object to modify
timeoutTime in milliseconds to wait before running the finalizer
finalizerFinalize 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.

Parameters:
optionsThe options object to modify
 All Classes Variables