Official reference client implementation for Cumulocity SmartREST on u-blox C027.
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Revision 3:32834ef7cb56, committed 2014-01-30
- Comitter:
- vwochnik
- Date:
- Thu Jan 30 11:47:29 2014 +0000
- Parent:
- 2:50013e2c3eb7
- Child:
- 4:363b4cc49445
- Commit message:
- fix
Changed in this revision
MbedSmartRest.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MbedSmartRest.lib Thu Jan 30 11:11:50 2014 +0000 +++ b/MbedSmartRest.lib Thu Jan 30 11:47:29 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/vwochnik/code/MbedSmartRest/#ab909221d22d +http://mbed.org/users/vwochnik/code/MbedSmartRest/#71e0439d9af7
--- a/main.cpp Thu Jan 30 11:11:50 2014 +0000 +++ b/main.cpp Thu Jan 30 11:47:29 2014 +0000 @@ -14,16 +14,23 @@ HTTPClient http; char str[512]; - int ret = modem.connect("internet"); // eventaully set another apn here + int ret = modem.connect("public4.m2minternet.com"); // eventaully set another apn here if(ret) { printf("Could not connect %d\n", ret); return; } + http.basicAuth("vaillant/admin", "klanpi"); + + char *hkey = "X-Id";char *hval = "com_test_device"; + char *harr[] = {hkey, hval}; + + http.customHeaders(harr, 1); + //GET data printf("Trying to fetch page...\n"); - ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128); + ret = http.get("http://nocore.info:8888", str, 128); if (!ret) { printf("Page fetched successfully - read %d characters\n", strlen(str)); printf("Result: %s\n", str); @@ -37,7 +44,7 @@ map.put("Hello", "World"); map.put("test", "1234"); printf("Trying to post data...\n"); - ret = http.post("http://httpbin.org/post", map, &text); + ret = http.post("http://nocore.info:8888", map, &text); if (!ret) { printf("Executed POST successfully - read %d characters\n", strlen(str)); printf("Result: %s\n", str);