You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, commands are sent in libezsp-main dedicated methods (mostly using a subcall to dongle.sendCommand())
Responses, however are parsed in a generic reception handler CLibEzspMain::handleEzspRxMessage() and its sub fonctions.
However, this spreads request and responses code apart one from the other, decreasing readability and maintenability, also requiring to store state between request and response.
A better approach would be to point to the response code in the request code, loading a temporary overlay for the duration of the request (possibly with a timeout). This would allow for default response handlers to still exist, but to indicate the expected response handler (the command ID is expected to be provided there).
This would also allow easily passing states as variable captured by value between request and response.
A whole response-dispatching framework supporting at least one level of overlay (defaut handler + overlaid halder) needs to be implemented for this and existing request code should be re-written, though.
The text was updated successfully, but these errors were encountered:
Currently, commands are sent in libezsp-main dedicated methods (mostly using a subcall to dongle.sendCommand())
Responses, however are parsed in a generic reception handler CLibEzspMain::handleEzspRxMessage() and its sub fonctions.
However, this spreads request and responses code apart one from the other, decreasing readability and maintenability, also requiring to store state between request and response.
A better approach would be to point to the response code in the request code, loading a temporary overlay for the duration of the request (possibly with a timeout). This would allow for default response handlers to still exist, but to indicate the expected response handler (the command ID is expected to be provided there).
This would also allow easily passing states as variable captured by value between request and response.
A whole response-dispatching framework supporting at least one level of overlay (defaut handler + overlaid halder) needs to be implemented for this and existing request code should be re-written, though.
The text was updated successfully, but these errors were encountered: