Adding C++ field instrumentation using config file
[iot2.git] / benchmarks / drivers / Cpp / LifxLightBulb / LightBulb_Skeleton.cpp
1 #include <iostream>
2 #include "LightBulb_Skeleton.hpp"
3
4 #include <unordered_set>
5 #include "IoTSet.hpp"
6 #include "LifxLightBulb.cpp"
7 #include "IoTDeviceAddress.hpp"
8
9 // External create, destroy, and init functions
10 extern "C" void* createLightBulb_Skeleton(void** params) {
11         // Arguments: LightBulb *_mainObj, string _callbackAddress, int _port
12         return new LightBulb_Skeleton((LightBulb*) params[0], *((string*) params[1]), *((int*) params[2]));
13 }
14
15
16 extern "C" void destroyLightBulb_Skeleton(void* t) {
17         LightBulb_Skeleton* lbs = (LightBulb_Skeleton*) t;
18         delete lbs;
19 }
20
21
22 extern "C" void initLightBulb_Skeleton(void* t) {
23         LightBulb_Skeleton* lbs = (LightBulb_Skeleton*) t;
24         lbs->init();
25 }
26
27
28 int main(int argc, char *argv[])
29 {
30         // LightBulb #1
31         string macAddress1 = "D073D5128E300000";
32         string devIPAddress1 = "192.168.2.126";
33         //string macAddress1 = "D073D50241DA0000";
34         //string devIPAddress1 = "192.168.2.232";
35         IoTDeviceAddress* devAddress1 = new IoTDeviceAddress(devIPAddress1, 43583, 56700, false, false);
36         unordered_set<void*>* myset1 = new unordered_set<void*>();
37         myset1->insert(devAddress1);
38         IoTSet<void*>* setDevAddress1 = new IoTSet<void*>(myset1);
39         LifxLightBulb *llb1 = new LifxLightBulb(setDevAddress1, macAddress1);
40         //cout << "Generated LifxLightBulb object!" << endl;
41
42         string callbackAddress = "localhost";
43         int stubPort = 55179;
44         LightBulb_Skeleton *lbs = new LightBulb_Skeleton(llb1, callbackAddress, stubPort);
45         cout << "Successfully instantiated object and its skeleton!" << endl;
46
47         return 0;
48 }