update example
This commit is contained in:
@ -61,6 +61,6 @@ def processLink(name, lstr):
|
|||||||
Returns (callable, Record, "arg1 arg2")
|
Returns (callable, Record, "arg1 arg2")
|
||||||
"""
|
"""
|
||||||
rec = getRecord(name)
|
rec = getRecord(name)
|
||||||
modname, factname, args = lstr.split(None,2)
|
modname, args = lstr.split(None,1)
|
||||||
mod = __import__(modname)
|
mod = __import__(modname)
|
||||||
return rec, mod.build(rec, args)
|
return rec, mod.build(rec, args)
|
||||||
|
16
test.cmd
16
test.cmd
@ -1,19 +1,13 @@
|
|||||||
#!./bin/linux-x86-debug/devsup
|
#!./bin/linux-x86-debug/devsup
|
||||||
|
|
||||||
epicsEnvSet("PYTHONPATH", "${PWD}/python")
|
epicsEnvSet("PYTHONPATH", "${PWD}/python:${PWD}/testApp")
|
||||||
|
|
||||||
dbLoadDatabase("dbd/devsup.dbd")
|
dbLoadDatabase("dbd/devsup.dbd")
|
||||||
devsup_registerRecordDeviceDriver(pdbbase)
|
devsup_registerRecordDeviceDriver(pdbbase)
|
||||||
|
|
||||||
evalPy "import sys"
|
#evalPy "import devsup.hooks"
|
||||||
evalPy "print sys.path"
|
#evalPy "devsup.hooks.debugHooks()"
|
||||||
evalPy "import devsup.hooks"
|
|
||||||
evalPy "devsup.hooks.debugHooks()"
|
|
||||||
evalPy "import devsup.db"
|
|
||||||
|
|
||||||
dbLoadRecords("test.db","")
|
dbLoadRecords("db/test1.db","P=md:")
|
||||||
|
|
||||||
iocInit
|
iocInit()
|
||||||
|
|
||||||
evalPy "print devsup.db.Record('test:rec')"
|
|
||||||
evalPy "print devsup.db.Record('does:not:exist')"
|
|
||||||
|
22
testApp/Makefile
Normal file
22
testApp/Makefile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
TOP=..
|
||||||
|
include $(TOP)/configure/CONFIG
|
||||||
|
#----------------------------------------
|
||||||
|
# ADD MACRO DEFINITIONS AFTER THIS LINE
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
|
# Optimization of db files using dbst (DEFAULT: NO)
|
||||||
|
#DB_OPT = YES
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
|
# Create and install (or just install) into <top>/db
|
||||||
|
# databases, templates, substitutions like this
|
||||||
|
DB += test1.db
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
|
# If <anyname>.db template is not named <anyname>*.template add
|
||||||
|
# <anyname>_template = <templatename>
|
||||||
|
|
||||||
|
include $(TOP)/configure/RULES
|
||||||
|
#----------------------------------------
|
||||||
|
# ADD RULES AFTER THIS LINE
|
||||||
|
|
6
testApp/test1.db
Normal file
6
testApp/test1.db
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
record(longin, "$(P)li:cnt") {
|
||||||
|
field(DTYP, "Python Device")
|
||||||
|
field(INP , "@test1 hello world")
|
||||||
|
field(SCAN, "1 second")
|
||||||
|
}
|
13
testApp/test1.py
Normal file
13
testApp/test1.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
class MySup(object):
|
||||||
|
def __init__(self, rec):
|
||||||
|
self.val = rec.field('VAL')
|
||||||
|
def process(self, rec, reason):
|
||||||
|
print 'test1 proc',rec.name(),reason
|
||||||
|
self.val.putval(1+self.val.getval())
|
||||||
|
def detach(self, rec):
|
||||||
|
print 'test1 detach',rec.name()
|
||||||
|
|
||||||
|
def build(rec, args):
|
||||||
|
print 'test1 build for',rec.name()
|
||||||
|
return MySup(rec)
|
Reference in New Issue
Block a user