A client for the SmartREST protocol from Cumulocity.

Dependencies:   SmartRest

Fork of MbedSmartRest by Vincent Wochnik

Revision:
14:dc3f8dd5c02b
Child:
15:0ce90c525e7a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPResponseFilter.h	Mon Apr 14 11:23:50 2014 +0000
@@ -0,0 +1,35 @@
+#ifndef HTTPRESPONSEFILTER_H
+#define HTTPRESPONSEFILTER_H
+
+#include <stddef.h>
+#include "AbstractDataSource.h"
+
+#define RESPF_STATE_INIT 0
+#define RESPF_STATE_READ_STATUS 1
+#define RESPF_STATE_READ_HEADERS 2
+
+/**
+ * Reads and evaluates a HTTP response.
+ * The read() and status() methods allow access to the response content
+ * without HTTP headers.
+ */
+class HTTPResponseFilter : public AbstractDataSource
+{
+public:
+    HTTPResponseFilter(AbstractDataSource& source);
+    ~HTTPResponseFilter();
+    
+    char read();
+    uint8_t status();
+
+    uint16_t readStatus();
+    bool skipHeaders();
+    
+    void reset();
+
+private:
+    AbstractDataSource& _source;
+    uint8_t _state;
+};
+
+#endif
\ No newline at end of file