4 * Created on: Jun 9, 2010
9 #include <plp/retval.h>
10 #include <plp/bus/BusServer.hh>
11 #include <plp/bus/BusClient.hh>
12 #include <plp/bus/BusMessage.hh>
14 #include <plp/devicebus/client/ClientListenerImpl.hh>
15 #include <plp/devicebus/client/DeviceManagerClient.hh>
16 #include <plp/devicebus/client/DeviceManagerController.hh>
19 using namespace plpbus;
21 using namespace plpdevicebus;
23 int main(int argc, char** argv)
25 DeviceManagerController *controller;
26 const list<Device *> *dev_lst;
27 list<Device *>::iterator dev_iter;
35 controller = new DeviceManagerController();
36 if (controller != NULL) {
37 dev_lst = controller->get_device_list(&err_flg);
38 if ((err_flg == PLP_OK) &&
40 for (dev_iter = ((list<Device *> *)dev_lst)->begin(); dev_iter != ((list<Device *> *)dev_lst)->end(); dev_iter++) {
41 device = (Device *)*dev_iter;
42 id = device->get_id();
44 log_info("id: %s\n", id.c_str());
45 data = controller->get_latest_data(id, &err_flg);
47 (err_flg == PLP_OK)) {
48 log_info("latest data for device: %s\n", id.c_str());
53 log_error("Could not get latest data for device id: %s\n", id.c_str());
55 dr = controller->get_data_range(id, &err_flg);
57 data = dr->get_first();
59 log_debug("first data for device: %s\n", id.c_str());
63 data = dr->get_last();
65 log_debug("last data for device: %s\n", id.c_str());
74 log_error("Could not get device list, device list NULL or error code returned.\n");
76 //if (dev_lst != NULL)