Hi Hinko,
This is at least partly a documentation issue. Using
ca.create_channel(pvname, connect=True) causes that function to wait
until the connection is complete. Using 'connect=False' does not wait
for the connection to complete before returning. So 'connect=True'
does not mean to postpone the connection until some later time.
Perhaps 'connect' should have been called 'wait_for_connection'. I'll
fix the doc to be clearer.
The ca.create_channel() function doesn't do much more than store some
data (such as chid and your connection callback), and call the C
ca_create_channel(). It always uses a pre-defined connection
callback (which subsequently calls any Python connection callback
function you may have defined). I suppose that could be made
optional, but I don't think it would exactly meet your desire to delay
the connection.
That is, there is not anything that explicitly tells the channel to
connect now, as opposed to waiting for additional input to make the
connection. I'm not aware of a way to delay the connection in that
way, short of not calling ca_create_channel() in the first place. Is
there a way to do this?
Cheers,
--Matt Newville <newville at cars.uchicago.edu>
On Thu, Jun 2, 2011 at 3:42 AM, Hinko Kocevar <[email protected]> wrote:
> Hi,
>
> We are using pyEpics 3.1.1 for our application. The web page states that CA
> connection can be performed auto-magically at ca.create_channel() call, by
> calling ca.connect_channel(). This works fine. The connection can also be
> postponed, by supplying the connect=False argument, the docs also say.
>
> We are unable to achieve the postponed connection. In the example I'm
> supplying both connections are made instantly, even though the first one has
> connect=False set.
>
> Is there a way to achieve the delayed connection? We would need this to more
> precisely control which PVs are actually 'enabled'/'used' in the application
> ..
>
>
>
> Example:
> import epics
> import time
> import sys
>
> def onConnectionChange(pvname=None, conn=None, chid=None):
> print 'ca connection status changed: ', time.time(), pvname, conn, chid
> sys.stdout.flush()
>
>
> # create channel, provide connection callback
> pv1 = 'HINKS:ENV:ENV_VOLTAGE1_MONITOR'
> chid1 = epics.ca.create_channel(pv1, connect=False,
> callback=onConnectionChange)
>
> # create channel, provide connection callback
> pv2 = 'HINKS:ENV:ENV_VOLTAGE1_MONITOR'
> chid2 = epics.ca.create_channel(pv1, connect=True,
> callback=onConnectionChange)
>
> print 'Now waiting, watching values and connection changes:'
> t0 = time.time()
> while time.time()-t0 < 30:
> time.sleep(0.001)
>
> print "Exiting .."
>
> Example output:
> $ python caconnect.py
> ca connection status changed: 1307003655.84 HINKS:ENV:ENV_VOLTAGE1_MONITOR
> True 162902648
> ca connection status changed: 1307003655.84 HINKS:ENV:ENV_VOLTAGE1_MONITOR
> True 162902648
> Now waiting, watching values and connection changes:
>
>
> Thank you!
>
> --
> Hinko Kocevar
> Technical support software engineer
> Instrumentation Technologies
> Velika pot 22, SI-5250 Solkan - Slovenia
> T:+386 5 3352600, F:+386 5 3352601
> mailto: [email protected]
>
> http://www.i-tech.si - When your users demand stability
>
> The information transmitted is intended solely for the addressee and may
> contain confidential and/or privileged information. Any review, retention,
> disclosure or other use by persons other than the intended recipient is
> prohibited. If you received this in error, please notify the sender and
> delete all copies.
>
>
- References:
- pyEpics want postponed connecting Hinko Kocevar
- Navigate by Date:
- Prev:
Re: caget command holds for more than 10 seconds Hinko Kocevar
- Next:
Re: EPICS Base darwin-x86_64 target architecture? J. Lewis Muir
- 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: pyEpics want postponed connecting Hinko Kocevar
- Next:
cross compiler error Chen Xue
- 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
|