Adding permission check and error throw in C++
[iot2.git] / iotjava / iotrmi / C++ / IoTRMIObject.hpp
index 27931cbd0b0d78f51dff057edfc4c27d8e744db4..8e688a3b128319efce9543c6e4e283cb0bb83c6b 100644 (file)
@@ -35,6 +35,7 @@ class IoTRMIObject {
                int                                     getObjectId();
                static int                      getObjectId(char* methodBytes);
                int                                     getMethodId();
+               static int                      getMethodId(char* methodBytes);
                void**                          getMethodParams(string paramCls[], int numParam, void* paramObj[]);
 
        private:
@@ -175,6 +176,20 @@ int IoTRMIObject::getMethodId() {
 }
 
 
+// Get methodId from bytes (static version)
+int IoTRMIObject::getMethodId(char* methodBytes) {
+
+       // Get method Id
+       char methodIdBytes[IoTRMIUtil::METHOD_ID_LEN];
+       memcpy(methodIdBytes, methodBytes + IoTRMIUtil::OBJECT_ID_LEN, IoTRMIUtil::METHOD_ID_LEN);
+       // Get method signature 
+       int methodId = 0;
+       IoTRMIUtil::byteArrayToInt(&methodId, methodIdBytes);
+       
+       return methodId;
+}
+
+
 // Get method parameters and return an array of parameter objects
 //
 // For primitive objects: