On Jul 23, 2011, at 12:45 AM, Igor Russkih wrote: > Our current idea is to keep this library running in monodroid as an android > service (and by this share the main "heavy" buisness logic code between > WM/android projects), and to create a UI wrapper. (it most probably will be > in native java).
Using Mono for Android to create a UI wrapper makes sense, but why do you want to run your library as an Android service? Android.App.Service has a main loop, just like Android.App.Activity, and it's the _same_ main loop that activities use. Consequently, it is _not_ the thread you want to be doing high data throughput algorithms on that thread, as it would lock up your UI. You want to use some background thread (e.g. a dedicated System.Threading.Thread) instead. > Is it possible to work with android BT API directly from monodroid code? There is an Android.Bluetooth namespace which allows use of bluetooth devices: http://docs.mono-android.net/Android.Bluetooth > How efficient it'll be in terms of data transfers? I don't know. Unfortunately, you would need to profile. Furthermore, I don't know if the emulator emulates bluetooth or not; you may need to profile on actual hardware to see what the overhead is (and you'd probably want actual hardware anyway to see if it's fast enough). > I mean since monodroid creates wrappers for Input/Output-Streams (does it?) > how well stream.read and stream.write will map data? The amounts of data is > not high (several bytes), but the request/response rate with BT hardware is > required to be as fast as possible. (normally its up to 50Hz). Won't > read/write serialization between dalvik/mono be a bottleneck here? Yes, Android.Runtime.OutputStreamInvoker.Write() will create a new Java-side array, copy the contents of the managed array into the byte array, then invoke the underlying Java method (which may make additional copies; who knows…). Whether this will be an actual bottleneck or not requires profiling to answer. :-( > Second question is service <-> UI interaction part. Normally this is done > with AIDL in java.. I haven't found any words on aidl support in monodroid. > Guess it could be implemented 'manually' - is there any experience exist in > this area? As mentioned above, I'm not sure you want to use a Service here. That said, there is currently no built-in support for AIDL files. If necessary, you could probably hack something together by invoking the aidl compiler as a pre-build step and including the Java sources (both generated and potentially hand-written) into the final app by using the AndroidJavaSource build action, then using Android.Runtime.JNIEnv to interact with the Java types. We intend on improving AIDL support in a future release, but there is no timeframe. - Jon _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid