Adicionar primeiro
This commit is contained in:
61
components/protocols/include/date_time.h
Executable file
61
components/protocols/include/date_time.h
Executable file
@@ -0,0 +1,61 @@
|
||||
#ifndef DATE_TIME_H
|
||||
#define DATE_TIME_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "esp_err.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize timezone and NTP
|
||||
*
|
||||
*/
|
||||
void date_time_init(void);
|
||||
|
||||
/**
|
||||
* @brief Return true if NTP is enabled, stored in NVS
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool date_time_is_ntp_enabled(void);
|
||||
|
||||
/**
|
||||
* @brief Get NTP server, string length 64, stored in NVS
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
void date_time_get_ntp_server(char* value);
|
||||
|
||||
/**
|
||||
* @brief Return true if NTP server from DHCP fetch is enabled, stored in NVS
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool date_time_is_ntp_from_dhcp(void);
|
||||
|
||||
/**
|
||||
* @brief Set timezone and NTP config
|
||||
*
|
||||
* @param enabled
|
||||
* @param server
|
||||
* @param from_dhcp
|
||||
* @return esp_err_t
|
||||
*/
|
||||
esp_err_t date_time_set_ntp_config(bool enabled, const char* server, bool from_dhcp);
|
||||
|
||||
/**
|
||||
* @brief Get timezone, string length 64, stored in NVS
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
void date_time_get_timezone(char* value);
|
||||
|
||||
/**
|
||||
* @brief Set timezone, string length 64, stored in NVS
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
esp_err_t date_time_set_timezone(const char* value);
|
||||
|
||||
|
||||
#endif /* DATE_TIME_H */
|
||||
27
components/protocols/include/modbus_tcp.h
Normal file
27
components/protocols/include/modbus_tcp.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef MODBUS_TCP_H
|
||||
#define MODBUS_TCP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @brief Init modbus tcp
|
||||
*
|
||||
*/
|
||||
void modbus_tcp_init(void);
|
||||
|
||||
/**
|
||||
* @brief Set enabled, stored in NVS
|
||||
*
|
||||
* @param enabled
|
||||
*/
|
||||
void modbus_tcp_set_enabled(bool enabled);
|
||||
|
||||
/**
|
||||
* @brief Get enabled, stored in NVS
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool modbus_tcp_is_enabled(void);
|
||||
|
||||
#endif /* MODBUS_TCP_H */
|
||||
70
components/protocols/include/mqtt.h
Executable file
70
components/protocols/include/mqtt.h
Executable file
@@ -0,0 +1,70 @@
|
||||
#ifndef MQTT_H_
|
||||
#define MQTT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "esp_err.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize MQTT
|
||||
*
|
||||
*/
|
||||
void mqtt_init(void);
|
||||
|
||||
/**
|
||||
* @brief Set MQTT config
|
||||
*
|
||||
* @param enabled
|
||||
* @param server NULL value will be skiped
|
||||
* @param base_topic NULL value will be skiped
|
||||
* @param user NULL value will be skiped
|
||||
* @param password NULL value will be skiped
|
||||
* @param periodicity 0 value will be skiped
|
||||
* @return esp_err_t
|
||||
*/
|
||||
esp_err_t mqtt_set_config(bool enabled, const char* server, const char* base_topic, const char* user, const char* password, uint16_t periodicity);
|
||||
|
||||
/**
|
||||
* @brief Get MQTT enabled, stored in NVS
|
||||
*
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool mqtt_get_enabled(void);
|
||||
|
||||
/**
|
||||
* @brief Get MQTT server, string length 64, stored in NVS
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
void mqtt_get_server(char* value);
|
||||
|
||||
/**
|
||||
* @brief Get MQTT password, string length 64, stored in NVS
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
void mqtt_get_password(char* value);
|
||||
|
||||
/**
|
||||
* @brief Get MQTT base topic, string length 32, stored in NVS
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
void mqtt_get_base_topic(char* value);
|
||||
|
||||
/**
|
||||
* @brief Get MQTT user, string length 32, stored in NVS
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
void mqtt_get_user(char* value);
|
||||
|
||||
/**
|
||||
* @brief Get MQTT periodicity in second, stored in NVS
|
||||
*
|
||||
* @return uint16_t
|
||||
*/
|
||||
uint16_t mqtt_get_periodicity(void);
|
||||
|
||||
#endif /* MQTT_H_ */
|
||||
6
components/protocols/include/protocols.h
Executable file
6
components/protocols/include/protocols.h
Executable file
@@ -0,0 +1,6 @@
|
||||
#ifndef PROTOCOLS_H_
|
||||
#define PROTOCOLS_H_
|
||||
|
||||
void protocols_init(void);
|
||||
|
||||
#endif /* PROTOCOLS_H_ */
|
||||
10
components/protocols/include/rest.h
Executable file
10
components/protocols/include/rest.h
Executable file
@@ -0,0 +1,10 @@
|
||||
#ifndef REST_H_
|
||||
#define REST_H_
|
||||
|
||||
/**
|
||||
* @brief Init rest server
|
||||
*
|
||||
*/
|
||||
void rest_init(void);
|
||||
|
||||
#endif /* REST_H_ */
|
||||
Reference in New Issue
Block a user