Hi Ralph,
You probably want to support asynOctet->write (to write the name of the file to be read) and asynOctet->read to return the contents of the first line of the file. Whether you want to implement a poller thread and make the read records be I/O Intr scan depends on the application. This is all easier of course if you inherit from asynPortDriver.
A limitation of streamDevice is that it does not support the asyn drvUser interface, so you cannot pass your driver a string that controls what "parameter" is being addressed from streamDevice, like you can with the standard asyn device support.
Mark
________________________________________
From: [email protected] [[email protected]] on behalf of Pearson, Matthew R. [[email protected]]
Sent: Tuesday, June 17, 2014 8:59 AM
To: Ralph Lange
Cc: EPICS Tech-Talk
Subject: Re: ASYN port driver for file IO?
If no one has done this, there might be some hints from asynNDArrayDriver in areaDetector. That implements the writeOctet function, so that when a file path is written (via the NDAttributesFile parameter) the function triggers a read of that file, which you could then extract information from and populate other parameters. The line number could be another parameter set at runtime.
Or, another way of doing it would be to read the file periodically in a polling thread, perhaps enabled and disabled by another parameter.
Cheers,
Matt
On Jun 17, 2014, at 8:26 AM, Ralph Lange <[email protected]> wrote:
> All,
>
> I was wondering if anyone has written an ASYN port driver for file read access.
> Something that on every read returns a (run-time) configurable line of a (start-up) configurable file, for example.
>
> Intended use: Read stuff from the /proc file system using StreamDevice.
>
> Thanks for any hints,
> ~Ralph
>
- References:
- ASYN port driver for file IO? Ralph Lange
- Re: ASYN port driver for file IO? Pearson, Matthew R.
- Navigate by Date:
- Prev:
Re: ASYN port driver for file IO? Stephen Beckwith
- Next:
EDM XY Graph Zenon Szalata
- 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:
Re: ASYN port driver for file IO? Pearson, Matthew R.
- Next:
Re: ASYN port driver for file IO? Stephen Beckwith
- 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
|