A client for the SmartREST protocol from Cumulocity.

Dependencies:   SmartRest

Fork of MbedSmartRest by Vincent Wochnik

Files at this revision

API Documentation at this revision

Comitter:
vwochnik
Date:
Wed Feb 05 16:21:46 2014 +0000
Parent:
9:3bbb83e7cbfd
Child:
11:844856ab160d
Commit message:
fix

Changed in this revision

HTTPBuffer.h Show annotated file Show diff for this revision Revisions of this file
HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
HTTPGeneratorWrapper.cpp Show annotated file Show diff for this revision Revisions of this file
MbedClient.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/HTTPBuffer.h	Sun Feb 02 16:40:14 2014 +0000
+++ b/HTTPBuffer.h	Wed Feb 05 16:21:46 2014 +0000
@@ -26,7 +26,8 @@
     void setDataLen(size_t len);
     void bufferSize(size_t length);
 
-private:
+//private:
+public:
     // buffer, write and read pointers
     char *_buf, *_wptr, *_rptr;
     size_t _len;
--- a/HTTPClient.lib	Sun Feb 02 16:40:14 2014 +0000
+++ b/HTTPClient.lib	Wed Feb 05 16:21:46 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/vwochnik/code/HTTPClient/#967c00d70d95
+http://mbed.org/users/vwochnik/code/HTTPClient/#9386b15b0820
--- a/HTTPGeneratorWrapper.cpp	Sun Feb 02 16:40:14 2014 +0000
+++ b/HTTPGeneratorWrapper.cpp	Wed Feb 05 16:21:46 2014 +0000
@@ -8,6 +8,13 @@
     generator.writeTo(_sink);
     _len = _sink.length();
     _pos = 0;
+    
+    char *p = (char*)_sink.buffer();
+    size_t i = 0;
+    while (i < _len) {
+        putchar(*p++);
+        i++;
+    }
 }
 
 void HTTPGeneratorWrapper::readReset()
--- a/MbedClient.cpp	Sun Feb 02 16:40:14 2014 +0000
+++ b/MbedClient.cpp	Wed Feb 05 16:21:46 2014 +0000
@@ -70,11 +70,12 @@
 
     if (_state != STATE_REQ_COMPLETE)
         return CLIENT_INTERNAL_ERROR;
-    puts("Sending data...");
     result = _client.post(_url, *_generator, &_buffer);
-    printf("Result: %d\r\n", result);
     if (result != 0)
         return CLIENT_CONNECTION_ERROR;
+    char *p = _buffer._buf;
+    while (p != _buffer._wptr)
+        putchar(*p++);
     _state = STATE_RECVD_RESPONSE;
     return CLIENT_OK;
 }