// NOTE: "this" pointer is passed into the detached thread because it does not belong
// to this object anymore so if it executes certain methods of "this" object, then it needs
// the correct references to stuff
-// thread th1 (&LifxLightBulb::workerFunction, this, this);
-// th1.detach();
+ thread th1 (&LifxLightBulb::workerFunction, this, this);
+ th1.detach();
//cout << "Initialized LifxLightBulb!" << endl;
log << "Initialized LifxLightBulb!" << endl;
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) {
int64_t lastSentGetBulbVersionRequest = 0; // time last request sent
char dat[1024];
+ llb->log << "Turning off and entering while loop!" << endl;
+
while (true) {
// Check if we got the bulb version yet
// could have requested it but message could have gotten lost (UDP)
{
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;