Exemplo n.º 1
0
# Create Controls and Devices
otherDevice = Device()
otherDevice.DeviceID = 1523
otherDevice.DeviceName = 'Sloppy'
Control1 = ControlValue()
Control1.ControlName = 'Forge'
Control2 = ControlValue()
Control2.ControlName = 'Fast'
otherDevice.ControlList.append(Control1)
otherDevice.ControlList.append(Control2)
print CheckEquality(otherDevice.DeviceName, 'Sloppy', 'DeviceNameSetTest')

# Extract, Create, and Update Queued Commands
firstCtrl = otherDevice.ControlList[1]
firstCtrl.CurCtrlValue = 40
otherDevice.QueueControl(firstCtrl)
curCtrl = otherDevice.ControlList[0]
curCtrl.CurCtrlValue = 3
otherDevice.QueueControl(curCtrl)
curCtrl.CurCtrlValue = 5
otherDevice.QueueControl(curCtrl)
otherDevice.QueueControlByName('Forge', 210)
print CheckEquality(otherDevice.GetQueuedControlString(), 'Fast,40;Forge,210;',
                    'QueueControlByNameTest')
print CheckEquality(otherDevice.GetQueuedControlString(), '',
                    'GetQueuedControlStringTest')

# Update controls on a device by string
otherDevice.UpdateControlsByString('Fast,20;Forge,30;')
print CheckEquality(otherDevice.ControlList[0].CurCtrlValue, 30,
                    'UpdateControlsByStringTest1')