Open Storm
|
Functions for parsing c strings. More...
Functions | |
uint8_t | parse_influxdb (char *value, char *packet, char *name) |
Searches InfluxDB json packet, "packet", for "name" and writes the associated value to "value" as a char array. This is ported from packet_get_value() from packet.c in kLabUM/IoT. More... | |
uint8_t | strparse_influxdb (char *param, char *packet, char *name) |
Searches InfluxDB json-packet, "packet" for "name" and stores the associated value as a string in "param". Removes the quotations that wrap the strings returned in the query. More... | |
uint8_t | intparse_influxdb (int *param, char *packet, char *name) |
Searches InfluxDB json-packet, "packet" for "name" and stores the associated value as an int in "param". Removes the quotations that wrap the strings returned in the query. More... | |
uint8_t | clear_str (char *str) |
Resets a string to null bytes. More... | |
void | zips (char *begin[], char *end[],...) |
Variadic function that zips c strings. More... | |
void | zipf (float begin[], float end[],...) |
Variadic function that zips floats. More... | |
char * | strextract (const char input_str[], char output_str[], const char search_start[], const char search_end[]) |
Searches for the left-most c string in between search_start and search_end and stores it in output_str . More... | |
void | for_each (void *begin, void *end, size_t sz, void(*fn)(void *a)) |
Applies a function over a range of values;. More... | |
uint8_t | gps_parse (const char *gps_string, float *lat, float *lon, float *hdop, float *altitude, uint8_t *gps_fix, float *cog, float *spkm, float *spkn, uint8_t *nsat) |
Parses the given gps string into the given buffers. More... | |
uint8_t | parse_http_status (char *http_status, char *version, char *status_code, char *phrase) |
Searches a string "http_status" and attempts to parse the status line. Stores the results in "version", "status_code", and "phrase". More... | |
Functions for parsing c strings.
uint8_t clear_str | ( | char * | str | ) |
Resets a string to null bytes.
str | String to reset |
void for_each | ( | void * | begin, |
void * | end, | ||
size_t | sz, | ||
void(*)(void *a) | fn | ||
) |
Applies a function over a range of values;.
begin[] | Pointer to beginning of range. |
end[] | Pointer to one past the end of the range. |
sz | Size of each element in bytes. |
fn | function which transforms each value. |
uint8_t gps_parse | ( | const char * | gps_string, |
float * | lat, | ||
float * | lon, | ||
float * | hdop, | ||
float * | altitude, | ||
uint8_t * | gps_fix, | ||
float * | cog, | ||
float * | spkm, | ||
float * | spkn, | ||
uint8_t * | nsat | ||
) |
Parses the given gps string into the given buffers.
gps_string | The string to be parsed |
lat | Buffer to store the Latitude. |
lon | Buffer to store the Longitude. |
hdop | Buffer to store the Horizontal Diluition of Precision. |
altitude | Buffer to store the Altitude: mean-sea-level (geoid). |
gps_fix | Buffer to store the flag:
|
cog | Buffer to store the Course over ground. |
spkm | Buffer to store the Speed over ground (km/hr). |
spkn | Buffer to store the Speed over ground (knots). |
nsat | Buffer to store the number of satellites in use [0..12] |
uint8_t intparse_influxdb | ( | int * | param, |
char * | packet, | ||
char * | name | ||
) |
Searches InfluxDB json-packet, "packet" for "name" and stores the associated value as an int in "param". Removes the quotations that wrap the strings returned in the query.
param | Parameter to be written to |
packet | Packet to search |
name | Substring to search for in packet |
uint8_t parse_http_status | ( | char * | http_status, |
char * | version, | ||
char * | status_code, | ||
char * | phrase | ||
) |
Searches a string "http_status" and attempts to parse the status line. Stores the results in "version", "status_code", and "phrase".
http_status | String to be parsed. Expects Status-Line protocol. |
version | Buffer to store the version. |
status_code | Buffer to store the status code. |
phrase | Buffer to store the phrase. |
uint8_t parse_influxdb | ( | char * | value, |
char * | packet, | ||
char * | name | ||
) |
Searches InfluxDB json packet, "packet", for "name" and writes the associated value to "value" as a char array. This is ported from packet_get_value() from packet.c in kLabUM/IoT.
value | Value to be written to |
packet | Packet to search |
name | Substring to search for in packet |
char* strextract | ( | const char | input_str[], |
char | output_str[], | ||
const char | search_start[], | ||
const char | search_end[] | ||
) |
Searches for the left-most c string in between search_start
and search_end
and stores it in output_str
.
input_str[] | C string to be searched |
output_str[] | Buffer to store the resulting c string |
search_start[] | Leading c string in the query |
search_end[] | Ending c string in the query |
search_end
after search_start
or NULL if extraction fails. uint8_t strparse_influxdb | ( | char * | param, |
char * | packet, | ||
char * | name | ||
) |
Searches InfluxDB json-packet, "packet" for "name" and stores the associated value as a string in "param". Removes the quotations that wrap the strings returned in the query.
param | Parameter to be written to |
packet | Packet to search |
name | Substring to search for in packet |
void zipf | ( | float | begin[], |
float | end[], | ||
... | |||
) |
Variadic function that zips floats.
begin | Buffer to store the floats. |
end | Pointer to one past the end of the buffer. |
... | Variadic number of floats. |
void zips | ( | char * | begin[], |
char * | end[], | ||
... | |||
) |
Variadic function that zips c strings.
begin | Buffer to store the c strings. |
end | Pointer to one past the end of the buffer. |
... | Variadic number of c strings. |