Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional callbacks for SharedPV handlers #155

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Implementation and example for nthandlers
Monarda committed Aug 4, 2024
commit 4ccfb7c41ad7c7a2b5a7d603449d563ef4bfd275
19 changes: 19 additions & 0 deletions example/ntscalar_walarm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import logging
logger = logging.getLogger(__name__)

from p4p.nt import NTScalar
from p4p.server import Server
from p4p.server.thread import SharedPV
from p4p.server.nthandlers import NTScalarRulesHandler

# Construct PV with control and valueAlarm structures
# and then set the values of some of those values with a post
pv = SharedPV(nt=NTScalar('d', control=True, valueAlarm=True),
handler=NTScalarRulesHandler(),
initial=12.0)
pv.post({'control.limitHigh': 6,
'valueAlarm.active': True, 'valueAlarm.lowAlarmLimit': 1, 'valueAlarm.lowAlarmSeverity':2})

Server.forever(providers=[{
'demo:pv:name':pv, # PV name only appears here
}])
Loading