Exemplo n.º 1
0
        private Message ReadMessage()
        {
            UInt16          len     = reader.ReadUInt16();
            byte            type    = reader.ReadByte();
            ULogMessageType msgType = (ULogMessageType)type;

            // Debug.WriteLine(msgType);
            switch (msgType)
            {
            case 0:
                // not sure what these are about!
                return(null);

            case ULogMessageType.FORMAT:
                return(ReadMessageFormat(len));

            case ULogMessageType.DATA:
                return(ReadDataMessage(len));

            case ULogMessageType.INFO:
                return(ReadInfoMessage(len));

            case ULogMessageType.INFO_MULTIPLE:
                return(ReadInfoMessageMultiple(len));

            case ULogMessageType.PARAMETER:
                return(ReadParameter(len));

            case ULogMessageType.PARAMETER_DEFAULT:
                return(ReadParameterDefault(len));

            case ULogMessageType.ADD_LOGGED_MSG:
                return(ReadAddLoggedMessage(len));

            case ULogMessageType.REMOVE_LOGGED_MSG:
                return(ReadRemoveLoggedMessage(len));

            case ULogMessageType.SYNC:
                return(ReadSyncMessage(len));

            case ULogMessageType.DROPOUT:
                return(ReadDropOutMessage(len));

            case ULogMessageType.LOGGING:
                return(ReadLoggingMessage(len));

            case ULogMessageType.LOGGING_TAGGED:
                return(ReadLoggingMessageTagged(len));

            case ULogMessageType.FLAG_BITS:
                return(ReadFlagBits(len));

            default:
                throw new FormatException("found unexpected ulog message type: " + msgType.ToString());
            }
        }
Exemplo n.º 2
0
        private Message ReadMessage()
        {
            UInt16          len     = reader.ReadUInt16();
            ULogMessageType msgType = (ULogMessageType)reader.ReadByte();

            switch (msgType)
            {
            case ULogMessageType.FORMAT:
                return(ReadMessageFormat(len));

            case ULogMessageType.DATA:
                return(ReadDataMessage(len));

            case ULogMessageType.INFO:
                return(ReadInfoMessage(len));

            case ULogMessageType.PARAMETER:
                return(ReadParameter(len));

            case ULogMessageType.ADD_LOGGED_MSG:
                return(ReadAddLoggedMessage(len));

            case ULogMessageType.REMOVE_LOGGED_MSG:
                return(ReadRemoveLoggedMessage(len));

            case ULogMessageType.SYNC:
                return(ReadSyncMessage(len));

            case ULogMessageType.DROPOUT:
                return(ReadDropOutMessage(len));

            case ULogMessageType.LOGGING:
                return(ReadLoggingMessage(len));

            default:
                throw new FormatException("found unexpected ulog message type: " + msgType.ToString());
            }
        }