Open Storm
Macros | Functions | Variables
services.c File Reference

Declares functions for sending requests to various services including Xively, Thingspeak and CHORDS. More...

#include <project.h>
#include <stdio.h>
#include "services.h"
#include "extern.h"
Include dependency graph for services.c:

Macros

#define XIVELY   1u
 
#define INFLUXDB   2u
 
#define THINGSPEAK   3u
 
#define CHORDS   4u
 

Functions

int construct_data_body (char *data_packet, char *labels[], float readings[], int nvars, int service_flag)
 Constructs body of POST request for various services. More...
 
void construct_data_post_request (char *body, char *socket_dial_str, char *send_str, int service_flag)
 Constructs full POST request for various services. More...
 

Variables

int XIVELY_FEED_ID = 726713202
 
const char * xively_api_key = "examplekey"
 
const char * xively_endpoint = "api.xively.com"
 
const char * xively_port = "80"
 
int INFLUXDB_AUTHENTICATION = 0u
 
const char * influxdb_endpoint = "example.compute.amazonaws.com"
 
const char * influxdb_port = "8086"
 
const char * influxdb_db = "TEST_DATABASE"
 
const char * influxdb_user = "root"
 
const char * influxdb_pw = "root"
 
const char * thingspeak_endpoint = "api.thingspeak.com"
 
const char * thingspeak_port = "80"
 
const char * thingspeak_api_key = "examplekey"
 
const char * chords_endpoint = "storm.chordsrt.com"
 
const char * chords_port = "80"
 
const char * chords_write_key = "examplekey"
 

Detailed Description

Declares functions for sending requests to various services including Xively, Thingspeak and CHORDS.

Author
Matt Bartos and Brandon Wong
Version
TODO
Date
2017-06-19

Function Documentation

int construct_data_body ( char *  data_packet,
char *  labels[],
float  readings[],
int  nvars,
int  service_flag 
)

Constructs body of POST request for various services.

Parameters
data_packetEmpty buffer to store POST request body
labelsArray to store labels corresponding to each trigger result
readingsArray to store trigger results as floating point values
nvarsMaximum size of label and reading arrays (number of entries)
service_flagService to use:
  • 1: Xively
  • 2: Influxdb
  • 3: Thingspeak
  • 4: CHORDS
Returns
number of entries filled
void construct_data_post_request ( char *  body,
char *  socket_dial_str,
char *  send_str,
int  service_flag 
)

Constructs full POST request for various services.

Parameters
bodyEmpty buffer to store POST request body
socket_dial_strBuffer to store socket dial string
send_strBuffer to store entire request, including headers
service_flagService to use:
  • 1: Xively
  • 2: Influxdb
  • 3: Thingspeak
  • 4: CHORDS
Returns
null