Created
May 16, 2017 07:08
-
-
Save xiaoqiangwang/6ff84f94da4ba20902ab16a047fd60c2 to your computer and use it in GitHub Desktop.
python object via channel access
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pickle | |
from CaChannel import ca, CaChannel | |
chan = CaChannel('MTEST:OBJECT') | |
chan.searchw() | |
a = chan.getw(ca.DBR_STRING) | |
pvdb = pickle.loads(a) | |
print(pvdb) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pickle | |
from pcaspy import Driver, SimpleServer | |
prefix = 'MTEST:' | |
pvdb = { | |
'OBJECT' : { | |
'type': 'char', | |
'count': 1024, | |
}, | |
} | |
class myDriver(Driver): | |
def __init__(self): | |
super(myDriver, self).__init__() | |
self.setParam('OBJECT', pickle.dumps(pvdb)) | |
self.updatePVs() | |
if __name__ == '__main__': | |
server = SimpleServer() | |
server.createPV(prefix, pvdb) | |
driver = myDriver() | |
# process CA transactions | |
while True: | |
server.process(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment