I am now designing a driver to communicate with a device using arrays of characters, via TCP.
Conceptually it is simple: for each command sent to the device there is always a response, but they can arrive out of order.
Responses received (out of order):
Some commands may take much longer time to be served, so this allows all responses to be returned as soon as they are ready.
Considering this, I would like to create an IOC where each record corresponds to a different command (these commands are actually a set/get of a property value, but I think that it is not relevant for the question).
These records would be SCAN Passive, and every read/write would force the value to be processed (i.e. read/written directly from/to the device, not cached in the records).
What would be the best approach for this?
We though of two options:
1) Use StreamDevice:
- Is quite easy to implement and we know it can work.
- However, the every time a record is being processed, it will lock the port while waiting for the respective response. This will block other users and can result in poor performance.
- Also, I don't think it supports tags.
2) Use asynDriver:
- From what I understood, it is possible to stop a callback and send it back to the queue using the 'callbackRequestDelayed()' EPICS function. This, with the help of a state machine, would allow the callback to be executed
in two steps, and not block callbacks from other users. It seems to be similar to the approach taken on the asynDriver '<top>/testApp'.
- In this case, a separate thread would receive all the results, and store them in a place where the callbacks would read later.
- However, I don't know if it is fully compatible with asynDriver, or if asynDriver provides a better mechanism for this type of interaction. Is there a better approach?
Maybe there is a 3rd better option that I am not aware of, and that is why I am asking this question. For now, if it works, the #2 seem to be the better one.
I also have another unrelated question: is there any situation where asynDriver has been used with TANGO?
I have seen it mentioned on documentation, but I haven't found any example where a TANGO infrastructure if able to interact with a device through asynDriver.
For now, I am developing for EPICS, but if this could be ported to TANGO somehow, it would be very helpful.
Thank you in advance,