Hi Dehong,
Another approach for this would be to just make this a channel access client program written in python or c++.
Using SNL standalone rather than within an IOC is another option, but maybe that's what Tim intended.
Is there anything about this application that would require that it be built as an IOC/record?
Regards,
- Bruce
On 8/24/2012 9:11 AM, Tim Mooney wrote:
Hi Dehong,
It was a really good idea to raise this on tech talk. It looks like you're basically doing channel access within a record. I tried that too; it was awful. I think it will in the long run be a lot more work than writing the equivalent SNL program, because this is the sort of thing SNL was designed to do. SNL includes a lot of features developers have found helpful for jobs like this: such as connection management, separate threads, and array syntax for collections of PV names. Plus, SNL is well documented, and there are lots of examples from which to lift code fragments.
Tim
----- Original Message -----
From: "Dehong Zhang" <[email protected]>
To: "Andrew Johnson" <[email protected]>, [email protected]
Sent: Thursday, August 23, 2012 5:47:22 PM
Subject: RE: Creating INLINK/OUTLINK in record support
Hi Andrew and Tim,
Thanks you very much for the advices.
I am trying to build an IOC/record to watch and protect a large system, where
I need to access 100+ PVs. Since those PVs have very similiar names, I was
hoping to hard-code the common part of the names, then use something
like the dbNameToAddr function to create an array of links to use in for loops.
Now, I am doing it half-automatic: list all those PVs in the dbd file, then put
them into some arrays in init_record, then use for loops to fetch their values.
This way i almost get what i wanted. If we can avoid the need to list all the PVs
in the dbd file, both the dbd and c files will be even shorter.
Best regards,
Dehong
________________________________________
From: Andrew Johnson [[email protected]]
Sent: Thursday, August 23, 2012 3:06 PM
To: [email protected]
Cc: Zhang, Dehong
Subject: Re: Creating INLINK/OUTLINK in record support
Hi Dehong,
On 2012-08-23 Zhang, Dehong wrote:
Is it possible to create these things dynamically inside a record, so that
I can access PVs on another IOC, without listing them all in the dbd file
of my custom record?
In other words, is there something like the
dbNameToAddr
to use for creating and accessing LINKs?
Anything is possible if you're willing to write enough code, but...
The dbNameToAddr() routine is only for local PVs; CA links are implemented
using the code in dbCa, and initializing those links happens at iocInit() or
whenever the INP/OUT link value is changed. However there isn't really a
public API for that kind of thing, and I don't really recommend that you try
to do that.
It sounds to me like you're creating a new record type when maybe you should
be writing a State Notation Language program. Why don't you step back a bit
and reconsider what you're trying to do? Feel free to explain here if you
want more advice, but you will need to explain the bigger picture because I
wouldn't recommend trying what you describe above.
HTH,
- Andrew
--
Never interrupt your enemy when he is making a mistake.
-- Napoleon Bonaparte
- References:
- Re: Creating INLINK/OUTLINK in record support Tim Mooney
- Navigate by Date:
- Prev:
EDM X Error on Linux Lucas Russo
- Next:
Re: EDM X Error on Linux John William Sinclair
- 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: Creating INLINK/OUTLINK in record support Tim Mooney
- Next:
Re: Creating INLINK/OUTLINK in record support Benjamin Franksen
- 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
|