예제 #1
0
        public static int parseClientDataOpCode(List <byte> buffer, ref int counter)
        {
            UnwrapMOPHeader(buffer, ref counter);

            int firmwareversion = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);

            return(firmwareversion);
        }
예제 #2
0
        public static MOPHeader UnwrapMOPHeader(List <byte> buffer, ref int counter)
        {
            DeviceID newDeviceID = HeepLanguage.GetDeviceIDFromBuffer(buffer, ref counter);

            int       numBytes = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);
            MOPHeader header   = new MOPHeader(numBytes, newDeviceID);

            return(header);
        }
예제 #3
0
        public static Vertex parseVertexMOP(List <byte> buffer, ref int counter)
        {
            MOPHeader header = UnwrapMOPHeader(buffer, ref counter);

            DeviceID  txID        = header.deviceID;
            DeviceID  rxID        = HeepLanguage.GetDeviceIDFromBuffer(buffer, ref counter);
            int       txControlID = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);
            int       rxControlID = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);
            IPAddress rxIPAddress = HeepLanguage.GetIPAddrFromBuffer(buffer, counter);

            counter += 4;

            Vertex newVertex = new Vertex(rxID, txID, rxControlID, txControlID, rxIPAddress);

            Console.WriteLine("Adding a vertex named: " + newVertex.GetDestIP());

            return(newVertex);
        }
예제 #4
0
        public static List <byte> ParseSetVertexCommand(List <byte> commandBuffer, HeepDevice theDevice)
        {
            int counter = 1;

            HeepLanguage.GetNumberFromBuffer(commandBuffer, ref counter, 1);
            DeviceID txID      = HeepLanguage.GetDeviceIDFromBuffer(commandBuffer, ref counter);
            DeviceID rxID      = HeepLanguage.GetDeviceIDFromBuffer(commandBuffer, ref counter);
            int      txControl = HeepLanguage.GetNumberFromBuffer(commandBuffer, ref counter, 1);

            int rxControl = HeepLanguage.GetNumberFromBuffer(commandBuffer, ref counter, 1);

            IPAddress destIP = HeepLanguage.GetIPAddrFromBuffer(commandBuffer, counter);

            Vertex newVertex = new Vertex(rxID, txID, rxControl, txControl, destIP);

            theDevice.AddVertex(newVertex);

            return(AddSuccessMessageToBuffer("Vertex Set", theDevice));;
        }
예제 #5
0
        public static Control parseControlMOP(List <byte> buffer, ref int counter)
        {
            MOPHeader header = UnwrapMOPHeader(buffer, ref counter);

            int controlID        = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);
            int controlType      = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);
            int controlDirection = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);
            int lowValue         = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);
            int highValue        = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);
            int curValue         = HeepLanguage.GetNumberFromBuffer(buffer, ref counter, 1);

            string controlName = HeepLanguage.GetStringFromBuffer(buffer, ref counter, header.numBytes - 6);

            Control newControl = new Control(controlID, (Heep.Control.CtrlInputOutput)controlDirection, (Heep.Control.CtrlType)controlType, highValue, lowValue, curValue, controlName);

            Console.WriteLine("Adding a control named: " + controlName);

            return(newControl);
        }