public Form_AutomatedAnalysis()
        {
            InitializeComponent();
            //
            usbCAN = new USBCAN(getRawPacket);
            udsCAN = new UDSBASEDCAN(usbCAN);

            chartCmp.Series.Clear();

            readUdsInstructions(Application.StartupPath + @"\OPTIONAL.txt");
            //test
            ANALYSISRESULT testResult = new ANALYSISRESULT();

            testResult.udsReq.description   = "[测试数据]大众途安发动机扭矩";
            testResult.udsReq.format        = 0;
            testResult.udsReq.expectedFrame = 0;
            testResult.udsReq.address       = 0x7E0;
            testResult.udsReq.serviceID     = 0x22;
            testResult.udsReq.parameterList.Add(0x10);
            testResult.udsReq.parameterList.Add(0x10);

            testResult.path = Application.StartupPath + @"\dataPacket\[测试数据]大众途安发动机扭矩.txt";
            analysisResults.Add(testResult);

            listBoxResult.Items.Add(testResult.udsReq.description);
        }
Ejemplo n.º 2
0
        public Form_SetCANParam(USBCAN can)
        {
            InitializeComponent();
            textBoxBTR0.Text = textBoxBTR1.Text = "";
            usbCAN           = can;

            uint device_count = USBCAN.detectCONNECT();

            if (device_count == 0xff)
            {
                MessageBox.Show("无设备连接!"); return;
            }
            int add_count = 0;

            while (device_count > 0)
            {
                device_count--;
                this.comboBoxCANIndex.Items.Add("设备" + add_count);
                add_count++;
            }

            if (usbCAN.CANIndex == 0 || usbCAN.CANIndex == 1)
            {
                comboBoxCANIndex.SelectedIndex = usbCAN.CANIndex;
                textBoxBTR0.Text = usbCAN.BTR0.ToString("X2");
                textBoxBTR1.Text = usbCAN.BTR1.ToString("X2");
            }
            CheckForIllegalCrossThreadCalls = false;
            form_setcan     = this;
            this.应用.Visible = false;
        }
Ejemplo n.º 3
0
        private void 应用_Click(object sender, EventArgs e)
        {
            if (comboBoxCANIndex.SelectedIndex == -1)
            {
                MessageBox.Show("请指定通道号");
                return;
            }

            if (textBoxBTR0.Text.Equals("") || textBoxBTR1.Text.Equals(""))
            {
                MessageBox.Show("请设置比特率寄存器");
                return;
            }

            byte BTR0 = 0, BTR1 = 0;

            try
            {
                BTR0 = Convert.ToByte(textBoxBTR0.Text, 16);
            }
            catch (Exception)
            {
                MessageBox.Show("BTR0转化成16进制失败");
                return;
            }
            try
            {
                BTR1 = Convert.ToByte(textBoxBTR1.Text, 16);
            }
            catch (Exception)
            {
                MessageBox.Show("BTR1转化成16进制失败");
                return;
            }

            int index = comboBoxCANIndex.SelectedIndex;

            if (!USBCAN_dictionary.ContainsKey(index))
            {
                USBCAN_dictionary.Add(index, new USBCAN());
            }
            else
            {
                USBCAN_dictionary[index] = new USBCAN();
            }
            USBCAN_dictionary[index].BTR0 = BTR0;
            USBCAN_dictionary[index].BTR1 = BTR1;
            USBCAN_dictionary[index].PCAN_PARA1.PCANIndex = PCAN_COMMON_VAL.can_channel_buf;
            USBCAN_dictionary[index].PCAN_PARA1.BTR0_1    = PCAN_COMMON_VAL.BTR0_1_buf;
            MessageBox.Show("设定成功");
        }
Ejemplo n.º 4
0
        public Form_Replay(USBCAN can, DataGridViewRow row)
        {
            InitializeComponent();

            usbCAN = can;
            dataGridViewsend.Rows.Add();
            int i;

            for (i = 1; i < row.Cells.Count; i++)
            {
                dataGridViewsend.Rows[0].Cells[i - 1].Value = row.Cells[i].Value;
            }
            dataGridViewsend.Rows[0].Cells[i - 1].Value = "30";
        }
Ejemplo n.º 5
0
        public Form_AidedAnalysis(USBCAN can)
        {
            InitializeComponent();

            dsClass      = new DISCRETEVARIABLES();
            ctClass      = new CONTINUOUSVARIABLE();
            usbCAN       = new USBCAN(dsClass.saveData);
            dispalyClass = new DISPLAYCLASS(dataGridViewshow);

            usbCAN.BTR0     = can.BTR0;
            usbCAN.BTR1     = can.BTR1;
            usbCAN.CANIndex = can.CANIndex;

            dataGridViewfuzzy.Rows.Add();
        }
Ejemplo n.º 6
0
        public Form_BasicFunction()
        {
            InitializeComponent();
            dataGridViewsend.Rows.Add();
            dataGridViewsend.Rows[0].Cells[0].Value  = false;
            dataGridViewsend.Rows[0].Cells[11].Value = "标准帧";
            dataGridViewsend.Rows[0].Cells[12].Value = "数据帧";
            dataGridViewsend.Rows[0].Cells[13].Value = "0";
            dataGridViewsend.CellValueChanged       += dataGridViewsend_CellValueChanged;

            dataGridViewfilter.Rows.Add();
            dataGridViewfilter.Rows[0].Cells[0].Value = false;
            dataGridViewfilter.CellValueChanged      += dataGridViewfilter_CellValueChanged;

            displayClass = new DISPLAYCLASS(dataGridViewshow);
            usbCAN       = new USBCAN(displayClass.ProcessingFrame);


            canMenu.usbCAN = usbCAN;
            CheckForIllegalCrossThreadCalls = false;
            form_basic = this;
        }
Ejemplo n.º 7
0
        public Form_OBD()
        {
            InitializeComponent();

            readUdsInstructions(Application.StartupPath + @"\OBD.txt", listOBD);
            addOBDinfo();

            usbCAN   = new USBCAN(obdProcess);
            udsClass = new UDSBASEDCAN(usbCAN);

            int cnt = listOBD.Count / 0x20;

            if ((cnt % 0x20) != 0)
            {
                cnt++;
            }
            arrStrSupported = new string[cnt];

            resetArrStrSupported();

            obdShowIndexs.Clear();

            delFetch = fetchObdValue;
        }
Ejemplo n.º 8
0
        public Form_SetCANParam(ref Dictionary <int, USBCAN> usbcan_dictionary)
        {
            InitializeComponent();
            textBoxBTR0.Text       = textBoxBTR1.Text = "";
            this.USBCAN_dictionary = usbcan_dictionary;

            uint device_count = USBCAN.detectCONNECT();

            if (device_count == 0xff)
            {
                MessageBox.Show("无设备连接!"); return;
            }
            int add_count = 0;

            while (device_count > 0)
            {
                device_count--;
                this.comboBoxCANIndex.Items.Add("设备" + add_count);
                add_count++;
            }
            CheckForIllegalCrossThreadCalls = false;
            form_setcan           = this;
            this.buttonOK.Visible = false;
        }
Ejemplo n.º 9
0
 public UDSBASEDCAN(USBCAN can)
 {
     usbCAN = can;
 }