[IoTivity Simulator] Handling resource interfaces.
[platform/upstream/iotivity.git] / service / simulator / src / common / simulator_utils.h
index 23dd47f..231078d 100644 (file)
@@ -34,7 +34,7 @@
 #include <map>
 
 /**
- * Utilities for Invokation of OC platfrom level APIs.
+ * Utilities for Invocation of OC platfrom level APIs.
  */
 template <typename FnT, typename... ArgsT>
 typename std::enable_if<std::is_same<OCStackResult, decltype(std::declval<FnT>()(std::declval<ArgsT>()...))>::value>::type
@@ -58,12 +58,29 @@ invokeocplatform(FnT fn, ArgsT &&...args)
 
 namespace OC
 {
+    // Read-Only interface
+    const std::string READ_INTERFACE = "oic.if.r";
+
+    // Read-Write Interface
+    const std::string READWRITE_INTERFACE = "oic.if.rw";
+
+    // Actuator Interface
+    const std::string ACTUATOR_INTERFACE = "oic.if.a";
+
+    // Sensor Interface
+    const std::string SENSOR_INTERFACE = "oic.if.s";
+
     class OCRepresentation;
 }
 
 std::string getPayloadString(const OC::OCRepresentation &);
+std::string getPayloadTypeString(OCPayloadType type);
 std::string getRequestString(const std::map<std::string, std::string> &queryParams,
                              const OC::OCRepresentation &rep);
 std::string getRequestString(const std::map<std::string, std::string> &queryParams);
 
+
+#define VALIDATE_INPUT(CONDITION, MSG) if (CONDITION) {throw InvalidArgsException(SIMULATOR_INVALID_PARAM, MSG);}
+#define VALIDATE_CALLBACK(CALLBACK) if (!CALLBACK){throw InvalidArgsException(SIMULATOR_INVALID_CALLBACK, "Invalid callback!");}
+
 #endif
\ No newline at end of file