Skip to content

Commit

Permalink
Fix Time and GSMClient integration issue in Core.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Dec 27, 2023
1 parent 6959462 commit 4a59009
Show file tree
Hide file tree
Showing 33 changed files with 35 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*
*/

/*░D░O░ ░N░O░T░ ░U░S░E░ ░T░H░I░S░ ░I░N░ ░P░R░O░D░U░T░I░O░N░*/

/** This example will show how to authenticate as a anonymous user.
*
* You need to enable Anonymous provider.
Expand Down Expand Up @@ -135,6 +137,8 @@ void setup()

Serial.print("Sign up new user... ");

/*░D░O░ ░N░O░T░ ░U░S░E░ ░T░H░I░S░ ░I░N░ ░P░R░O░D░U░T░I░O░N░*/

/* Sign up */
if (Firebase.signUp(&config, &auth, "", ""))
{
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 ESP8266 Client",
"version": "4.4.8",
"version": "4.4.10",
"keywords": "communication, REST, esp8266, arduino",
"description": "The secure, fast and reliable Firebase Realtime database library to read, store, update, delete, listen, backup, and restore data. You can also read and modify the database security rules with this library.",
"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 ESP8266 Client

version=4.4.8
version=4.4.10

author=Mobizt

Expand Down
4 changes: 0 additions & 4 deletions src/FB_Const.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Created September 14, 2023
Expand Down
4 changes: 0 additions & 4 deletions src/FB_Error.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Created September 5, 2023
Expand Down
4 changes: 0 additions & 4 deletions src/FB_Network.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Created September 14, 2023
Expand Down
4 changes: 0 additions & 4 deletions src/FB_Utils.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
*
Expand Down
4 changes: 0 additions & 4 deletions src/Firebase.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* The Firebase class, Firebase.cpp v1.2.8
Expand Down
3 changes: 0 additions & 3 deletions src/Firebase.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* The Firebase class, Firebase.h v1.2.8
Expand Down
5 changes: 3 additions & 2 deletions src/client/FB_TCP_Client.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Firebase TCP Client v1.0.2
* Firebase TCP Client v1.0.3
*
* Created September 14, 2023
* Created December 27, 2023
*
* The MIT License (MIT)
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -1007,6 +1007,7 @@ class Firebase_TCP_Client : public Client
timeinfo.tm_min = min3;
timeinfo.tm_sec = sec3;
time_t ts = mktime(&timeinfo);
ts -= timezone * 3600;
return ts;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/client/WiFiClientImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,13 @@ class WiFiClientImpl : public Client
}
else if (res < 0)
{
log_e("fail on fd %d, errno: %d, \"%s\"", _socket, errno, strerror(errno));
// log_e("fail on fd %d, errno: %d, \"%s\"", _socket, errno, strerror(errno));
if (errno != EAGAIN)
{
// if resource was busy, can try again, otherwise give up
res = 0;
retry = 0;
tcpClose();
}
}
else
Expand Down
13 changes: 7 additions & 6 deletions src/core/FirebaseCore.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Token Management class, FirebaseCore.cpp version 1.0.1
* Google's Firebase Token Management class, FirebaseCore.cpp version 1.0.2
*
* Created September 12, 2023
* Created December 27, 2023
*
* The MIT License (MIT)
* Copyright (c) 2023 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -691,12 +687,17 @@ void FirebaseCore::tokenProcessingTask()

