EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: What is void* puser in ca_create_channel
From: "Hill, Jeffrey O" <[email protected]>
To: Dirk Zimoch <[email protected]>
Cc: EPICS tech talk <[email protected]>, Florian Feldbauer <[email protected]>
Date: Wed, 11 Apr 2012 14:37:18 +0000
Hi Dirk,

> ca_pend_io() waits for search and get without callbacks but probably not
> for monitors? Jeff, please comment.

The ca_pend_io function is for implementing simple, short life span, clients 
like caget which don't need to reconnect if the IOC is rebooted.

The ca_pend_io function will 
o wait for channels created, specifying a nill connection state callback 
	handler function pointer, to connect
o additionally wait for all get requests, not specifying a completion 
	callback handler, to complete
o only wait for above mentioned requests issued after the previous call 
	to ca_pend_io or ca_context_create whichever is later
o will return early specifying an error condition if the timeout expires
o does also issue an implicit flush request before waiting
o does deal with any outstanding ca background activity while waiting
o will return immediately, after initiating the implicit flush, if no 
	such requests are pending

The ca_pend_io request does not wait for subscription request updates 
to complete. That's consistent considering that this type of request 
specifies a callback which is called multiple times. Also, a subscription
request is typically used by long lifespan clients which must deal with 
reconnect issues. 

Jeff

> -----Original Message-----
> From: Dirk Zimoch [mailto:[email protected]]
> Sent: Wednesday, April 11, 2012 1:53 AM
> To: Hill, Jeffrey O
> Cc: Florian Feldbauer; EPICS tech talk
> Subject: Re: What is void* puser in ca_create_channel
> 
> Hi Jeff, Florian,
> 
> I checked my presentation and found:
> 
> * Single-threaded context
>    - Callbacks are only called from within a ca_* function.
>      The program must call ca_pend_io(), ca_flush_io(), ca_pend_event()
> or ca_poll() regularly to receive any data (e.g. in event/idle loop).
> 
> This is wrong:
> ca_flush_io() will not do the job because it does not handle input.
> ca_pend_event() is definitely ok here.
> ca_poll() is ca_pend_event(1e-12) and thus is ok.
> ca_pend_io() waits for search and get without callbacks but probably not
> for monitors? Jeff, please comment.
> 
> Dirk
> 
> 
> Hill, Jeffrey O wrote:
> > Hi,
> >
> > Correct, a single-threaded CA client code must periodically spend some
> time in ca_pend_event() in order that the channels will connect. The
> channels will not transition from a disconnected to a connected state if
> your main thread doesn't periodically call ca_pend_event. The
> ca_pend_event(), among other tasks, arranges for the incoming TCP messages
> to be processed, and calls the user callbacks.
> >
> > The ca_flush_io() call is forcing all of the en-queued put/get/subscribe
> requests to be delivered to the TCP circuits in aggregate, but does not
> necessarily process the incoming messages on the TCP circuits, or call the
> connection callbacks.
> >
> > Jeff
> >
> >> -----Original Message-----
> >> From: Florian Feldbauer [mailto:[email protected]]
> >> Sent: Monday, April 02, 2012 8:05 AM
> >> To: Hill, Jeffrey O
> >> Cc: EPICS tech talk
> >> Subject: Re: What is void* puser in ca_create_channel
> >>
> >> Hey,
> >>
> >> after creating all channels and subscriptions I used ca_flush_io() in
> my
> >> program as
> >> mentioned in the talk "Channel Access Client Programming" from Dirk
> >> Zimoch at the last
> >> EPICS meeting at PSI.
> >> When I use ca_pend_event() instead, the CA is working.
> >>
> >> Best regards,
> >> Florian
> >>
> >>
> >> On 03/30/2012 04:10 PM, Hill, Jeffrey O wrote:
> >>>> Just one other question: Can I use the CA methods ca_create_channel
> and
> >>>> ca_create_subscription within a c++ class?
> >>> Yes, the necessary 'extern"C"' bracketing is in the ca header files so
> >> that its C interface can be called from C++.
> >>>> Any idea based on this few information, or should I post my code?
> >>> If the CA client and its IOC are not on the same subnet then you may
> >> need to add the IOC's address to the EPICS_CA_ADDR_LIST environment
> >> variable for the client. Otherwise, if they are intended to be on the
> same
> >> subnet them make certain that both hosts are configured with the same
> >> subnet mask.
> >>> There are also some additional suggestions in the troubleshooting
> >> section of the CA reference manual.
> >>> Jeff
> >>>
> >>>> -----Original Message-----
> >>>> From: Florian Feldbauer [mailto:[email protected]]
> >>>> Sent: Friday, March 30, 2012 6:29 AM
> >>>> To: Hill, Jeffrey O
> >>>> Cc: EPICS tech talk
> >>>> Subject: Re: What is void* puser in ca_create_channel
> >>>>
> >>>> Thanks for your answers.
> >>>>
> >>>> Just one other question: Can I use the CA methods ca_create_channel
> and
> >>>> ca_create_subscription within a c++ class?
> >>>> The project we are working on should use OO techniques.
> >>>> We need not only an interface to EPICS, but also to a simulation.
> >>>> So we wanted to have an abstract base class, which is used by the
> rest
> >>>> of our project, and  derived classes for the implementation of
> >>>> the individual "control systems". One derived class would contain the
> >> CA
> >>>> for EPICS and another the interface to our simulation.
> >>>>
> >>>> I can compile my test program for this object-structure, but I don't
> >> get
> >>>> a conncetion to my EPICS ioc.
> >>>> The two examples from makeBaseApp.pl are working correctly.
> >>>>
> >>>> Any idea based on this few information, or should I post my code?
> >>>>
> >>>> Best regards,
> >>>> Florian
> >>>>
> >>>> On 03/29/2012 05:19 PM, Hill, Jeffrey O wrote:
> >>>>> 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:tech-talk-
> >>>> [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     |
> >>>>>> -------------------------------------
> >>>> --
> >>>> -------------------------------------
> >>>> | 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     |
> >>>> -------------------------------------
> >>
> >> --
> >> -------------------------------------
> >> | 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     |
> >> -------------------------------------
> >
> >
> >



References:
What is void* puser in ca_create_channel Florian Feldbauer
RE: What is void* puser in ca_create_channel Hill, Jeffrey O
Re: What is void* puser in ca_create_channel Florian Feldbauer
RE: What is void* puser in ca_create_channel Hill, Jeffrey O
Re: What is void* puser in ca_create_channel Florian Feldbauer
RE: What is void* puser in ca_create_channel Hill, Jeffrey O
Re: What is void* puser in ca_create_channel Dirk Zimoch

Navigate by Date:
Prev: RE: Proposed support for additional Modbus data types Mark Rivers
Next: DCT flag in record reference manual Abadie Lana
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: What is void* puser in ca_create_channel Dirk Zimoch
Next: Re: What is void* puser in ca_create_channel Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·