]> pilppa.com Git - nws-w1.git/commitdiff
add test method for querying data between dates
authorMika Laitio <lamikr@pilppa.org>
Wed, 15 Aug 2012 20:05:13 +0000 (23:05 +0300)
committerMika Laitio <lamikr@pilppa.org>
Wed, 15 Aug 2012 20:05:13 +0000 (23:05 +0300)
Signed-off-by: Mika Laitio <lamikr@pilppa.org>
src_client/NetworkServiceClient_W1.cc

index 7d801be3306d9c794265fbc43e87c82a3c8eed2f..44dcd731154ba0a60bcf6a639a39dc49b6a0ad4e 100644 (file)
@@ -30,6 +30,8 @@ int main(int argc, char** argv)
        int                             err_flg;
        Data                            *data;
        DataRange                       *dr;
+       Date                            sdate;
+       Date                            edate;
 
        dev_lst         = NULL;
        controller      = new DeviceManagerController();
@@ -64,10 +66,23 @@ int main(int argc, char** argv)
                                        if (data != NULL) {
                                                log_debug("last data for device: %s\n", id.c_str());
                                                data->printout();
+
+                                               edate   = data->get_date();
                                                delete(data);
+
+                                               edate.copy(&sdate);
+                                               edate.day       = edate.day;
+                                               sdate.day       = sdate.day - 2;
+                                               DataRange       *dr2;
+
+                                               log_debug("first date: %s\n", sdate.to_string().c_str());
+                                               log_debug("last date: %s\n", edate.to_string().c_str());
+                                               dr2     = controller->get_data(id, &sdate, &edate, &err_flg);
+                                               dr2->printout();
+                                               delete(dr2);
                                        }
+                                       delete(dr);
                                }
-                               delete(dr);
                        }
                }
                else {