diff --git a/SerialIO/SerialIO.csproj b/SerialIO/SerialIO.csproj index 94ad688..1b51943 100644 --- a/SerialIO/SerialIO.csproj +++ b/SerialIO/SerialIO.csproj @@ -12,8 +12,9 @@ SerialIO SerialIO 512 - v6.0 + v11.0 XamarinAndroid + class-parse true diff --git a/SerialPort/Resources/Resource.designer.cs b/SerialPort/Resources/Resource.designer.cs index a3efc9c..ea8cba5 100644 --- a/SerialPort/Resources/Resource.designer.cs +++ b/SerialPort/Resources/Resource.designer.cs @@ -2,7 +2,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,7 +14,7 @@ namespace SerialPort { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.1.0.11")] public partial class Resource { diff --git a/SerialPort/SerialPort.csproj b/SerialPort/SerialPort.csproj index b0cc5a8..ff39e30 100644 --- a/SerialPort/SerialPort.csproj +++ b/SerialPort/SerialPort.csproj @@ -16,7 +16,7 @@ Resources\Resource.designer.cs Off false - v6.0 + v11.0 true diff --git a/SerialPort/SerialPortWrapper/SerialPort.cs b/SerialPort/SerialPortWrapper/SerialPort.cs index f6bc79d..a4abfb3 100644 --- a/SerialPort/SerialPortWrapper/SerialPort.cs +++ b/SerialPort/SerialPortWrapper/SerialPort.cs @@ -21,7 +21,7 @@ public class SerialPort /// /// Stop the reading from the Serial Port. /// - private bool _stopOnReceive = true; + private bool _stopOnReceive = false; private int _howManyDelayOnReceivingThread = 200; @@ -88,7 +88,7 @@ public SerialPort( }); OnReceiveThread.IsBackground = true; - OnReceiveThread.Start(); + //OnReceiveThread.Start(); _serialPort = Serial.NativeSerialPort; } @@ -346,6 +346,11 @@ public void StopReceive() } } + public int BytesToRead + { + get => _serialPort.Available(); + } + /// /// Blocks until CTS, DSR, RI, CD changes or something interrupts it. /// Can throw an exception if an error occurs while waiting. diff --git a/SerialPortPoc/MainActivity.cs b/SerialPortPoc/MainActivity.cs index e0c4574..94a0f0e 100644 --- a/SerialPortPoc/MainActivity.cs +++ b/SerialPortPoc/MainActivity.cs @@ -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, diff --git a/SerialPortPoc/Properties/AndroidManifest.xml b/SerialPortPoc/Properties/AndroidManifest.xml index 97d5bc8..6c13c5e 100644 --- a/SerialPortPoc/Properties/AndroidManifest.xml +++ b/SerialPortPoc/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/SerialPortPoc/Resources/Resource.Designer.cs b/SerialPortPoc/Resources/Resource.Designer.cs index d6abced..4a327df 100644 --- a/SerialPortPoc/Resources/Resource.Designer.cs +++ b/SerialPortPoc/Resources/Resource.Designer.cs @@ -2,7 +2,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,7 +14,7 @@ namespace SerialPortPoc { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.1.0.11")] public partial class Resource { diff --git a/SerialPortPoc/SerialPortPoc.csproj b/SerialPortPoc/SerialPortPoc.csproj index 985d81b..5ff8ada 100644 --- a/SerialPortPoc/SerialPortPoc.csproj +++ b/SerialPortPoc/SerialPortPoc.csproj @@ -15,7 +15,7 @@ true Resources\Resource.Designer.cs Off - v8.1 + v11.0 Properties\AndroidManifest.xml False @@ -29,6 +29,11 @@ 4 True None + false + false + false + false + armeabi-v7a pdbonly @@ -56,7 +61,7 @@ - + diff --git a/SerialPortPoc/lib/libserial.so b/SerialPortPoc/lib/armeabi-v7a/libserial.so similarity index 100% rename from SerialPortPoc/lib/libserial.so rename to SerialPortPoc/lib/armeabi-v7a/libserial.so