Fix for the update interval issue in attribute update automation.
authorG S Senthil Kumar <senthil.gs@samsung.com>
Mon, 12 Oct 2015 18:13:35 +0000 (23:43 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Tue, 13 Oct 2015 04:18:40 +0000 (04:18 +0000)
Taking the update interval from UI and performing attribute update
automations.

Change-Id: I5501c745b8b02f1338379e3a886d3ef31710c05a
Signed-off-by: G S Senthil Kumar <senthil.gs@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3837
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
27 files changed:
service/simulator/examples/server/service_provider.cpp
service/simulator/inc/simulator_resource_model.h
service/simulator/inc/simulator_resource_server.h
service/simulator/java/eclipse-plugin/ClientControllerPlugin/META-INF/MANIFEST.MF
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/manager/ResourceManager.java
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/view/dialogs/FindResourcePage.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/manager/ImageManager.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/manager/ResourceManager.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/utils/Constants.java
service/simulator/java/eclipse-plugin/ServiceProviderPlugin/src/oic/simulator/serviceprovider/view/dialogs/DeleteResourcePage.java
service/simulator/java/jni/resource_attributes_jni.cpp
service/simulator/java/jni/simulator_common_jni.h
service/simulator/java/jni/simulator_manager_jni.cpp
service/simulator/java/jni/simulator_resource_server_jni.cpp
service/simulator/java/jni/simulator_resource_server_jni.h
service/simulator/java/sdk/src/org/oic/simulator/serviceprovider/SimulatorResourceServer.java
service/simulator/ramlparser/raml/jsonSchemaParser/Definitions.h
service/simulator/ramlparser/raml/jsonSchemaParser/Items.h
service/simulator/src/client-controller/attribute_generator.cpp
service/simulator/src/client-controller/attribute_generator.h
service/simulator/src/client-controller/put_request_generator.cpp
service/simulator/src/client-controller/simulator_remote_resource_impl.cpp
service/simulator/src/common/simulator_resource_model.cpp
service/simulator/src/service-provider/resource_update_automation.cpp
service/simulator/src/service-provider/resource_update_automation.h
service/simulator/src/service-provider/simulator_resource_server_impl.cpp
service/simulator/src/service-provider/simulator_resource_server_impl.h

index 28512a8..3cb3c13 100644 (file)
@@ -26,7 +26,7 @@ class AppLogger : public ILogger
         void write(std::string time, ILogger::Level level, std::string message)
         {
             std::cout << "[APPLogger] " << time << " " << ILogger::getString(level) << " "
-                      << message;
+                    << message;
         }
 };
 std::shared_ptr<AppLogger> gAppLogger(new AppLogger());
