Hi,
It is difficult to say anything without looking at your source.
But one thing come to my mind is, you are using fileDescriptorManager.process to poll for updates.
It would be good to test again using preemptive callback in caCleint code.
Check here for more infos.
http://www.aps.anl.gov/epics/base/R3-14/12-docs/CAref.html#Thread
On the other hand, if you are not bound to use C++,
one can write such an application in Python, like I just did, in 3 minutes, 33 lines of code.
#!/usr/bin/env python
from pcaspy import Driver, SimpleServer
import CaChannel
import time
prefix = 'MTEST:'
pvdb = {
'RAND' : {
'prec' : 3,
},
}
class myDriver(Driver):
def __init__(self):
super(myDriver, self).__init__()
self.chan = CaChannel.CaChannel('RAND')
self.chan.searchw()
self.chan.add_masked_array_event(None, None, None, self.eventCB)
def eventCB(self, epicsArgs, userArgs):
self.setParam('RAND', epicsArgs['pv_value'])
self.updatePVs()
if __name__ == '__main__':
server = SimpleServer()
server.createPV(prefix, pvdb)
driver = myDriver()
# process CA transactions
while True:
server.process(0.1)
It uses module PCASpy[1] for PCAS server programming.
I use module CaChannel[2] for caClient, but other modules[3] should work the same.
Best
Xiaoqiang
[1] https://code.google.com/p/pcaspy/
[2] http://controls.web.psi.ch/cgi-bin/twiki/view/Main/NewPythonEpicsInterface
[3] http://www.aps.anl.gov/epics/extensions/index.php
On Feb 22, 2013, at 8:00 PM, [email protected] wrote:
> Hi,
>
> I am trying to add a portable channel access server to a channel access
> client, similar to the EPICS gateway I believe. The values for the process
> variables that are created by the PCAS are written to from the connection
> and event handler callbacks for the caClient. The problem I think I am
> running into, is that when I call fileDescriptorManager.process, these
> callbacks get called similar to as if a ca_pend_event was called. So after
> the call to fileDescriptorManager.process and before it completes, new
> values are being written to the PCAS process variables, and postEvent is
> being called for these changed values. This leads to funny behavior where
> the same value is posted for a PCAS channel multiple times in a row (as
> seen with camonitor). For example, it should post 1, 2, 3 but posts 3, 3,
> 3 instead, all with the same time stamps. Is there a way around this?
>
> I also ran a test, with just the PCAS and leaving out the caClient. I
> wrote to a PCAS process variable continuously with increasing values in
> one thread and called fileDescriptorManager.process continuously in
> another thread. This gave me similar results, that is the same value was
> posted multiple times in a row for stretches of time before it increased.
> I was not surprised that I got funny behavior doing this, but the fact
> that it was similar to the caClient helped me diagnose what may be
> happening.
>
> Also, what is the usual way to update the values for the PCAS process
> variables from the application itself (i.e. not with a caput)? I added a
> public function to the PCAS Server that calls functions in the appropriate
> PV instance to write a value and call the postEvent function. Is this
> typical? If so, I am guessing that I should also check in this function to
> see if the new value will actually be different before writing it, so that
> postEvent is not called when the value has not really changed? Or is there
> another way to do that?
>
> Thank you for your time,
> Patrick
>
>
- Replies:
- Re: caClient with PCAS pthomas
- References:
- caClient with PCAS pthomas
- Navigate by Date:
- Prev:
CA beacon question Pierrick Hanlet
- Next:
Re: asyn and snmp James F Ross
- 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:
caClient with PCAS pthomas
- Next:
Re: caClient with PCAS pthomas
- 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
|