Preparing Lifxtest as a test benchmark; making adjustments in IoTSet for C++, etc.
[iot2.git] / benchmarks / Cpp / Lifxtest / Lifxtest.cpp
1 #include <iostream>
2 #include <chrono>
3 #include <thread>
4
5 #include "Lifxtest.hpp"
6 #include "Iterator.hpp"
7
8 Lifxtest::Lifxtest() {
9
10 }
11
12 Lifxtest::Lifxtest(IoTSet<LightBulbTest*> _lifx_light_bulb) {
13
14         lifx_light_bulb = _lifx_light_bulb;
15 }
16
17
18 Lifxtest::~Lifxtest() {
19 }
20
21
22 void Lifxtest::init() {
23
24         unordered_set<LightBulbTest*>* bulbSet = lifx_light_bulb.values();
25         for(LightBulbTest* lifx : *bulbSet) {
26
27                 lifx->init();
28                 this_thread::sleep_for (chrono::milliseconds(1000));
29
30                 for (int i = 0; i < 5; i++) {
31                         lifx->turnOff();
32                         cout << "Turning off!" << endl;
33                         this_thread::sleep_for (chrono::milliseconds(1000));
34                         lifx->turnOn();
35                         cout << "Turning on!" << endl;
36                         this_thread::sleep_for (chrono::milliseconds(1000));
37                 }
38
39                 for (int i = 2500; i < 9000; i += 100) {
40                         cout << "Adjusting Temp: ";
41                         lifx->setTemperature(i);
42                         this_thread::sleep_for (chrono::milliseconds(100));
43                 }
44
45                 for (int i = 9000; i > 2500; i -= 100) {
46                         cout << "Adjusting Temp: ";
47                         lifx->setTemperature(i);
48                         this_thread::sleep_for (chrono::milliseconds(100));
49                 }
50
51                 for (int i = 100; i > 0; i -= 10) {
52                         cout << "Adjusting Brightness: ";
53                         lifx->setColor(lifx->getHue(), lifx->getSaturation(), i);
54                         this_thread::sleep_for (chrono::milliseconds(500));
55                 }
56
57                 for (int i = 0; i < 100; i += 10) {
58                         cout << "Adjusting Brightness: " << endl;
59                         lifx->setColor(lifx->getHue(), lifx->getSaturation(), i);
60                         this_thread::sleep_for (chrono::milliseconds(500));
61                 }
62         }
63 }
64
65
66 int main(int argc, char *argv[]) {
67
68         return 0;
69 }
70
71