Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed HTTPClient X_NUCLEO_IDW01M1v2 NetworkSocketAPI
Revision 8:1b5c28fe5e94, committed 2016-11-17
- Comitter:
- mapellil
- Date:
- Thu Nov 17 14:10:21 2016 +0000
- Parent:
- 7:c6414658b701
- Child:
- 9:b54448c7f712
- Commit message:
- Added NSAPITests lib for a more extensive test
Changed in this revision
--- a/HTTPClient.lib Tue Nov 08 17:37:49 2016 +0000 +++ b/HTTPClient.lib Thu Nov 17 14:10:21 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/mapellil/code/HTTPClient/#bbbfaf4cc055 +https://developer.mbed.org/users/mapellil/code/HTTPClient/#ae30428dc030
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NSAPITests.lib Thu Nov 17 14:10:21 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/mapellil/code/NSAPITests/#950327f445a3
--- a/X_NUCLEO_IDW01M1v2.lib Tue Nov 08 17:37:49 2016 +0000 +++ b/X_NUCLEO_IDW01M1v2.lib Thu Nov 17 14:10:21 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/mapellil/code/X_NUCLEO_IDW01M1v2/#c070a1949422 +https://developer.mbed.org/users/mapellil/code/X_NUCLEO_IDW01M1v2/#ecec238129a0
--- a/main.cpp Tue Nov 08 17:37:49 2016 +0000
+++ b/main.cpp Thu Nov 17 14:10:21 2016 +0000
@@ -1,3 +1,54 @@
+
+//#define TESTV2
+#ifdef TESTV2
+
+#include "mbed.h"
+#include "SpwfInterface.h"
+#include "NSAPITests.h"
+
+//------------------------------------
+// Hyperterminal configuration
+// 9600 bauds, 8-bit data, no parity
+//------------------------------------
+
+Serial pc(USBTX, USBRX);
+DigitalOut myled(LED1);
+SpwfSAInterface spwf(D8, D2, false);
+
+int main()
+{
+ int32_t err;
+// char * ssid = "STM";
+// char * seckey = "STMdemoPWD";
+ char * ssid = "crespan";
+ char * seckey = "Elfrontal1";
+
+
+ pc.printf("\r\nSpwf Interface NSAPI Tests\r\n");
+ pc.printf("\r\nconnecting to AP\r\n");
+
+ err = spwf.connect(ssid, seckey, NSAPI_SECURITY_WPA);
+
+ if (!err) {
+ printf("Interface failed to connect with code %d\r\n", err);
+ } else {
+ do {
+
+ nsapi_tests("SPWF Tests", &spwf, "192.168.1.19", 32001);
+
+ } while (1);
+ spwf.disconnect();
+ }
+
+ while(1)
+ {
+ wait(1);
+ myled = !myled;
+ }
+}
+
+#else
+
#include "mbed.h"
//#include "EthernetInterface.h"
#include "TCPSocket.h"
@@ -14,11 +65,10 @@
int main()
{
#ifdef LICIO
- SpwfSAInterface spwf(D8, D2, false);
+ SpwfSAInterface spwf(D8, D2, false);
+ spwf.connect("crespan","Elfrontal1", NSAPI_SECURITY_WPA2);
- HTTPWiFi ipstack(spwf, "crespan","Elfrontal1", NSAPI_SECURITY_WPA2);
-
-HTTPClient http(ipstack);
+ HTTPClient http(spwf);
#else
eth.init(); //Use DHCP
eth.connect();
@@ -38,7 +88,7 @@
{
printf("Error - ret = %d - HTTP return code = %d\n\r", ret, http.getHTTPResponseCode());
}
-
+
//POST data
HTTPMap map;
HTTPText inText(str, 512);
@@ -92,3 +142,4 @@
while(1) {
}
}
+#endif
\ No newline at end of file