Esempio n. 1
0
        } // End GenericCanRateReturn

        // ***************************************
        // DetectCanInterfaces
        // Pulls all of the available adapters for the CAN bus
        // ***************************************
        public static void DetectCanInterfaces()
        {
            try
            {
                KvaserCanBus.DetectCanInterfaces();
            }
            catch (Exception)
            {
                ErrorLog.NewLogEntry("Adapter", "Kvaser library not found");
            }

            try
            {
                IntrepidCanBus.DetectCanInterfaces();
            }
            catch (Exception)
            {
                ErrorLog.NewLogEntry("Adapter", "Intrepid library not found");
            }

            try
            {
                ECOMCanBus.DetectCanInterfaces();
            }
            catch (Exception)
            {
                ErrorLog.NewLogEntry("Adapter", "ECom library not found");
            }
        } // End DetectCanInterfaces
Esempio n. 2
0
        // **********************
        // Turns canInterface off
        // **********************
        public static void GenericCanBusOff(string canInterface)
        {
            string hardwareString0 = canInterface.Replace(" ", "");

            string[] msgOutput = hardwareString0.Split(';');

            if (msgOutput[2] == "Kvaser")
            {
                KvaserCanBus.CanBusOff(canInterface);
            }
            else if (msgOutput[2] == "ECom")
            {
                ECOMCanBus.CanBusOff(canInterface);
            }
            else if (msgOutput[2] == "Intrepid")
            {
                IntrepidCanBus.CanBusOff(canInterface);
            }
        }
Esempio n. 3
0
        } // End GenericCanTransmitSingle

        // CAN Transmit for multiple transmissions
        public static void GenericCanTransmitMultiple(CanData can)
        {
            string hardwareString0 = can.hardware.Replace(" ", "");

            string[] msgOutput = hardwareString0.Split(';');

            if (msgOutput[2] == "Kvaser")
            {
                KvaserCanBus.CanTransmitMultiple(can);
            }
            else if (msgOutput[2] == "ECom")
            {
                ECOMCanBus.CanTransmitMultiple(can);
            }
            else if (msgOutput[2] == "Intrepid")
            {
                IntrepidCanBus.CanTransmitMultiple(can);
            }
        }  // End GenericCanTransmitMultiple
Esempio n. 4
0
        } // End DetectCanInterfaces

        // ***************************************
        // GenericCanBusOn
        // Turns canInterface on based on User Selection
        // ***************************************
        public static int GenericCanBusOn(string canInterface, string bitRateSetting)
        {
            string hardwareString0 = canInterface.Replace(" ", "");

            string[] msgOutput = hardwareString0.Split(';');

            if (msgOutput[2] == "Kvaser")
            {
                return(KvaserCanBus.CanBusOn(canInterface, bitRateSetting));
            }
            else if (msgOutput[2] == "ECom")
            {
                return(ECOMCanBus.CanBusOn(canInterface, bitRateSetting));
            }
            else if (msgOutput[2] == "Intrepid")
            {
                return(IntrepidCanBus.CanBusOn(canInterface, bitRateSetting));
            }

            return(-1);
        }