]> pilppa.com Git - nws-w1.git/commitdiff
call get_data_range from client
authorMika Laitio <lamikr@pilppa.org>
Wed, 15 Aug 2012 11:19:36 +0000 (14:19 +0300)
committerMika Laitio <lamikr@pilppa.org>
Wed, 15 Aug 2012 11:19:36 +0000 (14:19 +0300)
Signed-off-by: Mika Laitio <lamikr@pilppa.org>
src_client/NetworkServiceClient_W1.cc

index 6ed247df5bdd6f0cc045da2258a65d4a2d3efb9d..7d801be3306d9c794265fbc43e87c82a3c8eed2f 100644 (file)
@@ -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 {