forked fromzephyrproject-rtos/arduino-core-zephyr
Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34
libraries/SocketWrapper: Fix agrs and improve error handling.#238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
2 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
41 changes: 24 additions & 17 deletionslibraries/SocketWrapper/SocketWrapper.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionslibraries/SocketWrapper/ZephyrClient.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlibraries/SocketWrapper/ZephyrSSLClient.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletionslibraries/WiFi/examples/WiFiWebClientTLS/WiFiWebClientTLS.ino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| /* | ||
| Web client with single CA certificate test | ||
| This sketch demonstrates how to load your own TLS CA certificates | ||
| and use them to establish a secure connection to a remote server, | ||
| such as www.howsmyssl.com. | ||
| */ | ||
| #include <WiFi.h> | ||
| #include <ZephyrSSLClient.h> | ||
| #include "arduino_secrets.h" | ||
| char ssid[] = SECRET_SSID; | ||
| char pass[] = SECRET_PASS; | ||
| char server[] = "www.howsmyssl.com"; | ||
| int port = 443; | ||
| ZephyrSSLClient client; | ||
| int status = WL_IDLE_STATUS; | ||
| // ISRG Root X1 (Let's Encrypt root CA certificate) | ||
| const char isrg_root_x1[] = | ||
| "-----BEGIN CERTIFICATE-----\n" | ||
| "MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw\n" | ||
| "TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh\n" | ||
| "cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4\n" | ||
| "WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu\n" | ||
| "ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY\n" | ||
| "MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc\n" | ||
| "h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+\n" | ||
| "0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U\n" | ||
| "A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW\n" | ||
| "T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH\n" | ||
| "B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC\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psMljq4Ui0/1lvh+wjChP4kqKOJ2qxq\n" | ||
| "4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA\n" | ||
| "mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d\n" | ||
| "emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=\n" | ||
| "-----END CERTIFICATE-----\n"; | ||
| void setup() { | ||
| Serial.begin(115200); | ||
| while (!Serial) { | ||
| ; | ||
| } | ||
| // Check for WiFi module | ||
| if (WiFi.status() == WL_NO_SHIELD) { | ||
| Serial.println("Communication with WiFi module failed!"); | ||
| return; | ||
| } | ||
| // Connect to WiFi | ||
| while (status != WL_CONNECTED) { | ||
| Serial.print("Attempting to connect to SSID: "); | ||
| Serial.println(ssid); | ||
| status = WiFi.begin(ssid, pass); | ||
| delay(3000); | ||
| } | ||
| Serial.println("Connected to wifi"); | ||
| Serial.print("IP Address: "); | ||
| Serial.println(WiFi.localIP()); | ||
| Serial.print("RSSI: "); | ||
| Serial.println(WiFi.RSSI()); | ||
| Serial.println("\nStarting connection to server..."); | ||
| if (client.connect(server, port, isrg_root_x1)) { | ||
| Serial.println("Connected to server!"); | ||
| // Make HTTP request | ||
| client.println("GET /a/check HTTP/1.1"); | ||
| client.print("Host: "); | ||
| client.println(server); | ||
| client.println("Connection: close"); | ||
| client.println(); | ||
| } else { | ||
| Serial.println("Connection failed!"); | ||
| } | ||
| } | ||
| void loop() { | ||
| // if there are incoming bytes available | ||
| // from the server, read them and print them: | ||
| while (client.available()) { | ||
| char c = client.read(); | ||
| Serial.write(c); | ||
| } | ||
| // if the server's disconnected, stop the client: | ||
| if (!client.connected()) { | ||
| Serial.println(); | ||
| Serial.println("disconnecting from server."); | ||
| client.stop(); | ||
| // do nothing forevermore: | ||
| while (true) | ||
| ; | ||
| } | ||
| } |
2 changes: 2 additions & 0 deletionslibraries/WiFi/examples/WiFiWebClientTLS/arduino_secrets.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #define SECRET_SSID "" | ||
| #define SECRET_PASS "" |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.