On Thu, 26 Jul 2012, Phil Dibowitz wrote:
On 07/26/2012 06:29 PM, Scott Talbert wrote:I can see your point about the utility of the GUI. Phil, what are your feelings on changing the API a bit to retain the same the usability of Congruity?I'm not against it in theory, but in practice, the only way of doing it I came up with wasn't that pretty and was going to be a huge amount of time to do, and I just didn't feel it was worth it. Having 5 or 6 steps pop up, IMO, isn't that big a deal. The important part is showing progress. It seemed more of a small nicety than anything else. As long as the user sees things are happening, it's not a big deal - to me.
I've got a proposed libconcord API change to better allow Congruity to keep its current usability (see attached patch). Basically, I added a get_stages() method that will allow Congruity to find out what stages will be executed for a given remote and operation file. Since there are really only 2 variations (zwave and not) and we only support firmware updates for non-zwave right now, I don't think this is a big deal to maintain, especially since it shouldn't really change much, if it all.
Let me know if you think this is reasonable. I have a Congruity implemented around this that seems to work well.
Scott
Add a get_stages() API call which will return the set of stages that will be performed for a given operation file and remote. At the moment, only config updates (pure HID & Zwave) and firmware updates (pure HID) are supported. Signed-off-by: Scott Talbert <s...@techie.net> Index: libconcord/libconcord.cpp =================================================================== RCS file: /cvsroot/concordance/concordance/libconcord/libconcord.cpp,v retrieving revision 1.42.2.22 diff -u -p -r1.42.2.22 libconcord.cpp --- libconcord/libconcord.cpp 15 Jul 2012 07:17:08 -0000 1.42.2.22 +++ libconcord/libconcord.cpp 1 Nov 2012 00:15:35 -0000 @@ -593,6 +593,94 @@ void _report_number_of_stages(lc_callbac cb(LC_CB_STAGE_NUM_STAGES, num, 0, 0, 0, cb_arg); } +static const uint32_t update_configuration_hid_stages[]={ + LC_CB_STAGE_INITIALIZE_UPDATE, + LC_CB_STAGE_INVALIDATE_FLASH, + LC_CB_STAGE_ERASE_FLASH, + LC_CB_STAGE_WRITE_CONFIG, + LC_CB_STAGE_VERIFY_CONFIG, + LC_CB_STAGE_RESET, +}; +static const int update_configuration_hid_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, +}; +static const int update_configuration_zwave_num_stages = 3; + +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, +}; +static const int update_configuration_usbnet_num_stages = 4; + +static const uint32_t update_firmware_hid_stages[]={ + LC_CB_STAGE_INITIALIZE_UPDATE, + LC_CB_STAGE_INVALIDATE_FLASH, + LC_CB_STAGE_ERASE_FLASH, + LC_CB_STAGE_WRITE_FIRMWARE, + LC_CB_STAGE_FINALIZE_UPDATE, + LC_CB_STAGE_RESET, + LC_CB_STAGE_SET_TIME, +}; +static const int update_firmware_hid_num_stages = 7; + +static const uint32_t update_firmware_hid_direct_stages[]={ + LC_CB_STAGE_INVALIDATE_FLASH, + LC_CB_STAGE_ERASE_FLASH, + LC_CB_STAGE_WRITE_FIRMWARE, + LC_CB_STAGE_RESET, + LC_CB_STAGE_SET_TIME, +}; +static const int update_firmware_hid_direct_num_stages = 5; + +int get_stages(int file_type, const uint32_t **stages, int *num_stages) +{ + if (!rmt) { + return LC_ERROR; + } + + if (file_type == LC_FILE_TYPE_CONFIGURATION) { + if (is_usbnet_remote()) { + *stages = update_configuration_usbnet_stages; + *num_stages = update_configuration_usbnet_num_stages; + } + else if (is_z_remote()) { + *stages = update_configuration_zwave_stages; + *num_stages = update_configuration_zwave_num_stages; + } + else { + *stages = update_configuration_hid_stages; + *num_stages = update_configuration_hid_num_stages; + } + return 0; + } + else if (file_type == LC_FILE_TYPE_FIRMWARE) { + if (is_z_remote()) { + return LC_ERROR_UNSUPP; + } + else { + if (!is_fw_update_supported(0)) { /* indirect */ + *stages = update_firmware_hid_stages; + *num_stages = update_firmware_hid_num_stages; + } + else { /* direct */ + *stages = update_firmware_hid_direct_stages; + *num_stages = + update_firmware_hid_direct_num_stages; + } + return 0; + } + } + else { + return LC_ERROR_UNSUPP; + } +} + /* * GENERAL REMOTE STUFF Index: libconcord/libconcord.h =================================================================== RCS file: /cvsroot/concordance/concordance/libconcord/libconcord.h,v retrieving revision 1.22.2.16 diff -u -p -r1.22.2.16 libconcord.h --- libconcord/libconcord.h 22 Oct 2012 00:40:42 -0000 1.22.2.16 +++ libconcord/libconcord.h 1 Nov 2012 00:15:35 -0000 @@ -166,6 +166,7 @@ int is_config_dump_supported(); int is_config_update_supported(); int is_fw_dump_supported(); int is_fw_update_supported(int direct); +int get_stages(int file_type, const uint32_t **stages, int *num_stages); /* * TIME ACCESSORS Index: libconcord/bindings/python/libconcord.py =================================================================== RCS file: /cvsroot/concordance/concordance/libconcord/bindings/python/libconcord.py,v retrieving revision 1.9.2.4 diff -u -p -r1.9.2.4 libconcord.py --- libconcord/bindings/python/libconcord.py 22 Oct 2012 00:40:43 -0000 1.9.2.4 +++ libconcord/bindings/python/libconcord.py 1 Nov 2012 00:15:35 -0000 @@ -485,6 +485,15 @@ is_fw_update_supported = _create_func( _in('direct', c_int) ) +# int get_stages(int file_type, const uint32_t **stages, int *num_stages); +get_stages = _create_func( + 'get_stages', + _ret_lc_concord(), + _in('file_type', c_int), + _out('stages', POINTER(c_uint)), + _out('num_stages', c_int) +) + # int get_time_second(); get_time_second = _create_func( 'get_time_second',
------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________ concordance-devel mailing list concordance-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/concordance-devel