Beispiel #1
0
        static private List <J2534Library> FindLibrarys()
        {
            List <string> DllFiles = new List <string>();

            foreach (J2534RegisteryEntry Entry in GetRegisteryEntries())
            {
                DllFiles.Add(Entry.FunctionLibrary);
            }

            DllFiles.AddRange(Directory.GetFiles(".", "*.dll"));

            if (ConfigurationManager.AppSettings["UserLibrarys"] != null)
            {
                DllFiles.AddRange(ConfigurationManager.AppSettings["UserLibrarys"].Split(';'));
            }

            foreach (string DllFile in DllFiles)
            {
                J2534Library ThisLibrary = new J2534Library(DllFile);
                if (ThisLibrary.IsLoaded && !Librarys.Exists(Listed => Listed.FileName == ThisLibrary.FileName))
                {
                    Librarys.Add(ThisLibrary);
                }
            }
            return(Librarys);
        }
Beispiel #2
0
 static private void ConnectAllDevices(J2534Library DLL)
 {
     //If the DLL successfully executes GetNextCarDAQ_RESET()
     if (DLL.GetNextCarDAQ_RESET().IsOK)
     {
         GetNextCarDAQResults TargetDrewtechDevice = DLL.GetNextCarDAQ();
         while (TargetDrewtechDevice.Exists)
         {
             J2534Device ThisDevice = DLL.ConstructDevice(TargetDrewtechDevice);
             if (ThisDevice.IsConnected) //This should always succeed.
             {                           //To avoid populating the list with duplicate devices due to disconnection
                 //Remove any unconnected devices that are attached to this library.
                 PhysicalDevices.RemoveAll(Listed => Listed.DeviceName == ThisDevice.DeviceName);
                 PhysicalDevices.Add(ThisDevice);
             }
             TargetDrewtechDevice = DLL.GetNextCarDAQ();
         }
     }
     //If its not a drewtech library, then attempt to connect a device
     else
     {
         J2534Device ThisDevice = DLL.ConstructDevice();
         if (ThisDevice.IsConnected)
         {   //To avoid populating the list with duplicate devices due to disconnection
             //Remove any unconnected devices that are attached to this library.
             PhysicalDevices.RemoveAll(Listed => (Listed.Library == ThisDevice.Library) && !Listed.IsConnected);
             PhysicalDevices.Add(ThisDevice);
         }
     }
 }
Beispiel #3
0
        internal J2534Device(J2534Library Library, GetNextCarDAQResults CarDAQ)
        {
            this.Library         = Library;
            this.DeviceName      = CarDAQ.Name;
            this.DrewtechVersion = CarDAQ.Version;
            this.DrewtechAddress = CarDAQ.Address;

            ConnectToDevice(DeviceName);
        }
Beispiel #4
0
 internal J2534Device(J2534Library Library, string DeviceName)
 {
     this.Library    = Library;
     this.DeviceName = DeviceName;
     ConnectToDevice(this.DeviceName);
 }
Beispiel #5
0
        private bool ValidDevice;   //Flag used to determine if this device failed initial connection

        internal J2534Device(J2534Library Library)
        {
            this.Library = Library;
            ConnectToDevice("");
        }