mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-09 21:17:06 +03:00
V14.1 backport to rolling (#2058)
* Migrate parameters to v14.1 branch (#2023) * Migrated parameters * - * . * . * . * . * . * Remove unneeded checkboxes for true/false * Remove ";" * Correct MaintTopic * Added missing parameters to UI: FlipImageSize, InitialMirror Removed checkbox in UI for ErrorMessage Added migration of pboolean parameters: enable them if they where disabled, set them to their default value, then enable them Switch SetRetainFlag internally to a boolean * . * CamImages -> RawImages * CamImages -> RawImages * catch error on unknown parameter * fix missing case insensitivity * fix typo * fixmissing rename * fix migration of ExtendedResolution * Delete ClassFlowMakeImage.cpp * Delete ClassFlowMakeImage.h --------- Co-authored-by: CaCO3 <caco@ruinelli.ch> Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com> * Update Changelog.md --------- Co-authored-by: CaCO3 <caco@ruinelli.ch> Co-authored-by: jomjol <30766535+jomjol@users.noreply.github.com>
This commit is contained in:
@@ -25,11 +25,12 @@ bool mqtt_connected = false;
|
||||
|
||||
esp_mqtt_client_handle_t client = NULL;
|
||||
std::string uri, client_id, lwt_topic, lwt_connected, lwt_disconnected, user, password, maintopic;
|
||||
int keepalive, SetRetainFlag;
|
||||
void (*callbackOnConnected)(std::string, int) = NULL;
|
||||
int keepalive;
|
||||
bool SetRetainFlag;
|
||||
void (*callbackOnConnected)(std::string, bool) = NULL;
|
||||
|
||||
|
||||
bool MQTTPublish(std::string _key, std::string _content, int retained_flag)
|
||||
bool MQTTPublish(std::string _key, std::string _content, bool retained_flag)
|
||||
{
|
||||
if (!mqtt_enabled) { // MQTT sevice not started / configured (MQTT_Init not called before)
|
||||
return false;
|
||||
@@ -153,7 +154,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
|
||||
|
||||
bool MQTT_Configure(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password,
|
||||
std::string _maintopic, std::string _lwt, std::string _lwt_connected, std::string _lwt_disconnected,
|
||||
int _keepalive, int _SetRetainFlag, void *_callbackOnConnected) {
|
||||
int _keepalive, bool _SetRetainFlag, void *_callbackOnConnected) {
|
||||
if ((_mqttURI.length() == 0) || (_maintopic.length() == 0) || (_clientid.length() == 0))
|
||||
{
|
||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Init aborted! Config error (URI, MainTopic or ClientID missing)");
|
||||
@@ -168,7 +169,7 @@ bool MQTT_Configure(std::string _mqttURI, std::string _clientid, std::string _us
|
||||
keepalive = _keepalive;
|
||||
SetRetainFlag = _SetRetainFlag;
|
||||
maintopic = _maintopic;
|
||||
callbackOnConnected = ( void (*)(std::string, int) )(_callbackOnConnected);
|
||||
callbackOnConnected = ( void (*)(std::string, bool) )(_callbackOnConnected);
|
||||
|
||||
if (_user.length() && _password.length()){
|
||||
user = _user;
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
bool MQTT_Configure(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password,
|
||||
std::string _maintopic, std::string _lwt, std::string _lwt_connected, std::string _lwt_disconnected,
|
||||
int _keepalive, int SetRetainFlag, void *callbackOnConnected);
|
||||
int _keepalive, bool SetRetainFlag, void *callbackOnConnected);
|
||||
int MQTT_Init();
|
||||
void MQTTdestroy_client(bool _disable);
|
||||
|
||||
bool MQTTPublish(std::string _key, std::string _content, int retained_flag = 1); // retained Flag as Standart
|
||||
bool MQTTPublish(std::string _key, std::string _content, bool retained_flag = 1); // retained Flag as Standart
|
||||
|
||||
bool getMQTTisEnabled();
|
||||
bool getMQTTisConnected();
|
||||
|
||||
@@ -29,7 +29,7 @@ std::string timeUnit = "";
|
||||
std::string rateUnit = "Unit/Minute";
|
||||
float roundInterval; // Minutes
|
||||
int keepAlive = 0; // Seconds
|
||||
int retainFlag;
|
||||
bool retainFlag;
|
||||
static std::string maintopic;
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ esp_err_t sendDiscovery_and_static_Topics(httpd_req_t *req) {
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void GotConnected(std::string maintopic, int retainFlag) {
|
||||
void GotConnected(std::string maintopic, bool retainFlag) {
|
||||
if (HomeassistantDiscovery) {
|
||||
MQTThomeassistantDiscovery();
|
||||
}
|
||||
@@ -251,7 +251,7 @@ void SetHomeassistantDiscoveryEnabled(bool enabled) {
|
||||
}
|
||||
|
||||
|
||||
void setMqtt_Server_Retain(int _retainFlag) {
|
||||
void setMqtt_Server_Retain(bool _retainFlag) {
|
||||
retainFlag = _retainFlag;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
void SetHomeassistantDiscoveryEnabled(bool enabled);
|
||||
void mqttServer_setParameter(std::vector<NumberPost*>* _NUMBERS, int interval, float roundInterval);
|
||||
void mqttServer_setMeterType(std::string meterType, std::string valueUnit, std::string timeUnit,std::string rateUnit);
|
||||
void setMqtt_Server_Retain(int SetRetainFlag);
|
||||
void setMqtt_Server_Retain(bool SetRetainFlag);
|
||||
void mqttServer_setMainTopic( std::string maintopic);
|
||||
std::string mqttServer_getMainTopic();
|
||||
|
||||
@@ -19,7 +19,7 @@ void register_server_mqtt_uri(httpd_handle_t server);
|
||||
void publishSystemData();
|
||||
|
||||
std::string getTimeUnit(void);
|
||||
void GotConnected(std::string maintopic, int SetRetainFlag);
|
||||
void GotConnected(std::string maintopic, bool SetRetainFlag);
|
||||
|
||||
|
||||
#endif //SERVERMQTT_H
|
||||
|
||||
Reference in New Issue
Block a user