Skip to content

Commit b24696c

Browse files
committed
Update comments and Readme.
1 parent edbc9c1 commit b24696c

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,8 @@ param **`networkConnectionCB`** The function that handles the network connection
525525

526526
param **`networkStatusCB`** The function that handle the network connection status acknowledgement.
527527

528+
Due to the client pointer is assigned, to avoid dangling pointer, client should be existed as long as it was used for transportation.
529+
528530
```cpp
529531
void setExternalClient(Client *client, GS_NetworkConnectionRequestCallback networkConnectionCB,
530532
GS_NetworkStatusRequestCallback networkStatusCB);
@@ -545,6 +547,8 @@ param **`user`** The GPRS user.
545547
546548
param **`password`** The GPRS password.
547549
550+
Due to the client and modem pointers are assigned, to avoid dangling pointer, client should be existed as long as it was used for transportation.
551+
548552
```cpp
549553
void setGSMClient(Client *client, void *modem, const char *pin, const char *apn, const char *user, const char *password);
550554
```

examples/Ethernet/Pico/Pico.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ void setupGsheet()
151151
GSheet.setTokenCallback(tokenStatusCallback);
152152

153153
/* Assign the pointer to global defined external SSL Client object and required callback functions */
154+
// Due to the client (eth) pointer is assigned, to avoid dangling pointer,
155+
// client should be existed as long as it was used for transportation.
154156
GSheet.setExternalClient(&eth, networkConnection, networkStatusRequestCallback);
155157

156158
// Set the seconds to refresh the auth token before expire (60 to 3540, default is 300 seconds)

examples/GSM/GSM.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ void setup()
145145
DBG("Modem Info:", modemInfo);
146146

147147
GSheet.printf("ESP Google Sheet Client v%s\n\n", ESP_GOOGLE_SHEET_CLIENT_VERSION);
148-
148+
149+
// Due to the gsm_client and modem pointers are assigned, to avoid dangling pointer,
150+
// gsm_client and modem should be existed as long as it was used for transportation.
149151
GSheet.setGSMClient(&gsm_client, &modem, GSM_PIN, apn, gprsUser, gprsPass);
150152
}
151153

src/ESP_Google_Sheet_Client.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,9 @@ class ESP_Google_Sheet_Client
14681468
* @param client The pointer to Arduino Client derived class of SSL Client.
14691469
* @param networkConnectionCB The function that handles the network connection.
14701470
* @param networkStatusCB The function that handle the network connection status acknowledgement.
1471+
*
1472+
* Due to the client pointer is assigned, to avoid dangling pointer,
1473+
* client should be existed as long as it was used for transportation.
14711474
*/
14721475
void setExternalClient(Client *client, ESP_GOOGLE_SHEET_CLIENT_NetworkConnectionRequestCallback networkConnectionCB,
14731476
ESP_GOOGLE_SHEET_CLIENT_NetworkStatusRequestCallback networkStatusCB)
@@ -1483,6 +1486,9 @@ class ESP_Google_Sheet_Client
14831486
* @param apn The GPRS APN (Access Point Name).
14841487
* @param user The GPRS user.
14851488
* @param password The GPRS password.
1489+
*
1490+
* Due to the client and modem pointers are assigned, to avoid dangling pointer,
1491+
* client and modem should be existed as long as it was used for transportation.
14861492
*/
14871493
void setGSMClient(Client *client, void *modem = nullptr, const char *pin = nullptr, const char *apn = nullptr, const char *user = nullptr, const char *password = nullptr)
14881494
{

0 commit comments

Comments
 (0)