FIELD_TYPE_2=IoTRelation
# Language
-LANGUAGE=Java
+LANGUAGE=C++
//Room* rs = (Room*) *itr;
RoomSmart* rs = (RoomSmart*) *itr;
log << "Getting Room! ID: " << rs->getRoomID() << endl;
- auto itrLight = roomLightRel->find(rs);
+ //auto itrLight = roomLightRel->find(rs);
- if (itrLight == roomLightRel->end())
+ /*if (itrLight == roomLightRel->end())
log << "No match!" << endl;
//while (itrLight != roomLightRel->end()) {
else {
this_thread::sleep_for (chrono::milliseconds(500));
}
//++itrLight;
- }
+ }*/
log << "End of one LightBulb!" << endl << endl;
}
include $(BASE)/common.mk
-all: so-lifxtest-arm so-lightstub-arm so-roomstub-arm zip
+all: so-lifxtest so-lightstub so-roomstub zip
ARGS = -shared -fpic
# Lifxtest .so file will be generated for ARM (Raspberry Pi)
+PHONY += so-lifxtest
+so-lifxtest:
+ $(G++) $(ARGS) ./Lifxtest.cpp $(BASE)/iotjava/iotruntime/cpp/socket/Socket.cpp -o $(BIN_DIR)/Lifxtest/Lifxtest.so --std=c++11 -pthread -pg -I$(BASE)/iotjava/iotruntime/cpp/ -I$(BASE)/iotjava/iotruntime/cpp/socket/ -I$(BASE)/iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/iotjava/iotrmi/C++/ -I$(BASE)/benchmarks/virtuals/ -I$(BASE)/benchmarks/drivers/Cpp/LifxLightBulb/ -I$(BASE)/benchmarks/drivers/Cpp/LabRoom/
+ cp ./Lifxtest.config $(BIN_DIR)/Lifxtest
+
+# Lifxtest .so file will be generated for ARM (Raspberry Pi) using a cross-compiler
PHONY += so-lifxtest-arm
so-lifxtest-arm:
$(ARM_G++) $(ARGS) ./Lifxtest.cpp $(BASE)/iotjava/iotruntime/cpp/socket/Socket.cpp -o $(BIN_DIR)/Lifxtest/Lifxtest.so --std=c++11 -pthread -pg -I$(BASE)/iotjava/iotruntime/cpp/ -I$(BASE)/iotjava/iotruntime/cpp/socket/ -I$(BASE)/iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/iotjava/iotrmi/C++/ -I$(BASE)/benchmarks/virtuals/ -I$(BASE)/benchmarks/drivers/Cpp/LifxLightBulb/ -I$(BASE)/benchmarks/drivers/Cpp/LabRoom/
cp ./Lifxtest.config $(BIN_DIR)/Lifxtest
# Light stub .so file will be generated for ARM (Raspberry Pi)
+PHONY += so-lightstub
+so-lightstub:
+ $(G++) $(ARGS) ./LightBulbTest_Stub.cpp $(BASE)/iotjava/iotruntime/cpp/socket/Socket.cpp -o $(BIN_DIR)/Lifxtest/LightBulbTest_Stub.so --std=c++11 -pthread -pg -I$(BASE)/iotjava/iotruntime/cpp/ -I$(BASE)/iotjava/iotruntime/cpp/socket/ -I$(BASE)/iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/iotjava/iotrmi/C++/ -I$(BASE)/benchmarks/virtuals/
+ cp ./Lifxtest.config $(BIN_DIR)/Lifxtest
+
+# Light stub .so file will be generated for ARM (Raspberry Pi) using a cross-compiler
PHONY += so-lightstub-arm
so-lightstub-arm:
$(ARM_G++) $(ARGS) ./LightBulbTest_Stub.cpp $(BASE)/iotjava/iotruntime/cpp/socket/Socket.cpp -o $(BIN_DIR)/Lifxtest/LightBulbTest_Stub.so --std=c++11 -pthread -pg -I$(BASE)/iotjava/iotruntime/cpp/ -I$(BASE)/iotjava/iotruntime/cpp/socket/ -I$(BASE)/iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/iotjava/iotrmi/C++/ -I$(BASE)/benchmarks/virtuals/
cp ./Lifxtest.config $(BIN_DIR)/Lifxtest
# Room stub .so file will be generated for ARM (Raspberry Pi)
+PHONY += so-roomstub
+so-roomstub:
+ $(G++) $(ARGS) ./RoomSmart_Stub.cpp $(BASE)/iotjava/iotruntime/cpp/socket/Socket.cpp -o $(BIN_DIR)/Lifxtest/RoomSmart_Stub.so --std=c++11 -pthread -pg -I$(BASE)/iotjava/iotruntime/cpp/ -I$(BASE)/iotjava/iotruntime/cpp/socket/ -I$(BASE)/iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/iotjava/iotrmi/C++/ -I$(BASE)/benchmarks/virtuals/
+ cp ./Lifxtest.config $(BIN_DIR)/Lifxtest
+
+# Room stub .so file will be generated for ARM (Raspberry Pi) using a cross-compiler
PHONY += so-roomstub-arm
so-roomstub-arm:
$(ARM_G++) $(ARGS) ./RoomSmart_Stub.cpp $(BASE)/iotjava/iotruntime/cpp/socket/Socket.cpp -o $(BIN_DIR)/Lifxtest/RoomSmart_Stub.so --std=c++11 -pthread -pg -I$(BASE)/iotjava/iotruntime/cpp/ -I$(BASE)/iotjava/iotruntime/cpp/socket/ -I$(BASE)/iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/iotjava/iotrmi/C++/ -I$(BASE)/benchmarks/virtuals/
FIELD_NUMBER=0
# Language
-#LANGUAGE=C++
+LANGUAGE=C++
# Language (fine-grained flags)
-LANGUAGE_LabRoomRM1=C++
-LANGUAGE_LabRoomRM2=C++
+#LANGUAGE_LabRoomRM1=C++
+#LANGUAGE_LabRoomRM2=C++
}
switch (methodId) {
case 0: {
- thread th0 (&Room_Skeleton::___getRoomID, std::ref(skel), skel);
+ thread th0 (&Room_Skeleton::___getRoomID, skel, skel);
th0.detach(); break;
}
default:
# Skeleton/original interface
INTERFACE_CLASS=LightBulb
# Stub
-#INTERFACE_STUB_CLASS=LightBulbTest # This one is needed for Lifxtest application
-INTERFACE_STUB_CLASS=LightBulbSmart # This one is needed for SmartLightsController application
+# LightBulbTest is for Lifxtest and LightBulbSmart is for SmartLightsController
+INTERFACE_STUB_CLASS=LightBulbTest
+#INTERFACE_STUB_CLASS=LightBulbSmart
# For C++ instrumentation
FIELD_NUMBER=1
FIELD_TYPE_0=IoTSet
# Language
-LANGUAGE=Java
-#LANGUAGE=C++
+#LANGUAGE=Java
+LANGUAGE=C++
# Language (fine-grained flags)
#LANGUAGE_LifxLightBulbLB1=C++
#LANGUAGE_LifxLightBulbLB1=Java
recHeader.setFromBytes(headerBytes);
// load the payload bytes (strip away the header)
- //char payloadBytes[recHeader.getSize()];
char* payloadBytes = new char[recHeader.getSize()];
for (int i = 36; i < recHeader.getSize(); i++) {
payloadBytes[i - 36] = packetData[i];
int type = recHeader.getType();
//cout << "Received: " << type << endl;
+ log << "Received: " << type << endl;
DeviceStateService* dat = NULL;
switch (type) {
}
-int main(int argc, char *argv[])
+/*int main(int argc, char *argv[])
{
string macAddress1 = "D073D5128E300000";
//string macAddress = "D073D50241DA0000";
- string devIPAddress1 = "192.168.2.126";
- //string devIPAddress = "192.168.2.232";
+ string devIPAddress1 = "192.168.1.126";
+ //string devIPAddress = "192.168.1.232";
IoTDeviceAddress* devAddress1 = new IoTDeviceAddress(devIPAddress1, 12345, 56700, false, false);
unordered_set<void*>* myset1 = new unordered_set<void*>();
myset1->insert(devAddress1);
LifxLightBulb *llb1 = new LifxLightBulb(setDevAddress1, macAddress1);
cout << "Generated LifxLightBulb object!" << endl;
llb1->init();
+ cout << "Initialized!" << endl;
llb1->turnOn();
+ cout << "Turning on!" << endl;
onOff(llb1);
- adjustTemp(llb1);
- adjustBright(llb1);
-// llb->turnOff();
+// adjustTemp(llb1);
+// adjustBright(llb1);
+ llb1->turnOff();
// delete devAddress1;
// delete llb1;
return 0;
-}
+}*/
}
switch (methodId) {
case 0: {
- thread th0 (&LightBulb_Skeleton::___init, std::ref(skel), skel);
+ thread th0 (&LightBulb_Skeleton::___init, skel, skel);
th0.detach(); break;
}
case 1: {
- thread th1 (&LightBulb_Skeleton::___turnOff, std::ref(skel), skel);
+ thread th1 (&LightBulb_Skeleton::___turnOff, skel, skel);
th1.detach(); break;
}
case 2: {
- thread th2 (&LightBulb_Skeleton::___turnOn, std::ref(skel), skel);
+ thread th2 (&LightBulb_Skeleton::___turnOn, skel, skel);
th2.detach(); break;
}
case 3: {
- thread th3 (&LightBulb_Skeleton::___getState, std::ref(skel), skel);
+ thread th3 (&LightBulb_Skeleton::___getState, skel, skel);
th3.detach(); break;
}
case 4: {
- thread th4 (&LightBulb_Skeleton::___setColor, std::ref(skel), skel);
+ thread th4 (&LightBulb_Skeleton::___setColor, skel, skel);
th4.detach(); break;
}
case 5: {
- thread th5 (&LightBulb_Skeleton::___setTemperature, std::ref(skel), skel);
+ thread th5 (&LightBulb_Skeleton::___setTemperature, skel, skel);
th5.detach(); break;
}
case 6: {
- thread th6 (&LightBulb_Skeleton::___getBrightness, std::ref(skel), skel);
+ thread th6 (&LightBulb_Skeleton::___getBrightness, skel, skel);
th6.detach(); break;
}
case 7: {
- thread th7 (&LightBulb_Skeleton::___getHue, std::ref(skel), skel);
+ thread th7 (&LightBulb_Skeleton::___getHue, skel, skel);
th7.detach(); break;
}
case 8: {
- thread th8 (&LightBulb_Skeleton::___getSaturation, std::ref(skel), skel);
+ thread th8 (&LightBulb_Skeleton::___getSaturation, skel, skel);
th8.detach(); break;
}
case 9: {
- thread th9 (&LightBulb_Skeleton::___getTemperature, std::ref(skel), skel);
+ thread th9 (&LightBulb_Skeleton::___getTemperature, skel, skel);
th9.detach(); break;
}
case 10: {
- thread th10 (&LightBulb_Skeleton::___getBrightnessRangeLowerBound, std::ref(skel), skel);
+ thread th10 (&LightBulb_Skeleton::___getBrightnessRangeLowerBound, skel, skel);
th10.detach(); break;
}
case 11: {
- thread th11 (&LightBulb_Skeleton::___getBrightnessRangeUpperBound, std::ref(skel), skel);
+ thread th11 (&LightBulb_Skeleton::___getBrightnessRangeUpperBound, skel, skel);
th11.detach(); break;
}
case 12: {
- thread th12 (&LightBulb_Skeleton::___getHueRangeLowerBound, std::ref(skel), skel);
+ thread th12 (&LightBulb_Skeleton::___getHueRangeLowerBound, skel, skel);
th12.detach(); break;
}
case 13: {
- thread th13 (&LightBulb_Skeleton::___getHueRangeUpperBound, std::ref(skel), skel);
+ thread th13 (&LightBulb_Skeleton::___getHueRangeUpperBound, skel, skel);
th13.detach(); break;
}
case 14: {
- thread th14 (&LightBulb_Skeleton::___getSaturationRangeLowerBound, std::ref(skel), skel);
+ thread th14 (&LightBulb_Skeleton::___getSaturationRangeLowerBound, skel, skel);
th14.detach(); break;
}
case 15: {
- thread th15 (&LightBulb_Skeleton::___getSaturationRangeUpperBound, std::ref(skel), skel);
+ thread th15 (&LightBulb_Skeleton::___getSaturationRangeUpperBound, skel, skel);
th15.detach(); break;
}
case 16: {
- thread th16 (&LightBulb_Skeleton::___getTemperatureRangeLowerBound, std::ref(skel), skel);
+ thread th16 (&LightBulb_Skeleton::___getTemperatureRangeLowerBound, skel, skel);
th16.detach(); break;
}
case 17: {
- thread th17 (&LightBulb_Skeleton::___getTemperatureRangeUpperBound, std::ref(skel), skel);
+ thread th17 (&LightBulb_Skeleton::___getTemperatureRangeUpperBound, skel, skel);
th17.detach(); break;
}
default:
int main() {
return 0;
}
+
include $(BASE)/common.mk
-all: so-light-arm so-lightskel-arm lightzip so-labroom-arm so-labroomskel-arm labroomzip
+all: so-light so-lightskel lightzip so-labroom so-labroomskel labroomzip
ARGS = -shared -fpic
# LightBulb
# LifxLightBulb .so file will be generated for ARM (Raspberry Pi)
+PHONY += so-light
+so-light:
+ cd LifxLightBulb/; $(G++) $(ARGS) ./LifxLightBulb.cpp $(BASE)/../iotjava/iotruntime/cpp/socket/Socket.cpp -o ../$(BIN_DIR)/iotcode/LifxLightBulb/LifxLightBulb.so --std=c++11 -pthread -pg -I$(BASE)/../iotjava/iotruntime/cpp/ -I$(BASE)/../iotjava/iotruntime/cpp/socket/ -I$(BASE)/../iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/../iotjava/iotrmi/C++/ -I$(BASE)/../benchmarks/virtuals/
+ cp LifxLightBulb/LifxLightBulb.config $(BIN_DIR)/iotcode/LifxLightBulb
+
+# LifxLightBulb skeleton .so file will be generated for ARM (Raspberry Pi)
+PHONY += so-lightskel
+so-lightskel:
+ cd LifxLightBulb/; $(G++) $(ARGS) ./LightBulb_Skeleton.cpp $(BASE)/../iotjava/iotruntime/cpp/socket/Socket.cpp -o ../$(BIN_DIR)/iotcode/LifxLightBulb/LightBulb_Skeleton.so --std=c++11 -pthread -pg -I$(BASE)/../iotjava/iotruntime/cpp/ -I$(BASE)/../iotjava/iotruntime/cpp/socket/ -I$(BASE)/../iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/../iotjava/iotrmi/C++/ -I$(BASE)/../benchmarks/virtuals/
+ cp LifxLightBulb/LifxLightBulb.config $(BIN_DIR)/iotcode/LifxLightBulb
+
+# LifxLightBulb .so file will be generated for ARM (Raspberry Pi) using a cross-compiler
PHONY += so-light-arm
so-light-arm:
cd LifxLightBulb/; $(ARM_G++) $(ARGS) ./LifxLightBulb.cpp $(BASE)/../iotjava/iotruntime/cpp/socket/Socket.cpp -o ../$(BIN_DIR)/iotcode/LifxLightBulb/LifxLightBulb.so --std=c++11 -pthread -pg -I$(BASE)/../iotjava/iotruntime/cpp/ -I$(BASE)/../iotjava/iotruntime/cpp/socket/ -I$(BASE)/../iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/../iotjava/iotrmi/C++/ -I$(BASE)/../benchmarks/virtuals/
# LabRoom
# LabRoom .so file will be generated for ARM (Raspberry Pi)
+PHONY += so-labroom
+so-labroom:
+ cd LabRoom/; $(G++) $(ARGS) ./LabRoom.cpp $(BASE)/../iotjava/iotruntime/cpp/socket/Socket.cpp -o ../$(BIN_DIR)/iotcode/LabRoom/LabRoom.so --std=c++11 -pthread -pg -I$(BASE)/../iotjava/iotruntime/cpp/ -I$(BASE)/../iotjava/iotruntime/cpp/socket/ -I$(BASE)/../iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/../iotjava/iotrmi/C++/ -I$(BASE)/../benchmarks/virtuals/
+ cp LabRoom/LabRoom.config $(BIN_DIR)/iotcode/LabRoom
+
+# LabRoom skeleton .so file will be generated for ARM (Raspberry Pi)
+PHONY += so-labroomskel
+so-labroomskel:
+ cd LabRoom/; $(G++) $(ARGS) ./Room_Skeleton.cpp $(BASE)/../iotjava/iotruntime/cpp/socket/Socket.cpp -o ../$(BIN_DIR)/iotcode/LabRoom/Room_Skeleton.so --std=c++11 -pthread -pg -I$(BASE)/../iotjava/iotruntime/cpp/ -I$(BASE)/../iotjava/iotruntime/cpp/socket/ -I$(BASE)/../iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/../iotjava/iotrmi/C++/ -I$(BASE)/../benchmarks/virtuals/
+ cp LabRoom/LabRoom.config $(BIN_DIR)/iotcode/LabRoom
+
+# LabRoom .so file will be generated for ARM (Raspberry Pi) using a cross-compiler
PHONY += so-labroom-arm
so-labroom-arm:
cd LabRoom/; $(ARM_G++) $(ARGS) ./LabRoom.cpp $(BASE)/../iotjava/iotruntime/cpp/socket/Socket.cpp -o ../$(BIN_DIR)/iotcode/LabRoom/LabRoom.so --std=c++11 -pthread -pg -I$(BASE)/../iotjava/iotruntime/cpp/ -I$(BASE)/../iotjava/iotruntime/cpp/socket/ -I$(BASE)/../iotjava/iotruntime/cpp/setrelation/ -I$(BASE)/../iotjava/iotrmi/C++/ -I$(BASE)/../benchmarks/virtuals/
# Skeleton/original interface
INTERFACE_CLASS=LightBulb
# Stub
-#INTERFACE_STUB_CLASS=LightBulbTest # This one is needed for Lifxtest application
-INTERFACE_STUB_CLASS=LightBulbSmart # This one is needed for SmartLightsController application
+# LightBulbTest is for Lifxtest and LightBulbSmart is for SmartLightsController
+INTERFACE_STUB_CLASS=LightBulbTest
+#INTERFACE_STUB_CLASS=LightBulbSmart
# For C++ instrumentation
FIELD_NUMBER=1
-G++ := g++
+G++ := g++-4.9
+#G++ := g++
ARM_G++ := arm-linux-gnueabihf-g++
JAVA := java
JAR := jar
PHONY += cpp
cpp:
$(G++) $(GCCFLAGS) -o IoTSlave.o IoTSlave.cpp $(INCLUDE) $(CCCLINKERFLAGS)
+ cp IoTSlave.o $(BASE)/bin/iotruntime/slave/
PHONY += cpp-arm
cpp-arm: