There is one example driver in asyn, testIPServerApp which handles unsolicited messages. It functions as a simple "echo" program to send responses to an IP client. It simply has a read pending all the time, i.e. a read with infinite timeout.
That approach won't work if you have a device that implements both typical command/reply syntax and ALSO sends unsolicited messages. For that type of device here is what I would do:
1) Before each write, do a series of reads with 0 timeout to read any unsolicited messages that have arrived. This reading could also be done periodically if it is important to read the unsolicited messages frequently.
2) Then do the write/read. If you got an "incorrect response" because it was an unsolicited one, then do another read.
Another approach you might imagine is to replace step 1) with a read with an infinite timeout, and then cancel that request when one wants to do a write/read. I believe this will NOT work, because asyn provides no mechanism to cancel a pending read or write operation in the low level drivers like serial or IP. asyn's cancel request only cancels a request that is still in the asynManager queue, not a request that has already been delivered to the driver. Is this correct Eric/Marty?
Mark
________________________________
From: Steven Banks [mailto:[email protected]]
Sent: Fri 8/4/2006 4:57 AM
To: [email protected]
Subject: Devices Which Send Unsolicited Messages
This is a follow up question to a comment that Dirk Zimoch made in another
thread.
We use Asyn for almost all of our device drivers, however up till now none
of the devices we have used send unsolicited messages. We live in fear
of the day when we encounter such a device because we don't know how to
handle these messages in Asyn. In fact, Dirk commented that this is not
even supported in Asyn. If this is true, what is the canonical method in
EPICS of writing a device driver which copes with such a device?
Regards,
Steve Banks
Australian Synchrotron Project
- Replies:
- Re: Devices Which Send Unsolicited Messages Eric Norum
- References:
- Devices Which Send Unsolicited Messages Steven Banks
- Navigate by Date:
- Prev:
Devices Which Send Unsolicited Messages Steven Banks
- Next:
Re: Devices Which Send Unsolicited Messages Eric Norum
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
<2006>
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Devices Which Send Unsolicited Messages Steven Banks
- Next:
Re: Devices Which Send Unsolicited Messages Eric Norum
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
<2006>
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|