int retLen = 0;
char* retObjBytes = NULL;
retObjBytes = rmiClient->receiveBytes(retObjBytes, &retLen);
+ IoTRMIUtil::printBytes(retObjBytes, retLen, false);
retObj = IoTRMIUtil::getParamObject(retObj, retType.c_str(), retObjBytes, retLen);
}
// Find the parameter length
int paramLen = rmiUtil->getTypeSize(paramCls[i]);
if (paramLen == -1) { // Store the length of the field - indefinite length
- 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<string>*) paramObj[i]);
- } else {
- string error = "IoTRMICall: Unrecognizable type: " + paramCls[i];
- throw error;
- }
+ paramLen = rmiUtil->getVarTypeSize(paramCls[i], paramObj[i]);
// Some space for param length, i.e. 32 bits for integer
methodLen = methodLen + IoTRMIUtil::PARAM_LEN;
}
// Find the parameter length
int paramLen = rmiUtil->getTypeSize(paramCls[i]);
if (paramLen == -1) { // Store the length of the field - indefinite length
- 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<string>*) paramObj[i]);
- } else {
- string error = "IoTRMICall: Unrecognizable type: " + paramCls[i];
- throw error;
- }
+ paramLen = rmiUtil->getVarTypeSize(paramCls[i], paramObj[i]);
// Write the parameter length
char prmLenBytes[IoTRMIUtil::METHOD_ID_LEN];
IoTRMIUtil::intToByteArray(paramLen, prmLenBytes);