Ejemplo n.º 1
0
        public static void LOG_cmd(byte[] cmd, e_cmd type)
        {
            string prefix = "";
            string hex    = BitConverter.ToString(cmd).Replace("-", " ");

            switch (type)
            {
            case (e_cmd.sending):
                prefix = "Sending:\t";
                LOG_sent(hex);
                break;

            case (e_cmd.received):
                prefix = "Got:\t";
                LOG_got(hex);
                break;

            case (e_cmd.receivedEchoOf):
                prefix = "Echo confirm:\t";
                LOG_got(hex);
                break;

            case (e_cmd.
                  receivedStatusPacket):
                prefix = "Got Status:\t";
                LOG_got(hex);
                break;

            case (e_cmd.receivedCheckNot):
                prefix = "! Got with wrong Checksum: ";
                LOG_got(hex);
                break;

            case (e_cmd.receivedWithError):
                prefix = "! Got with an Error: ";
                LOG_got(hex);
                break;
            }
            LOG(prefix + hex);
        }
Ejemplo n.º 2
0
        private void LOG_cmd(Byte[] cmd, e_cmd type)
        {
            string prefix = "";
            string hex    = BitConverter.ToString(cmd).Replace("-", " ");
            string line   = hex + "\r\n";

            switch (type)
            {
            case (e_cmd.received):
                prefix  = "Got : ";
                logRec += line;
                break;

            case (e_cmd.receivedCheckNot):
                prefix  = "! Got with wrong Checksum: ";
                logRec += line;
                break;

            case (e_cmd.receivedWithError):
                prefix  = "! Got with an Error: ";
                logRec += line;
                break;

            case (e_cmd.sent):
                prefix   = "Sent: ";
                logSent += line;
                break;
            }

            log += prefix + line;
            //log = hex;

            // raise event LOG_UPDATE_tx!!
            logChanged = true;
            //LOG_msgAppendLine(prefix + hex);
            //txLog.AppendText(prefix + line);
            //txSent.AppendText(line);
            //txReceived.AppendText(line);
        }