IoTSlave::IoTSlave(string _serverAddress, int _serverPort, string _objectName) {
- //isDriverObject = false; // Default to false
serverAddress = _serverAddress;
serverPort = _serverPort;
objectName = _objectName;
void IoTSlave::openFile(string fileName) {
- log.open(FILEPATH + fileName + FILEEXT);
+ log.open(LOGFILEPATH + fileName + FILEEXT);
}
objMainCls = create_object(params);
writeToFile("Object created for " + mainObjectName);
init_object(objMainCls);
+ // TODO: Maybe we want to change this into multithreading at some point
//thread th1 (&IoTSlave::runInitObject, this, this);
//th1.detach();
//thread th1 (&IoTSlave::runInitObject, this, this);
char recvInt[sizeof(int)]; // Normally 4 bytes
// Receive and iterate until complete
- //writeToFile("Receiving Integer! Size: " + to_string(toBeReceived));
recvIter(recvInt, toBeReceived);
int retVal = 0;
char* recvStr = new char[strLen];
// Receive and iterate until complete
- //writeToFile("Receiving String! Size: " + to_string(strLen));
recvIter(recvStr, strLen);
string retVal(recvStr, strLen);
// TODO: perhaps we need to replace this with libzip or zlib later
writeToFile("Unzipping file!");
string chmodCmd = FILEPATH + fileName + SHELL;
- //std::system(chmodCmd.c_str());
thread th1 (std::system, chmodCmd.c_str());
th1.detach();
writeToFile("Finished unzipping file!");
fileStream.write(recvFil, fileLen);
delete[] recvFil;
fileStream.close();
- // TODO: Experimental
- //string chmodCmd = FILEPATH + fileName + SHELL;
- //execv(chmodCmd.c_str(), 0);
return fileName;
}
isetObject->insert(objDeviceAddress);
writeToFile("=> Inserting IoTDeviceAddress into set...");
writeToFile("==> Now we have " + to_string(isetObject->size()) + " object(s)!");
- // Set flag to true;
- //isDriverObject = true;
}
break;
case GET_ZB_DEV_IOTSET_OBJECT:
+ // TODO: Support ZigBee in the future
//getZBDevIoTSetObject();
break;