Ejemplo n.º 1
0
 private static void ReadIdent(IKW1281Dialog kwp1281)
 {
     foreach (var identInfo in kwp1281.ReadIdent())
     {
         Logger.WriteLine($"Ident: {identInfo}");
     }
 }
Ejemplo n.º 2
0
        private void DumpClusterEeprom(IKW1281Dialog kwp1281, ushort startAddress, ushort length)
        {
            var identInfo = kwp1281.ReadIdent().First().ToString().Replace(' ', '_').Replace(":", "");

            UnlockControllerForEepromReadWrite(kwp1281);

            var dumpFileName = _filename ?? $"{identInfo}_${startAddress:X4}_eeprom.bin";

            Logger.WriteLine($"Saving EEPROM dump to {dumpFileName}");
            DumpEeprom(kwp1281, startAddress, length, maxReadLength: 16, dumpFileName);
            Logger.WriteLine($"Saved EEPROM dump to {dumpFileName}");
        }
Ejemplo n.º 3
0
        private string DumpClusterEeprom(IKW1281Dialog kwp1281, ushort startAddress, ushort length)
        {
            var identInfo = kwp1281.ReadIdent().First().ToString()
                            .Split(Environment.NewLine).First() // Sometimes ReadIdent() can return multiple lines
                            .Replace(' ', '_').Replace(":", "");

            UnlockControllerForEepromReadWrite(kwp1281);

            var dumpFileName = _filename ?? $"{identInfo}_${startAddress:X4}_eeprom.bin";

            Logger.WriteLine($"Saving EEPROM dump to {dumpFileName}");
            DumpEeprom(kwp1281, startAddress, length, maxReadLength: 16, dumpFileName);
            Logger.WriteLine($"Saved EEPROM dump to {dumpFileName}");

            return(dumpFileName);
        }
Ejemplo n.º 4
0
        private void LoadClusterEeprom(IKW1281Dialog kwp1281, ushort address, string filename)
        {
            _ = kwp1281.ReadIdent();

            UnlockControllerForEepromReadWrite(kwp1281);

            if (!File.Exists(filename))
            {
                Logger.WriteLine($"File {filename} does not exist.");
                return;
            }

            Logger.WriteLine($"Reading {filename}");
            var bytes = File.ReadAllBytes(filename);

            Logger.WriteLine("Writing to cluster...");
            WriteEeprom(kwp1281, address, bytes, 16);
        }