mcci-catena / Catena-Arduino-Platform

Arduino platform library for MCCI Catena IoT Systems

Repository from Github https://github.commcci-catena/Catena-Arduino-PlatformRepository from Github https://github.commcci-catena/Catena-Arduino-Platform

Support commands that don't complete instantly

terrillmoore opened this issue · comments

The command parser currently works well, but it doesn't support commands that do things like "read Modbus registers" -- this is an asynchronous operation that completes "later".

High-level summary:

  • Add a kPending code to the list of command statuses.
  • When a command routine returns kPending, then it is committed to completing the operation by calling pThis->completeCommand(status).
  • Change the command dispatcher not to print results and queue status until a completion occurs.

Note that a command might pThis->completeCommand() before it returns kPending. (This is useful when handling completion routines that might call back during the downcall if there's an immediate failure -- they can just call completeCommand no matter when the callback occurs.)