devices = create_device(["bs://Int32Waveform?waveform=true&samples=5&interval=-1&op=sum&integrate=true", ]) 
try:
    mscan([], devices , 5, -1)  #ar is ony updated on read
    #tscan( devices , 5, 0.1)
finally:
    devices[0].source.parent.close()




devices = create_device(["dev://arr","ca://TESTIOC:TESTWF2:MyWF", ])  #TODO: Why does not work?
try:
    #mscan([], devices , 5, -1)  #ar is ony updated on read
    tscan( devices , 5, 0.1)
finally:
    devices[1].close()


devices = create_device(["bs://PID", "bs://Int32Scalar", "bs://Int16Scalar", "dev://arr?op=sum"])
try:
    mscan([], devices , 5, 5.0)
finally:
    devices[0].parent.close()



    
devices = create_device(["bs://Int32Scalar"])

try:
    mscan([], devices , 5, 5.0)
finally:
    devices[0].parent.close()



device = create_device("bs://Int32Scalar?samples=3&interval=-1")

try:
    mscan([], device , 5, 5.0)
finally:
    #device is averager, parent s scalar, parent.parent is stream
    device.parent.parent.close()



s = Stream("stream", dispatcher)
devices  = create_device(["bs://Int32Scalar", "bs://Int16Scalar"],s)

try:
    s.initialize()
    s.start()
    s.waitCacheChange(10000)
    mscan([], devices , 5, 5.0)
finally:
    s.close()


device = create_device('ca://TESTIOC:TESTSINUS:SinCalc?monitored=true')

mscan([], [device], 5, 5.0)



devices = create_device(['ca://TESTIOC:TESTSINUS:SinCalc?monitored=true', 'ca://TESTIOC:TESTCALCOUT:Output?monitored=true'])

mscan([], devices, 5, 5.0)