On Sat, 12 Jan 2013, Phil Dibowitz wrote:

Applied. Thanks for all your work on this!

What do you think about the attached mods to the use of set_time?

Also, what do you think about moving the pre/post web function calls into update_firmware/config()?

Scott
Move set_time() into update_configuration() as is done in update_firmware().
Additionally, use internal _set_time() when it is called from within
update_config and update_firmware().

Signed-off-by: Scott Talbert <s...@techie.net>

Index: concordance/concordance.c
===================================================================
RCS file: /cvsroot/concordance/concordance/concordance/concordance.c,v
retrieving revision 1.41.2.23
diff -u -p -r1.41.2.23 concordance.c
--- concordance/concordance.c   12 Jan 2013 23:50:32 -0000      1.41.2.23
+++ concordance/concordance.c   13 Jan 2013 02:42:49 -0000
@@ -807,11 +807,6 @@ int upload_config(struct options_t *opti
                return err;
        }
 
-       /* Set the time, after a reboot */
-       if ((err = set_time(cb, NULL))) {
-               return err;
-       }
-
        /* Tell the website we're done */
        if (!(*options).binary && !(*options).noweb) {
                if ((err = post_postconfig(cb, cb_arg))) {
Index: libconcord/libconcord.cpp
===================================================================
RCS file: /cvsroot/concordance/concordance/libconcord/libconcord.cpp,v
retrieving revision 1.42.2.24
diff -u -p -r1.42.2.24 libconcord.cpp
--- libconcord/libconcord.cpp   12 Jan 2013 23:54:55 -0000      1.42.2.24
+++ libconcord/libconcord.cpp   13 Jan 2013 02:42:49 -0000
@@ -602,8 +602,9 @@ static const uint32_t update_configurati
        LC_CB_STAGE_WRITE_CONFIG,
        LC_CB_STAGE_VERIFY_CONFIG,
        LC_CB_STAGE_RESET,
+       LC_CB_STAGE_SET_TIME,
 };
-static const int update_configuration_hid_num_stages = 6;
+static const int update_configuration_hid_num_stages = 7;
 
 static const uint32_t update_configuration_hid_noreset_stages[]={
        LC_CB_STAGE_INITIALIZE_UPDATE,
@@ -611,23 +612,26 @@ static const uint32_t update_configurati
        LC_CB_STAGE_ERASE_FLASH,
        LC_CB_STAGE_WRITE_CONFIG,
        LC_CB_STAGE_VERIFY_CONFIG,
+       LC_CB_STAGE_SET_TIME,
 };
-static const int update_configuration_hid_noreset_num_stages = 5;
+static const int update_configuration_hid_noreset_num_stages = 6;
 
 static const uint32_t update_configuration_zwave_stages[]={
        LC_CB_STAGE_INITIALIZE_UPDATE,
        LC_CB_STAGE_WRITE_CONFIG,
        LC_CB_STAGE_FINALIZE_UPDATE,
+       LC_CB_STAGE_SET_TIME,
 };
-static const int update_configuration_zwave_num_stages = 3;
+static const int update_configuration_zwave_num_stages = 4;
 
 static const uint32_t update_configuration_usbnet_stages[]={
        LC_CB_STAGE_INITIALIZE_UPDATE,
        LC_CB_STAGE_WRITE_CONFIG,
        LC_CB_STAGE_FINALIZE_UPDATE,
        LC_CB_STAGE_RESET,
+       LC_CB_STAGE_SET_TIME,
 };
-static const int update_configuration_usbnet_num_stages = 4;
+static const int update_configuration_usbnet_num_stages = 5;
 
 static const uint32_t update_firmware_hid_stages[]={
        LC_CB_STAGE_INITIALIZE_UPDATE,
@@ -893,13 +897,14 @@ int get_time()
        return 0;
 }
 
-int _set_time(lc_callback cb, void *cb_arg, uint32_t cb_stage)
+int _set_time(lc_callback cb, void *cb_arg)
 {
        const time_t t = time(NULL);
        struct tm *lt = localtime(&t);
 
        if (cb)
-               cb(cb_stage, 0, 1, 2, LC_CB_COUNTER_TYPE_STEPS, cb_arg, NULL);
+               cb(LC_CB_STAGE_SET_TIME, 0, 1, 2, LC_CB_COUNTER_TYPE_STEPS,
+                       cb_arg, NULL);
 
        rtime.second = lt->tm_sec;
        rtime.minute = lt->tm_min;
@@ -916,7 +921,8 @@ int _set_time(lc_callback cb, void *cb_a
                return err;
        }
        if (cb)
-               cb(cb_stage, 1, 2, 2, LC_CB_COUNTER_TYPE_STEPS, cb_arg, NULL);
+               cb(LC_CB_STAGE_SET_TIME, 1, 2, 2, LC_CB_COUNTER_TYPE_STEPS,
+                       cb_arg, NULL);
 
        return 0;
 }
@@ -924,7 +930,7 @@ int _set_time(lc_callback cb, void *cb_a
 int set_time(lc_callback cb, void *cb_arg)
 {
        _report_stages(cb, cb_arg, 1, NULL);
-       return _set_time(cb, cb_arg, LC_CB_STAGE_SET_TIME);
+       return _set_time(cb, cb_arg);
 }
 
 
@@ -1182,6 +1188,9 @@ int update_configuration(lc_callback cb,
        if ((err = reset_remote(cb, cb_arg)))
                return err;
 
+       if ((err = _set_time(cb, cb_arg)))
+               return err;
+
        return 0;
 }
 
@@ -1423,7 +1432,7 @@ int update_firmware(lc_callback cb, void
 
        reset_remote(cb, cb_arg);
 
-       if ((err = set_time(cb, cb_arg)))
+       if ((err = _set_time(cb, cb_arg)))
                return err;
 
        return 0;
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel

Reply via email to