On Freitag, 30. Mai 2008, Tim Mooney wrote:
> Ben Franksen wrote:
> > On Freitag, 30. Mai 2008, Mathias Steiner wrote:
> >> All would be well if it were possible to change links -- either .FLNK
> >> or .OUT -- from within a subroutine. I've tried a couple of things
> >> without success. Just pasting the channel name into the "value" field
> >> of the union does not, and probably should not, work.
> >>
> >> Assigning a different value to a link by copying an input link doesn't
> >> work either:
> >> psub->flnk = psub->inpb;
> >>
> >> This isn't so clear to me, since they are both of type DBLINK. After
> >> all, I can "just" type the value into the .FLNK field of any channel
> >> using edm, and it'll work...
> >
> > It works because this operation is going via Channel Access.
> >
> > You can do the same from your subroutine: use the CA client library to
> > [...]
>
> I think I would not do this from within a sub record's subroutine, even
> though it's possible. [...]
It's also not necessary at all. Just use plain runtime database access, see
the same named chapter in the Developer's Guide. Specifically, dbPutField()
calls dbPutFieldLink() which re-targets the link field being written to,
both are defined in src/db/dbAccess.c.
So: just do a dbNameToAddr() in the init routine, save the dbAddr pointer(s)
somewhere (DTYP comes to mind, it is reserved for device support which
subRecord doesn't have) and do a dbPutField() in the subroutine proper.
This is even simpler than the CA stuff and works synchronously.
Cheers
Ben
- References:
- subroutine, chaning links Mathias Steiner
- Re: subroutine, chaning links Ben Franksen
- Re: subroutine, chaning links Tim Mooney
- Navigate by Date:
- Prev:
procServ soft IOC server - V2.2.0 released Ralph Lange
- Next:
Re: combining problem with etherip and motor Ron Sluiter
- 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: subroutine, chaning links Tim Mooney
- Next:
procServ soft IOC server - V2.2.0 released Ralph Lange
- 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
|