@@ -34,7 +34,7 @@ std::shared_ptr<AppLogger> gAppLogger(new AppLogger());
 class SimLightResource
 {
     public:
-        void startTest(std::string &configPath)
+        void startTest()
         {
             printMenu();
             bool cont = true;
@@ -50,19 +50,9 @@ class SimLightResource
 
                 switch (choice)
                 {
-                    case 1 : simulateResource(configPath); break;
+                    case 1 : simulateResource(); break;
                     case 2 : displayResource(); break;
-                    case 3 :
-                        try
-                        {
-                            deleteResource();
-                        }
-                        catch (InvalidArgsException &e)
-                        {
-                            std::cout << "InvalidArgsException occured [code : " << e.code() <<
-                                      " Detail: " << e.what() << "]" << std::endl;
-                        }
-                        break;
+                    case 3 : deleteResource(); break;
                     case 4 : updateAttributePower(); break;
                     case 5 : updateAttributeIntensity(); break;
                     case 6 : automateResourceUpdate(); break;
@@ -124,17 +114,17 @@ class SimLightResource
                                     const SimulatorResourceModel &resModel)
         {
             std::cout << "[callback] Resource model is changed URI: " << uri.c_str()
-                      << " Count : " << resModel.size() << std::endl;
+                    << " Count : " << resModel.size() << std::endl;
             std::cout << "#### Modified attributes are ####" << std::endl;
             for (auto & attribute : resModel.getAttributes())
             {
                 std::cout << attribute.second.getName() << " :  "
-                          << attribute.second.valueToString().c_str() << std::endl;
+                        << attribute.second.valueToString().c_str() << std::endl;
             }
             std::cout << "########################" << std::endl;
         }
 
-        void simulateResource(std::string &configPath)
+        void simulateResource()
         {
             SimulatorResourceServer::ResourceModelChangedCB callback = std::bind(
                         &SimLightResource::onResourceModelChanged, this, std::placeholders::_1,
@@ -142,21 +132,24 @@ class SimLightResource
 
             try
             {
+                std::string configPath;
+                std::cout << "Enter RAML path: ";
+                std::cin>>configPath;
                 SimulatorResourceServerSP resource =
-                    SimulatorManager::getInstance()->createResource(configPath, callback);
+                        SimulatorManager::getInstance()->createResource(configPath, callback);
                 m_resources.push_back(resource);
                 std::cout << "Resource created successfully! URI= " << resource->getURI().c_str()
-                          << std::endl;
+                        << std::endl;
             }
             catch (InvalidArgsException &e)
             {
                 std::cout << "InvalidArgsException occured [code : " << e.code() << " Detail: "
-                          << e.what() << "]" << std::endl;
+                        << e.what() << "]" << std::endl;
             }
             catch (SimulatorException &e)
             {
                 std::cout << "SimulatorException occured [code : " << e.code() << " Detail: "
-                          << e.what() << "]" << std::endl;
+                        << e.what() << "]" << std::endl;
             }
         }
 
@@ -204,7 +197,7 @@ class SimLightResource
                         {
                             SimulatorManager::getInstance()->deleteResource(resourceType);
                             std::cout << "Resources of type \"" << resourceType << "\"" <<
-                                      " deleted successfully! " << std::endl;
+                                    " deleted successfully! " << std::endl;
                             std::vector<SimulatorResourceServerSP>::iterator ite = m_resources.begin();
                             while (ite != m_resources.end())
                             {
@@ -219,12 +212,12 @@ class SimLightResource
                         catch (InvalidArgsException &e)
                         {
                             std::cout << "InvalidArgsException occured [code : " << e.code()
-                                      << " Detail: " << e.what() << "]" << std::endl;
+                                    << " Detail: " << e.what() << "]" << std::endl;
                         }
                         catch (SimulatorException &e)
                         {
                             std::cout << "SimulatorException occured [code : " << e.code()
-                                      << " Detail: " << e.what() << "]" << std::endl;
+                                    << " Detail: " << e.what() << "]" << std::endl;
                         }
                     } break;
 
@@ -257,7 +250,7 @@ class SimLightResource
             }
 
             std::cout << "Setting the new values from allowed values list to power attribute" <<
-                      std::endl;
+                    std::endl;
             // Update all possible values from allowed values
             for (int index = 0; index < allowedValuesSize; index++)
             {
@@ -303,7 +296,7 @@ class SimLightResource
             }
 
             std::cout << "Setting the new values from allowed values list to intensity attribute"
-                      << std::endl;
+                    << std::endl;
             // Update all possible values from allowed values
             for (int index = min; index <= max; index++)
             {
@@ -350,7 +343,7 @@ class SimLightResource
             // Attributes
             SimulatorResourceModel resModel = resource->getModel();
             std::map<std::string, SimulatorResourceModel::Attribute> attributes =
-                resModel.getAttributes();
+                    resModel.getAttributes();
             std::cout << "##### Attributes [" << attributes.size() << "]" << std::endl;
             for (auto & attribute : attributes)
             {
@@ -374,7 +367,7 @@ class SimLightResource
                                          const int id)
         {
             std::cout << "Update automation is completed [URI: " << uri.c_str()
-                      << "  AutomationID: " << id << "] ###" << std::endl;
+                    << "  AutomationID: " << id << "] ###" << std::endl;
         }
 
         void automateResourceUpdate()
@@ -392,16 +385,16 @@ class SimLightResource
 
             try
             {
-                int id = m_resources[index - 1]->startUpdateAutomation(type,
+                int id = m_resources[index - 1]->startUpdateAutomation(type, 500,
                          std::bind(&SimLightResource::onUpdateAutomationCompleted, this,
-                                   std::placeholders::_1, std::placeholders::_2));
+                                 std::placeholders::_1, std::placeholders::_2));
 
                 std::cout << "startUpdateAutomation() returned succces : " << id << std::endl;
             }
             catch (SimulatorException &e)
             {
                 std::cout << "SimulatorException occured [code : " << e.code() << " Detail: " <<
-                          e.what() << "]" << std::endl;
+                        e.what() << "]" << std::endl;
             }
         }
 
@@ -414,7 +407,7 @@ class SimLightResource
             SimulatorResourceServerSP resource = m_resources[index - 1];
             SimulatorResourceModel resModel = resource->getModel();
             std::map<std::string, SimulatorResourceModel::Attribute> attributes =
-                resModel.getAttributes();
+                    resModel.getAttributes();
             int size = 0;
             for (auto & attribute : attributes)
             {
@@ -429,7 +422,7 @@ class SimLightResource
 
             int choice = -1;
             std::cout << "Select the attribute which you want to automate for updation: " <<
-                      std::endl;
+                    std::endl;
             std::cin >> choice;
             if (choice < 0 || choice > size)
             {
@@ -457,20 +450,20 @@ class SimLightResource
                 type = AutomationType::RECURRENT;
 
             std::cout << "Requesting attribute automation for " << attributeName.c_str() <<
-                      std::endl;
+                    std::endl;
 
             try
             {
 
-                int id = resource->startUpdateAutomation(attributeName, type,
+                int id = resource->startUpdateAutomation(attributeName, type, 500,
                          std::bind(&SimLightResource::onUpdateAutomationCompleted, this,
-                                   std::placeholders::_1, std::placeholders::_2));
+                                std::placeholders::_1, std::placeholders::_2));
                 std::cout << "startUpdateAutomation() returned succces : " << id << std::endl;
             }
             catch (SimulatorException &e)
             {
                 std::cout << "SimulatorException occured [Error: " << e.code() << " Details: " <<
-                          e.what() << "]" << std::endl;
+                        e.what() << "]" << std::endl;
             }
         }
 
@@ -494,7 +487,7 @@ class SimLightResource
             if (!ids.size())
             {
                 std::cout << "No automation operation is going on this resource right now!" <<
-                          std::endl;
+                        std::endl;
                 return;
             }
 
@@ -514,7 +507,7 @@ class SimLightResource
             std::ostringstream out;
             out << "ID:  " << (int) observerInfo.id << std::endl;
             out << " [address: " << observerInfo.address << " port: " << observerInfo.port
-                << "]" << std::endl;
+                    << "]" << std::endl;
             std::cout << out.str();
         }
 
@@ -537,7 +530,7 @@ class SimLightResource
             for (auto & observerInfo : observersList)
             {
                 std::cout << " ID :  " << (int) observerInfo.id << " [address: " <<
-                          observerInfo.address << " port: " << observerInfo.port << "]" << std::endl;
+                        observerInfo.address << " port: " << observerInfo.port << "]" << std::endl;
             }
             std::cout << "########################" << std::endl;
         }
@@ -553,12 +546,6 @@ void printMainMenu()
     std::cout << "2. Set Logger" << std::endl;
     std::cout << "3. Help" << std::endl;
     std::cout << "0. Exit" << std::endl;
-    std::cout <<
-              "To set the Resource from RAML file, run the service provider with argument of Path of Raml File."
-              << std::endl;
-    std::cout <<
-              "Example: ./simulator-server PATH-TO-RAML-FILE"
-              << std::endl;
     std::cout << "######################################" << std::endl;
 }
 
