Hi,
The puser pointer you pass to ca_create_channel is saved by the library with the channel and is later supplied as a puser argument to your channel connectione state update callback function. There is also a ca function "void * ca_puser ( CHID )" that will return the puser pointer that was supplied when the channel was created.
Likewise, the puser pointer you pass to ca_create_subscription is saved by the library with the subscription and is later supplied as a puser argument to your subscription update callback function.
> How does this parameter have to look like?
> Can I use a C-Struct with any member I want to have (even members which
> are not for the CA, but for another part of my program)? Are there any
> members which are mandatory? (like value or chid)
A pointer to any data structure can be used. The CA library does not in any way access, or place any restrictions on the content of, this user application private data structure. The user application is of course responsible for allocation, initialization, maintenance, and de-allocation (proper cleanup) of this data structure.
Use of void pointers passed to callbacks is an old technique which is roughly equivalent to a virtual function in modern software interfaces, BTW.
HTH, and feel free to send any other questions that you might have, and I will do my best to answer them.
Jeff
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of Florian Feldbauer
> Sent: Thursday, March 29, 2012 4:01 AM
> To: EPICS tech talk
> Subject: What is void* puser in ca_create_channel
>
> Dear all,
>
> I currently write a CA Client that should monitor all measured
> temperatures in my experiment
> to regulate the chillers.
> This is my first try to program a CA Client, and I have a question
> concerning this:
>
> The ca_create_channel and the ca_create_subscription methods both have
> a parameter void* puser. How does this parameter have to look like?
> Can I use a C-Struct with any member I want to have (even members which
> are not
> for the CA, but for another part of my program)? Are there any members
> which are mandatory? (like value or chid)
>
> In the camonitor.c example generated with makeBaseApp.pl this puser is
> just a pointer to a C-Struct containing
> a c-string value, the chid and evid of the channel.
>
> Best regards,
> Florian
>
> --
> -------------------------------------
> | Florian Feldbauer |
> | Ph.D. student |
> | |
> | Institut für Experimentalphysik I |
> | Ruhr-Universität Bochum |
> | Universitätsstr. 150 |
> | D-44780 Bochum |
> | |
> | Office: NB 2/173 |
> | Phone: (+49)234 / 32-23538 |
> | Fax: (+49)234 / 32-14170 |
> | Web: http://www.ep1.rub.de |
> -------------------------------------
- Replies:
- Re: What is void* puser in ca_create_channel Florian Feldbauer
- Re: What is void* puser in ca_create_channel Benjamin Franksen
- References:
- What is void* puser in ca_create_channel Florian Feldbauer
- Navigate by Date:
- Prev:
Re: ../testServer.cpp:672: warning: converting to 'int' from 'double' Dirk Zimoch
- Next:
Fiber Optic Switches Bjorklund, Eric A
- 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: What is void* puser in ca_create_channel Ralph Lange
- Next:
Re: What is void* puser in ca_create_channel Florian Feldbauer
- 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
|