Beispiel #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
Beispiel #2
0
        // ***************************************
        // CAN return rate
        // ***************************************
        public static string GenericCanRateReturn(string canInterface)
        {
            string hardwareString0 = canInterface.Replace(" ", "");

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

            // Kvaser can return
            if (msgOutput[2] == "Kvaser")
            {
                return(KvaserCanBus.CanRateReturn(canInterface));
            }
            else if (msgOutput[2] == "ECom")
            {
                return(ECOMCanBus.CanRateReturn(canInterface));
            }

            return(null);
        } // End GenericCanRateReturn
Beispiel #3
0
        }  // End GenericCanTransmitMultiple

        // CAN Receive
        public static bool GenericCanReceive(CanData can)
        {
            string hardwareString0 = can.hardware.Replace(" ", "");

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

            // Kvaser receive section
            if (msgOutput[2] == "Kvaser")
            {
                return(KvaserCanBus.CanReceive(can));
            }
            else if (msgOutput[2] == "ECom")
            {
                return(ECOMCanBus.CanReceive(can));
            }

            return(false);
        } // End Read
Beispiel #4
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
Beispiel #5
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);
            }
        }
Beispiel #6
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);
        }