""" 
Creating pseudo-devices
"""
import time

sin_val=None        
        
class Sensor(Readable):
    def read(self):
        global sin_val
        return sin_val + time.clock()

class Positioner(Writable):
    def write(self,pos):
        print pos

class Listener (DeviceListener):
    def onStateChanged(self, device, state, former):
        pass
    def onValueChanged(self, device, value, former):
        global sin_val
        sin_val=value

sensor=Sensor()
positioner=Positioner()
listener = Listener()

sin.addListener(listener)
try:
    a= lscan((inp,positioner),(sin,sensor),(0,0),(40,10),20,0.1)
finally:
    sin.removeListener(listener)