コード例 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            test test1 = new test();

            test1       = SimpleFactory.Create <test>();
            label1.Text = test1.deviceType + "--" + test1.DevicesIndex + "--" + test1.CANIndex;
        }
コード例 #2
0
        public string  CANG <T>(T t) where T : CANAbstract
        {
            string dataResult = "";
            test   test1      = new test();

            test1 = SimpleFactory.Create <test>();
            t.Query("ec a0 45 2d 43 61 72 78", 0x77B, test1.deviceType, test1.DevicesIndex, test1.CANIndex, 0x77a);
            Thread.Sleep(100);
            if (t.initializeCAN(test1.deviceType, test1.DevicesIndex, test1.CANIndex, 0X1C))
            {
                foreach (var item in test1.TestItem)
                {
                    string key   = item.Key;
                    string value = item.Value;
                    dataResult = t.Query(value, 0x77B, test1.deviceType, test1.DevicesIndex, test1.CANIndex, 0x77a);
                    WriteLog.WriteLogFile(key + value + "\r\n" + dataResult);
                    updateTextBoxUI(Displytb, key + value + "\r\n" + dataResult + "\r\n");
                }
                t.CancelCAN(test1.deviceType, test1.DevicesIndex, test1.CANIndex);
                return(dataResult);
            }
            else
            {
                return("初始化失败!");
            }
        }
コード例 #3
0
        public string CANG <T>(T t, string data) where T : CANAbstract
        {
            string dataResult = "";
            test   test1      = new test();

            test1 = SimpleFactory.Create <test>();

            if (t.initializeCAN(test1.deviceType, test1.DevicesIndex, test1.CANIndex, 0X1C))
            {
                t.Query("ec a0 45 2d 43 61 72 78", 0x77B, test1.deviceType, test1.DevicesIndex, test1.CANIndex, 0x77a);
                Thread.Sleep(100);
                dataResult = t.Query(data, 0x77B, test1.deviceType, test1.DevicesIndex, test1.CANIndex, 0x77a);
                updateTextBoxUI(Displytb, data + "\r\n" + dataResult + "\r\n");
                t.CancelCAN(test1.deviceType, test1.DevicesIndex, test1.CANIndex);
                return(dataResult);
            }
            else
            {
                return("初始化失败!");
            }
        }