5 #include "Lifxtest.hpp"
6 #include "LifxLightBulb.cpp"
7 #include "Iterator.hpp"
13 /*Lifxtest::Lifxtest(IoTSet<LightBulbTest*> _lifx_light_bulb) {
15 lifx_light_bulb = _lifx_light_bulb;
18 Lifxtest::Lifxtest(void** args) {
20 //lifx_light_bulb = *(IoTSet<LightBulbTest*>*) args[0];
21 lifx_light_bulb = *(IoTSet<LightBulb*>*) args[0];
24 Lifxtest::~Lifxtest() {
28 void Lifxtest::init() {
30 //unordered_set<LightBulbTest*>* bulbSet = lifx_light_bulb.values();
31 unordered_set<LightBulb*>* bulbSet = lifx_light_bulb.values();
32 //for(LightBulbTest* lifx : *bulbSet) {
33 for(LightBulb* lifx : *bulbSet) {
36 this_thread::sleep_for (chrono::milliseconds(1000));
38 for (int i = 0; i < 1; i++) {
40 cout << "Turning off!" << endl;
41 this_thread::sleep_for (chrono::milliseconds(1000));
43 cout << "Turning on!" << endl;
44 this_thread::sleep_for (chrono::milliseconds(1000));
47 /* for (int i = 2500; i < 9000; i += 100) {
48 cout << "Adjusting Temp: " << i << endl;
49 lifx->setTemperature(i);
50 this_thread::sleep_for (chrono::milliseconds(100));
53 for (int i = 9000; i > 2500; i -= 100) {
54 cout << "Adjusting Temp: " << i << endl;
55 lifx->setTemperature(i);
56 this_thread::sleep_for (chrono::milliseconds(100));
59 for (int i = 100; i > 0; i -= 10) {
60 cout << "Adjusting Brightness: " << i << endl;
61 lifx->setColor(lifx->getHue(), lifx->getSaturation(), i);
62 this_thread::sleep_for (chrono::milliseconds(500));
65 for (int i = 0; i < 100; i += 10) {
66 cout << "Adjusting Brightness: " << i << endl;
67 lifx->setColor(lifx->getHue(), lifx->getSaturation(), i);
68 this_thread::sleep_for (chrono::milliseconds(500));
74 int main(int argc, char *argv[])
77 string macAddress1 = "D073D5128E300000";
78 string devIPAddress1 = "192.168.2.126";
79 IoTDeviceAddress* devAddress1 = new IoTDeviceAddress(devIPAddress1, 12345, 56700, false, false);
80 unordered_set<IoTDeviceAddress*>* myset1 = new unordered_set<IoTDeviceAddress*>();
81 myset1->insert(devAddress1);
82 IoTSet<IoTDeviceAddress*>* setDevAddress1 = new IoTSet<IoTDeviceAddress*>(*myset1);
83 LifxLightBulb *llb1 = new LifxLightBulb(setDevAddress1, macAddress1);
84 //cout << "Generated LifxLightBulb object!" << endl;
87 string macAddress2 = "D073D50241DA0000";
88 string devIPAddress2 = "192.168.2.232";
89 IoTDeviceAddress* devAddress2 = new IoTDeviceAddress(devIPAddress2, 12346, 56700, false, false);
90 unordered_set<IoTDeviceAddress*>* myset2 = new unordered_set<IoTDeviceAddress*>();
91 myset2->insert(devAddress2);
92 IoTSet<IoTDeviceAddress*>* setDevAddress2 = new IoTSet<IoTDeviceAddress*>(*myset2);
93 LifxLightBulb *llb2 = new LifxLightBulb(setDevAddress2, macAddress2);
96 unordered_set<LightBulb*>* setLb = new unordered_set<LightBulb*>();
99 IoTSet<LightBulb*>* lbSet = new IoTSet<LightBulb*>(*setLb);
102 args[0] = (void*) lbSet;
103 Lifxtest *lt = new Lifxtest(args);
112 delete setDevAddress1;
113 delete setDevAddress2;