MistyGro API
C++ API for MistyGro's ESP32 controller based on the Arduino framework
firebase_logger.h
Go to the documentation of this file.
1 /*
2  * Copyright 2023 Myron Rodrigues
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _FIREBASE_LOGGER_H_
18 #define _FIREBASE_LOGGER_H_
19 
20 #include <FirebaseESP32.h>
21 #include <WiFi.h>
22 
28 {
29 private:
30  FirebaseAuth auth_;
31  FirebaseConfig config_;
32  FirebaseData fbdo_;
33  String path_prefix_;
34 
35  // print errors from last operation
36  void print_error();
37 
38  // add path prefix for specific user
39  MB_String full_path(const char * path);
40 
41 public:
42  FireLogger();
43 
53  void begin(
54  const char * fire_url, const char * fire_token, const char * email,
55  const char * pass);
56 
63  void set_int(const char * path, int64_t value);
64 
71  void set_float(const char * path, double value);
72 
79  void set_string(const char * path, const char * value);
80 
87  void set_bool(const char * path, bool value);
88 
96  void push_time(const char * path, time_t timestamp);
97 
103  bool is_ready();
104 
110  bool is_keep_alive();
111 
117  bool is_connected();
118 
125 };
126 
127 #endif // _FIREBASE_LOGGER_H_
Firebase RTDB logger.
bool is_connected()
Get http server connection status.
void begin(const char *fire_url, const char *fire_token, const char *email, const char *pass)
initialise and authorise system to use Firebase RTDB (real time database) make sure wifi is initialis...
void set_float(const char *path, double value)
Set a float value.
bool is_ready()
Check if authenticated.
void set_int(const char *path, int64_t value)
Set an integer value.
void set_bool(const char *path, bool value)
Set a bool value.
bool is_keep_alive()
Get TCP keepalive status.
bool check_and_refresh_token()
refresh token if expired
void set_string(const char *path, const char *value)
Set a string value.
void push_time(const char *path, time_t timestamp)
Push a timestamp into a list to a relative path, useful to log times like when initialisation was com...