chore: add callback PV to template
Deploy bin / deploy (push) Successful in 2s
Deploy agebd python package / deploy (push) Successful in 2s

This commit is contained in:
Benjamin Labrecque
2026-07-08 12:11:16 +02:00
parent 1e19517930
commit cd94cb3b7e
2 changed files with 19 additions and 3 deletions
@@ -43,7 +43,9 @@ class PVs(BasePVs):
# TODO: class attribute names usually lowercase
# usually it is advisable to trigger the mainloop of a service on changes of certain PVs:
self.CallbackPV = PV("...", auto_monitor=dbr.DBE_VALUE)
self.CallbackPV = PV(
"AGEBD-{{ service_name_upper }}:CALLBACK", auto_monitor=dbr.DBE_VALUE
) # TODO: ok?
class Service(BaseService[PVs]):
@@ -77,13 +79,17 @@ class Service(BaseService[PVs]):
#######################################################################################
# here goes all the code that your service
# is supposed to be running in any case, e.g.,
# update some pvs/vals
self.pvs.my_pv1.put("MY_PV1 value")
self.pvs.my_pv2.put("MY_PV2 value")
# self.pvs.my_pv1.put("MY_PV1 value")
# self.pvs.my_pv2.put("MY_PV2 value")
# get some pvs/vals
self.val1 = self.pvs.my_pv1.get()
self.val2 = self.pvs.my_pv2.get()
print(self.val1)
print(self.val2)
# maybe sleep to limit the update loop execution rate
sleep(1)
#######################################################################################
@@ -24,4 +24,14 @@ record(bo, "$(DEVICE):BO") {
field(OSV, "NO_ALARM")
field(VAL, "1")
field(PINI, "YES")
}
# TODO: ok?
record(bo, "$(DEVICE):CALLBACK") {
field(DESC, "Callback PV to listen to for changes")
field(ASG, "READONLY")
field(ZSV, "MINOR")
field(OSV, "NO_ALARM")
field(VAL, "1")
field(PINI, "YES")
}