if (_cli_type == firebase_client_type_external_gsm_client)
{
if (!tcpClient)
newClient(&tcpClient);

uint32_t _time = tcpClient->gprsGetTime();
if (_time > 0)
{
baseTs = _time;
setTimestamp(_time);
}

freeClient(&tcpClient);
}
else
{
Expand Down
8 changes: 2 additions & 6 deletions src/core/FirebaseCore.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Token Management class, FirebaseCore.h version 1.0.1
* Google's Firebase Token Management class, FirebaseCore.h version 1.0.2
*
* Created September 12, 2023
* Created December 27, 2023
*
* The MIT License (MIT)
* Copyright (c) 2023 K. Suwatchai (Mobizt)
Expand Down
7 changes: 3 additions & 4 deletions src/core/Firebase_Client_Version.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef FIREBASE_CLIENT_VERSION
#define FIREBASE_CLIENT_VERSION "4.4.8"
#define FIREBASE_CLIENT_VERSION_NUM 40408
#define FIREBASE_CLIENT_VERSION "4.4.10"
#define FIREBASE_CLIENT_VERSION_NUM 40410

/* The inconsistent file version checking to prevent mixed versions compilation. */
#define FIREBASE_CLIENT_VERSION_CHECK(ver) (ver == FIREBASE_CLIENT_VERSION_NUM)
#define FIREBASE_CLIENT_VERSION_CHECK(ver) (true)
#endif
6 changes: 3 additions & 3 deletions src/json/FirebaseJson.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* FirebaseJson, version 3.0.8
* FirebaseJson, version 3.0.9
*
* The Easiest Arduino library to parse, create and edit JSON object using a relative path.
*
* Created September 6, 2023
* Created November 17, 2023
*
* Features
* - Using path to access node element in search style e.g. json.get(result,"a/b/c")
Expand Down Expand Up @@ -166,7 +166,7 @@ extern "C"

#define Serial_Printf Serial.printf

#elif defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F4) || defined(__AVR__)
#elif defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F4) || defined(__AVR__)

#include "extras/print/fb_json_print.h"

Expand Down
14 changes: 9 additions & 5 deletions src/json/MB_String.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

/**
* Mobizt's SRAM/PSRAM supported String, version 1.2.9
* Mobizt's SRAM/PSRAM supported String, version 1.2.10
*
* Created December 3, 2022
* Created November 15, 2023
*
* Changes Log
*
*
* v1.2.10
* - add support Arduino UNO WiFi R4
*
* v1.2.9
* - substring optimization
*
Expand Down Expand Up @@ -900,15 +904,15 @@ class MB_String
s = boolStr(value);
else if (is_num_neg_int<T>::value)
{
#if defined(ARDUINO_ARCH_SAMD) || defined(__AVR_ATmega4809__) || defined(ARDUINO_NANO_RP2040_CONNECT)
#if defined(ARDUINO_ARCH_SAMD) || defined(__AVR_ATmega4809__) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_UNOWIFIR4)
s = int32Str(value);
#else
s = int64Str(value);
#endif
}
else if (is_num_pos_int<T>::value)
{
#if defined(ARDUINO_ARCH_SAMD) || defined(__AVR_ATmega4809__) || defined(ARDUINO_NANO_RP2040_CONNECT)
#if defined(ARDUINO_ARCH_SAMD) || defined(__AVR_ATmega4809__) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_UNOWIFIR4)
s = uint32Str(value);
#else
s = uint64Str(value);
Expand Down Expand Up @@ -1475,7 +1479,7 @@ class MB_String
static const size_t npos = -1;

private:
#if defined(ARDUINO_ARCH_SAMD) || defined(__AVR_ATmega4809__) || defined(ARDUINO_NANO_RP2040_CONNECT)
#if defined(ARDUINO_ARCH_SAMD) || defined(__AVR_ATmega4809__) || defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_UNOWIFIR4)

char *int32Str(signed long value)
{
Expand Down
4 changes: 0 additions & 4 deletions src/message/FCM.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Cloud Messaging class, FCM.cpp version 1.1.0
Expand Down
4 changes: 0 additions & 4 deletions src/message/FCM.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Cloud Messaging class, FCM.h version 1.1.0
Expand Down
5 changes: 0 additions & 5 deletions src/message/LFCM.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

#include <Arduino.h>
#include "./mbfs/MB_MCU.h"
#include "./FirebaseFS.h"
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/FB_RTDB.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Realtime Database class, FB_RTDB.cpp version 2.1.1
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/FB_RTDB.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Realtime Database class, FB_RTDB.h version 2.1.1
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/QueryFilter.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase QueryFilter class, QueryFilter.cpp version 1.0.7
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/QueryFilter.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase QueryFilter class, QueryFilter.h version 1.0.7
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/QueueInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase QueueInfo class, QueueInfo.cpp version 1.0.6
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/QueueInfo.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase QueueInfo class, QueueInfo.h version 1.0.6
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/QueueManager.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase QueueManager class, QueueManager.cpp version 1.0.5
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/QueueManager.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase QueueManager class, QueueManager.h version 1.0.5
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/stream/FB_MP_Stream.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase MultiPathStream class, FB_MP_Stream.cpp version 1.1.7
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/stream/FB_MP_Stream.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase MultiPathStream class, FB_MP_Stream.h version 1.1.7
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/stream/FB_Stream.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Stream class, FB_Stream.cpp version 1.1.8
Expand Down
4 changes: 0 additions & 4 deletions src/rtdb/stream/FB_Stream.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Stream class, FB_Stream.h version 1.1.8
Expand Down
4 changes: 0 additions & 4 deletions src/session/FB_Session.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Data class, FB_Session.cpp version 1.4.1
Expand Down
4 changes: 0 additions & 4 deletions src/session/FB_Session.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#include "./core/Firebase_Client_Version.h"
#if !FIREBASE_CLIENT_VERSION_CHECK(40408)
#error "Mixed versions compilation."
#endif

/**
* Google's Firebase Data class, FB_Session.h version 1.4.1
Expand Down

0 comments on commit 4a59009

Please sign in to comment.