Writing to Exosite Using C


#1

Hi again,

I am posting again because I’ve been having some non-Exosite related issues between the scripting languages NodeJS, Bonescript, and my device BeagleBone Black Rev C (mostly in trying to get a program to start at boot).

Anyway, I was trying to find an example of how to write to Exosite using C. I cloned the C repository from https://github.com/exosite-labs/libexositecoap.

Any help would be appreciated.

Thanks,

Thomas


#2

Hi Thomas,

Bummer to hear that you are having problems using the scripting languages.

Have you looked into the example contained in that repository? https://github.com/exosite-labs/libexositecoap/blob/master/examples/subscribe.c.

You could configure your generic client to use some the aliases is it expects: uptime, errorcount, and command. It should compile and try to reach out to the platform straight away.

With your free account you won’t have access to the Provisioning system to setup your own test, so I would recommend doing what the library README says:

If you’re planning on testing the included example (make posixsubscribe && ./posixsubscribe) and you’re not using the provisioning system you’ll need to paste your CIK into a file named cik to fool the library into thinking that it already activated itself.

You should make this file in the same directory that holds your executable.

Happy to help,
-Martin


#3

@Martin,

Sorry for the late reply. Based on the readme file, I was expecting that there would be separate files for subscribing, writing, and reading, respectively. Oops. :slight_smile:

I will work on using the suscribe.c in my Beaglebone Black. In the meantime, thanks!

Thomas


#4

@Martin,

Looking at suscribe.c, I noticed that the file mentioned vendor, model, and serial. Do those values matter or not if my device is just a generic device?

Also, what are the data types for the aliases uptime, errorcount, and command (int, int, and string, I am guessing)?

Thanks,

Thomas


#5

Those values matter because the library attempts to activate the device. But you device is generic, and skips activation.

Try creating a CIK file to trick the script: