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"
|
#define | XIVELY 1u |
|
#define | INFLUXDB 2u |
|
#define | THINGSPEAK 3u |
|
#define | CHORDS 4u |
|
|
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...
|
|
|
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" |
|
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
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_packet | Empty buffer to store POST request body |
labels | Array to store labels corresponding to each trigger result |
readings | Array to store trigger results as floating point values |
nvars | Maximum size of label and reading arrays (number of entries) |
service_flag | Service 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
-
body | Empty buffer to store POST request body |
socket_dial_str | Buffer to store socket dial string |
send_str | Buffer to store entire request, including headers |
service_flag | Service to use:
- 1: Xively
- 2: Influxdb
- 3: Thingspeak
- 4: CHORDS
|
- Returns
- null