Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make this project work under visual studio 2022 #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion SerialIO/SerialIO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
<RootNamespace>SerialIO</RootNamespace>
<AssemblyName>SerialIO</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<AndroidCodegenTarget>XamarinAndroid</AndroidCodegenTarget>
<AndroidClassParser>class-parse</AndroidClassParser>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
3 changes: 1 addition & 2 deletions SerialPort/Resources/Resource.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion SerialPort/SerialPort.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
9 changes: 7 additions & 2 deletions SerialPort/SerialPortWrapper/SerialPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class SerialPort
/// <summary>
/// Stop the reading from the Serial Port.
/// </summary>
private bool _stopOnReceive = true;
private bool _stopOnReceive = false;

private int _howManyDelayOnReceivingThread = 200;

Expand Down Expand Up @@ -88,7 +88,7 @@ public SerialPort(
});

OnReceiveThread.IsBackground = true;
OnReceiveThread.Start();
//OnReceiveThread.Start();

_serialPort = Serial.NativeSerialPort;
}
Expand Down Expand Up @@ -346,6 +346,11 @@ public void StopReceive()
}
}

public int BytesToRead
{
get => _serialPort.Available();
}

/// <summary>
/// Blocks until CTS, DSR, RI, CD changes or something interrupts it.
/// Can throw an exception if an error occurs while waiting.
Expand Down
2 changes: 1 addition & 1 deletion SerialPortPoc/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected override void OnCreate(Bundle bundle)
private void OpenLibSerialPort()
{
LibSerialPort = new SerialPort.SerialPortWrapper.SerialPort(
"/dev/tty",
"/dev/ttyS3",
115200,
Stopbits.One,
Parity.None,
Expand Down
4 changes: 2 additions & 2 deletions SerialPortPoc/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="SerialPortPoc.SerialPortPoc" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="27" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="SerialPortPoc.SerialPortPoc" android:versionCode="1" android:versionName="1.0" android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="30" />
<application android:label="SerialPortPoc"></application>
</manifest>
3 changes: 1 addition & 2 deletions SerialPortPoc/Resources/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions SerialPortPoc/SerialPortPoc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<AndroidApplication>true</AndroidApplication>
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
</PropertyGroup>
Expand All @@ -29,6 +29,11 @@
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
<AndroidLinkMode>None</AndroidLinkMode>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies>
<AndroidSupportedAbis>armeabi-v7a</AndroidSupportedAbis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down Expand Up @@ -56,7 +61,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="lib\libserial.so" />
<AndroidNativeLibrary Include="lib\armeabi-v7a\libserial.so" />
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
</ItemGroup>
Expand Down