} // End KvaserCanRateReturn // *************************************** // DetectCanInterfaces // Pulls all of the available adapters for the CAN bus // *************************************** public static void DetectCanInterfaces() { // Detect Process for Kvaser CAN devices try { int nrOfChannels; object o = new object(); Canlib.canInitializeLibrary(); //List available channels Canlib.canGetNumberOfChannels(out nrOfChannels); for (int i = 0; i < nrOfChannels; i++) { Canlib.canGetChannelData(i, Canlib.canCHANNELDATA_CHANNEL_NAME, out o); // Display of data in ListView as follows // Network; Type; Mfg; Channel; Status; canHandle BusInterface.AddInterface("CAN;" + o.ToString() + ";" + "Kvaser" + ";" + i, -1); ErrorLog.NewLogEntry("CAN", "Detect CAN: " + o.ToString()); } } catch (Exception) { ErrorLog.NewLogEntry("Adapter", "Kvaser library not found"); } } // End DetectCanInterfaces
} // End GenericCanInitilize // *************************************** // DetectCanInterfaces // Pulls all of the available adapters for the CAN bus // *************************************** public static void DetectCanInterfaces() { // Detect Process for Intrepid devices try { int iResult; neoCSNet2003.NeoDevice ndNeoToOpen = new neoCSNet2003.NeoDevice(); //Struct holding detected hardware information int iNumberOfDevices; //Number of hardware devices to look for string neoDevice; //Set the number of devices to find iNumberOfDevices = 1; // Revision needed to search for multiple devices //Search for connected hardware iResult = neoCSNet2003.icsNeoDll.icsneoFindNeoDevices(65535, ref ndNeoToOpen, ref iNumberOfDevices); // Obtain the name of the Interpid device -- Device names from Intrepid Sample code switch (ndNeoToOpen.DeviceType) { case 1: neoDevice = "neoVI Blue SN " + Convert.ToString(ndNeoToOpen.SerialNumber); break; case 4: neoDevice = "Value CAN 2 SN " + Convert.ToString(ndNeoToOpen.SerialNumber); break; case 8: neoDevice = "neoVI FIRE SN " + Convert.ToString(ndNeoToOpen.SerialNumber); break; case 16: neoDevice = "ValueCAN 3 SN " + Convert.ToString(ndNeoToOpen.SerialNumber); break; default: neoDevice = "Unknown neoVI SN " + Convert.ToString(ndNeoToOpen.SerialNumber); break; } if (iNumberOfDevices < 1 || iResult == 0) { ErrorLog.NewLogEntry("CAN", "Detect CAN: No Intrepid devices detected "); } else { BusInterface.AddInterface("CAN;" + neoDevice + ";" + "Intrepid" + ";" + 0, -1); ErrorLog.NewLogEntry("CAN", "Detect CAN: " + neoDevice); } } catch (Exception) { ErrorLog.NewLogEntry("Adapter", "Intrepid library not found"); } } // End DetectCanInterfaces
// Pulls all of the available adapters for the CAN bus public static void DetectLinInterfaces(BusInterface busInterface) { int nrOfChannels; Canlib.canInitializeLibrary(); //List available channels Canlib.canGetNumberOfChannels(out nrOfChannels); object o = new object(); for (int i = 0; i < nrOfChannels; i++) { Canlib.canGetChannelData(i, Canlib.canCHANNELDATA_CHANNEL_NAME, out o); // Display of data in ListView as follows // Network; Type; Mfg; Channel; Status BusInterface.AddInterface("CAN" + ";" + o.ToString() + ";" + "Kvasier" + ";" + i + ";" + "Pending", -1); } }
} // End GenericCanRateReturn // *************************************** // DetectCanInterfaces // Pulls all of the available adapters for the CAN bus // *************************************** public static void DetectCanInterfaces() { // Detect Process for ECom devices try { ECOMLibrary.DeviceInfo di = new ECOMLibrary.DeviceInfo(); UInt32 deviceSearch = ECOMLibrary.StartDeviceSearch(ECOMLibrary.FIND_ALL); while (deviceSearch != 0 && ECOMLibrary.FindNextDevice(deviceSearch, ref di) == ECOMLibrary.ECI_NO_ERROR) { BusInterface.AddInterface("CAN;" + "CANCapture" + ";" + "ECom" + ";" + di.SerialNumber, -1); ErrorLog.NewLogEntry("CAN", "Detect CAN: " + di.SerialNumber); } ECOMLibrary.CloseDeviceSearch(deviceSearch); } catch (Exception) { ErrorLog.NewLogEntry("Adapter", "ECom library not found"); } } // End DetectCanInterfaces