mbed.org implementation of the abstract SmartREST library for the Cumulocity Platform SmartREST protocol.

Dependents:   MbedSmartRestMain MbedSmartRestMain

Revision:
5:2b74510900da
Parent:
4:059b8b90e0d9
Child:
6:cd7ba1ddb664
--- a/SmartRest.h	Wed Jul 09 15:37:19 2014 +0200
+++ b/SmartRest.h	Thu Jul 10 16:20:31 2014 +0200
@@ -41,6 +41,7 @@
 #include "AbstractClient.h"
 #include "ParsedRecord.h"
 #include "Parser.h"
+#include "Aggregator.h"
 
 /** Return value indicating that no error occurred. */
 #define SMARTREST_SUCCESS 0
@@ -104,6 +105,22 @@
 
     uint8_t setAuthorization(const char*, const char*);
 
+#ifdef SMARTREST_TRANSACTIONAL
+    uint8_t request(const DataGenerator&, const char* = NULL);
+    uint8_t request(const DataGenerator&, Aggregator&, const char* = NULL);
+#endif
+
+    /*
+     * Initiates the SmartRest bootstrap process.
+     * When successful, the template identifier will be replaced by the
+     * global managed object ID in future requests.
+     * @param generator the generator which will generate the data to be
+     *                  sent as a template.
+     * @return a non-zero value if and only if an error occured
+     */
+    uint8_t bootstrap(const DataGenerator&);
+
+#ifndef SMARTREST_TRANSACTIONAL
     /**
      * Sends a smart request.
      * @param generator the generator which will generate the data to be
@@ -114,7 +131,7 @@
      *                           specified, no identifier is sent at all.
      * @return a non-zero value if and only if an error occured
      */
-    uint8_t send(const DataGenerator& generator, const char *overrideIdentifier=NULL);
+    uint8_t send(const DataGenerator&, const char* = NULL);
 
     /**
      * Tries to receive a parsed response row.
@@ -126,21 +143,17 @@
     uint8_t receive(ParsedRecord&);
 
     /*
-     * Initiates the SmartRest bootstrap process.
-     * When successful, the template identifier will be replaced by the
-     * global managed object ID in future requests.
-     * @param generator the generator which will generate the data to be
-     *                  sent as a template.
-     * @return a non-zero value if and only if an error occured
-     */
-    uint8_t bootstrap(const DataGenerator&);
-
-    /*
      * Closes the connection.
      */
     void stop();
+#endif
 
 protected:
+#ifdef SMARTREST_TRANSACTIONAL
+    uint8_t send(const DataGenerator&, const char*);
+    uint8_t receive(ParsedRecord&);
+    void stop();
+#endif
     uint8_t beginRequest(const char*);
     uint8_t awaitResponse();
     bool setMoGid(ParsedRecord&);