Skip to content

Commit

Permalink
Update comments and Readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Aug 26, 2023
1 parent edbc9c1 commit b24696c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ param **`networkConnectionCB`** The function that handles the network connection

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

Due to the client pointer is assigned, to avoid dangling pointer, client should be existed as long as it was used for transportation.

```cpp
void setExternalClient(Client *client, GS_NetworkConnectionRequestCallback networkConnectionCB,
GS_NetworkStatusRequestCallback networkStatusCB);
Expand All @@ -545,6 +547,8 @@ param **`user`** The GPRS user.
param **`password`** The GPRS password.
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.
```cpp
void setGSMClient(Client *client, void *modem, const char *pin, const char *apn, const char *user, const char *password);
```
Expand Down
2 changes: 2 additions & 0 deletions examples/Ethernet/Pico/Pico.ino
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ void setupGsheet()
GSheet.setTokenCallback(tokenStatusCallback);

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

// Set the seconds to refresh the auth token before expire (60 to 3540, default is 300 seconds)
Expand Down
4 changes: 3 additions & 1 deletion examples/GSM/GSM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ void setup()
DBG("Modem Info:", modemInfo);

GSheet.printf("ESP Google Sheet Client v%s\n\n", ESP_GOOGLE_SHEET_CLIENT_VERSION);


// Due to the gsm_client and modem pointers are assigned, to avoid dangling pointer,
// gsm_client and modem should be existed as long as it was used for transportation.
GSheet.setGSMClient(&gsm_client, &modem, GSM_PIN, apn, gprsUser, gprsPass);
}

Expand Down
6 changes: 6 additions & 0 deletions src/ESP_Google_Sheet_Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,9 @@ class ESP_Google_Sheet_Client
* @param client The pointer to Arduino Client derived class of SSL Client.
* @param networkConnectionCB The function that handles the network connection.
* @param networkStatusCB The function that handle the network connection status acknowledgement.
*
* Due to the client pointer is assigned, to avoid dangling pointer,
* client should be existed as long as it was used for transportation.
*/
void setExternalClient(Client *client, ESP_GOOGLE_SHEET_CLIENT_NetworkConnectionRequestCallback networkConnectionCB,
ESP_GOOGLE_SHEET_CLIENT_NetworkStatusRequestCallback networkStatusCB)
Expand All @@ -1483,6 +1486,9 @@ class ESP_Google_Sheet_Client
* @param apn The GPRS APN (Access Point Name).
* @param user The GPRS user.
* @param password The GPRS password.
*
* Due to the client and modem pointers are assigned, to avoid dangling pointer,
* client and modem should be existed as long as it was used for transportation.
*/
void setGSMClient(Client *client, void *modem = nullptr, const char *pin = nullptr, const char *apn = nullptr, const char *user = nullptr, const char *password = nullptr)
{
Expand Down

0 comments on commit b24696c

Please sign in to comment.