Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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));;
        }