示例#1
0
 private void createSerialCanConnection()
 {
     string str;
     try
     {
         if (canconnection != null && canconnection.isConnected()) canconnection.disconnect(out str);
         canconnection = new serialCanConnection((int)serialSettings["baud"], (System.IO.Ports.Parity)Enum.Parse(typeof(System.IO.Ports.Parity), serialSettings["parity"].ToString()), (string)serialSettings["port"], (System.IO.Ports.StopBits)Enum.Parse(typeof(System.IO.Ports.StopBits), serialSettings["stopbits"].ToString()), (int)serialSettings["databits"], false);
     }
     catch (Exception e2) { MessageBox.Show("Error during port initlization. Check settings. Error message: " + e2.Message, "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }
示例#2
0
 public eeDownloader(byte[] eebytes,ulong eelength,ulong eestart,eeType eetype, serialCanConnection sc, byte myId, byte targetId)
 {
     for (ulong i = 0; (i < eelength && i < MAX_EE_SIZE); i++) this.eebytes[i] = eebytes[i];
     for (ulong i = eelength; i < MAX_EE_SIZE; i++) this.eebytes[i] = 0xFF;
     this.eelength = eelength;
     this.eestart = eestart;
     this.eetype = eetype;
     this.sc = sc;
     this.MY_ID = myId;
     this.TARGET_ID = targetId;
 }
示例#3
0
 public frmIrtable(serialCanConnection sc)
 {
     InitializeComponent();
     this.sc = sc;
     string err;
     if (!sc.connect(out err))
     {
         MessageBox.Show("Error opening port. Description: " + err, "Port error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Close();
     }
     sc.newIncommingCanMessage += new EventHandler(sc_newIncommingCanMessage);
     loadTable();
 }