Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
96dbe3d5
Commit
96dbe3d5
authored
Feb 13, 2022
by
Eric Duminil
Browse files
One pointer, two possible objects
parent
24ae465c
Pipeline
#5809
passed with stage
in 2 minutes and 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/mqtt.cpp
View file @
96dbe3d5
...
...
@@ -24,9 +24,7 @@ namespace config {
# include <WiFiClientSecure.h>
#endif
//TODO: Find better way. Only one of both will be used
WiFiClientSecure
secureClient
;
WiFiClient
espClient
;
WiFiClient
*
espClient
;
PubSubClient
mqttClient
;
...
...
@@ -46,11 +44,13 @@ namespace mqtt {
if
(
config
::
mqtt_encryption
)
{
// The sensor doesn't check the fingerprint of the MQTT broker, because otherwise this fingerprint should be updated
// on the sensor every 3 months. The connection can still be encrypted, though:
secureClient
.
setInsecure
();
// If not available for ESP32, please update Arduino IDE / PlatformIO
mqttClient
.
setClient
(
secureClient
);
WiFiClientSecure
*
secureClient
=
new
WiFiClientSecure
();
secureClient
->
setInsecure
();
espClient
=
secureClient
;
}
else
{
mqttClient
.
setClient
(
esp
Client
);
espClient
=
new
WiFi
Client
(
);
}
mqttClient
.
setClient
(
*
espClient
);
mqttClient
.
setServer
(
config
::
mqtt_server
,
config
::
mqtt_port
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment