From 9056ba9d1b09be0fe455e7a68e9bf6a9ce5cf88d Mon Sep 17 00:00:00 2001 From: rtrimana Date: Tue, 10 Jan 2017 14:57:31 -0800 Subject: [PATCH] Minor fixes in LifxLightBulb driver (not fully tested yet) --- benchmarks/Makefile | 1 + .../drivers/Cpp/LifxLightBulb/LifxLightBulb.hpp | 11 +++-------- iotjava/iotruntime/cpp/IoTUDP.hpp | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/benchmarks/Makefile b/benchmarks/Makefile index 74fb11a..481611c 100644 --- a/benchmarks/Makefile +++ b/benchmarks/Makefile @@ -17,6 +17,7 @@ annotation: PHONY += drivers drivers: $(MAKE) -C drivers/Java + $(MAKE) -C drivers/Cpp PHONY += Lifxtest Lifxtest: diff --git a/benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.hpp b/benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.hpp index a70a982..489fd54 100644 --- a/benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.hpp +++ b/benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.hpp @@ -438,16 +438,16 @@ class LifxLightBulb //: public LightBulb continue; } - /*socketMutex.lock(); + socketMutex.lock(); char dat[1024]; - dat = communicationSocket.receiveData(1024); + int ret = communicationSocket->receiveData(dat, 1024); // Never forget to release! socketMutex.unlock(); // A packed arrived - if (dat != null) { + if (ret != -1) { receivedPacket(dat); } @@ -459,11 +459,6 @@ class LifxLightBulb //: public LightBulb // Wait a bit as to not tie up system resources this_thread::sleep_for (chrono::milliseconds(100)); - } catch (Exception e) { - - }*/ - - } } diff --git a/iotjava/iotruntime/cpp/IoTUDP.hpp b/iotjava/iotruntime/cpp/IoTUDP.hpp index ccdb5d9..1c46ffa 100644 --- a/iotjava/iotruntime/cpp/IoTUDP.hpp +++ b/iotjava/iotruntime/cpp/IoTUDP.hpp @@ -62,7 +62,7 @@ class IoTUDP int receiveData(void* buffer, int iMaxDataLength) { unsigned short destinationPort = (unsigned short) iDstPort; - socket->recvFrom(buffer, iMaxDataLength, strHostAddress, destinationPort); + return socket->recvFrom(buffer, iMaxDataLength, strHostAddress, destinationPort); } }; #endif -- 2.34.1