diff --git a/OBD.NET/OBD.NET.Universal/Communication/BluetoothSerialConnection.cs b/OBD.NET/OBD.NET.Universal/Communication/BluetoothSerialConnection.cs deleted file mode 100644 index c6ea7c1..0000000 --- a/OBD.NET/OBD.NET.Universal/Communication/BluetoothSerialConnection.cs +++ /dev/null @@ -1,165 +0,0 @@ -using System; -using System.Runtime.InteropServices.WindowsRuntime; -using System.Threading; -using System.Threading.Tasks; -using OBD.NET.Communication.EventArgs; -using Windows.Devices.Bluetooth.Rfcomm; -using Windows.Networking.Sockets; -using Windows.Storage.Streams; -using System.Linq; -using Windows.Devices.Enumeration; - -// ReSharper disable once CheckNamespace -namespace OBD.NET.Communication -{ - /// - /// Bluetooth OBD serial implementation - /// - /// - public class BluetoothSerialConnection : ISerialConnection - { - #region Properties & Fields - - private StreamSocket _socket; - private DataWriter _writer; - - private readonly byte[] _readBuffer = new byte[1024]; - - private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); - private Task _readerTask; - - private string _device; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public BluetoothSerialConnection() - { - _device = null; - } - - /// - /// Initializes a new instance of the class. - /// - /// Name of the _device. - public BluetoothSerialConnection(string deviceName) - { - this._device = deviceName; - } - - #endregion - - #region Methods - - /// - /// Gets a value indicating whether this instance is open. - /// - /// - /// true if this instance is open; otherwise, false. - /// - public bool IsOpen { get; private set; } - - /// - /// Gets a value indicating whether this instance uses asynchronous IO - /// - /// - /// Has to be set to true if asynchronous IO is supported. - /// If true async methods have to be implemented - /// - public bool IsAsync => true; - - /// - /// Occurs when a full line was received - /// - public event EventHandler DataReceived; - - /// - /// Connects the serial port. - /// - /// Synchronous operations not supported - public void Connect() => throw new NotSupportedException("Synchronous operations not supported on UWP platform"); - - /// - /// Connects the serial port asynchronously - /// - /// - public async Task ConnectAsync() - { - DeviceInformationCollection services = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort)); - - //use first serial service - if (services.Count > 0) - { - string id = services[0].Id; - - //use predefined _device from constructor - if (!string.IsNullOrWhiteSpace(_device)) - { - id = services.Where(x => x.Name.Equals(_device, StringComparison.OrdinalIgnoreCase)) - .Select(x => x.Id) - .FirstOrDefault(); - - if (id == null) - throw new InvalidOperationException($"Device {_device} not found"); - } - - // Initialize the target Bluetooth _device - RfcommDeviceService service = await RfcommDeviceService.FromIdAsync(id); - - // Check that the service meets this App's minimum requirement - _socket = new StreamSocket(); - await _socket.ConnectAsync(service.ConnectionHostName, - service.ConnectionServiceName); - _writer = new DataWriter(_socket.OutputStream); - _readerTask = StartReader(); - IsOpen = true; - } - } - - /// - /// Writes the specified text to the serial connection - /// - /// Synchronous operations not supported - public void Write(byte[] data) => throw new NotSupportedException("Synchronous operations not supported on UWP platform"); - - /// - /// Writes the specified text to the serial connection asynchronously - /// - /// - public async Task WriteAsync(byte[] data) - { - _writer.WriteBytes(data); - await _writer.StoreAsync(); - await _writer.FlushAsync(); - } - - private Task StartReader() - { - return Task.Factory.StartNew(async () => - { - - IBuffer buffer = _readBuffer.AsBuffer(); - while (!_cancellationTokenSource.IsCancellationRequested) - { - IBuffer readData = await _socket.InputStream.ReadAsync(buffer, buffer.Capacity, InputStreamOptions.Partial); - SerialPortOnDataReceived(readData); - } - }, _cancellationTokenSource.Token); - } - - private void SerialPortOnDataReceived(IBuffer buffer) => DataReceived?.Invoke(this, new DataReceivedEventArgs((int)buffer.Length, _readBuffer)); - - public void Dispose() - { - _cancellationTokenSource?.Cancel(); - _readerTask?.Wait(); - _socket?.Dispose(); - } - } - - #endregion -} diff --git a/OBD.NET/OBD.NET.Universal/OBD.NET.Universal.csproj b/OBD.NET/OBD.NET.Universal/OBD.NET.Universal.csproj deleted file mode 100644 index cc044c5..0000000 --- a/OBD.NET/OBD.NET.Universal/OBD.NET.Universal.csproj +++ /dev/null @@ -1,138 +0,0 @@ - - - - - Debug - AnyCPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73} - Library - Properties - OBD.NET.Universal - OBD.NET.Universal - en-US - UAP - 10.0.22000.0 - 10.0.19041.0 - 14 - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - prompt - 4 - - - x86 - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x86 - false - prompt - - - x86 - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x86 - false - prompt - - - ARM - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM - false - prompt - - - ARM - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM - false - prompt - - - x64 - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x64 - false - prompt - - - x64 - bin\x64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x64 - false - prompt - - - PackageReference - - - - - - - - - 6.2.13 - - - - - {d985b70e-cdf3-4cf1-ab5d-8d19c7fe7b31} - OBD.NET - - - - - - - 14.0 - - - - \ No newline at end of file diff --git a/OBD.NET/OBD.NET.Universal/OBD.NET.Universal.nuspec b/OBD.NET/OBD.NET.Universal/OBD.NET.Universal.nuspec deleted file mode 100644 index 5fcc230..0000000 --- a/OBD.NET/OBD.NET.Universal/OBD.NET.Universal.nuspec +++ /dev/null @@ -1,15 +0,0 @@ - - - - $id$ - $version$ - $title$ - $author$ - $author$ - https://github.com/romanlum/OBD.NET - false - $description$ - Initial release. - Copyright 2017 - - \ No newline at end of file diff --git a/OBD.NET/OBD.NET.Universal/Properties/AssemblyInfo.cs b/OBD.NET/OBD.NET.Universal/Properties/AssemblyInfo.cs deleted file mode 100644 index 1b60af7..0000000 --- a/OBD.NET/OBD.NET.Universal/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OBD.NET.Universal")] -[assembly: AssemblyDescription("C#-Library to read/write data from/to a car through an ELM327-/STN1170-Adapter on UWP")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Roman Lumetsberger")] -[assembly: AssemblyProduct("OBD.NET")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)] \ No newline at end of file diff --git a/OBD.NET/OBD.NET.Universal/Properties/OBD.NET.Universal.rd.xml b/OBD.NET/OBD.NET.Universal/Properties/OBD.NET.Universal.rd.xml deleted file mode 100644 index 874b02e..0000000 --- a/OBD.NET/OBD.NET.Universal/Properties/OBD.NET.Universal.rd.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - diff --git a/OBD.NET/OBD.NET.sln b/OBD.NET/OBD.NET.sln index b5c2464..504b747 100644 --- a/OBD.NET/OBD.NET.sln +++ b/OBD.NET/OBD.NET.sln @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OBD.NET", "OBD.NET\OBD.NET. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleClient", "ConsoleClient\ConsoleClient.csproj", "{8AC58110-3925-481F-9D85-4B809D7D18B9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OBD.NET.Universal", "OBD.NET.Universal\OBD.NET.Universal.csproj", "{E0EAFF82-C514-4827-8F49-F1928EBA8E73}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -63,26 +61,6 @@ Global {8AC58110-3925-481F-9D85-4B809D7D18B9}.Release|x64.Build.0 = Release|Any CPU {8AC58110-3925-481F-9D85-4B809D7D18B9}.Release|x86.ActiveCfg = Release|Any CPU {8AC58110-3925-481F-9D85-4B809D7D18B9}.Release|x86.Build.0 = Release|Any CPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|ARM.ActiveCfg = Debug|ARM - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|ARM.Build.0 = Debug|ARM - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|ARM64.Build.0 = Debug|Any CPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|x64.ActiveCfg = Debug|x64 - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|x64.Build.0 = Debug|x64 - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|x86.ActiveCfg = Debug|x86 - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Debug|x86.Build.0 = Debug|x86 - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|Any CPU.Build.0 = Release|Any CPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|ARM.ActiveCfg = Release|ARM - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|ARM.Build.0 = Release|ARM - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|ARM64.ActiveCfg = Release|Any CPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|ARM64.Build.0 = Release|Any CPU - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|x64.ActiveCfg = Release|x64 - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|x64.Build.0 = Release|x64 - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|x86.ActiveCfg = Release|x86 - {E0EAFF82-C514-4827-8F49-F1928EBA8E73}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tools/nuget.exe b/Tools/nuget.exe deleted file mode 100644 index 856263d..0000000 Binary files a/Tools/nuget.exe and /dev/null differ