示例#1
0
        /// <summary>
        /// Open the CAN hardware device via the CanFestival driver, NB this is currently a simple version that will
        /// not work with drivers that have more complex bus ids so only supports com port (inc usb serial) devices for the moment
        /// </summary>
        /// <param name="comport">COM PORT number</param>
        /// <param name="speed">CAN Bit rate</param>
        /// <param name="drivername">Driver to use</param>
        public void open(int comport, BUSSPEED speed, string drivername)
        {
            driver = loader.loaddriver(drivername);
            driver.open(string.Format("COM{0}", comport), speed);

            driver.rxmessage += Driver_rxmessage;

            threadrun = true;
            Thread thread = new Thread(new ThreadStart(asyncprocess));

            thread.Name = "CAN Open worker";
            thread.Start();
        }
示例#2
0
        /// <summary>
        /// Open the CAN hardware device via the CanFestival driver, NB this is currently a simple version that will
        /// not work with drivers that have more complex bus ids so only supports com port (inc usb serial) devices for the moment
        /// </summary>
        /// <param name="comport">COM PORT number</param>
        /// <param name="speed">CAN Bit rate</param>
        /// <param name="drivername">Driver to use</param>
        public void open(string comport, BUSSPEED speed, string drivername)
        {
            driver = loader.loaddriver(drivername);
            driver.open(string.Format("{0}", comport), speed);

            driver.rxmessage += Driver_rxmessage;

            threadrun = true;
            Thread thread = new Thread(new ThreadStart(asyncprocess));

            thread.Name = "CAN Open worker";
            thread.Start();

            if (connectionevent != null)
            {
                connectionevent(this, new ConnectionChangedEventArgs(true));
            }
        }