Remoting SDK Android Client - Xamarin

net

(Owen) #1

Is it possible to use C# and the Xamarin runtime to create an Android RemObjects SDK client?

I’ve got an existing server I’d like to connect to and I’m able to generate an interface file to add into the Xamarin project. Adding the RemObjects.SDK package is causing me some difficulty though. There’s no obvious package available and browsing through what I’ve been able to find has led me to a set of DLLs under “PortableLibrary” which are working but which appear to contain only a small fraction of the RO components I’m used to. In particular it does not have any of the HTTP or SuperHTTP-type client components necessary for the connection I’m trying to make.

So some questions:

  • Am I using the wrong package here?
  • If so, which one(s) should I be using?
  • Is there any good example code available for such a client project?

Thanks in advance for any advice.


(marc hoffman) #2

yes, this should be fine with the .NET version of Remoting SDK. You will probably want to use the .NET Standard version of the library, but the regular version might work, as well (i’m not that familiar with Xamarins for Android, myself).


(antonk) #3

Hello

Portable Library builds were meant co contain the very bare minimum that should work on all supported platforms. This means that PCL does support only simple Http channel with async requests.

Still PCL build should be now considered as obsolete and in one of the next releases it will be removed altogether.

Starting this release we do ship .NET Standard 2.0 - targeted builds of Remoting SDK and Data Abstract. This means that now one has access to a much wider set of features including all client channels (Http, SuperHttp, Tcp, SuperTCP) excluding NamedPipes channel that is a strictly Windows-only feature.

Also it is now possible to send requests to the server in synchronous manner or using async/await calls.

Unfortunately I am not proficient with Xamarin to create a sample of proper quality (Xamarin specific code wise).
Just create a new .NET Standard class library project. Add there references to Remoting.SDK assemblies from the .NETStandard folder. Then import RODL of an existing server using Tools -> Remoting SDK & Data Abstract menu item. Then you will be able to call Remoting SDK server as usual

Regards


(Owen) #4

Thanks both very much for the details.

I’ve updated from the October SDK release to the March one. I’ll try out the .NET Standard version and see how things go!

Owen.


(Owen) #5

This is working now, to a degree.

Methods dealing with empty arrays, standard types (Integer, DateTime) and RO enumerations are working well, but any which deals with a ComplexType descendent generates the same exception:

“Unknown class ‘CLASSNAME’ found in stream.”

Where “CLASSNAME” is the name of the class in question.

As an example:

TdteErrorCode errorCode = sessionService.GetTimeUTC(out DateTime dt);

TdteErrorCode is an enumerated type defined in the RODL.
This works exactly as expected
The correct error code (EC_NONE) is returned and the DateTime out parameter is populated by the server.

TdtsReading reading = sessionService.GenerateReading();

TdtsReading is a ComplexType descendent defined in the RODL.
This throws System.Exception with the message:

"Unknown class 'TdtsReading' found in stream."

This pattern repeats with every method, except where the returned ComplexType descendent is null or an empty array of such types is being returned.

Any idea what’s causing this?


(antonk) #6

Hello

Due to platform limitations you need to explicitly tell Remoting SDK where it can find types matching to the type names sent from the server.

This is as easy as to call

RemObjects.SDK.TypeManager.TypeAssemblies.Add(typeof(TdtsReading).Assembly);

Regards


(marc hoffman) #7

Anton,

you we emit a cleaner error message there, when no assemblies were registered?


(antonk) #8

Sure, I’ll log an issue


(RemObjects) #9

Thanks, logged as bugs://79912


(RemObjects) #10

bugs://79912 got closed with status fixed.


(Owen) #11

Thanks, that makes sense now and is working well!


(a.xanthoudakis) #12

In case someone is interested I have a code sample that i use with a xamarin app. I can share. mail alex@oda.gr


(antonk) #13

You could share it here. There is a special category named ‘Snippets’ for this