roshbaik2 / open-zwave

Automatically exported from code.google.com/p/open-zwave
0 stars 0 forks source link

Support Android NDK platform #212

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Thank you for your suggestion.

I tried that of course ;-)
Android is missing some standard linux libraries to make it work.
The hidapi part of the code won't compile.
Also the way threads are implemented in openzwave is not supported (things like 
PTHREAD_CANCEL_ENABLE are blocked 
(https://groups.google.com/group/android-ndk/tree/browse_frm/thread/b33991121d61
5e12/29949daae0a38205?hide_quotes=no)).

Maybe it can be fairly easy by rewriting just that thread part of openzwave, 
but there is still no guarantee that the hidapi part will work. (the usb 
controller already shows up as /dev/ttyUSB0, which is good i presume?)
Maybe there are some more things missing that I haven't even tried to compile 
yet.
I'm not that great with c/c++ and low level programming, so still any help 
would be greatly apreciated.

Willem

Original issue reported on code.google.com by glsatz on 14 Apr 2013 at 2:48

GoogleCodeExporter commented 9 years ago
+1 for this

Have there been any progresses on supporting Android ?

I will need to have OZW running on Android soon, so I was wondering if I will 
have to bang my head against it or if it will build smoothly.

Thanks for the great job

Original comment by massimoc...@gmail.com on 11 Jan 2015 at 5:50

GoogleCodeExporter commented 9 years ago
I'm afraid your head is going to be bloody. HID, Threads are incompatible, and 
there is no JNI interface for OZW.... 

of course, if you get it working - Patches welcome!

Original comment by jus...@dynam.ac on 11 Jan 2015 at 7:28

GoogleCodeExporter commented 9 years ago
Thanks for the reply.
Well, my project has a different approach to Android.
I stay away from Java code, which is not a serious language for us C++ 
developers :)

I use the Qt framework (which now runs on Android and iOS as well), so OZW will 
be cross-built just with an arm toolchain.
Probably the first thing to do for HID is allowing to build OZW without the HID 
support.
Shouldn't be that difficult, right ?
Having a quick look at the code, it seems the HidController is confined into 
Driver.cpp, which is good and should make things easier to #ifdef-ine

As for threads, I'm afraid I haven't gone into that deep yet.
I surely know that Qt makes large use of threads, and since they ported their 
framework to Android, there has to be a reliable way. I'll probably have a look 
at their QThread implementation and see what they changed for Android and see 
if it can be applied to OZW as well.

If I'll come up with patches, I'll be happy to submit them here.

Cheers

Original comment by massimoc...@gmail.com on 12 Jan 2015 at 1:09

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Another minor comment.
I see that in platform/unix/SerialControllerImpl.cpp there's <libudev.h> 
included.
Lookig at the code, it seems it is not needed as everything is done on the 
serial port through a file descriptor.
As far as I understand, udev is needed only by hidapi.

Needing udev in Android might be another problem, so if it can be removed it 
would be great :)

Original comment by massimoc...@gmail.com on 12 Jan 2015 at 1:37