1
0
mirror of https://github.com/DarthAffe/OBD.NET.git synced 2025-12-12 16:58:30 +00:00
2017-05-20 18:09:24 +02:00
2017-05-20 18:09:24 +02:00
2016-04-16 16:13:51 +02:00
2016-04-16 16:07:12 +02:00
2016-04-16 16:07:12 +02:00
2017-05-08 22:22:53 +02:00

OBD.NET

C#-Library to read/write data from/to a car through an ELM327-/STN1170-Adapter

Projects

  • OBD.NET.Common - NetStandard 1.4 Library for platform independent stuff
  • OBD.NET.Desktop - Implemenation of SerialConnection on full .NET Framework
  • OBD.NET.Universal - Implementation of BluetoothSerialConnection for connecting to Bluetooth Adapter on UWP
  • OBD.NET.ConsoleClient - Example client application using SerialConnection on full .NET Framework

Usage

  • Add OBD.NET.Common and OBD.NET.Desktop packages to project
class Program
{
    static void Main(string[] args)
    {
        if (args.Length < 1)
        {
            Console.WriteLine("Parameter ComPort needed.");
            return;
        }

        var comPort = args[0];

        using (SerialConnection connection = new SerialConnection(comPort))
        using (ELM327 dev = new ELM327(connection, new OBDConsoleLogger(OBDLogLevel.Debug)))
        {
            dev.SubscribeDataReceived<EngineRPM>((sender, data) =>
            {
                Console.WriteLine("EngineRPM: " + data.Data.Rpm);
            });

            dev.SubscribeDataReceived<VehicleSpeed>((sender, data) =>
            {
                Console.WriteLine("VehicleSpeed: " + data.Data.Speed);
            });

            dev.Initialize();
            dev.RequestData<FuelType>();
            for (int i = 0; i < 5; i++)
            {
                dev.RequestData<EngineRPM>();
                dev.RequestData<VehicleSpeed>();
                Thread.Sleep(1000);
            }
            Console.ReadLine();
        }
        
    }
}
Languages
C# 100%