Example #1
0
        // Allows the thread to place data in the RichEditBox control.
        private void AddMessageData(Int32 chNum, UInt32 msgId, UInt32 dlc, Byte [] msgData,
            UInt32 flags, Linlib.LinMessageInfo msgInfo)
        {
            if ((flags & Linlib.LIN_RX) != 0)
             {
            OutputRTB.AppendText("  RX   " + chNum.ToString("00") + "   ");
             }
             else
             {
            OutputRTB.AppendText("  TX   " + chNum.ToString("00") + "   ");
             }
             OutputRTB.AppendText(msgId.ToString("X8") + "   ");

             OutputRTB.AppendText(
            (((flags & Linlib.LIN_BIT_ERROR) != 0) ? "B" : " ") +
            (((flags & Linlib.LIN_SYNCH_ERROR) != 0) ? "S" : " ") +
            (((flags & Linlib.LIN_PARITY_ERROR) != 0) ? "P" : " ") +
            (((flags & Linlib.LIN_CSUM_ERROR) != 0) ? "C" : " ") +
            (((flags & Linlib.LIN_NODATA) != 0) ? "H" : " ") +
            (((flags & Linlib.LIN_WAKEUP_FRAME) != 0) ? "W" : " ") + "   ");

             OutputRTB.AppendText(dlc.ToString("D") + "     " +
                              msgInfo.checkSum.ToString("X2") + "     " +
                              msgInfo.idPar.ToString("X2") +
                              "         ");
             for (int i = 0; i < 8; i++)
             {
            if (i < dlc)
            {
               OutputRTB.AppendText(msgData[i].ToString("X2") + "  ");
            }
            else
            {
               OutputRTB.AppendText("    ");
            }
             }
             // time stamp
             double modifiedTime;
             modifiedTime = ((double)(msgInfo.timestamp)) / 1000.0;
             OutputRTB.AppendText(modifiedTime.ToString(" " + "000000.000") + "\n");

             // Need scroll bar to move down as data is added.
             // qqq - Something needs to be fixed here so scroll bar prevents this call.
             OutputRTB.ScrollToCaret();
        }
Example #2
0
 private void DisplayError(Linlib.LinStatus status, String funcName)
 {
     System.Windows.Forms.MessageBox.Show(funcName + " failed with error code " + status,
                  funcName + " Error",
                  System.Windows.Forms.MessageBoxButtons.OK,
                  System.Windows.Forms.MessageBoxIcon.Error);
 }