X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=blobdiff_plain;f=iotjava%2Fiotrmi%2FC%2B%2B%2FIoTRMICall.hpp;h=eb767dd5a84f8c4f2fed0037df3582c9c4b1a08c;hp=8503cdf211f4ff6f94e31bda37601233ec86e55d;hb=b6effa890ccb61eb4b7a82f0dd7493cac354ef49;hpb=6af259f06ec3a02ae9195099afc5b2dfc71f274f diff --git a/iotjava/iotrmi/C++/IoTRMICall.hpp b/iotjava/iotrmi/C++/IoTRMICall.hpp index 8503cdf..eb767dd 100644 --- a/iotjava/iotrmi/C++/IoTRMICall.hpp +++ b/iotjava/iotrmi/C++/IoTRMICall.hpp @@ -90,7 +90,7 @@ void* IoTRMICall::remoteCall(string methodSign, string retType, string paramCls[ int retLen = 0; char* retObjBytes = NULL; retObjBytes = rmiClient->receiveBytes(retObjBytes, &retLen); - retObj = IoTRMIUtil::getParamObject(retObj, retType.c_str(), retObjBytes); + retObj = IoTRMIUtil::getParamObject(retObj, retType.c_str(), retObjBytes, retLen); } return retObj; @@ -110,6 +110,11 @@ int IoTRMICall::methodLength(string paramCls[], void* paramObj[], int numParam) if (paramCls[i].compare("string") == 0) { // Get the length of the string through void* casting to string* paramLen = (*(string*)paramObj[i]).length(); + } else if (paramCls[i].compare("string[]") == 0) { + paramLen = IoTRMIUtil::getByteStringLength(*(vector*) paramObj[i]); + } else { + string error = "IoTRMICall: Unrecognizable type: " + paramCls[i]; + throw error; } // Some space for param length, i.e. 32 bits for integer methodLen = methodLen + IoTRMIUtil::PARAM_LEN; @@ -139,6 +144,11 @@ char* IoTRMICall::methodToBytes(string methodSign, string paramCls[], if (paramCls[i].compare("string") == 0) { // Get the length of the string through void* casting to string* paramLen = (*(string*)paramObj[i]).length(); + } else if (paramCls[i].compare("string[]") == 0) { + paramLen = IoTRMIUtil::getByteStringLength(*(vector*) paramObj[i]); + } else { + string error = "IoTRMICall: Unrecognizable type: " + paramCls[i]; + throw error; } // Write the parameter length char prmLenBytes[IoTRMIUtil::METHOD_ID_LEN];