Skip to content

Commit

Permalink
Fix compilation error.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Nov 15, 2022
1 parent e294095 commit 5d10506
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 68 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ The flash and SD filesystems supports depend on the devices and third party file

This library required **ESP8266 or ESP32 Core SDK**.

ESP8266 Core SDK v2.5.0 and older versions are not supported.

For Arduino IDE, ESP8266 Core SDK can be installed through **Boards Manager**.

For PlatfoemIO IDE, ESP8266 Core SDK can be installed through **PIO Home** > **Platforms** > **Espressif 8266 or Espressif 32**.
Expand Down
3 changes: 2 additions & 1 deletion examples/ExternalClient/RTDB/Ethernet/ESP32/Basic/Basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
// Provide the RTDB payload printing info and other helper functions.
#include <addons/RTDBHelper.h>

//https://github.com/arduino-libraries/Ethernet
#include <Ethernet.h>

// Include built-in SSL Client which supports other network interfaces
Expand Down Expand Up @@ -165,7 +166,7 @@ void setup()

Serial_Printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);

/* Assign the basic Client (Ethernet) pointer to the SSL Client */
/* Assign the basic Client (Ethernet) pointer to the basic Client */
ssl_client.setClient(&basic_client);

/* Similar to WiFiClientSecure */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// Provide the RTDB payload printing info and other helper functions.
#include <addons/RTDBHelper.h>

//https://github.com/arduino-libraries/Ethernet
#include <Ethernet.h>

// Include built-in SSL Client which supports other network interfaces
Expand Down Expand Up @@ -225,13 +226,13 @@ void setup()

Serial_Printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);

/* Assign the basic Client (Ethernet) pointer to the SSL Client */
/* Assign the basic Client (Ethernet) pointer to the basic Client */
ssl_client1.setClient(&basic_client1);

/* Similar to WiFiClientSecure */
ssl_client1.setInsecure();

/* Assign the basic Client (Ethernet) pointer to the SSL Client */
/* Assign the basic Client (Ethernet) pointer to the basic Client */
ssl_client2.setClient(&basic_client2);

/* Similar to WiFiClientSecure */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void setup()

Serial_Printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);

/* Assign the basic Client (Ethernet) pointer to the SSL Client */
/* Assign the basic Client (Ethernet) pointer to the basic Client */
ssl_client.setClient(&basic_client);

/* Similar to WiFiClientSecure */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void setup()

Serial_Printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);

/* Assign the basic Client (Ethernet) pointer to the SSL Client */
/* Assign the basic Client (Ethernet) pointer to the basic Client */
ssl_client1.setClient(&basic_client1);

/* Similar to WiFiClientSecure */
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Firebase Arduino Client Library for ESP8266 and ESP32",
"version": "4.2.6",
"version": "4.2.7",
"keywords": "communication, REST, esp32, esp8266, arduino",
"description": "The library supports Firebase products e.g. Realtime database, Cloud Firestore database, Firebase Storage and Google Cloud Storage, Cloud Functions for Firebase and Cloud Messaging. The library also supported other Arduino devices using Clients interfaces e.g. WiFiClient, EthernetClient, and GSMClient.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=Firebase Arduino Client Library for ESP8266 and ESP32

version=4.2.6
version=4.2.7

author=Mobizt

Expand Down
11 changes: 10 additions & 1 deletion src/FB_Const.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* Created November 9, 2022
* Created November 15, 2022
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -58,6 +58,15 @@
#define OTA_UPDATE_ENABLED
#endif

#if defined(ESP32)
#if defined(ESP_ARDUINO_VERSION)
#if ESP_ARDUINO_VERSION > ESP_ARDUINO_VERSION_VAL(2, 0, 1)
#define ESP32_GT_2_0_1_FS_MEMORY_FIX
#endif
#endif
#endif


#if defined(FIREBASE_ESP_CLIENT)
#define FIREBASE_STREAM_CLASS FirebaseStream
#define FIREBASE_MP_STREAM_CLASS MultiPathStream
Expand Down
6 changes: 3 additions & 3 deletions src/Firebase_ESP_Client.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#ifndef FIREBASE_CLIENT_VERSION
#define FIREBASE_CLIENT_VERSION "4.2.6"
#define FIREBASE_CLIENT_VERSION "4.2.7"
#endif

/**
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h v4.2.6
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h v4.2.7
*
* This library supports Espressif ESP8266 and ESP32 MCUs
*
* Created November 11, 2022
*
* Updates:
* - Remove unused file 'MB_File.h'.
* - Fix compilation error.
*
*
* This work is a part of Firebase ESP Client library
Expand Down
25 changes: 7 additions & 18 deletions src/gcs/GCS.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Google's Cloud Storage class, GCS.cpp version 1.2.1
* Google's Cloud Storage class, GCS.cpp version 1.2.2
*
* This library supports Espressif ESP8266 and ESP32
*
* Created November 10, 2022
* Created November 15, 2022
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -1671,20 +1671,11 @@ bool GG_CloudStorage::handleResponse(FirebaseData *fbdo, struct fb_esp_gcs_req_t
if (req->requestType == fb_esp_gcs_request_type_download && strlen(ut->mbfs->name(mbfs_type req->storageType)) == 0)
{

#if defined(ESP32)
#if defined(ESP_ARDUINO_VERSION) && ESP_ARDUINO_VERSION > ESP_ARDUINO_VERSION_VAL(2, 0, 1)
#if defined(ESP32_GT_2_0_1_FS_MEMORY_FIX)
// Fix issue in ESP32 core v2.0.x filesystems
// We can't open file (flash or sd) to write here because of truncated result, only append is success.
// We have to remove existing file
ut->mbfs->remove(req->localFileName, mbfs_type req->storageType);
#else
int ret = ut->mbfs->open(req->localFileName, mbfs_type req->storageType, mb_fs_open_mode_write);
if (ret < 0)
{
fbdo->session.response.code = ret;
return false;
}
#endif
#else
int ret = ut->mbfs->open(req->localFileName, mbfs_type req->storageType, mb_fs_open_mode_write);
if (ret < 0)
Expand Down Expand Up @@ -1941,8 +1932,8 @@ bool GG_CloudStorage::handleResponse(FirebaseData *fbdo, struct fb_esp_gcs_req_t
{
if (error.code == 0)
{
#if defined(ESP32)
#if defined(ESP_ARDUINO_VERSION) && ESP_ARDUINO_VERSION > ESP_ARDUINO_VERSION_VAL(2, 0, 1)

#if defined(ESP32_GT_2_0_1_FS_MEMORY_FIX)
// We open file to append here
int ret = ut->mbfs->open(req->localFileName, mbfs_type req->storageType, mb_fs_open_mode_append);

Expand All @@ -1952,16 +1943,14 @@ bool GG_CloudStorage::handleResponse(FirebaseData *fbdo, struct fb_esp_gcs_req_t
fbdo->session.response.code = ret;
return false;
}
#endif
#endif
if (ut->mbfs->write(mbfs_type req->storageType, buf, read) != (int)read)
error.code = MB_FS_ERROR_FILE_IO_ERROR;

#if defined(ESP32)
#if defined(ESP_ARDUINO_VERSION) && ESP_ARDUINO_VERSION > ESP_ARDUINO_VERSION_VAL(2, 0, 1)

#if defined(ESP32_GT_2_0_1_FS_MEMORY_FIX)
// We close file here after append
ut->mbfs->close(mbfs_type req->storageType);
#endif
#endif
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/gcs/GCS.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Google's Cloud Storage class, GCS.h version 1.2.1
* Google's Cloud Storage class, GCS.h version 1.2.2
*
* This library supports Espressif ESP8266 and ESP32
*
* Created November 10, 2022
* Created November 15, 2022
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down
6 changes: 2 additions & 4 deletions src/sslclient/esp32/MB_ESP32_SSLClient.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The Mobizt ESP32 SSL Client Class, MB_ESP32_SSLClient.cpp v1.0.1
* The Mobizt ESP32 SSL Client Class, MB_ESP32_SSLClient.cpp v1.0.2
*
* Created November 8, 2022
* Created November 15, 2022
*
* The MIT License (MIT)
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -103,8 +103,6 @@ void MB_ESP32_SSLClient::stop()
if (!_ssl->basic_client)
return;

_host.clear();

stop_tcp_connection(_ssl, _CA_cert, _cert, _private_key);

if (_ssl->basic_client)
Expand Down
4 changes: 2 additions & 2 deletions src/sslclient/esp32/MB_ESP32_SSLClient.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The Mobizt ESP32 SSL Client Class, MB_ESP32_SSLClient.h v1.0.1
* The Mobizt ESP32 SSL Client Class, MB_ESP32_SSLClient.h v1.0.2
*
* Created November 8, 2022
* Created November 15, 2022
*
* The MIT License (MIT)
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down
5 changes: 2 additions & 3 deletions src/sslclient/esp8266/MB_ESP8266_SSLClient.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
*
* The Mobizt ESP8266 SSL Client Class, MB_ESP8266_SSLClient.cpp v1.0.0
* The Mobizt ESP8266 SSL Client Class, MB_ESP8266_SSLClient.cpp v1.0.1
*
* Created November 2, 2022
* Created November 15, 2022
*
* The MIT License (MIT)
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -120,7 +120,6 @@ void MB_ESP8266_SSLClient::setTimeout(unsigned long timeout)

void MB_ESP8266_SSLClient::stop()
{
_host.clear();
WCS_CLASS::stop();
}

Expand Down
9 changes: 3 additions & 6 deletions src/sslclient/esp8266/MB_ESP8266_SSLClient.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
*
* The Mobizt ESP8266 SSL Client Class, MB_ESP8266_SSLClient.h v1.0.0
* The Mobizt ESP8266 SSL Client Class, MB_ESP8266_SSLClient.h v1.0.1
*
* Created November 2, 2022
* Created November 15, 2022
*
* The MIT License (MIT)
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -33,12 +33,9 @@

#include <vector>
#include <WiFiClient.h>

#include "MB_BearSSL.h"

#if defined(ESP8266)
#include <StackThunk.h>
#endif


#include "ESP8266_SSL_Client.h"

Expand Down
25 changes: 5 additions & 20 deletions src/storage/FCS.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Google's Firebase Storage class, FCS.cpp version 1.2.1
* Google's Firebase Storage class, FCS.cpp version 1.2.2
*
* This library supports Espressif ESP8266 and ESP32
*
* Created November 10, 2022
* Created November 15, 2022
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2021 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -694,8 +694,7 @@ bool FB_Storage::handleResponse(FirebaseData *fbdo, struct fb_esp_fcs_req_t *req

if (req->requestType == fb_esp_fcs_request_type_download)
{
#if defined(ESP32)
#if defined(ESP_ARDUINO_VERSION) && ESP_ARDUINO_VERSION > ESP_ARDUINO_VERSION_VAL(2, 0, 1)
#if defined(ESP32_GT_2_0_1_FS_MEMORY_FIX)
// Fix issue in ESP32 core v2.0.x filesystems
// We can't open file (flash or sd) to write here because of truncated result, only append is success.
// We have to remove existing file
Expand All @@ -710,16 +709,6 @@ bool FB_Storage::handleResponse(FirebaseData *fbdo, struct fb_esp_fcs_req_t *req
return false;
}
#endif
#else
int ret = ut->mbfs->open(req->localFileName, mbfs_type req->storageType, mb_fs_open_mode_write);

if (ret < 0)
{
fbdo->tcpClient.flush();
fbdo->session.response.code = ret;
return false;
}
#endif
}

if (chunkBufSize > 1)
Expand Down Expand Up @@ -889,8 +878,7 @@ bool FB_Storage::handleResponse(FirebaseData *fbdo, struct fb_esp_fcs_req_t *req

if (error.code == 0)
{
#if defined(ESP32)
#if defined(ESP_ARDUINO_VERSION) && ESP_ARDUINO_VERSION > ESP_ARDUINO_VERSION_VAL(2, 0, 1)
#if defined(ESP32_GT_2_0_1_FS_MEMORY_FIX)
// We open file to append here
int ret = ut->mbfs->open(req->localFileName, mbfs_type req->storageType, mb_fs_open_mode_append);

Expand All @@ -900,17 +888,14 @@ bool FB_Storage::handleResponse(FirebaseData *fbdo, struct fb_esp_fcs_req_t *req
fbdo->session.response.code = ret;
return false;
}
#endif
#endif

if (ut->mbfs->write(mbfs_type req->storageType, buf, read) != (int)read)
error.code = MB_FS_ERROR_FILE_IO_ERROR;

#if defined(ESP32)
#if defined(ESP_ARDUINO_VERSION) && ESP_ARDUINO_VERSION > ESP_ARDUINO_VERSION_VAL(2, 0, 1)
#if defined(ESP32_GT_2_0_1_FS_MEMORY_FIX)
// We close file here after append
ut->mbfs->close(mbfs_type req->storageType);
#endif
#endif
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/storage/FCS.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Google's Firebase Storage class, FCS.h version 1.2.1
* Google's Firebase Storage class, FCS.h version 1.2.2
*
* This library supports Espressif ESP8266 and ESP32
*
* Created November 10, 2022
* Created November 15, 2022
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down

0 comments on commit 5d10506

Please sign in to comment.