Hi,
just for reference and to help future questions:
I am running OpenHAB on a dedicated RasPi. It is a Java application which I do not want to run on a Neuron. Keep it simple and stupid.
In C code it was not too complicated to get data from OpenHAB though curl calls.
See code snipplet:
/* Function gets calledd with an item name */
/* The url is defined here globally: */
/* url="http://openhab.domain.com:8080/rest/items/" */
long get_2file(char *url, char *filename )
{
CURL *curl_handle;
FILE *FI;
int r,code;
code = 0;
curl_handle = curl_easy_init();
/* set URL to get here */
curl_easy_setopt(curl_handle, CURLOPT_URL, url);
/* disable progress meter, set to 0L to enable and disable debug output */
curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L);
/* use default write function */
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, NULL);
/* open the file */
FI = fopen(filename, "w");
if(FI) {
/* write the page body to this file handle */
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, FI);
/* get it! */
r = curl_easy_perform(curl_handle);
if (r != 0) {
code=-1;
} else {
/* Data is now in the file */
}
/* close the header file */
r = fclose(FI);
} else {
code=-1;
}
/* cleanup curl stuff */
curl_easy_cleanup(curl_handle);
return code;
}