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 23d99b6 commit 3ce86d5
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 @@ -393,6 +393,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, ESP_Signer_NetworkConnectionRequestCallback networkConnectionCB,
ESP_Signer_NetworkStatusRequestCallback networkStatusCB);
Expand All @@ -413,6 +415,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 @@ -179,6 +179,8 @@ void begin()
config.signer.tokens.scope = "https://www.googleapis.com/auth/spreadsheets,https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/drive.file";

/* Assign the pointer to global defined external 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.
Signer.setExternalClient(&eth, networkConnection, networkStatusRequestCallback);

Signer.begin(&config);
Expand Down
4 changes: 3 additions & 1 deletion examples/GSM/GSM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ void setup()
config.token_status_callback = tokenStatusCallback;

config.signer.tokens.scope = "https://www.googleapis.com/auth/spreadsheets,https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/drive.file";


// 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.
Signer.setGSMClient(&gsm_client, &modem, GSM_PIN, apn, gprsUser, gprsPass);

Signer.begin(&config);
Expand Down
6 changes: 6 additions & 0 deletions src/ESP_Signer.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class ESP_Signer
* @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_Signer_NetworkConnectionRequestCallback networkConnectionCB,
ESP_Signer_NetworkStatusRequestCallback networkStatusCB)
Expand All @@ -66,6 +69,9 @@ class ESP_Signer
* @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 3ce86d5

Please sign in to comment.