Open Storm
data.h
Go to the documentation of this file.
1 
8 #ifndef DATA_H
9 #define DATA_H
10 #include <device.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include "decagon.h"
15 #include "ultrasonic.h"
16 #include "optical_rain.h"
17 #include "atlas_wq_sensor.h"
18 #include "autosampler.h"
19 #include "valve.h"
20 #include "misc.h"
21 #include "modem.h"
22 #include "strlib.h"
23 #include "commit.h"
24 
25 // Function prototypes
26 
41 int take_readings(char *labels[], float readings[], uint8 *array_ix, uint8 take_average, uint8 max_size);
42 
54 uint8 execute_triggers(char *labels[], float readings[], uint8 *array_ix, uint8 max_size);
55 
66 uint8 zip_meta(char *labels[], float readings[], uint8 *array_ix, uint8 max_size);
67 
79 uint8 zip_modem(char *labels[], float readings[], uint8 *array_ix, uint8 max_size);
80 
93 uint8 run_meta_subroutine(char* meid, char* send_str, char* response_str, uint8 get_device_meid);
94 
116 int update_meta(char* meid, char* send_str, char* response_str);
117 
137 int update_triggers(char* body, char* send_str, char* response_str);
138 
149 void update_params(char* body, char* send_str, char* response_str);
150 
162 void construct_route(char* route, char* base, char* user, char* pass, char* database);
163 
174 void construct_default_body(char *data_packet, char *labels[], float readings[],
175  int nvars);
176 
190 uint8 send_readings(char* body, char* send_str, char* response_str, char* socket_dial_str,
191  char *labels[], float readings[], uint8 nvars);
192 
202 uint8 append_tags(char *main_tags, char *appended_label, char *appended_value);
203 
211 char *url_encode(char *str);
212 
213 #endif
214 /* [] END OF FILE */
void construct_route(char *route, char *base, char *user, char *pass, char *database)
Constructs the route (URL) following the base endpoint.
Definition: data.c:446
Declares functions for Decagon GS3 soil moisture sensor.
int update_triggers(char *body, char *send_str, char *response_str)
Update values of triggers, such as valve_trigger, autosampler_trigger and gps_trigger based on curren...
Definition: data.c:293
Declares miscellaneous utilites.
uint8 zip_meta(char *labels[], float readings[], uint8 *array_ix, uint8 max_size)
Inserts current value of meta_trigger into readings array.
Definition: data.c:169
int take_readings(char *labels[], float readings[], uint8 *array_ix, uint8 take_average, uint8 max_size)
Takes sensor readings and stores results into an array of labels and an array of readings.
Definition: data.c:90
int update_meta(char *meid, char *send_str, char *response_str)
Update values of node_id, node_user, node_pass, node_db on device based on current values stored on s...
Definition: data.c:234
void update_params(char *body, char *send_str, char *response_str)
Update values of onboard parameters, such as sleeptimer and flags such as ultrasonic_flag or valve_fl...
Definition: data.c:380
Functions for connecting to the cellular network, and sending/receiving packets.
uint8 append_tags(char *main_tags, char *appended_label, char *appended_value)
Append new tags to existing influxdb tags.
Definition: data.c:466
Declares functions for ISCO autosampler.
Declares functions for operating valve.
char * url_encode(char *str)
Return a URL-encoded version of the input string.
Definition: data.c:474
uint8 zip_modem(char *labels[], float readings[], uint8 *array_ix, uint8 max_size)
Inserts current values of connection_attempt_counter rssi and fer into readings array.
Definition: data.c:181
uint8 execute_triggers(char *labels[], float readings[], uint8 *array_ix, uint8 max_size)
Executes triggers and stores results into an array of labels and an array of readings.
Definition: data.c:141
Declares functions for Atlas water quality sensors.
void construct_default_body(char *data_packet, char *labels[], float readings[], int nvars)
Parses label and readings arrays into an influxdb line protocol body.
Definition: data.c:451
uint8 run_meta_subroutine(char *meid, char *send_str, char *response_str, uint8 get_device_meid)
Runs update_meta and stores the results in an array of readings and labels.
Definition: data.c:215
uint8 send_readings(char *body, char *send_str, char *response_str, char *socket_dial_str, char *labels[], float readings[], uint8 nvars)
Send readings to influxdb.
Definition: data.c:197
Implements functions for maxbotix ultrasonic sensors and senix toughsonic sensors subroutines...
Functions for parsing c strings.
Declares functions for hydreon optical rain sensor.