2

I'm trying to use libxively to update my feed, but it frequently seems to do nothing. I've got a basic call:

{
    xi_datastream_t& ds = mXIFeed.datastreams[2];
    ::xi_str_copy_untiln(ds.datastream_id, sizeof (ds.datastream_id), "cc-output-power", '\0');
    xi_datapoint_t& dp = ds.datapoints[0];
    ds.datapoint_count = 1;
    ::xi_set_value_f32(&dp, mChargeController->outputPower());
}

const xi_context_t* ctx = ::xi_nob_feed_update(mXIContext, &mXIFeed);

it logs the following:

[io/posix/posix_io_layer.c:182 (posix_io_layer_init)] [posix_io_layer_init]
[io/posix/posix_io_layer.c:191 (posix_io_layer_init)] Creating socket...
[io/posix/posix_io_layer.c:202 (posix_io_layer_init)] Socket creation [ok]

Once or twice I saw my Xively developer page show a GET feed, but otherwise, nothing seems to get written. Any suggestions on what I should look at?

I tried to rebuild the library using blocking calls (would be nice if nob didn't mean no blocking calls), but I couldn't figure out how to build it.

Thanks!

EDIT:

I was able to build a synchronous version of the library, and that seems to work. Can anyone verify that the async version works? Is there more to it than simply calling xi_nob_feed_update()?

EDIT 2:

I tried running the async example, but I'm doing something wrong, as it always complains of no data received:

$ bin/asynch_feed_update <my key> <my feed ID> example 1 example 4 example 20 example 58 example 11 example 17
example: 1 7
example: 4 7
example: 20 7
example: 58 7
example: 11 7
example: 17 7
[io/posix_asynch/posix_asynch_io_layer.c:165 (posix_asynch_io_layer_init)] [posix_io_layer_init]
[io/posix_asynch/posix_asynch_io_layer.c:174 (posix_asynch_io_layer_init)] Creating socket...
[io/posix_asynch/posix_asynch_io_layer.c:185 (posix_asynch_io_layer_init)] Setting socket non blocking behaviour...
[io/posix_asynch/posix_asynch_io_layer.c:203 (posix_asynch_io_layer_init)] Socket creation [ok]
No data within five seconds.
Rick
  • 3,298
  • 3
  • 29
  • 47

1 Answers1

1

The asynchronous version should work. The xi_nob_feed_update() is the right function to make a feed update request.

You have to call process_xively_nob_step() in a loop just after select().

In general, you should follow the asynchronous example.

errordeveloper
  • 6,716
  • 6
  • 41
  • 54
olgierdh
  • 151
  • 5
  • Thank you, I overlooked that. I'll try that when I get a chance, and come back to accept the answer if it works. – Rick Jul 16 '14 at 18:50
  • So, I tried executing the example, but it doesn't work, either (or I'm invoking it wrong). See the edit to my original post above. – Rick Aug 23 '14 at 20:57
  • I'll look into this problem as soon as it's possible. – olgierdh Aug 28 '14 at 19:34
  • I think I know where problem may be... check your compilation flags. The correct ones for asynchronious version of libxively are: `make XI_NOB_ENABLED=true XI_IO_LAYER=posix_asynch` for debug version. – olgierdh Aug 28 '14 at 19:45