Exemplo n.º 1
0
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
Exemplo n.º 2
0
otherDevice = Device()
otherDevice.DeviceID = 12332
otherDevice.DeviceName = 'Sloppy'
Control1 = ControlValue()
Control1.ControlName = 'Forge'
Control1.ControlID = 0
Control2 = ControlValue()
Control2.ControlName = 'Fast'
Control2.ControlID = 1
otherDevice.ControlList.append(Control1)
otherDevice.ControlList.append(Control2)
otherDevice.AddVertex(myVertex)
otherDevice.SetFrontEndXY(10322, 1032)
otherDevice.SetIPAddress(myIP)

otherDevice.SetIconInformation(1, [chr(3), chr(4), chr(12), chr(41)])
myString = otherDevice.GetDeviceString()

print CheckEquality(OpCodeUtilities().ConvertStringToByteArray(myString),
                    otherDevice.GetDeviceByteArray(),
                    "Get Device String OpCodes")
print CheckEquality(otherDevice.GetIPAddress().GetIPAsString(), "192.168.1.1",
                    "Get Device IP Address")

# Action Op Codes
actionParser = ActionOpCodeParser()
myArray = [chr(0x0A), chr(0x02), chr(0x01), chr(0x0f)]
SuccessArray = [
    chr(0x10),
    chr(0x00),
    chr(0x00),