Synopsis
CTL_STATUS_t ctl_xively_feed_update(CTL_XIVELY_FEED_t *self);
Description

ctl_xively_feed_update pushes as much data as it can from feed to the Xively service.

A feed may well have data outstanding even if ctl_xively_feed_update completes successfully as only a subset of outstanding data in the feed may have been sent to Xively. ctl_xively_feed_update uses the string buffer in the feed's context to encode the data to send to Xively, so smaller string buffers will mean that fewer datapoints can be encoded without overflowing the buffer and, hence, there is a possibility that not all outstanding datapoints in the feed will be pushed to Xively.

After encoding the datapoints, the datapoints are sent to Xively using the selected transport—only the HTTP transport is implemented at present. If there is an error sending the encoded datapoints to Xively, the datapoints buffered in the feed self are not discarded, they remain in the datastream buffers such that they can be pushed to Xively by invoking ctl_xively_feed_update again.

The way to ensure that all datapoints are sent to Xively is to inquire whether there are more outstanding datapoints after successfully pushing to Xively, for instance:

while (ctl_xively_feed_has_pending_data(&feed))
  {
    // Send as much data to Xively as we can.
    ctl_xively_feed_update(&feed);

    // Wait a little before sending more.
    ctl_delay(1000);
  }
See Also

ctl_xively_feed_has_pending_data