Created
May 11, 2016 08:53
-
-
Save vxgmichel/128314bda87adb43cdc6305954e01e48 to your computer and use it in GitHub Desktop.
Test file for using events with devicetest
This file contains 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
from time import sleep | |
from devicetest import TangoTestContext | |
from PyTango import utils, EventType, DevState | |
from PyTango.server import Device, DeviceMeta, command, run | |
class Dummy(Device): | |
__metaclass__ = DeviceMeta | |
def init_device(self): | |
self.set_change_event('State', True, True) | |
@command | |
def On(self): | |
self.set_state(DevState.ON) | |
@command | |
def Off(self): | |
self.set_state(DevState.OFF) | |
if __name__ == '__main__': | |
with TangoTestContext(Dummy) as proxy: | |
cb = utils.EventCallBack() | |
proxy.subscribe_event('State', EventType.CHANGE_EVENT, cb) | |
while True: | |
proxy.On() | |
sleep(3) | |
proxy.Off() | |
sleep(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment