4 * Created on: Jun 9, 2010
11 #include <plp/retval.h>
12 #include <plp/bus/BusServer.hh>
13 #include <plp/bus/BusClient.hh>
14 #include <plp/bus/BusMessage.hh>
16 #include <plp/devicebus/client/ClientListenerImpl.hh>
17 #include <plp/devicebus/client/DeviceManagerClient.hh>
18 #include <plp/devicebus/client/DeviceManagerController.hh>
21 using namespace plpbus;
23 using namespace plpdevicebus;
25 int main(int argc, char** argv)
27 DeviceManagerController *controller;
28 const list<Device *> *dev_lst;
29 list<Device *>::iterator dev_iter;
39 controller = new DeviceManagerController();
40 if (controller != NULL) {
41 dev_lst = controller->get_device_list(&err_flg);
42 if ((err_flg == PLP_OK) &&
44 for (dev_iter = ((list<Device *> *)dev_lst)->begin(); dev_iter != ((list<Device *> *)dev_lst)->end(); dev_iter++) {
45 device = (Device *)*dev_iter;
46 id = device->get_id();
48 log_info("id: %s\n", id.c_str());
49 data = controller->get_latest_data(id, &err_flg);
51 (err_flg == PLP_OK)) {
52 log_info("latest data for device: %s\n", id.c_str());
57 log_error("Could not get latest data for device id: %s\n", id.c_str());
59 dr = controller->get_data_range(id, &err_flg);
61 data = dr->get_first();
63 log_debug("first data for device: %s\n", id.c_str());
67 data = dr->get_last();
69 log_debug("last data for device: %s\n", id.c_str());
72 edate = data->get_date();
76 edate.day = edate.day;
77 sdate.day = sdate.day - 2;
80 log_debug("first date: %s\n", sdate.to_string().c_str());
81 log_debug("last date: %s\n", edate.to_string().c_str());
82 dr2 = controller->get_data(id, &sdate, &edate, &err_flg);
91 log_error("Could not get device list, device list NULL or error code returned.\n");
93 //if (dev_lst != NULL)