Moving includes back to local

Moving the includes back under the '#ifdef USE_MQTT_AZURE_IOT', so the build process will complete for all builds.
This commit is contained in:
ksaye 2021-04-29 14:45:45 -05:00 committed by GitHub
parent 5b90754af6
commit 8aa006625a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,9 +23,9 @@
#define MQTT_WIFI_CLIENT_TIMEOUT 200 // Wifi TCP connection timeout (default is 5000 mSec) #define MQTT_WIFI_CLIENT_TIMEOUT 200 // Wifi TCP connection timeout (default is 5000 mSec)
#endif #endif
#ifdef USE_MQTT_AZURE_IOT
#include <bearssl\bearssl.h> #include <bearssl\bearssl.h>
#include <base64.hpp> #include <base64.hpp>
#ifdef USE_MQTT_AZURE_IOT
#include <JsonParser.h> #include <JsonParser.h>
#undef MQTT_PORT #undef MQTT_PORT
#define MQTT_PORT 8883 #define MQTT_PORT 8883
@ -224,6 +224,7 @@ void MqttInit(void) {
MqttClient.setSocketTimeout(Settings.mqtt_socket_timeout); MqttClient.setSocketTimeout(Settings.mqtt_socket_timeout);
} }
#ifdef USE_MQTT_AZURE_IOT
String azurePreSharedKeytoSASToken(char *iotHubFQDN, const char *deviceId, const char *preSharedKey, int sasTTL = 86400){ String azurePreSharedKeytoSASToken(char *iotHubFQDN, const char *deviceId, const char *preSharedKey, int sasTTL = 86400){
int ttl = time(NULL) + sasTTL; int ttl = time(NULL) + sasTTL;
String dataToSignString = urlEncodeBase64(String(iotHubFQDN) + "/devices/" + String(deviceId)) + "\n" + String(ttl); String dataToSignString = urlEncodeBase64(String(iotHubFQDN) + "/devices/" + String(deviceId)) + "\n" + String(ttl);
@ -268,6 +269,7 @@ String urlEncodeBase64(String stringToEncode){
stringToEncode.replace("/", "%2F"); stringToEncode.replace("/", "%2F");
return stringToEncode; return stringToEncode;
} }
#endif // USE_MQTT_AZURE_IOT
bool MqttIsConnected(void) { bool MqttIsConnected(void) {
return MqttClient.connected(); return MqttClient.connected();