projects
/
iot2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleaning up C++ slave.
[iot2.git]
/
iotjava
/
iotruntime
/
cpp
/
iotslave
/
IoTSlave.cpp
diff --git
a/iotjava/iotruntime/cpp/iotslave/IoTSlave.cpp
b/iotjava/iotruntime/cpp/iotslave/IoTSlave.cpp
index 89d99970f21ce52ec86ba529fc9761407e7432a6..e0ebcd8d8c784f13ba4c44ced08e07a5e5b9722e 100644
(file)
--- a/
iotjava/iotruntime/cpp/iotslave/IoTSlave.cpp
+++ b/
iotjava/iotruntime/cpp/iotslave/IoTSlave.cpp
@@
-5,7
+5,6
@@
IoTSlave::IoTSlave(string _serverAddress, int _serverPort, string _objectName) {
IoTSlave::IoTSlave(string _serverAddress, int _serverPort, string _objectName) {
- //isDriverObject = false; // Default to false
serverAddress = _serverAddress;
serverPort = _serverPort;
objectName = _objectName;
serverAddress = _serverAddress;
serverPort = _serverPort;
objectName = _objectName;
@@
-117,7
+116,7
@@
char* IoTSlave::recvFileIter(char* recvBuffer, int recvLen) {
void IoTSlave::openFile(string fileName) {
void IoTSlave::openFile(string fileName) {
- log.open(FILEPATH + fileName + FILEEXT);
+ log.open(
LOG
FILEPATH + fileName + FILEEXT);
}
}
@@
-203,6
+202,7
@@
void IoTSlave::instantiateMainObject() {
objMainCls = create_object(params);
writeToFile("Object created for " + mainObjectName);
init_object(objMainCls);
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);
//thread th1 (&IoTSlave::runInitObject, this, this);
//th1.detach();
//thread th1 (&IoTSlave::runInitObject, this, this);
@@
-308,7
+308,6
@@
int IoTSlave::recvInteger() {
char recvInt[sizeof(int)]; // Normally 4 bytes
// Receive and iterate until complete
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;
recvIter(recvInt, toBeReceived);
int retVal = 0;
@@
-341,7
+340,6
@@
string IoTSlave::recvString() {
char* recvStr = new char[strLen];
// Receive and iterate until complete
char* recvStr = new char[strLen];
// Receive and iterate until complete
- //writeToFile("Receiving String! Size: " + to_string(strLen));
recvIter(recvStr, strLen);
string retVal(recvStr, strLen);
recvIter(recvStr, strLen);
string retVal(recvStr, strLen);
@@
-365,7
+363,6
@@
void IoTSlave::unzipFile(string fileName) {
// TODO: perhaps we need to replace this with libzip or zlib later
writeToFile("Unzipping file!");
string chmodCmd = FILEPATH + fileName + SHELL;
// 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!");
thread th1 (std::system, chmodCmd.c_str());
th1.detach();
writeToFile("Finished unzipping file!");
@@
-391,9
+388,6
@@
string IoTSlave::recvFile() {
fileStream.write(recvFil, fileLen);
delete[] recvFil;
fileStream.close();
fileStream.write(recvFil, fileLen);
delete[] recvFil;
fileStream.close();
- // TODO: Experimental
- //string chmodCmd = FILEPATH + fileName + SHELL;
- //execv(chmodCmd.c_str(), 0);
return fileName;
}
return fileName;
}
@@
-464,8
+458,6
@@
void IoTSlave::getDeviceIoTSetObject() {
isetObject->insert(objDeviceAddress);
writeToFile("=> Inserting IoTDeviceAddress into set...");
writeToFile("==> Now we have " + to_string(isetObject->size()) + " object(s)!");
isetObject->insert(objDeviceAddress);
writeToFile("=> Inserting IoTDeviceAddress into set...");
writeToFile("==> Now we have " + to_string(isetObject->size()) + " object(s)!");
- // Set flag to true;
- //isDriverObject = true;
}
}
@@
-683,6
+675,7
@@
void IoTSlave::commIoTMaster() {
break;
case GET_ZB_DEV_IOTSET_OBJECT:
break;
case GET_ZB_DEV_IOTSET_OBJECT:
+ // TODO: Support ZigBee in the future
//getZBDevIoTSetObject();
break;
//getZBDevIoTSetObject();
break;