7 #include "LifxLightBulb.hpp"
9 #include "IoTDeviceAddress.hpp"
13 void run(LifxLightBulb *llb) {
19 void *prun(void *llb) {
21 ((LifxLightBulb*)llb)->init();
25 void onOff(LifxLightBulb *llb) {
27 for (int i = 0; i < 5; i++) {
29 cout << "Turning off!" << endl;
30 this_thread::sleep_for (chrono::milliseconds(1000));
32 cout << "Turning on!" << endl;
33 this_thread::sleep_for (chrono::milliseconds(1000));
38 void adjustTemp(LifxLightBulb *llb) {
40 for (int i = 2500; i < 9000; i += 100) {
41 cout << "Adjusting Temp: " << i << endl;
42 llb->setTemperature(i);
43 this_thread::sleep_for (chrono::milliseconds(100));
45 cout << "Adjusted temperature to 9000!" << endl;
46 for (int i = 9000; i > 2500; i -= 100) {
47 cout << "Adjusting Temp: " << i << endl;
48 llb->setTemperature(i);
49 this_thread::sleep_for (chrono::milliseconds(100));
51 cout << "Adjusted temperature to 2500!" << endl;
55 void adjustBright(LifxLightBulb *llb) {
56 for (int i = 100; i > 0; i -= 10) {
57 cout << "Adjusting Brightness: " << i << endl;
58 llb->setColor(llb->getHue(), llb->getSaturation(), i);
59 this_thread::sleep_for (chrono::milliseconds(100));
61 cout << "Adjusted brightness to 0!" << endl;
62 for (int i = 0; i < 100; i += 10) {
63 cout << "Adjusting Brightness: " << i << endl;
64 llb->setColor(llb->getHue(), llb->getSaturation(), i);
65 this_thread::sleep_for (chrono::milliseconds(100));
67 cout << "Adjusting brightness to 100!" << endl;
71 int main(int argc, char *argv[])
73 string macAddress = "D073D5128E300000";
74 //string macAddress = "D073D50241DA0000";
75 string devIPAddress = "192.168.2.126";
76 //string devIPAddress = "192.168.2.232";
77 //IoTDeviceAddress devAddress(devIPAddress, 12345, 56700, false, false);
78 IoTDeviceAddress* devAddress = new IoTDeviceAddress(devIPAddress, 12345, 56700, false, false);
79 unordered_set<IoTDeviceAddress*> myset = { devAddress };
81 IoTSet<IoTDeviceAddress*> setDevAddress(myset);
82 LifxLightBulb *llb = new LifxLightBulb(setDevAddress, macAddress);
85 cout << "Generated LifxLightBulb object!" << endl;