@@ -597,17 +584,6 @@ void setLogger()
 
 int main(int argc, char *argv[])
 {
-    std::string configPath = "";
-
-    if (argc == 2)
-    {
-        char *value = argv[1];
-        configPath.append(value);
-    }
-    else
-    {
-        configPath = "";
-    }
     SimLightResource lightResource;
 
     printMainMenu();
@@ -624,7 +600,7 @@ int main(int argc, char *argv[])
 
         switch (choice)
         {
-            case 1: lightResource.startTest(configPath);
+            case 1: lightResource.startTest();
                 std::cout << "Welcome back to main menu !" << std::endl;
                 break;
             case 2: setLogger(); break;
index fcdfb6b..d596ed9 100644 (file)
@@ -202,7 +202,7 @@ class SimulatorResourceModel
 
                 bool compare(Attribute &attribute);
 
-                std::vector<ValueVariant> getAllowedValues();
+                std::vector<ValueVariant> getAllowedValues() const;
 
                 int getUpdateFrequencyTime() {return m_updateInterval;}
                 void setUpdateFrequencyTime(int interval) {m_updateInterval = interval;}
@@ -231,7 +231,7 @@ class SimulatorResourceModel
                         ValueVariant &at(unsigned int index);
                         int size() const;
                         std::vector<std::string> toString() const;
-                        std::vector<ValueVariant> getValues();
+                        std::vector<ValueVariant> getValues() const;
                     private:
                         std::vector<ValueVariant> m_values;
                 };
@@ -291,7 +291,7 @@ class SimulatorResourceModel
           * @param attr  - Attribute pointer
           *
           */
-        void addAttribute(const Attribute &attribute);
+        void addAttribute(const Attribute &attribute, bool overwrite = false);
 
         /**
          * API to set range of attribute value.
index 715e8bb..95791df 100644 (file)
@@ -199,7 +199,7 @@ class SimulatorResourceServer
          * @return ID representing update automation session.
          * NOTE: API throws @InvalidArgsException, @SimulatorException exceptions.
          */
-        virtual int startUpdateAutomation(AutomationType type,
+        virtual int startUpdateAutomation(AutomationType type, int updateInterval,
                                           updateCompleteCallback callback) = 0;
 
         /**
@@ -216,7 +216,7 @@ class SimulatorResourceServer
          * NOTE: API throws @InvalidArgsException, @SimulatorException exceptions.
          */
         virtual int startUpdateAutomation(const std::string &attrName, AutomationType type,
-                                          updateCompleteCallback callback) = 0;
+                                          int updateInterval, updateCompleteCallback callback) = 0;
 
         /**
          * API to get the Ids of all ongoing resource update automation .
index 4366174..6822dfb 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: ClientControllerPlugin
 Bundle-SymbolicName: ClientControllerPlugin;singleton:=true
-Bundle-Version: 0.1.0
+Bundle-Version: 1.0.0.qualifier
 Bundle-Activator: oic.simulator.clientcontroller.Activator
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime
index 9b8bdb4..c7d225f 100644 (file)
@@ -47,7 +47,6 @@ import oic.simulator.clientcontroller.utils.Utility;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.swt.graphics.Image;
 import org.oic.simulator.ILogger.Level;
-import org.oic.simulator.InvalidArgsException;
 import org.oic.simulator.ResourceAttribute;
 import org.oic.simulator.ResourceAttribute.Range;
 import org.oic.simulator.ResourceAttribute.Type;
@@ -398,7 +397,7 @@ public class ResourceManager {
         // TODO: For debugging
         if (null != attributeMap) {
             RemoteResourceAttribute.printAttributes(attributeMap);
-            System.out.println("Attributes found: ");
+            System.out.println("Attributes found: " + (null != attributeMap));
             System.out.println("No of attributes: " + attributeMap.size());
 
             resource.setResourceAttributesMap(attributeMap);
@@ -582,7 +581,7 @@ public class ResourceManager {
     }
 
     public boolean isResourceObserved(String resourceURI) {
-        boolean observed;
+        boolean observed = false;
         synchronized (observedResourceURIList) {
             observed = observedResourceURIList.contains(resourceURI);
         }
@@ -1483,16 +1482,6 @@ public class ResourceManager {
         }
         try {
             resourceN.stopVerification(autoId);
-        } catch (InvalidArgsException e) {
-            Activator
-            .getDefault()
-            .getLogManager()
-            .log(Level.ERROR.ordinal(),
-                    new Date(),
-                    "[" + e.getClass().getSimpleName() + "]"
-                            + e.code().toString() + "-"
-                            + e.message());
-            return;
         } catch (SimulatorException e) {
             Activator
                     .getDefault()
index 9b0d603..d851d11 100644 (file)
@@ -143,8 +143,8 @@ public class FindResourcePage extends WizardPage {
          */
 
         // TODO: Temporarily adding a resourceType for testing
-       // resourceTypeCmb.add("oic.r.light");
-        resourceTypeCmb.add("sample.light");
+        resourceTypeCmb.add("oic.r.light");
+       // resourceTypeCmb.add("sample.light");
 
         // By default, selecting the first item in the resourceType combo
         if (resourceTypeCmb.getItemCount() > 0) {
index 940c1b3..ee700d1 100644 (file)
@@ -56,7 +56,7 @@ public class ImageManager {
                 .createFromURL(bundle.getEntry("icons/button_pressed.PNG")));
 
         // Resource icons based on the resource type
-        r.put(Constants.OIC_R_LIGHT, ImageDescriptor.createFromURL(bundle
+        r.put(Constants.SAMPLE_LIGHT, ImageDescriptor.createFromURL(bundle
                 .getEntry("/icons/light_16x16.png")));
 
         // Log View related icons
index 37a36dd..e6cca32 100644 (file)
@@ -44,7 +44,6 @@ import oic.simulator.serviceprovider.utils.Utility;
 import org.eclipse.swt.graphics.Image;
 import org.oic.simulator.IAutomation;
 import org.oic.simulator.ILogger.Level;
-import org.oic.simulator.InvalidArgsException;
 import org.oic.simulator.ResourceAttribute;
 import org.oic.simulator.ResourceAttribute.Range;
 import org.oic.simulator.ResourceAttribute.Type;
@@ -483,7 +482,7 @@ public class ResourceManager {
     }
 
     public boolean isDisplayName(String displayName) {
-        boolean exist;
+        boolean exist = false;
         synchronized (displayNameMap) {
             exist = displayNameMap.containsKey(displayName);
         }
@@ -491,7 +490,7 @@ public class ResourceManager {
     }
 
     public String getCompleteUriFromDisplayName(String displayName) {
-        String completeURI;
+        String completeURI = null;
         synchronized (displayNameMap) {
             completeURI = displayNameMap.get(displayName);
         }
@@ -567,7 +566,7 @@ public class ResourceManager {
             @Override
             public void run() {
                 Map<String, SimulatorResource> resourceTypeMap;
-                SimulatorResourceServer[] simulatorResourceServers;
+                SimulatorResourceServer[] simulatorResourceServers = null;
                 try {
                     simulatorResourceServers = SimulatorManager.createResource(
                             configFilePath, noOfInstances,
@@ -1123,12 +1122,12 @@ public class ResourceManager {
     }
 
     public List<String> getURIList() {
-        List<String> list;
+        List<String> list = null;
         synchronized (orderedResourceUriMap) {
             Set<String> typeSet = orderedResourceUriMap.keySet();
             List<String> typeList = Utility.convertSetToList(typeSet);
             if (null == typeList || typeList.size() < 1) {
-                return null;
+                return list;
             }
             list = new ArrayList<String>();
 
@@ -1350,7 +1349,7 @@ public class ResourceManager {
                 String attrName = attribute.getAttributeName();
                 try {
                     autoId = resourceServerN.startAttributeAutomation(attrName,
-                            autoType, automationListener);
+                            autoType, autoUpdateInterval, automationListener);
                 } catch (SimulatorException e) {
                     Activator
                             .getDefault()
@@ -1471,7 +1470,7 @@ public class ResourceManager {
                 int autoId = -1;
                 try {
                     autoId = resourceServer.startResourceAutomation(
-                            AutomationType.NORMAL, automationListener);
+                            AutomationType.NORMAL, 500, automationListener);
                 } catch (SimulatorException e) {
                     Activator
                             .getDefault()
index b444073..09fecfc 100644 (file)
@@ -103,5 +103,5 @@ public class Constants {
 
     public static final String         SPLIT_BY_DOT_PATTERN             = "\\.";
 
-    public static final String         OIC_R_LIGHT                      = "oic.r.light";
+    public static final String         SAMPLE_LIGHT                      = "sample.light";
 }
\ No newline at end of file
index a62f0ae..be7dae8 100644 (file)
@@ -207,12 +207,9 @@ public class DeleteResourcePage extends WizardPage {
         if (deleteCategory == DeleteCategory.ALL) {
             done = true;
         } else if (deleteCategory == DeleteCategory.BY_TYPE) {
-            int selectedItemIndex = resourceTypeCmb.getSelectionIndex();
-            if (selectedItemIndex >= 0) {
-                deleteCandidate = resourceTypeCmb.getItem(selectedItemIndex);
-                if (null != deleteCandidate && deleteCandidate.length() > 0) {
-                    done = true;
-                }
+            deleteCandidate = resourceTypeCmb.getText();
+            if (null != deleteCandidate && deleteCandidate.length() > 0) {
+                done = true;
             }
         } else if (deleteCategory == DeleteCategory.BY_URI) {
             deleteCandidate = resourceUriTxt.getText();
index 0203afa..5732eff 100644 (file)
@@ -54,7 +54,6 @@ class attribute_value_visitor : public boost::static_visitor<jobject>
             return static_cast<jobject>(str);
         }
 
-#if 0
         // Boolean type value conversion
         jobject operator ()(const bool &value) const
         {
@@ -62,7 +61,7 @@ class attribute_value_visitor : public boost::static_visitor<jobject>
                                               gSimulatorClassRefs.classBooleanCtor, value);
             return result;
         }
-
+#if 0
         // SimulatorResourceModel::Attribute type value conversion
         jobject operator ()(const SimulatorResourceModel::Attribute &value) const
         {
index 860874e..b0fd74b 100644 (file)
@@ -28,6 +28,7 @@ typedef struct
     jclass classObject;
     jclass classInteger;
     jclass classDouble;
+    jclass classBoolean;
     jclass classString;
     jclass classHashMap;
     jclass classVector;
@@ -52,6 +53,7 @@ typedef struct
 
     jmethodID classIntegerCtor;
     jmethodID classDoubleCtor;
+    jmethodID classBooleanCtor;
     jmethodID classHashMapCtor;
     jmethodID classHashMapPut;
     jmethodID classVectorCtor;
index 6ae6e58..0fc5796 100644 (file)
@@ -712,6 +712,11 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
         return JNI_ERR;
     }
 
+    if (false == getClassRef(env, "java/lang/Boolean", gSimulatorClassRefs.classBoolean))
+    {
+        return JNI_ERR;
+    }
+
     if (false == getClassRef(env, "java/lang/String", gSimulatorClassRefs.classString))
     {
         return JNI_ERR;
@@ -829,6 +834,11 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
     if (!gSimulatorClassRefs.classDoubleCtor)
         return JNI_ERR;
 
+    gSimulatorClassRefs.classBooleanCtor= env->GetMethodID(gSimulatorClassRefs.classBoolean, "<init>",
+                                          "(Z)V");
+    if (!gSimulatorClassRefs.classBooleanCtor)
+        return JNI_ERR;
+
     gSimulatorClassRefs.classHashMapCtor = env->GetMethodID(gSimulatorClassRefs.classHashMap, "<init>",
                                            "()V");
     if (!gSimulatorClassRefs.classHashMapCtor)
index c9b08c9..1853c95 100644 (file)
@@ -482,7 +482,7 @@ Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_setAllowedValuesS
 
 JNIEXPORT jint JNICALL
 Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_startResourceAutomation
-(JNIEnv *env, jobject object, jint automationType, jobject listener)
+(JNIEnv *env, jobject object, jint automationType, jint updateInterval, jobject listener)
 {
     SimulatorResourceServerSP resource = JniSimulatorResource::getJniSimulatorResourceSP(env, object);
     if (!resource)
@@ -514,7 +514,7 @@ Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_startResourceAuto
 
     try
     {
-        automationId = resource->startUpdateAutomation(type, callback);
+        automationId = resource->startUpdateAutomation(type, updateInterval, callback);
     }
     catch (InvalidArgsException &e)
     {
@@ -533,7 +533,7 @@ Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_startResourceAuto
 
 JNIEXPORT jint JNICALL
 Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_startAttributeAutomation
-(JNIEnv *env, jobject object, jstring attrName, jint automationType, jobject listener)
+(JNIEnv *env, jobject object, jstring attrName, jint automationType, jint updateInterval, jobject listener)
 {
     SimulatorResourceServerSP resource = JniSimulatorResource::getJniSimulatorResourceSP(env, object);
     if (!resource)
@@ -572,7 +572,7 @@ Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_startAttributeAut
     int automationId = -1;
     try
     {
-        automationId = resource->startUpdateAutomation(attrNamePtr, type, callback);
+        automationId = resource->startUpdateAutomation(attrNamePtr, type, updateInterval, callback);
     }
     catch (InvalidArgsException &e)
     {
index 765d2b6..298071a 100644 (file)
@@ -98,11 +98,11 @@ Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_setAllowedValuesS
 
 JNIEXPORT jint JNICALL
 Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_startResourceAutomation
-(JNIEnv *, jobject, jint, jobject);
+(JNIEnv *, jobject, jint, jint, jobject);
 
 JNIEXPORT jint JNICALL
 Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_startAttributeAutomation
-(JNIEnv *, jobject, jstring, jint, jobject);
+(JNIEnv *, jobject, jstring, jint, jint, jobject);
 
 JNIEXPORT void JNICALL
 Java_org_oic_simulator_serviceprovider_SimulatorResourceServer_stopAutomation
index 0d9accd..2329be0 100644 (file)
@@ -346,9 +346,9 @@ public class SimulatorResourceServer {
      *             This exception will be thrown for other errors.
      */
     public int startResourceAutomation(AutomationType typeOfAutomation,
-            IAutomation listener) throws InvalidArgsException,
+            int updateInterval, IAutomation listener) throws InvalidArgsException,
             SimulatorException {
-        return startResourceAutomation(typeOfAutomation.getValue(), listener);
+        return startResourceAutomation(typeOfAutomation.getValue(), updateInterval, listener);
     }
 
     /**
@@ -373,10 +373,11 @@ public class SimulatorResourceServer {
      *             This exception will be thrown for other errors.
      */
     public int startAttributeAutomation(String attrName,
-            AutomationType typeOfAutomation, IAutomation listener)
+            AutomationType typeOfAutomation, int updateInterval,
+            IAutomation listener)
             throws InvalidArgsException, SimulatorException {
         return startAttributeAutomation(attrName, typeOfAutomation.getValue(),
-                listener);
+                updateInterval, listener);
     }
 
     /**
@@ -463,11 +464,11 @@ public class SimulatorResourceServer {
             SimulatorException;
 
     private native int startResourceAutomation(int typeOfAutomation,
-            IAutomation listener) throws InvalidArgsException,
+            int updateInterval, IAutomation listener) throws InvalidArgsException,
             SimulatorException;
 
     private native int startAttributeAutomation(String attrName,
-        int typeOfAutomation, IAutomation listener)
+        int typeOfAutomation, int updateInterval, IAutomation listener)
         throws InvalidArgsException, SimulatorException;
 
     @Override
index d2eec8f..401e448 100755 (executable)
@@ -118,7 +118,7 @@ namespace RAML
                     if (*it == reqValue)\r
                         break;\r
                 }\r
-                if (m_required.end() == it)\r
+                if (m_required.end() != it)\r
                 {\r
                     m_required.push_back(reqValue);\r
                 }\r
index d2463b2..b0a0e50 100755 (executable)
@@ -124,7 +124,7 @@ namespace RAML
                     if (*it == reqValue)\r
                         break;\r
                 }\r
-                if (m_required.end() == it)\r
+                if (m_required.end() != it)\r
                 {\r
                     m_required.push_back(reqValue);\r
                 }\r
index 5943264..03abd64 100644 (file)
 
 #include "attribute_generator.h"
 
-AttributeGenerator::AttributeGenerator(SimulatorResourceModel::Attribute &attribute)
+AttributeGenerator::AttributeGenerator(const SimulatorResourceModel::Attribute &attribute)
     :   m_name(attribute.getName()),
         m_min(INT_MIN),
         m_max(INT_MAX),
         m_rangeIndex(-1),
-        m_nextAllowedValueIndex(0),
-        m_prevAllowedValueIndex(0),
+        m_allowedValueIndex(0),
         m_hasRange(false),
         m_hasAllowedValue(false)
 {
@@ -47,7 +46,6 @@ AttributeGenerator::AttributeGenerator(SimulatorResourceModel::Attribute &attrib
         {
             m_hasAllowedValue = true;
         }
-        m_prevAllowedValueIndex = m_allowedValues.size();
     }
 }
 
@@ -58,7 +56,7 @@ bool AttributeGenerator::hasNext()
         return true;
     }
 
-    if (m_hasAllowedValue && m_nextAllowedValueIndex < m_allowedValues.size())
+    if (m_hasAllowedValue && m_allowedValueIndex < m_allowedValues.size())
     {
         return true;
     }
@@ -77,28 +75,113 @@ bool AttributeGenerator::next(SimulatorResourceModel::Attribute &attribute)
     }
     else if (m_hasAllowedValue)
     {
-        attribute.setValue(m_allowedValues[m_nextAllowedValueIndex++]);
+        attribute.setValue(m_allowedValues[m_allowedValueIndex++]);
         return true;
     }
 
     return false;
 }
 
-bool AttributeGenerator::previous(SimulatorResourceModel::Attribute &attribute)
+SimulatorResourceModel::Attribute AttributeGenerator::current()
 {
+    SimulatorResourceModel::Attribute attribute;
+
     attribute.setName(m_name);
+    if (m_hasRange)
+    {
+        attribute.setValue(m_rangeIndex);
+    }
+    else if (m_hasAllowedValue)
+    {
+        attribute.setValue(m_allowedValues[m_allowedValueIndex]);
+    }
+
+    return attribute;
+}
 
+void AttributeGenerator::reset()
+{
     if (m_hasRange)
     {
-        attribute.setValue(m_rangeIndex - 1);
-        return true;
+        m_rangeIndex = m_min;
     }
     else if (m_hasAllowedValue)
     {
-        attribute.setValue(m_allowedValues[m_prevAllowedValueIndex - 1]);
+        m_allowedValueIndex = 0;
+    }
+}
+
+AttributeCombinationGen::AttributeCombinationGen(
+        const std::vector<SimulatorResourceModel::Attribute> &attributes)
+{
+    for (auto &attr : attributes)
+    {
+        AttributeGenerator attrGen(attr);
+        m_attrGenList.push_back(attr);
+    }
+
+    m_index = -1;
+}
+
+bool AttributeCombinationGen::next(SimulatorResourceModel &resModel)
+{
+    if (!m_attrGenList.size())
+    {
+        return false;
+    }
+
+    std::lock_guard<std::mutex> lock(m_lock);
+
+    // This block will execute for only first time
+    if (-1 == m_index)
+    {
+        for (int index = 0; index < m_attrGenList.size(); index++)
+        {
+            // Add the attribute on resource model
+            addAttributeToModel(index);
+        }
+
+        m_index = m_attrGenList.size() - 1;
+        resModel = m_resModel;
+        return true;
+    }
+
+    // Get the next attribute from statck top element
+    if (m_attrGenList[m_index].hasNext())
+    {
+        addAttributeToModel(m_index);
+        resModel = m_resModel;
+        return true;
+    }
+    else
+    {
+        for (int index = m_index; index >= 0; index--)
+        {
+            if (!m_attrGenList[index].hasNext())
+            {
+                if (!index)
+                    return false;
+
+                m_attrGenList[index].reset();
+                addAttributeToModel(index);
+            }
+            else
+            {
+                addAttributeToModel(index);
+                break;
+            }
+        }
+
+        resModel = m_resModel;
         return true;
     }
 
     return false;
 }
 
+void AttributeCombinationGen::addAttributeToModel(int index)
+{
+    SimulatorResourceModel::Attribute attribute;
+    m_attrGenList[index].next(attribute);
+    m_resModel.addAttribute(attribute, true);
+}
index 3f66372..fab888f 100644 (file)
 class AttributeGenerator
 {
     public:
-        AttributeGenerator(SimulatorResourceModel::Attribute &attribute);
+        AttributeGenerator(const SimulatorResourceModel::Attribute &attribute);
         bool hasNext();
         bool next(SimulatorResourceModel::Attribute &attribute);
-        bool previous(SimulatorResourceModel::Attribute &attribute);
+        SimulatorResourceModel::Attribute current();
         void reset();
 
     private:
         std::string m_name;
-        SimulatorResourceModel::Attribute::ValueType m_type;
         int m_min;
         int m_max;
         int m_rangeIndex;
-        int m_nextAllowedValueIndex;
-        int m_prevAllowedValueIndex;
+        int m_allowedValueIndex;
         bool m_hasRange;
         bool m_hasAllowedValue;
         std::vector<SimulatorResourceModel::Attribute::ValueVariant> m_allowedValues;
 };
 
+class AttributeCombinationGen
+{
+    public:
+        AttributeCombinationGen(const std::vector<SimulatorResourceModel::Attribute> &attributes);
+        bool next(SimulatorResourceModel &resModel);
+
+    private:
+        void addAttributeToModel(int index);
+
+        std::mutex m_lock;
+        std::vector<AttributeGenerator> m_attrGenList;
+        int m_index;
+        SimulatorResourceModel m_resModel;
+};
+
 #endif
 
index 3c8d63b..56bee77 100644 (file)
@@ -75,63 +75,44 @@ void PUTRequestGenerator::SendAllRequests()
     OC_LOG(DEBUG, TAG, "Sending OP_START event");
     m_callback(m_id, OP_START);
 
-    // Create attribute generator for value manipulation
-    std::vector<AttributeGenerator> attributeGenList;
+    // Create attribute combination generator for generating resource model
+    // with different attribute values
+    std::vector<SimulatorResourceModel::Attribute> attributes;
     for (auto &attributeElement : m_rep->getAttributes())
-        attributeGenList.push_back(AttributeGenerator(attributeElement.second));
+    {
+        attributes.push_back(attributeElement.second);
+    }
 
-    if (!attributeGenList.size())
+    if (!attributes.size())
     {
         OC_LOG(ERROR, TAG, "Zero attribute found from resource model!");
         return;
     }
 
-    bool hasNext = false;
-
     do
     {
-        if (!m_stopRequested)
+        if (m_stopRequested)
         {
-            // Get the next possible queryParameter
-            std::map<std::string, std::string> queryParam = m_queryParamGen.next();
-
-            while (true)
-            {
-                SimulatorResourceModelSP repModel(new SimulatorResourceModel);
-                for (auto & attributeGen : attributeGenList)
-                {
-                    if (attributeGen.hasNext())
-                    {
-                        SimulatorResourceModel::Attribute attribute;
-                        if (true == attributeGen.next(attribute))
-                            repModel->addAttribute(attribute);
-
-                        hasNext = true;
-                    }
-                    else
-                    {
-                        SimulatorResourceModel::Attribute attribute;
-                        if (true == attributeGen.previous(attribute))
-                            repModel->addAttribute(attribute);
-                    }
-                }
-
-                if (hasNext)
-                {
-                    // Send the request
-                    m_requestSender->sendRequest(queryParam, repModel,
-                            std::bind(&PUTRequestGenerator::onResponseReceived, this,
-                            std::placeholders::_1, std::placeholders::_2), true);
-
-                    m_requestCnt++;
-                    hasNext = false;
-                    continue;
-                }
-                else
-                {
-                    break;
-                }
-            }
+            break;
+        }
+
+        // Get the next possible queryParameter
+        std::map<std::string, std::string> queryParam = m_queryParamGen.next();
+
+        AttributeCombinationGen attrCombGen(attributes);
+
+        // Get the new model from attribute combination generator
+        SimulatorResourceModel resModel;
+        while (!m_stopRequested && attrCombGen.next(resModel))
+        {
+            SimulatorResourceModelSP repModel(new SimulatorResourceModel(resModel));
+
+            // Send the request
+            m_requestSender->sendRequest(queryParam, repModel,
+                    std::bind(&PUTRequestGenerator::onResponseReceived, this,
+                    std::placeholders::_1, std::placeholders::_2), true);
+
+            m_requestCnt++;
         }
     }
     while (m_queryParamGen.hasNext());
index d4472f8..6b068af 100644 (file)
@@ -302,8 +302,8 @@ int SimulatorRemoteResourceImpl::startVerification(RequestType type,
             if (m_getRequestSender)
             {
                 return m_autoRequestGenMngr->startOnGET(m_getRequestSender,
-                                                        m_requestModelList[RequestType::RQ_TYPE_GET]->getQueryParams(),
-                                                        localCallback);
+                                    m_requestModelList[RequestType::RQ_TYPE_GET]->getQueryParams(),
+                                    localCallback);
             }
             break;
 
@@ -311,9 +311,9 @@ int SimulatorRemoteResourceImpl::startVerification(RequestType type,
             if (m_putRequestSender)
             {
                 return m_autoRequestGenMngr->startOnPUT(m_putRequestSender,
-                                                        m_requestModelList[RequestType::RQ_TYPE_PUT]->getQueryParams(),
-                                                        m_requestModelList[RequestType::RQ_TYPE_PUT]->getRepSchema(),
-                                                        localCallback);
+                                    m_requestModelList[RequestType::RQ_TYPE_PUT]->getQueryParams(),
+                                    m_requestModelList[RequestType::RQ_TYPE_PUT]->getRepSchema(),
+                                    localCallback);
             }
             break;
 
@@ -321,9 +321,9 @@ int SimulatorRemoteResourceImpl::startVerification(RequestType type,
             if (m_postRequestSender)
             {
                 return m_autoRequestGenMngr->startOnPOST(m_putRequestSender,
-                        m_requestModelList[RequestType::RQ_TYPE_POST]->getQueryParams(),
-                        m_requestModelList[RequestType::RQ_TYPE_POST]->getRepSchema(),
-                        localCallback);
+                                    m_requestModelList[RequestType::RQ_TYPE_POST]->getQueryParams(),
+                                    m_requestModelList[RequestType::RQ_TYPE_POST]->getRepSchema(),
+                                    localCallback);
             }
             break;
 
index dcd7988..5cae008 100644 (file)
@@ -127,6 +127,8 @@ class range_validation : public boost::static_visitor<bool>
         {
             std::vector<SimulatorResourceModel::Attribute::ValueVariant> values
                 = m_attrItem.getAllowedValues();
+            if(0 == values.size())
+                return true;
             for (SimulatorResourceModel::Attribute::ValueVariant & val : values)
             {
                 SimulatorResourceModel::Attribute::ValueVariant vVal = value;
@@ -145,6 +147,8 @@ class range_validation : public boost::static_visitor<bool>
         {
             std::vector<SimulatorResourceModel::Attribute::ValueVariant> values
                 = m_attrItem.getAllowedValues();
+            if(0 == values.size())
+                return true;
             for (SimulatorResourceModel::Attribute::ValueVariant & vVal : values)
             {
                 std::string val = boost::get<std::string>(vVal);
@@ -183,7 +187,7 @@ std::vector<std::string> SimulatorResourceModel::Attribute::AllowedValues::toStr
 }
 
 std::vector<SimulatorResourceModel::Attribute::ValueVariant>
-SimulatorResourceModel::Attribute::AllowedValues::getValues()
+SimulatorResourceModel::Attribute::AllowedValues::getValues() const
 {
     return m_values;
 }
@@ -259,7 +263,7 @@ bool SimulatorResourceModel::Attribute::compare(SimulatorResourceModel::Attribut
 }
 
 std::vector<SimulatorResourceModel::Attribute::ValueVariant>
-SimulatorResourceModel::Attribute::getAllowedValues()
+SimulatorResourceModel::Attribute::getAllowedValues() const
 {
     return m_allowedValues.getValues();
 }
@@ -281,10 +285,10 @@ const
     return m_attributes;
 }
 
-void SimulatorResourceModel::addAttribute(const SimulatorResourceModel::Attribute &attribute)
+void SimulatorResourceModel::addAttribute(const SimulatorResourceModel::Attribute &attribute, bool overwrite)
 {
     if (!attribute.getName().empty() &&
-        m_attributes.end() == m_attributes.find(attribute.getName()))
+        (m_attributes.end() == m_attributes.find(attribute.getName()) || overwrite))
     {
         m_attributes[attribute.getName()] = attribute;
     }
@@ -377,6 +381,8 @@ SimulatorResourceModelSP SimulatorResourceModel::create(const OC::OCRepresentati
             attribute.setValue(attributeItem.getValue<double>());
         if (attributeItem.type() == OC::AttributeType::String)
             attribute.setValue(attributeItem.getValue<std::string>());
+        if (attributeItem.type() == OC::AttributeType::Boolean)
+            attribute.setValue(attributeItem.getValue<bool>());
 
         attribute.setName(attributeItem.attrname());
         resModel->m_attributes[attributeItem.attrname()] = attribute;
index c66711a..f2f2bc0 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "resource_update_automation.h"
 #include "simulator_resource_server_impl.h"
+#include "attribute_generator.h"
 #include "simulator_exceptions.h"
 #include "simulator_logger.h"
 #include "logger.h"
@@ -92,7 +93,7 @@ void AttributeUpdateAutomation::updateAttribute()
         SIM_LOG(ILogger::INFO, "Automation of " << m_attrName << " attribute is completed.");
     }
 
-    // Notify application through callback
+    // Notify application
     if (m_callback)
         m_callback(m_resource->getURI(), m_id);
 
@@ -142,65 +143,61 @@ ResourceUpdateAutomation::ResourceUpdateAutomation(int id, SimulatorResourceServ
     :   m_resource(resource),
         m_type(type),
         m_id(id),
+        m_stopRequested(false),
         m_updateInterval(interval),
         m_callback(callback),
-        m_finishedCallback(finishedCallback) {}
+        m_finishedCallback(finishedCallback),
+        m_thread(nullptr) {}
 
 void ResourceUpdateAutomation::start()
 {
-    m_resModel = m_resource->getModel();
-    std::map<std::string, SimulatorResourceModel::Attribute> attributes = m_resModel.getAttributes();
-    if (0 == attributes.size())
+    SimulatorResourceModel resModel = m_resource->getModel();
+    std::map<std::string, SimulatorResourceModel::Attribute> attributesTable =
+            resModel.getAttributes();
+    if (0 == attributesTable.size())
     {
         OC_LOG(ERROR, RTAG, "Resource has zero attributes!");
         throw SimulatorException(SIMULATOR_ERROR, "Resource has zero attributes!");
     }
 
-    int id = 0;
-    for (auto & attribute : attributes)
-    {
-        AttributeUpdateAutomationSP attributeAutomation(new AttributeUpdateAutomation(
-                    id, m_resource, attribute.first, m_type, m_updateInterval, nullptr,
-                    std::bind(&ResourceUpdateAutomation::finished, this, std::placeholders::_1)));
+    std::vector<SimulatorResourceModel::Attribute> attributes;
+    for (auto &attributeEntry : attributesTable)
+        attributes.push_back(attributeEntry.second);
 
-        m_attrUpdationList[id++] = attributeAutomation;
-        try
-        {
-            attributeAutomation->start();
-        }
-        catch (SimulatorException &e)
-        {
-            stop();
-            throw;
-        }
-    }
+    m_thread = new std::thread(&ResourceUpdateAutomation::updateAttributes, this, attributes);
 }
 
-void ResourceUpdateAutomation::finished(int id)
+void ResourceUpdateAutomation::stop()
 {
-    if (m_attrUpdationList.end() != m_attrUpdationList.find(id))
-    {
-        m_attrUpdationList.erase(m_attrUpdationList.find(id));
-    }
-
-    if (!m_attrUpdationList.size())
-    {
-        // Notify application through callback
-        if (m_callback)
-            m_callback(m_resource->getURI(), m_id);
-
-        if (m_finishedCallback)
-            m_finishedCallback(m_id);
-    }
+    m_stopRequested = true;
+    if (m_thread)
+        m_thread->join();
 }
 
-void ResourceUpdateAutomation::stop()
+void ResourceUpdateAutomation::updateAttributes(
+        std::vector<SimulatorResourceModel::Attribute> attributes)
 {
-    // Stop all the attributes updation
-    for (auto & attrAutomation : m_attrUpdationList)
+    SimulatorResourceServerImpl *resourceImpl =
+        dynamic_cast<SimulatorResourceServerImpl *>(m_resource);
+
+    AttributeCombinationGen attrCombGen(attributes);
+    SimulatorResourceModel resModel;
+    while (!m_stopRequested && attrCombGen.next(resModel))
     {
-        (attrAutomation.second)->stop();
+        for (auto &attributeEntry : resModel.getAttributes())
+        {
+            resourceImpl->updateAttributeValue(attributeEntry.first, attributeEntry.second.getValue());
+        }
+
+        resourceImpl->notifyApp();
+        SLEEP_FOR(m_updateInterval);
     }
 
-    m_attrUpdationList.clear();
+    // Notify application
+    if (m_callback)
+        m_callback(m_resource->getURI(), m_id);
+
+    if (m_finishedCallback && !m_stopRequested)
+        m_finishedCallback(m_id);
 }
+
index ba80911..6ae1f0e 100644 (file)
@@ -66,17 +66,17 @@ class ResourceUpdateAutomation
 
         void stop();
 
-        void finished(int id);
-
     private:
+        void updateAttributes(std::vector<SimulatorResourceModel::Attribute> attributes);
+
         SimulatorResourceServer *m_resource;
         AutomationType m_type;
         int m_id;
+        bool m_stopRequested;
         int m_updateInterval;
-        SimulatorResourceModel m_resModel;
-        std::map<int, AttributeUpdateAutomationSP> m_attrUpdationList;
         updateCompleteCallback m_callback;
         std::function<void (const int)> m_finishedCallback;
+        std::thread *m_thread;
 };
 
 typedef std::shared_ptr<ResourceUpdateAutomation> ResourceUpdateAutomationSP;
index 083e67f..4f3b042 100644 (file)
@@ -66,7 +66,7 @@ void SimulatorResourceServerImpl::setObservable(bool state)
 }
 
 int SimulatorResourceServerImpl::startUpdateAutomation(AutomationType type,
-        updateCompleteCallback callback)
+        int updateInterval, updateCompleteCallback callback)
 {
     if (!callback)
     {
@@ -80,11 +80,11 @@ int SimulatorResourceServerImpl::startUpdateAutomation(AutomationType type,
         throw SimulatorException(SIMULATOR_NO_RESOURCE, "Invalid resource!");
     }
 
-    return m_updateAutomationMgr.startResourceAutomation(this, type, -1, callback);
+    return m_updateAutomationMgr.startResourceAutomation(this, type, updateInterval, callback);
 }
 
 int SimulatorResourceServerImpl::startUpdateAutomation(const std::string &attrName,
-        AutomationType type,
+        AutomationType type, int updateInterval,
         updateCompleteCallback callback)
 {
     if (!callback)
@@ -99,7 +99,7 @@ int SimulatorResourceServerImpl::startUpdateAutomation(const std::string &attrNa
         throw SimulatorException(SIMULATOR_NO_RESOURCE, "Invalid resource!");
     }
 
-    return m_updateAutomationMgr.startAttributeAutomation(this, attrName, type, -1, callback);
+    return m_updateAutomationMgr.startAttributeAutomation(this, attrName, type, updateInterval, callback);
 }
 
 std::vector<int> SimulatorResourceServerImpl::getResourceAutomationIds()
index 471ed9c..010865c 100644 (file)
@@ -41,11 +41,11 @@ class SimulatorResourceServerImpl : public SimulatorResourceServer
 
         bool isObservable() const;
 
-        int startUpdateAutomation(AutomationType type,
+        int startUpdateAutomation(AutomationType type, int updateInterval,
                                   updateCompleteCallback callback);
 
         int startUpdateAutomation(const std::string &attrName, AutomationType type,
-                                  updateCompleteCallback callback);
+                                  int updateInterval, updateCompleteCallback callback);
 
         std::vector<int> getResourceAutomationIds();