We're observing some unexpected behavior from pcaspy. I have a simple server that is hosting a few integer parameters. If I write to one of the PVs over channel access, and I have a monitor setup on the same PV, I see two monitor events posted by pcaspy.
Is this because the writeValue() function in driver.py calls updateValue() on the parameter without clearing the self.pvDB[reason].flag? The second monitor event is caused by the updatePVs() function, which calls updateValue() again, and then clears the self.pvDB[reason].flag flag.
I also see a single monitor event when I set the PV to the same value, which I believe is caused by the use updateValue() in the writeValue() function.
So, I believe these two changes would be appropriate:
1) The clearing of self.pvDB[reason].flag should be done inside the updateValue() function, and not updatePVs().
2) Should the writeValue() function not call updateValue()? The developer can call setParam() in his write() function, and that can be responsible for calling updateValue(). Then the developer has control over when an update is posted.
With these changes pcaspy would have behavior that is the same as a normal soft IOC.
I can work around the two issues for now by not using updatePVs() in a periodic processing thread. And in my write() function I check for values that are not being changed, and return False in this case, which causes driver.py::writeValue() to not call updateValue().
From Matthew Pearson:
We're observing some unexpected behavior from pcaspy. I have a simple server that is hosting a few integer parameters. If I write to one of the PVs over channel access, and I have a monitor setup on the same PV, I see two monitor events posted by pcaspy.
Is this because the writeValue() function in driver.py calls updateValue() on the parameter without clearing the self.pvDB[reason].flag? The second monitor event is caused by the updatePVs() function, which calls updateValue() again, and then clears the self.pvDB[reason].flag flag.
I also see a single monitor event when I set the PV to the same value, which I believe is caused by the use updateValue() in the writeValue() function.
So, I believe these two changes would be appropriate:
1) The clearing of self.pvDB[reason].flag should be done inside the updateValue() function, and not updatePVs().
2) Should the writeValue() function not call updateValue()? The developer can call setParam() in his write() function, and that can be responsible for calling updateValue(). Then the developer has control over when an update is posted.
With these changes pcaspy would have behavior that is the same as a normal soft IOC.
I can work around the two issues for now by not using updatePVs() in a periodic processing thread. And in my write() function I check for values that are not being changed, and return False in this case, which causes driver.py::writeValue() to not call updateValue().