-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinflux.h
38 lines (27 loc) · 1.1 KB
/
influx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#include <stdint.h>
// global variable to be returned by worker from callback fn
// struct for the influxDB worker to return
typedef struct
{
char time[64]; // time string
char text[64]; // text string for TARGETNAMES
int16_t scanID; // scanID
float *value; // values of measurements
char **name; // names of measurements
char **cols; // how many columns of values are returned from influx
size_t length; // how many time are a measurement returned from influx
} influxStruct;
extern influxStruct *influxReturn;
// InfluxDB parameters
#define INFLUXDB_URL "http://localhost:8086/query?&db=gustoDBlp"
// Callback function to handle the response from the InfluxDB server
size_t write_callback(char *contents, size_t size, size_t nmemb, void *userp);
// Initialization function to connect to the Influx DB.
// Returns: The curl handle to pass to the handler function
CURL *init_influx();
influxStruct* influxWorker(CURL *curl, char *query);
void freeinfluxStruct(influxStruct *influxReturn);