Go to the source code of this file.
Typedefs | |
typedef double | cp_time |
Functions | |
cp_res | cloudplugs_enroll_json (cp_session cps, json_t *obj, json_t **result) |
cp_res | cloudplugs_enroll_product_json (cp_session cps, const char *model, const char *hwid, const char *pass, json_t *props, json_t **result) |
cp_res | cloudplugs_enroll_prototype_json (cp_session cps, const char *name, const char *hwid, const char *pass, json_t *perm, json_t *props, json_t **result) |
cp_res | cloudplugs_enroll_ctrl_json (cp_session cps, const char *model, const char *ctrl, const char *pass, const char *hwid, const char *name, json_t **result) |
cp_res | cloudplugs_control_device_json (cp_session cps, const char *model, const char *ctrl, const char *pass, json_t **result) |
cp_res | cloudplugs_uncontrol_device_json (cp_session cps, const char *plugid, json_t *plugid_controlled, json_t **result) |
cp_res | cloudplugs_get_channel_json (cp_session cps, const char *channel_mask, json_t *before, json_t *after, json_t *at, json_t *of, int offset, int limit, json_t **result) |
cp_res | cloudplugs_get_device_json (cp_session cps, const char *plugid, json_t **result) |
cp_res | cloudplugs_get_device_prop_json (cp_session cps, const char *plugid, const char *prop, json_t **result) |
cp_res | cloudplugs_set_device_prop_json (cp_session cps, const char *plugid, const char *prop, json_t *value) |
cp_res | cloudplugs_remove_device_prop_json (cp_session cps, const char *plugid, const char *prop) |
cp_res | cloudplugs_set_device_json (cp_session cps, const char *plugid, json_t *value, json_t **result) |
cp_res | cloudplugs_unenroll_json (cp_session cps, json_t *plugid, json_t **result) |
cp_res | cloudplugs_retrieve_data_json (cp_session cps, const char *channel_mask, cp_time before, cp_time after, cp_time at, const char *of, int offset, int limit, json_t **result) |
cp_res | cloudplugs_publish_data_json (cp_session cps, const char *channel, json_t *body, json_t **result) |
cp_res | cloudplugs_remove_data_json (cp_session cps, const char *channel_mask, json_t *id, json_t *before, json_t *after, json_t *at, json_t *of, json_t **result) |
cp_res | cloudplugs_set_device_location_json (cp_session cps, const char *plugid, double longitude, double latitude, double altitude, double accuracy, cp_time timestamp) |
cp_res | cloudplugs_get_device_location_json (cp_session cps, const char *plugid, json_t **result) |
typedef double cp_time |
Number of milliseconds in GMT since the time of Epoch
cp_res cloudplugs_control_device_json | ( | cp_session | cps, |
const char * | model, | ||
const char * | ctrl, | ||
const char * | pass, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for enrolling an already existent controller device. It places place the response in *result.
cps | The session reference. |
model | The model PLUG_ID of the device to control. |
ctrl | The serial number ( HWID ) of the device to control. |
pass | The device password's |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_enroll_ctrl_json | ( | cp_session | cps, |
const char * | model, | ||
const char * | ctrl, | ||
const char * | pass, | ||
const char * | hwid, | ||
const char * | name, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for enrolling a new or already existent controller device. It places place the response in *result.
cps | The session reference without authentication if it's the first enroll. |
model | The model PLUG_ID of the device to control. |
ctrl | The serial number ( HWID ) of the device to control. |
pass | The device password's |
hwid | HWID unique string to identify this controller device |
name | string the name of this device |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_enroll_json | ( | cp_session | cps, |
json_t * | obj, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for enrolling a new production device or create new (development) device or enroll new or already existent controller device, that depends on the content of the json. Optionally places the response in *result.
cps | The session reference such that: if it's an prototype enroll, master authentication is required; if it's a product or controller enroll, the session cannot have authentication. |
obj | Json object that contain the info for enroll new production device or create new (development) device (X-Plug-Master header required!) or enroll new or already existent controller device. |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_enroll_product_json | ( | cp_session | cps, |
const char * | model, | ||
const char * | hwid, | ||
const char * | pass, | ||
json_t * | props, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for enrolling a new production device. It places place the response in *result.
cps | The session reference without authentication. |
model | PLUG_ID The device model's . |
hwid | HWID The serial number. |
pass | string The password. |
props | If not NULL, then initialize the custom properties. |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_enroll_prototype_json | ( | cp_session | cps, |
const char * | name, | ||
const char * | hwid, | ||
const char * | pass, | ||
json_t * | perm, | ||
json_t * | props, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for enrolling a prototype. It places place the response in *result.
cps | The session reference without authentication. |
name | string The name of the product. |
hwid | HWID If NULL, then it will be set as a random unique string. |
pass | string If NULL, then set as the X-Plug-Master of the company |
perm | PERM_FILTER If NULL, then permit all. |
props | If not NULL, then initialize the custom properties. |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result., { "id":"PLUG_ID", "auth":String } |
cp_res cloudplugs_get_channel_json | ( | cp_session | cps, |
const char * | channel_mask, | ||
json_t * | before, | ||
json_t * | after, | ||
json_t * | at, | ||
json_t * | of, | ||
int | offset, | ||
int | limit, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for retrieving list channels/channels about already published data. It places the response information in *result and *result_length.
cps | The session reference. |
channel_mask | The CHMASK. |
before | : TIMESTAMP or OBJECT_ID Optional, timestamp valid if greater than zero or OID of published data |
after | : TIMESTAMP or OBJECT_ID Optional, timestamp valid if greater than zero or OID of published data |
at | : TIMESTAMP_CSV Optional, timestamp valid if greater than zero //TODO TIMESTAMP_CSV&? |
of | : PLUG_ID_CSV Optional, PLUG_ID_CSV |
offset | : N |
limit | : N |
result | A pointer such that *result will contain the dynamically allocated json string of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_get_device_json | ( | cp_session | cps, |
const char * | plugid, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for reading a device. It places the response in *result.
cps | The session reference. |
plugid | If NULL, then is the PLUG_ID in the session. |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_get_device_location_json | ( | cp_session | cps, |
const char * | plugid, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for writing or deleting device location. It places the response in *result.
cps | The session reference. |
plugid | If not NULL, then the PLUG_ID of the device, otherwise the device referenced in the session. |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_get_device_prop_json | ( | cp_session | cps, |
const char * | plugid, | ||
const char * | prop, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for reading the device properties and place the response in *result.
cps | The session reference. |
plugid | If NULL, then is the PLUG_ID in the session. |
prop | If NULL, then all properties value; otherwise the single property value. |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_publish_data_json | ( | cp_session | cps, |
const char * | channel, | ||
json_t * | body, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server to publish data. Authentication is requested
cps | The session reference. |
channel | A optional channel, if NULL data need to contain a couple "channel":"channel name" |
body | JSON an object or an array of objects like this: { "id" : OBJECT_ID, "channel" : CHANNEL, // optional, to override the channel in the url "data" : JSON, "at" : TIMESTAMP_CSV , "of" : PLUG_ID, // optional, check if the X-Plug-Id is authorized for setting this field "is_priv" : Boolean, // optional, default false "expire_at" : TIMESTAMP , // optional, expire date of this data entry "ttl" : Number // optional, how many seconds this data entry will live (if "expire_at" is present, then this field is ignored) } |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_remove_data_json | ( | cp_session | cps, |
const char * | channel_mask, | ||
json_t * | id, | ||
json_t * | before, | ||
json_t * | after, | ||
json_t * | at, | ||
json_t * | of, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server to delete some published data
cps | The session reference. |
channel_mask | The channel mask |
id | : OBJECT_ID_CSV , |
before | : TIMESTAMP or OBJECT_ID , |
after | : TIMESTAMP or OBJECT_ID , |
at | : TIMESTAMP_CSV, |
of | : PLUG_ID_CSV , |
result | The response returned as a reference |
cp_res cloudplugs_remove_device_prop_json | ( | cp_session | cps, |
const char * | plugid, | ||
const char * | prop | ||
) |
This function performs an HTTP request to the server for deleting device property and [optionally] place the response in *result and *result_length.
cps | The session reference. |
plugid | The PLUG_ID of the device. |
prop | The single property to be remove. |
cp_res cloudplugs_retrieve_data_json | ( | cp_session | cps, |
const char * | channel_mask, | ||
cp_time | before, | ||
cp_time | after, | ||
cp_time | at, | ||
const char * | of, | ||
int | offset, | ||
int | limit, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for retrieving already published data
cps | The session reference. |
channel_mask | CHMASK The channel mask. |
before | TIMESTAMP or OBJECT_ID Timestamp valid if greater than zero. |
after | TIMESTAMP or OBJECT_ID Timestamp valid if greater than zero. |
at | TIMESTAMP_CSV Timestamp valid if greater than zero. |
of | If not NULL, then PLUG_ID_CSV. |
offset | Offset valid if greater than zero. |
limit | Limit valid if greater than zero. |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_set_device_json | ( | cp_session | cps, |
const char * | plugid, | ||
json_t * | value, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for modifying a device and [optionally] it places the response in *result
cps | The session reference. |
plugid | If NULL, then is the PLUG_ID in the session. |
value | A json object like this: { "perm" : PERM_FILTER , // optional, it contains just the sharing filters to modify "name" : String, // optional "status" : STATUS , // optional "props" : Object // optional, it contains just the properties to modify } |
result | A pointer such that *result will contain the dynamically allocated json object of the retrieved response body. The caller is responsible to free memory in *result. |
cp_res cloudplugs_set_device_location_json | ( | cp_session | cps, |
const char * | plugid, | ||
double | longitude, | ||
double | latitude, | ||
double | altitude, | ||
double | accuracy, | ||
cp_time | timestamp | ||
) |
This function performs an HTTP request to the server for writing or deleting device location and [optionally] it places the response in *result.
cps | The session reference. |
plugid | If not NULL, then the PLUG_ID of the device, otherwise the device referenced in the session. |
longitude | |
latitude | |
altitude | //optional |
accuracy | //optional |
timestamp | //optional |
cp_res cloudplugs_set_device_prop_json | ( | cp_session | cps, |
const char * | plugid, | ||
const char * | prop, | ||
json_t * | value | ||
) |
This function performs an HTTP request to the server for writing or deleting device properties and [optionally] it places the response in *result.
cps | The session reference. |
plugid | If NULL, then is the PLUG_ID in the session. |
prop | If NULL, then value must be an object; otherwise the single property value is written. |
value | A json value, use null to delete one or all device properties. |
cp_res cloudplugs_uncontrol_device_json | ( | cp_session | cps, |
const char * | plugid, | ||
json_t * | plugid_controlled, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for uncontrolling a device and [optionally] place the response in *result.
cps | The session reference. |
plugid | If NULL, then is the PLUG_ID in the session. |
plugid_controlled | If not NULL, then a json string or a json array of strings of PLUG_ID device(s) to uncontroll; (default all associated devices). |
result | The response returned as a reference |
cp_res cloudplugs_unenroll_json | ( | cp_session | cps, |
json_t * | plugid, | ||
json_t ** | result | ||
) |
This function performs an HTTP request to the server for removing a device (any: development, product or controller) and [optionally] place the response in *result.
cps | The session reference. |
plugid | The PLUG_ID_CSV of the device(s) to remove; if NULL then remove the device referenced in the session. |
result | The response returned as a reference |