sputnikdev / eclipse-smarthome-bluetooth-binding

Eclipse SmartHome Bluetooth Binding
46 stars 10 forks source link

Eclipse Setup for extending/developing this binding #65

Open benjaminaigner opened 5 years ago

benjaminaigner commented 5 years ago

Dear Vlad,

I'm now going to start with developing a Mesh feature for this binding. Therefor, I need to have a build system which integrates the openHAB/ESH platform and the GIT version of this binding.

I followed the IDE setup guide for openHAB ( https://www.openhab.org/docs/developer/development/ide.html ), which results in a working Eclipse workspace, which is building and running the core+GUI+bindings.

Nevertheless, I cannot start the framework with the currently built BT binding, the run configuration is offering me only the BT binding from the Maven repo (via "Run Configurations"->"Plug-ins").

Is there a preferred way of starting the local build of this binding together with ESH/OpenHAB?

THX, Benjamin

vkolotov commented 5 years ago

Hi Benjamin, good on you. I'll be supporting you in all aspects. However, I'd like to make sure that you understand that this won't be as easy as you may think...

As far as I know, the only way to add mesh networking at the moment is to make use of the Bluez new functionality, meaning that the transport that uses Bluez needs to be updated accordingly. Particularly this part is not easy as the transport uses TinyB library. This library is written in C and it's got a wrapper around it in java. Effectively, if you want to extend TinyB with some new features, you have to extend the C part first, and then the java wrapper. Having said that, it is still possible. I have contributed some small bits and pieces into TinyB. I must say that it was not very easy to do as it requires some C knowledge which is not my strongest skill.

Anyway, honestly speaking, the TinyB library is something that we always wanted to get rid because of a number of reasons. First of all, it is just unnecessary/superfluous layer that brings another level of complexity. Secondly, it also is not stable and introduces some bugs. Lastly, it does not allow as to add new features easily. Effectively, what we wanted is to talk to Bluez directly via DBus without TinyB, @xrucka has an initial version of his DBus Transport that does it. @xrucka did a great job, however, it still needs some more tweaks/fixes/testing to bring it to usable condition (although @xrucka reported that he is using it already, I found some issues that I did not have time to fix/troubleshoot, it is on my radar).

I'd recommend you to have a look at the @xrucka 's transport and see/test if you can extend it with mesh networking (obviously you will need to add extra interfaces into the Bluetooth Manager as well).

vkolotov commented 5 years ago

As per IDE set up, I never use Eclipse as I'm big fan of intellij IDEA (and a big hater of Eclipse). What I do is:

  1. Install OH through apt-get as per OH installation instruction.
  2. Set up OH to accept java remote debugger
  3. Run unittests, build all modules/plugins using maven
  4. Manually upload updated plugins into the 'addons' folder in OH.
  5. Connect IDEA remote debugger to the OH as per normal

Having said that, if you prefer Eclipse, you should still be able to use it as per normal with maven.

BTW, you don't have to have ESH/OH sources locally.

pfink commented 5 years ago

FTR: The reason why it is not available within "Plug-Ins" menu of Eclipse Runtime Configuration is that this binding does not provide any MANIFEST.MF. Other bindings use MANIFEST/OSGI for dependency resolution, but this one is using Maven instead.

Both approaches were discussed at the SmartHome day. I remember that lack of full-blown IDE integration was mentioned there as one major drawback of the Maven/POM-only approach.