From: Mika Laitio Date: Wed, 15 Aug 2012 11:19:36 +0000 (+0300) Subject: call get_data_range from client X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=9f8e02c9fa3127e75aef6d22e699894c495b4c42;p=nws-w1.git call get_data_range from client Signed-off-by: Mika Laitio --- diff --git a/src_client/NetworkServiceClient_W1.cc b/src_client/NetworkServiceClient_W1.cc index 6ed247d..7d801be 100644 --- a/src_client/NetworkServiceClient_W1.cc +++ b/src_client/NetworkServiceClient_W1.cc @@ -29,6 +29,7 @@ int main(int argc, char** argv) string id; int err_flg; Data *data; + DataRange *dr; dev_lst = NULL; controller = new DeviceManagerController(); @@ -44,13 +45,29 @@ int main(int argc, char** argv) data = controller->get_latest_data(id, &err_flg); if ((data != NULL) && (err_flg == PLP_OK)) { - log_info("latest data:\n"); + log_info("latest data for device: %s\n", id.c_str()); data->printout(); delete(data); } else { log_error("Could not get latest data for device id: %s\n", id.c_str()); } + dr = controller->get_data_range(id, &err_flg); + if (dr != NULL) { + data = dr->get_first(); + if (data != NULL) { + log_debug("first data for device: %s\n", id.c_str()); + data->printout(); + delete(data); + } + data = dr->get_last(); + if (data != NULL) { + log_debug("last data for device: %s\n", id.c_str()); + data->printout(); + delete(data); + } + } + delete(dr); } } else {