[Off-topic] Kittenrainbow:
Hey Guys

First of all: I realize that this is a rather long text, so I appreciate the effort of everyone who is going to read it!

Also, I asked a questions about 2 weeks ago, which was related to this topic, but was very specific about android wear (which I gave up on since then!).

So, actual post:

I want to build, or already am building an informational system for my motorcycle.

As the result of my work, I imagine a display (about 7 inches) in the dash of my motorcycle. It shall display information from my Smartphone (for example notifications about incoming calls etc.) as well as giving me the possibility to control the music on the smartphone (Android 5.1).

Also, I want to display further information, like speed, average speed, altitude etc. (hope you got the idea, basically just an advanced trip computer).

I started developing something, but ran into issues. I will explain my two concepts or ideas I had so far and explain, what the issues were I ran into. I then hope, that somebody here has a solution for my problem (which includes recommending hard- and software).

Firstly about my skills: I am experienced in programming "low level hardware", like Atmel's AVR Series (in plain old C) and developing the associated hardware for it. Also making custom pcb's at home isn't a problem for me, as long it doesn't come to some fancy BGA or SMD packages ;)

On the programming side I am experienced the most in Java (and Android, which is basically Java of course). I know also C# and the .NET framework.

But I am willing to learn something new;)

The two ideas I had so far differed on the way how I wanted to let the raspberry pi (which I wanted to place in the cockpit) communicate with the smartphone.

In both concepts, I planned to have a raspberry pi with attached display in the cockpit on which I wanted to run a JavaFX application (already started programing). This application would then communicate with the smartphone over:

Idea 1: Java serialization:

I wanted to communicate over command objects. So for example I'd have an object for asking the altitude from the smartphone.

I'd then serialize this command object on the pi's side and deserialize on the smartphone. This isn't a problem, because there's java on either side (already got that piece working).

The smartphone would, after receiving and deserializing the object, get the actual altitude from the GPS sensor, pack the result in an answer-object, serialize it and send it back to the pi.

The issues I ran into were the following:

-Java Bluetooth library: I wasn't able to find a good, up-to-date, java library for communicate over Bluetooth in java. I then stuck to RXTX Library which did the job, but I always had the feeling of doing something "not so good". In particular I didn't want to just write on a COM-Port (which is emulated from the Bluetooth-module), because I had the feeling that COM-Ports may change after reboots if the OS feels like it, and I didn't want to build something which needed constant "tinkering". Also, writing to COM-Ports in 2015 just feels wrong, but this may be my personal problem ;)

Idea 2: HTTP and Web Sockets

The basic idea was to have a webserver running on the smartphone and offering a REST-like API which I could access from the pi.

I also got this concept working, like so:

By using the NanoHTTPD library (from github) I was able to start a webserver on the android device. When then someone issued a POST-request on, for example, <IP>:<port>/api/music/next, the WebServer would receive this request and switch to the next song.

Actualizing data on the pi which changes often, for example the altitude, would have been achieved by using a WebSocket connection between the Java-App on the pi and the android webserver (which I also got to work).

I figured out that it would be a power consumption problem to let the smartphone offer a wifi hotspot (I don't want to have to connect the smartphone to cables on the motorcycle), so I decided to let the pi start a wifi access point (which isn't a power problem, because the pi is connected to on-board-power of the motorcycle).

However I then realized that the smartphone won't connect to an access point which doesn't offer internet access but only LAN-access.

And even if there was a way to force the smartphone to let it connect anyways, it isn't guaranteed that this will work too on future devices. And: The whole notification-stuff would have been needless, because as long as the smartphone is connected to a "dead-end wifi", it wouldn't receive emails or whatsapp-messages.

Idea 3: Using Bluetooth low energy:

It seems like the new, modern way, to let devices communicate over Bluetooth is to use Bluetooth low energy (BLE). (But I never worked with it before!).

However, there seems to be little to no support on raspberry pi for it, and it seems to be impossible to find a library for java which helps in using BLE. (If anyone knows one, please let me know).

I then thought about replacing the raspberry pi with an android board, because android has support for BLE. But I wasn't able to find a board which is supported from android 5.1+ and offers support for BLE. Even the Odroid-boards don't seem to support android >4.4 and BLE.

Summary:

In general I liked the second and third option much better. It seemed to be the the more versatile, modern way. The first way felt a bit like a hack.

However I found those problems I presented above, and until now, I couldn't think of a way around it.

If anyone here:

1) Solved this problem already

2) Knows a really good, NON-HACKY, community supported, Java (BLE) Bluetooth library

3) Knows a language or framework which would be well suited to solve the problem

4) Has another good idea how to solve it

Please let me know!

I just want to build something sophisticated, (which I could maybe make an open source project out of it) which isn't hacky.

I mean, the problem has to be solvable, look at the Pebble smartwatch. They also solved it without android wear.

I really want to emphasise that this is an open question. I am not limited / fixed on Java, Raspberry pi or anything.

I those have two requirements.

1) I don't want to connect the smartphone to a cable, either for data or for power

2) The solution needs to be something power saving, so no hotspot on the android device ;)

3) Non-hacky, sophisticated solution

Best regards

Me =)

PS: As English isn't my native language, I maybe put some sentences wrong or wasn't able to express something clearly and unambiguous.

Please feel free to ask, I'd be pleased to clear any questions!