Most recent activity
-
Actually that gadgetbridge OSMAnd branch should use the OSMAnd api, but they didn't like the binary distribution of it so they copied only the code they needed instead of using the library (there might be a point in that as it's 2MB)
That library is an external OSMAnd library and should be relatively stable as all OSMAnd plugins rely on it and it works with the standard OSMAnd version. -
I've added the global.GB function to handle my type in the lcars app js:
global.GB = (_GB => e => { switch (e.t) { case "bangleOSM": if(e.turnIn || e.turnNow){ turnAlert(e); } else if (e.turnType) { turn = e; drawNavInfo(turn); } else { turn = null; drawPosition0(); } break; default: // pass on other events if (_GB) setTimeout(_GB, 0, e); } })(global.GB);
-
I realized I didn't use much of the pebbleKit things, so once I saw your intent broadcast receiver I just used that instead, but with \u0010 so it would execute a javascript line. So I didn't change anything at the Gadgetbridge side.
val jsonData = JSONObject(data) logger.info(jsonData.toString()) jsonData.put("t", "bangleOSM") sendDataIntent.putExtra("line", "\u0010GB($jsonData)\n") sendBroadcast(sendDataIntent)
and indeed the app loading also works (created an android app to load the tasks from OpenTasks into the todolist watch app and open it)
sendDataIntent = new Intent("com.banglejs.uart.tx"); sendDataIntent.putExtra("line", "\u0010load(\"todolist.app.js\");\n"); sendBroadcast(sendDataIntent);
-
I've made a first test version of navigation with the lcars app together with OsmAnd
watch App
Companion android code@Gordon it uses your gadgetBridge commit to allow sending intents to the watch, I don't know if this is the intended use though. You can do whatever you want on the watch from intents now, which is nice, but might be a bit of a security issue.
I guess for most purposes it would be enough to have the current line method but it won't allow executing of code and a method which accept a json body and a type and send that to the gb function. Maybe an intent to start/stop apps on the watch, for example to start a navigation app when navigation is started on the phone. -
-
pebbleKit is not notification based, but intent based, it was made by pebble not so much for notifications, but for communication to companion apps running on the phone (e.g. using the watch as a camera viewer or adding pebble support to your existing apps)
Basically gadgetbridge will listen to pebblekit broadcast intents which have an application specific payload and an UUID per app. On the watch the applications will listen to their own UUIDs. It also works the other way around, an app on the watch sends a message to gadgetbridge with its UUID and gadgetbridge will broadcast an intent and a android app will react on messages with its own UUID.
https://developer.rebble.io/developer.pebble.com/guides/communication/index.html
Basically what I did was modify the existing pebbleKitSupport in gadgetBridge to support bangle
https://github.com/Freeyourgadget/Gadgetbridge/blob/master/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleKitSupport.javabasically it does something like this (pebblekit always packs the data in a array, guess it can just as well be without it) For now I just implemented the send to bangle part
int transaction_id = intent.getIntExtra("transaction_id", -1); uuid = (UUID) intent.getSerializableExtra("uuid"); String jsonString = intent.getStringExtra("msg_data"); LOG.info("json string: " + jsonString); try { JSONArray jsonArray = new JSONArray(jsonString); mBangleDevice.uartTxJSON("pebble kit app send", new JSONObject().put("t", "pebbleKit").put("uuid", uuid).put("message", jsonArray)); sendAppMessageAck(transaction_id); } catch (JSONException e) { LOG.error("failed decoding JSON", e); }
OsmAnd has pebbleKit support so that would work (though I want some more info as it provides) Google maps won't work as that doesn't have pebbleKit support
OsmAnd doesn't add images for turns, it has a defined a set of 14 turn types you need to render yourself (it can also give the angle of the next turn)
-
I'm trying to add navigation to the lcars watch (using the bottom panel for next turn arrow, distance to next turn and eta/distance left) based on navigation info from OsmAnd and right now repurposing the pebblekit support in gadgetbridge for the communication.
I wonder if I could/should use this built in notifications in Messages for it, or are you working on another way to communicate to the phone with gadgetbridge, I guess something like bangleKit could be added to gadgetbridge in the same way as pebble has pebblekit.
I think their pebble integration still works, that basically sends their voice output as pebble intents, so I guess that could still be used:
https://github.com/osmandapp/OsmAnd/blob/2d3fe242aed291233ccda9bcf091230dc0ccf11e/OsmAnd/src/net/osmand/plus/voice/JsTtsCommandPlayer.java#L36
That kind of works but only shows the route changes, what I did was make an small app with the OSMAnd api that converts the route updates to intents to be sent to the watch, so I can display the distance to the next turn + the one after that on the watch and buzz when the turn is imminent. This works quite ok for walking and biking, only seems to loose connection to OSM when you stand still for a while so you need to restart the app.