Then the board will respond like this, also in binary:
<Status of command 1>,<Response bytes for command 1>,<Status of command 2>,<Response bytes for command 2>...
<Status of command 1>,<Response bytes for command 1>,<Status of command 2>,<Response bytes for command 2>...
Currently I have a concept in my head of how this would work, ideally I would like to be able to queue up a bunch of request classes (Which I will refer to herein as TRequest), then call a ProcessCommands function which sends these to the IO board, receives a response, and then I can de-queue response classes that are a match for the TRequests passed to the function with the response data.
My question is, how would I be best to go about this, I've currently tried something with generic types however am struggling to do what I want with it. Heres what I have currently:
Please see attached cs file, the code is too large to write into a discord message
CommandPayload is an abstract class containing a command code as well as an abstract Serialise() function which serialises from its own parameters, and Report is an abstract class containing a status code along with a Deserialise() function which deserialises to its own paramters
Am I going the right way about this? Please note the Enqueue line, where im really not sure how to get back to the Report superclass after the ChangeType (If I can even do a ChangeType like this?)
I'm really hoping this makes sense, anything that isnt clear/is awful please do ask. Any assistance would be greatly appreciated :)