Example #1
0
        static public List <J2534Device> ListDevices()
        {
            if (j2534Devices != null)
            {
                return(j2534Devices);
            }

            j2534Devices = new List <J2534Device>();
            RegistryKey myKey = Registry.LocalMachine.OpenSubKey(PASSTHRU_REGISTRY_PATH, false);

            if (myKey == null)
            {
                myKey = Registry.LocalMachine.OpenSubKey(PASSTHRU_REGISTRY_PATH_6432, false);
                if (myKey == null)
                {
                    return(j2534Devices);
                }
            }
            string[] devices = myKey.GetSubKeyNames();
            foreach (string device in devices)
            {
                J2534Device tempDevice = new J2534Device();
                RegistryKey deviceKey  = myKey.OpenSubKey(device);
                if (deviceKey == null)
                {
                    continue;
                }
                tempDevice.Vendor            = (string)deviceKey.GetValue("Vendor", "");
                tempDevice.Name              = (string)deviceKey.GetValue("Name", "");
                tempDevice.ConfigApplication = (string)deviceKey.GetValue("ConfigApplication", "");
                tempDevice.FunctionLibrary   = (string)deviceKey.GetValue("FunctionLibrary", "");

                tempDevice.CANChannels          = (int)deviceKey.GetValue("CAN", 0);
                tempDevice.ISO15765Channels     = (int)deviceKey.GetValue("ISO15765", 0);
                tempDevice.J1850PWMChannels     = (int)deviceKey.GetValue("J1850PWM", 0);
                tempDevice.J1850VPWChannels     = (int)deviceKey.GetValue("J1850VPW", 0);
                tempDevice.ISO9141Channels      = (int)deviceKey.GetValue("ISO9141", 0);
                tempDevice.ISO14230Channels     = (int)deviceKey.GetValue("ISO14230", 0);
                tempDevice.SCI_A_ENGINEChannels = (int)deviceKey.GetValue("SCI_A_ENGINE", 0);
                tempDevice.SCI_A_TRANSChannels  = (int)deviceKey.GetValue("SCI_A_TRANS", 0);
                tempDevice.SCI_B_ENGINEChannels = (int)deviceKey.GetValue("SCI_B_ENGINE", 0);
                tempDevice.SCI_B_TRANSChannels  = (int)deviceKey.GetValue("SCI_B_TRANS", 0);

                if (tempDevice.FunctionLibrary == Assembly.GetExecutingAssembly().Location)
                {
                    continue;
                }

                j2534Devices.Add(tempDevice);
            }

            return(j2534Devices);
        }
Example #2
0
 public bool LoadLibrary(J2534Device device)
 {
     try {
         _device   = device;
         _wrapper  = new J2534DllWrapper();
         _IsLoaded = _wrapper.LoadJ2534Library(_device.FunctionLibrary);
         return(_IsLoaded);
     }
     catch (Exception)
     {
         _IsLoaded = false;
         return(_IsLoaded);
     }
 }
Example #3
0
        public static List<J2534Device> ListDevices()
        {
            if (j2534Devices != null)
            {
                return j2534Devices;
            }

            j2534Devices = new List<J2534Device>();
            RegistryKey myKey = Registry.LocalMachine.OpenSubKey(PASSTHRU_REGISTRY_PATH, false);
            if (myKey == null)
            {
                myKey = Registry.LocalMachine.OpenSubKey(PASSTHRU_REGISTRY_PATH_6432, false);
                if (myKey == null)
                    return j2534Devices;
            }
            string[] devices = myKey.GetSubKeyNames();
            foreach (string device in devices)
            {
                J2534Device tempDevice = new J2534Device();
                RegistryKey deviceKey = myKey.OpenSubKey(device);
                if(deviceKey == null)
                    continue;
                tempDevice.Vendor = (string)deviceKey.GetValue("Vendor","");
                tempDevice.Name = (string)deviceKey.GetValue("Name","");
                tempDevice.ConfigApplication = (string)deviceKey.GetValue("ConfigApplication", "");
                tempDevice.FunctionLibrary = (string)deviceKey.GetValue("FunctionLibrary", "");

                tempDevice.CANChannels = (int)deviceKey.GetValue("CAN",0);
                tempDevice.ISO15765Channels = (int)deviceKey.GetValue("ISO15765",0);
                tempDevice.J1850PWMChannels = (int)deviceKey.GetValue("J1850PWM",0);
                tempDevice.J1850VPWChannels = (int)deviceKey.GetValue("J1850VPW", 0);
                tempDevice.ISO9141Channels = (int)deviceKey.GetValue("ISO9141", 0);
                tempDevice.ISO14230Channels = (int)deviceKey.GetValue("ISO14230", 0);
                tempDevice.SCI_A_ENGINEChannels = (int)deviceKey.GetValue("SCI_A_ENGINE", 0);
                tempDevice.SCI_A_TRANSChannels = (int)deviceKey.GetValue("SCI_A_TRANS", 0);
                tempDevice.SCI_B_ENGINEChannels = (int)deviceKey.GetValue("SCI_B_ENGINE", 0);
                tempDevice.SCI_B_TRANSChannels = (int)deviceKey.GetValue("SCI_B_TRANS", 0);

                if (tempDevice.FunctionLibrary == Assembly.GetExecutingAssembly().Location) continue;

                j2534Devices.Add(tempDevice);
            }

            return j2534Devices;
        }
Example #4
0
 public bool LoadLibrary(J2534Device device)
 {
     m_device  = device;
     m_wrapper = new J2534DllWrapper();
     return(m_wrapper.LoadJ2534Library(m_device.FunctionLibrary));
 }
Example #5
0
 public bool LoadLibrary(J2534Device device)
 {
     m_device = device;
     m_wrapper = new J2534DllWrapper();
     return m_wrapper.LoadJ2534Library(m_device.FunctionLibrary);
 }