def SetupDeviceConnection(): deviceConnection = ServerlessDeviceConnection() BlinkyLEDDevice = Device() BlinkyLEDDevice.DeviceID = 444 BlinkyLEDDevice.SetDeviceName('BlinkyLED') OnOffControls = ControlValue() OnOffControls.ControlName = 'LEDState' OnOffControls.ControlValueType = OnOffControls.OnOff OnOffControls.ControlID = 0 BlinkyLEDDevice.ControlList.append(OnOffControls) deviceConnection.SetDeviceData(BlinkyLEDDevice) return deviceConnection
def SetupDeviceConnection(): deviceConnection = ServerlessDeviceConnection() ButtonDevice = Device() ButtonDevice.DeviceID = 27 ButtonDevice.SetDeviceName('MyButt') outControl = ControlValue() outControl.ControlName = 'Butt' outControl.ControlDirection = outControl.Output outControl.ControlValueType = outControl.Range outControl.ControlID = 0 ButtonDevice.ControlList.append(outControl) deviceConnection.SetDeviceData(ButtonDevice) return deviceConnection
from ServerlessDevice import ServerlessDeviceConnection import sys from ControlValue import ControlValue from Device import Device from Vertex import Vertex from CommonDataTypes import HeepIPAddress functionalDevice = Device() functionalDevice.DeviceID = 5678 functionalDevice.SetFrontEndXY(100, 287) functionalDevice.SetIconInformation(1, [chr(3), chr(4), chr(12), chr(41)]) functionalDevice.SetDeviceName("JERCERB") OnOffControls = ControlValue() OnOffControls.ControlValueType = OnOffControls.OnOff OnOffControls.ControlDirection = 1 OnOffControls.ControlName = 'Fig' OnOffControls.ControlID = 2 functionalDevice.ControlList.append(OnOffControls) AnotherControl = ControlValue() AnotherControl.ControlValueType = AnotherControl.OnOff AnotherControl.ControlDirection = 1 AnotherControl.ControlName = 'Pretzel' AnotherControl.ControlID = 1 functionalDevice.ControlList.append(AnotherControl) Output1 = ControlValue() Output1.ControlValueType = Output1.Range Output1.ControlName = 'Fruity' Output1.ControlID = 0
from MemoryUtilities import MemoryUtilities from CommonDataTypes import HeepIPAddress from ActionOpCodeParser import ActionOpCodeParser from OpCodeUtilities import OpCodeUtilities def CheckEquality(first, second, testName): if first == second: return testName + ': Success' return testName + ': Failed****** Received: ' + str( first) + ' **** Expected:' + str(second) # 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