Open Storm
|
Implements the sensor subroutine, metadata updater, trigger updater, and parameter updater. More...
Functions | |
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. More... | |
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. More... | |
uint8 | zip_meta (char *labels[], float readings[], uint8 *array_ix, uint8 max_size) |
Inserts current value of meta_trigger into readings array. More... | |
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. More... | |
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. More... | |
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. More... | |
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 server. More... | |
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 current values stored on server. More... | |
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_flag . More... | |
void | construct_route (char *route, char *base, char *user, char *pass, char *database) |
Constructs the route (URL) following the base endpoint. More... | |
void | construct_default_body (char *data_packet, char *labels[], float readings[], int nvars) |
Parses label and readings arrays into an influxdb line protocol body. More... | |
uint8 | append_tags (char *main_tags, char *appended_label, char *appended_value) |
Append new tags to existing influxdb tags. More... | |
char * | url_encode (char *str) |
Return a URL-encoded version of the input string. More... | |
Implements the sensor subroutine, metadata updater, trigger updater, and parameter updater.
uint8 append_tags | ( | char * | main_tags, |
char * | appended_label, | ||
char * | appended_value | ||
) |
Append new tags to existing influxdb tags.
main_tags | Existing tag string (comma-separated) |
appended_label | Tag label to append |
appended_value | Tag value to append |
void construct_default_body | ( | char * | data_packet, |
char * | labels[], | ||
float | readings[], | ||
int | nvars | ||
) |
Parses label and readings arrays into an influxdb line protocol body.
data_packet | Empty buffer to store POST request body |
labels | Buffer to store labels corresponding to each trigger result |
readings | Buffer to store trigger results as floating point values |
nvars | Number of variables (entries) in the readings array |
void construct_route | ( | char * | route, |
char * | base, | ||
char * | user, | ||
char * | pass, | ||
char * | database | ||
) |
Constructs the route (URL) following the base endpoint.
route | Empty buffer to store route information |
base | Base endpoint |
user | Influxdb username |
pass | Influxdb password |
database | Influxdb database |
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.
labels | Array to store labels corresponding to each trigger result |
readings | Array to store trigger results as floating point values |
array_ix | Array index to label and readings |
max_size | Maximum size of label and reading arrays (number of entries) |
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.
meid | The mobile equipment identificiation number for the cell module |
send_str | Empty buffer to place request string |
response_str | Empty buffer to store server response |
get_device_meid | Whether to re-read meid from cell module.
|
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.
body | Empty buffer to hold message body |
send_str | Empty buffer to hold request string |
response_str | Empty buffer to hold server response |
socket_dial_str | Empty buffer to hold string used in socket dial |
labels | Array containing reading labels |
readings | Array containing readings as floating point values |
nvars | Number of variables (entries) in the readings array |
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.
labels | Array to store labels corresponding to each reading |
readings | Array to store readings as floating point values |
array_ix | Array index to label and readings |
take_average | Whether to take average or not
|
max_size | Maximum size of label and reading arrays (number of entries) in buffer. |
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 server.
meid | The mobile equipment identificiation number for the cell module |
send_str | Empty buffer to place request string |
response_str | Empty buffer to store server response |
get_device_meid | Whether to re-read meid from cell module.
|
node_id
successfully updateduser
successfully updatedpass
successfully updateddatabase
successfully updated A response code of 15 indicates that all parameters were successfully updated. The true_reponse_code
is 15. Thus, if all parameters are updated successfully, the function will return 0. 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_flag
.
body | Empty buffer to store request body |
send_str | Empty buffer to store request string |
response_str | Empty buffer to store server response |
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 current values stored on server.
body | Empty buffer to store request body |
send_str | Empty buffer to store request string |
response_str | Empty buffer to store server response |
meta_trigger
successfully updatedautosampler_trigger
successfully updatedvalve_trigger
successfully updatedvalve_2_trigger
successfully updatedgps_trigger
successfully updated A response code of 15 indicates that all parameters were successfully updated. The true_reponse_code
is 31. Thus, if all parameters are updated successfully, the function will return 0. char* url_encode | ( | char * | str | ) |
Return a URL-encoded version of the input string.
str | String to URL-encode |
uint8 zip_meta | ( | char * | labels[], |
float | readings[], | ||
uint8 * | array_ix, | ||
uint8 | max_size | ||
) |
Inserts current value of meta_trigger
into readings array.
labels | Array to store labels corresponding to each trigger result |
readings | Array to store trigger results as floating point values |
array_ix | Array index to label and readings |
max_size | Maximum size of label and reading arrays (number of entries) |
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.
labels | Array to store labels corresponding to each trigger result |
readings | Array to store trigger results as floating point values |
array_ix | Array index to label and readings |
max_size | Maximum size of label and reading arrays (number of entries) |