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

Experimental PoC of SwissbitCloud SCU for Android #215

Merged
merged 3 commits into from
Nov 6, 2023
Merged
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
48 changes: 48 additions & 0 deletions scu-de/fiskaltrust.Middleware.SCU.DE.sln
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "fiskaltrust.Middleware.SCU.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fiskaltrust.Middleware.SCU.DE.SwissbitAndroid", "src\fiskaltrust.Middleware.SCU.DE.SwissbitAndroid\fiskaltrust.Middleware.SCU.DE.SwissbitAndroid.csproj", "{05DC89A3-8C70-43B6-8FEB-52A25FF3C0F2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SwissbitCloudAndroid", "SwissbitCloudAndroid", "{8C3D1F0D-2A68-455F-B627-48B0CAA07770}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fiskaltrust.Middleware.SCU.DE.SwissbitCloudAndroid.Bindings.FccApi", "src\fiskaltrust.Middleware.SCU.DE.SwissbitCloudAndroid.Bindings.FccApi\fiskaltrust.Middleware.SCU.DE.SwissbitCloudAndroid.Bindings.FccApi.csproj", "{DA07A1A6-5301-43CE-A15D-94D32F3B357A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fiskaltrust.Middleware.SCU.DE.SwissbitCloudAndroid.Bindings.FccLibrary", "src\fiskaltrust.Middleware.SCU.DE.SwissbitCloudAndroid.Bindings.FccLibrary\fiskaltrust.Middleware.SCU.DE.SwissbitCloudAndroid.Bindings.FccLibrary.csproj", "{737C7190-D5E3-44BB-A049-ED1D36AD7C95}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fiskaltrust.Middleware.SCU.DE.SwissbitCloudAndroid", "src\fiskaltrust.Middleware.SCU.DE.SwissbitCloudAndroid\fiskaltrust.Middleware.SCU.DE.SwissbitCloudAndroid.csproj", "{F9A0B22D-31F7-4323-BF69-4C74333EEA29}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -323,6 +331,42 @@ Global
{05DC89A3-8C70-43B6-8FEB-52A25FF3C0F2}.Release|x64.Build.0 = Release|Any CPU
{05DC89A3-8C70-43B6-8FEB-52A25FF3C0F2}.Release|x86.ActiveCfg = Release|Any CPU
{05DC89A3-8C70-43B6-8FEB-52A25FF3C0F2}.Release|x86.Build.0 = Release|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Debug|x64.ActiveCfg = Debug|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Debug|x64.Build.0 = Debug|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Debug|x86.ActiveCfg = Debug|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Debug|x86.Build.0 = Debug|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Release|Any CPU.Build.0 = Release|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Release|x64.ActiveCfg = Release|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Release|x64.Build.0 = Release|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Release|x86.ActiveCfg = Release|Any CPU
{DA07A1A6-5301-43CE-A15D-94D32F3B357A}.Release|x86.Build.0 = Release|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Debug|x64.ActiveCfg = Debug|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Debug|x64.Build.0 = Debug|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Debug|x86.ActiveCfg = Debug|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Debug|x86.Build.0 = Debug|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Release|Any CPU.Build.0 = Release|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Release|x64.ActiveCfg = Release|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Release|x64.Build.0 = Release|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Release|x86.ActiveCfg = Release|Any CPU
{737C7190-D5E3-44BB-A049-ED1D36AD7C95}.Release|x86.Build.0 = Release|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Debug|x64.ActiveCfg = Debug|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Debug|x64.Build.0 = Debug|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Debug|x86.ActiveCfg = Debug|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Debug|x86.Build.0 = Debug|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Release|Any CPU.Build.0 = Release|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Release|x64.ActiveCfg = Release|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Release|x64.Build.0 = Release|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Release|x86.ActiveCfg = Release|Any CPU
{F9A0B22D-31F7-4323-BF69-4C74333EEA29}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -351,6 +395,10 @@ Global
{7AF5FB9E-29D7-4410-B5A3-1B0A3D9E1F49} = {2F690A2B-96D1-45AC-BD36-E27D68422352}
{AC4C74D6-C27A-4BA4-88CD-5194C7EC28DD} = {7201C6FB-C25C-45DB-9C0B-1355FEF13939}
{05DC89A3-8C70-43B6-8FEB-52A25FF3C0F2} = {2F690A2B-96D1-45AC-BD36-E27D68422352}
{8C3D1F0D-2A68-455F-B627-48B0CAA07770} = {2F690A2B-96D1-45AC-BD36-E27D68422352}
{DA07A1A6-5301-43CE-A15D-94D32F3B357A} = {8C3D1F0D-2A68-455F-B627-48B0CAA07770}
{737C7190-D5E3-44BB-A049-ED1D36AD7C95} = {8C3D1F0D-2A68-455F-B627-48B0CAA07770}
{F9A0B22D-31F7-4323-BF69-4C74333EEA29} = {8C3D1F0D-2A68-455F-B627-48B0CAA07770}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C5E269B8-4A21-4B1B-8805-C8193C08FE3E}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461;net6</TargetFrameworks>
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461;net6</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="sharpcompress" Version="0.24.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="sharpcompress" Version="0.24.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.2" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<PackageReference Include="BouncyCastle" Version="1.7.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<PackageReference Include="BouncyCastle" Version="1.7.0" />
</ItemGroup>
<ItemGroup>
<_Licenses Include="$(SolutionDir)/LICENSES/**" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.cs]
# Fix warnings that are caused by generated code
dotnet_diagnostic.cs0114.severity=suggestion
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Additions allow you to add arbitrary C# to the generated classes
before they are compiled. This can be helpful for providing convenience
methods or adding pure C# classes.

== Adding Methods to Generated Classes ==

Let's say the library being bound has a Rectangle class with a constructor
that takes an x and y position, and a width and length size. It will look like
this:

public partial class Rectangle
{
public Rectangle (int x, int y, int width, int height)
{
// JNI bindings
}
}

Imagine we want to add a constructor to this class that takes a Point and
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
with a partial class containing our new method:

public partial class Rectangle
{
public Rectangle (Point location, Size size) :
this (location.X, location.Y, size.Width, size.Height)
{
}
}

At compile time, the additions class will be added to the generated class
and the final assembly will a Rectangle class with both constructors.


== Adding C# Classes ==

Another thing that can be done is adding fully C# managed classes to the
generated library. In the above example, let's assume that there isn't a
Point class available in Java or our library. The one we create doesn't need
to interact with Java, so we'll create it like a normal class in C#.

By adding a Point.cs file with this class, it will end up in the binding library:

public class Point
{
public int X { get; set; }
public int Y { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class AuthorizationException
{
public new sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class ClientRegistrationException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class CloudTssException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class GeneralException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class InvalidInputException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class LibraryNotInitializedException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class MissingStoragePermission
{
public new sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public partial class NetworkException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class NoInternetConnectionException
{
public new sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class SessionExpiredException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class SessionNotStartedException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public partial class StorageException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class TssCspCommunicationException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class TssErrorTypeException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class TssNotAllowedToStartException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Android.OS;

namespace DE.Fiskal.Connector.Android.Api.Exception
{
public sealed partial class TssTokenException
{
public sealed partial class Creator
{
Java.Lang.Object IParcelableCreator.CreateFromParcel(Parcel source) => source;

Java.Lang.Object[] IParcelableCreator.NewArray(int size) => new Java.Lang.Object[size];
}
}
}
Loading
Loading