mirror of
https://github.com/DarthAffe/OBD.NET.git
synced 2026-11-11 13:06:25 +00:00
Moved common parts into ODB.NET.Common
re-factored SerialConnection to ISerialConnection interface and removed stuff which is not compatible with NetStandard
This commit is contained in:
1 parent
7e0e2447c7
commit
9dd42cba6f
144 files changed
+71
-534
No files matched your search
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace OBD.NET.Communication
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Serial connection interface
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="System.IDisposable" />
|
||||||
|
public interface ISerialConnection : IDisposable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this instance is open.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// <c>true</c> if this instance is open; otherwise, <c>false</c>.
|
||||||
|
/// </value>
|
||||||
|
bool IsOpen { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when a full line was received
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<string> MessageReceived;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Connects the serial port.
|
||||||
|
/// </summary>
|
||||||
|
void Connect();
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the specified text to the serial connection
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The text.</param>
|
||||||
|
void Write(string text);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -36,7 +36,7 @@ namespace OBD.NET.Devices
|
|||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public ELM327(SerialConnection connection, IOBDLogger logger = null)
|
public ELM327(ISerialConnection connection, IOBDLogger logger = null)
|
||||||
: base(connection, logger: logger)
|
: base(connection, logger: logger)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ namespace OBD.NET.Devices
|
|||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public STN1170(SerialConnection connection, IOBDLogger logger = null)
|
public STN1170(ISerialConnection connection, IOBDLogger logger = null)
|
||||||
: base(connection, logger)
|
: base(connection, logger)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
+2
-2
@@ -11,14 +11,14 @@ namespace OBD.NET.Devices
|
|||||||
|
|
||||||
protected IOBDLogger Logger { get; }
|
protected IOBDLogger Logger { get; }
|
||||||
|
|
||||||
protected SerialConnection Connection { get; }
|
protected ISerialConnection Connection { get; }
|
||||||
protected char Terminator { get; set; }
|
protected char Terminator { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
protected SerialDevice(SerialConnection connection, char terminator = '\r', IOBDLogger logger = null)
|
protected SerialDevice(ISerialConnection connection, char terminator = '\r', IOBDLogger logger = null)
|
||||||
{
|
{
|
||||||
this.Connection = connection;
|
this.Connection = connection;
|
||||||
this.Terminator = terminator;
|
this.Terminator = terminator;
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-4
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace OBD.NET.Exceptions
|
namespace OBD.NET.Exceptions
|
||||||
{
|
{
|
||||||
@@ -18,9 +17,6 @@ namespace OBD.NET.Exceptions
|
|||||||
: base(message, innerException)
|
: base(message, innerException)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
protected SerialException(SerializationInfo info, StreamingContext context)
|
|
||||||
: base(info, context)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
-7
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace OBD.NET.Exceptions
|
namespace OBD.NET.Exceptions
|
||||||
{
|
{
|
||||||
@@ -35,12 +34,6 @@ namespace OBD.NET.Exceptions
|
|||||||
this.ExpectedResult = expectedResult;
|
this.ExpectedResult = expectedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UnexpectedResultException(SerializationInfo info, StreamingContext context, string result, string expectedResult)
|
|
||||||
: base(info, context)
|
|
||||||
{
|
|
||||||
this.Result = result;
|
|
||||||
this.ExpectedResult = expectedResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard1.6</TargetFramework>
|
||||||
|
<Authors>Wyrez / Roman Lumetsberger</Authors>
|
||||||
|
<Company>-</Company>
|
||||||
|
<Product>OBD.NET</Product>
|
||||||
|
<Description>C#-Library to read/write data from/to a car through an ELM327-/STN1170-Adapter</Description>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Communication\" />
|
||||||
|
<Folder Include="Properties\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 144 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user