diff --git a/EdiabasLib/EdiabasLib/BtLeGattSpp.cs b/EdiabasLib/EdiabasLib/BtLeGattSpp.cs index 971b8460c..a46dcce60 100644 --- a/EdiabasLib/EdiabasLib/BtLeGattSpp.cs +++ b/EdiabasLib/EdiabasLib/BtLeGattSpp.cs @@ -142,7 +142,9 @@ public bool ConnectLeGattDevice(Context context, BluetoothDevice device) _btGattSppInStream = new MemoryQueueBufferStream(true); _btGattSppOutStream = new BGattOutputStream(this); BGattBaseCallback bGattCallback = Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu ? new BGatt2Callback(this) : new BGatt1Callback(this); +#pragma warning disable CA1416 _bluetoothGatt = device.ConnectGatt(context, false, bGattCallback, BluetoothTransports.Le); +#pragma warning restore CA1416 if (_bluetoothGatt == null) { LogString("*** ConnectGatt failed"); @@ -309,7 +311,9 @@ public bool ConnectLeGattDevice(Context context, BluetoothDevice device) byte[] enableNotifyArray = BluetoothGattDescriptor.EnableNotificationValue.ToArray(); if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu) { +#pragma warning disable CA1416 if (_bluetoothGatt.WriteDescriptor(descriptor, enableNotifyArray) != (int) CurrentBluetoothStatusCodes.Success) +#pragma warning restore CA1416 { LogString("*** GATT SPP write config descriptor failed"); return false; @@ -646,6 +650,7 @@ public BGattOutputStream(BtLeGattSpp btLeGattSpp) : base(true) _btLeGattSpp = btLeGattSpp; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416: Validate platform compatibility")] public override void Write(byte[] buffer, int offset, int count) { base.Write(buffer, offset, count); diff --git a/EdiabasLib/EdiabasLib/EdBluetoothInterfaceAndroid.cs b/EdiabasLib/EdiabasLib/EdBluetoothInterfaceAndroid.cs index dc4fd7a71..041d83a0b 100644 --- a/EdiabasLib/EdiabasLib/EdBluetoothInterfaceAndroid.cs +++ b/EdiabasLib/EdiabasLib/EdBluetoothInterfaceAndroid.cs @@ -1011,6 +1011,7 @@ public override void OnReceive(Android.Content.Context context, Android.Content. public static class AndroidExtensions { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416: Validate platform compatibility")] public static T GetParcelableExtraType(this Android.Content.Intent intent, string name) { object parcel; diff --git a/EdiabasLib/EdiabasLib/EdCustomWiFiInterface.cs b/EdiabasLib/EdiabasLib/EdCustomWiFiInterface.cs index 5e5989d2d..6867a5f84 100644 --- a/EdiabasLib/EdiabasLib/EdCustomWiFiInterface.cs +++ b/EdiabasLib/EdiabasLib/EdCustomWiFiInterface.cs @@ -189,6 +189,7 @@ public static bool InterfaceConnect(string port, object parameter, bool reconnec { Android.Net.NetworkCapabilities networkCapabilities = connectivityManager.GetNetworkCapabilities(network); Android.Net.LinkProperties linkProperties = connectivityManager.GetLinkProperties(network); +#pragma warning disable CA1416 if (networkCapabilities != null && linkProperties != null && linkProperties.DhcpServerAddress != null) { if (networkCapabilities.TransportInfo is Android.Net.Wifi.WifiInfo) @@ -201,6 +202,7 @@ public static bool InterfaceConnect(string port, object parameter, bool reconnec } } } +#pragma warning restore CA1416 } } } diff --git a/EdiabasLib/EdiabasLib/MemoryStreamReaderAndroid.cs b/EdiabasLib/EdiabasLib/MemoryStreamReaderAndroid.cs index 6ed6aea9f..63efc7f8c 100644 --- a/EdiabasLib/EdiabasLib/MemoryStreamReaderAndroid.cs +++ b/EdiabasLib/EdiabasLib/MemoryStreamReaderAndroid.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; +using System.Runtime.Versioning; using Android.OS; // ReSharper disable ConvertPropertyToExpressionBody @@ -344,6 +345,7 @@ private static Dictionary GetDirDict(string dirName) } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416: Validate platform compatibility")] private static string GetRealFileName(string filePath, bool enableNameEncoding) { if (File.Exists(filePath)) @@ -443,6 +445,7 @@ public DirectoryObserver(String rootPath) { } + [SupportedOSPlatform("android29.0")] public DirectoryObserver(Java.IO.File rootPath) : base(rootPath, Events) { diff --git a/EdiabasLib/EdiabasLib/TcpClientWithTimeout.cs b/EdiabasLib/EdiabasLib/TcpClientWithTimeout.cs index 74b4d08b2..ab6d8528f 100644 --- a/EdiabasLib/EdiabasLib/TcpClientWithTimeout.cs +++ b/EdiabasLib/EdiabasLib/TcpClientWithTimeout.cs @@ -123,6 +123,7 @@ public TcpClient Connect(System.Threading.ManualResetEvent resetEvent = null) return _connection; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416: Validate platform compatibility")] public static void ExecuteNetworkCommand(ExecuteNetworkDelegate command, IPAddress ipAddr, object networkDataObject) { #if ANDROID diff --git a/EdiabasLib/EdiabasLibAndroidNet/EdiabasLibAndroidNet.csproj b/EdiabasLib/EdiabasLibAndroidNet/EdiabasLibAndroidNet.csproj index 6229625fa..00edffef6 100644 --- a/EdiabasLib/EdiabasLibAndroidNet/EdiabasLibAndroidNet.csproj +++ b/EdiabasLib/EdiabasLibAndroidNet/EdiabasLibAndroidNet.csproj @@ -8,10 +8,10 @@ true - 1701;1702;CA1416 + 1701;1702 - 1701;1702;CA1416 + 1701;1702