-
-// Functions for the main function
-void onOff(LifxLightBulb *llb) {
-
- for (int i = 0; i < 5; i++) {
- llb->turnOff();
- cout << "Turning off!" << endl;
- this_thread::sleep_for (chrono::milliseconds(1000));
- llb->turnOn();
- cout << "Turning on!" << endl;
- this_thread::sleep_for (chrono::milliseconds(1000));
- }
-}
-
-
-void adjustTemp(LifxLightBulb *llb) {
-
- for (int i = 2500; i < 9000; i += 100) {
- cout << "Adjusting Temp: " << i << endl;
- llb->setTemperature(i);
- this_thread::sleep_for (chrono::milliseconds(100));
- }
- cout << "Adjusted temperature to 9000!" << endl;
- for (int i = 9000; i > 2500; i -= 100) {
- cout << "Adjusting Temp: " << i << endl;
- llb->setTemperature(i);
- this_thread::sleep_for (chrono::milliseconds(100));
- }
- cout << "Adjusted temperature to 2500!" << endl;
-}
-
-
-void adjustBright(LifxLightBulb *llb) {
- for (int i = 100; i > 0; i -= 10) {
- cout << "Adjusting Brightness: " << i << endl;
- llb->setColor(llb->getHue(), llb->getSaturation(), i);
- this_thread::sleep_for (chrono::milliseconds(100));
- }
- cout << "Adjusted brightness to 0!" << endl;
- for (int i = 0; i < 100; i += 10) {
- cout << "Adjusting Brightness: " << i << endl;
- llb->setColor(llb->getHue(), llb->getSaturation(), i);
- this_thread::sleep_for (chrono::milliseconds(100));
- }
- cout << "Adjusting brightness to 100!" << endl;
-}
-
-
-int main(int argc, char *argv[])
-{
- string macAddress = "D073D5128E300000";
- //string macAddress = "D073D50241DA0000";
- string devIPAddress = "192.168.2.126";
- //string devIPAddress = "192.168.2.232";
- //IoTDeviceAddress devAddress(devIPAddress, 12345, 56700, false, false);
- IoTDeviceAddress* devAddress = new IoTDeviceAddress(devIPAddress, 12345, 56700, false, false);
- unordered_set<IoTDeviceAddress*> myset = { devAddress };
-
- IoTSet<IoTDeviceAddress*> setDevAddress(myset);
- LifxLightBulb *llb = new LifxLightBulb(setDevAddress, macAddress);
- cout << "Generated LifxLightBulb object!" << endl;
- llb->init();
- llb->turnOn();
- onOff(llb);
- adjustTemp(llb);
- adjustBright(llb);
-// llb->turnOff();
-
- delete devAddress;
- delete llb;
-
- return 0;
-}