PIC to Mbed errors

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ubidots.c Source File

ubidots.c

00001 #include "ubidots.h"
00002 
00003 uint8_t buffer[256];
00004     
00005 /*const char* ubidotsPOST( const char* token,  const char* variable_id, float value){
00006     uint8_t  httpBody[SIZE_HTTP_BODY];
00007     memset(&buffer, 0,sizeof(buffer));
00008     sprintf(httpBody,"{\"value\":%2.2f}", value);
00009     
00010     sprintf(buffer, "POST /api/v1.6/variables/%s/values HTTP/1.1\r\n", variable_id);
00011     sprintf(buffer, "%sHost: things.ubidots.com\r\n",buffer);
00012     sprintf(buffer, "%sContent-Type: application/json\r\n", buffer);
00013     sprintf(buffer, "%sX-Auth-Token: %s\r\n", buffer, token);
00014     sprintf(buffer, "%sContent-Length: %i\r\n\r\n%s", buffer, strlen(httpBody), httpBody);
00015     
00016     return (uint8_t*)buffer;
00017 }*/
00018 uint8_t* ubidotsGET(const char* token, const char* variable_id )
00019 {
00020     memset(&buffer, 0,sizeof(buffer));
00021     sprintf(buffer,"http://www.things.com/variables/%*s/?token=%*s",sizeof(variable_id),variable_id,sizeof(token),token);
00022     return (uint8_t*)buffer;
00023 }
00024 
00025