[Feature Request] OsmAnd to InfiniTime Navigation App
#2387
Open
opened 2 years ago by TimoVersemann
·
34 comments
No Branch/Tag Specified
master
jr-sony-settings-overwrite
nightly-branch
jr-zepp-os-morning-updates
flattenasciitransliterator-force-ascii
arjan5-testing-branch
fix_supported_unsupported_discovery
osmand-experiments
remove-duplicated-empty-methods
nightly-changelog
huami-reserved-calendar-reminders
sony-fixes
sony-linkbuds-s
supercars_blinking
device-update-reason
discover-freeze-fix
device-flipper-zero
test_link
test_debug_release
debug-branch
fossil-hr-gen6
test_own_image
fix_logger_again
streaks
huami-sms-reply
RemoveMibandGlobalPreferences
SystemEvents
combined
openTracksObserver-debug
cycling_sensor
multi-device-support-clean-2
miband6-alipay
fossil-hr-activity-fix
fossil-q-hr-html
dakhnod/fix-notification-removed
dakhnod/beautify-device-information
Lightwars/TurnClocksForward
andyboeh/ble_reconnect_scan
ildar/patches/circleci
mvallerie/custom_menu_miband2
christian-n/master
lucasgaley/master
Dikay900/steps_diagram
comradekingu/patch-3
elagin/sleep_values_on_chart
boun/runnerup
thePanz/add-raw-data-support
plugdio/master
atx/master
Vebryn/csv-export
rosenpin/master
lazarosfs/EnableBtOnConnect
health-new-database
mi2-text-notifications
polarm400
release-0.11.x
led-profile
live-sensor-data
0.1.0
0.1.1
0.1.2
0.1.3
0.1.4
0.1.5
0.10.0
0.10.1
0.10.2
0.11.0
0.11.1
0.11.2
0.12.2
0.13.0
0.13.1
0.13.2
0.13.3
0.13.4
0.13.5
0.13.6
0.13.7
0.13.8
0.13.9
0.14.0
0.14.1
0.14.2
0.14.3
0.14.4
0.15.0
0.15.1
0.15.2
0.16.0
0.17.0
0.17.1
0.17.2
0.17.3
0.17.4
0.17.5
0.18.0
0.18.1
0.18.2
0.18.3
0.18.4
0.18.5
0.19.0
0.19.1
0.19.2
0.19.3
0.19.4
0.2.0
0.20.0
0.20.1
0.20.2
0.21.0
0.21.1
0.21.2
0.21.3
0.21.4
0.21.5
0.21.6
0.22.0
0.22.1
0.22.2
0.22.3
0.22.4
0.22.5
0.23.0
0.23.1
0.23.2
0.24.0
0.24.1
0.24.2
0.24.3
0.24.4
0.24.5
0.24.6
0.25.0
0.25.1
0.26.0
0.26.1
0.26.2
0.26.3
0.26.4
0.26.5
0.27.0
0.27.1
0.28.0
0.28.1
0.29.0
0.29.1
0.3.0
0.3.1
0.3.2
0.3.3
0.3.4
0.3.5
0.30.0
0.31.0
0.31.1
0.31.2
0.31.3
0.32.0
0.32.1
0.32.2
0.32.3
0.32.4
0.33.0
0.33.1
0.34.0
0.34.1
0.35.0
0.35.1
0.35.2
0.36.0
0.36.1
0.36.2
0.37.0
0.37.1
0.38.0
0.39.0
0.39.1
0.4.0
0.4.1
0.4.2
0.4.3
0.4.4
0.4.5
0.4.6
0.40.0
0.40.1
0.41.0
0.41.1
0.42.0
0.42.1
0.43.0
0.43.1
0.43.2
0.43.3
0.44.0
0.44.1
0.44.2
0.45.0
0.45.1
0.46.0
0.47.0
0.47.1
0.47.2
0.48.0
0.49.0
0.5.0
0.5.1
0.5.2
0.5.3
0.5.4
0.50.0
0.51.0
0.52.0
0.53.0
0.54.0
0.54.1
0.55.0
0.56.0
0.56.1
0.56.2
0.57.0
0.57.1
0.58.0
0.58.1
0.58.2
0.59.0
0.59.1
0.59.2
0.59.3
0.6.0
0.6.1
0.6.2
0.6.3
0.6.4
0.6.5
0.6.6
0.6.7
0.6.8
0.6.9
0.60.0
0.61.0
0.62.0
0.63.0
0.63.1
0.64.0
0.65.0
0.66.0
0.67.0
0.67.1
0.68.0
0.69.0
0.7.0
0.7.1
0.7.2
0.7.3
0.7.4
0.70.0
0.71.0
0.71.1
0.71.2
0.71.3
0.72.0
0.73.0
0.8.0
0.8.1
0.8.2
0.9.0
0.9.1
0.9.2
0.9.3
0.9.4
0.9.5
0.9.6
0.9.7
0.9.8
Labels
Mi Band 7 activity post processing
activity data processing, import, export activity/health Android 12 Android 13 android integrations architecture Bangle.js bug changes requested
the provided PR needs some modifications charts details not provided developer documentation
Information for contributors device amazfit band 5
Amazfit Band 5 device amazfit bip device amazfit cor device Casio device fossil device gtr 2e device gts 2 mini device h30 device hplus device Huawei
Huawei honor device liveview device mi band device mi band 2 device mi band 3 device mi band 4 device mi band 5
Mi Smart Band 5 device mi band 6
Mi Smart Band 6 device no.1 f1 device pace device pebble device pebble 2 device pinetime infinitime device request device sony
Sony device support device watch 9 discussion documentation duplicate enhancement feature request Gadgetbridge
Gadgetbridge good first issue
good entry level issue for new contributors help wanted i am developing my own app can you help
no, sorry icebox
An icebox for abandoned PRs. Feel free to pick it up, update and make a new PR internationalisation
metric/imperial/celsius/fahrentheit... invalid needs work network companion app
ideas pool for a network enabled companion app no feedback not a bug notifications
ideas and improvements for notifications one of the 1000 issues about disconnection pairing/connecting potentially fixed / confirm and close question research security seems abandoned
PR seems to abandoned Solved, waiting for F-Droid release suggest to close
probably should/could close task user interface / UX weather wontfix Zepp OS
Apply labels
Clear labels
device mi band 7
Mi Band 7 activity post processing
activity data processing, import, export activity/health Android 12 Android 13 android integrations architecture Bangle.js bug changes requested
the provided PR needs some modifications charts details not provided developer documentation
Information for contributors device amazfit band 5
Amazfit Band 5 device amazfit bip device amazfit cor device Casio device fossil device gtr 2e device gts 2 mini device h30 device hplus device Huawei
Huawei honor device liveview device mi band device mi band 2 device mi band 3 device mi band 4 device mi band 5
Mi Smart Band 5 device mi band 6
Mi Smart Band 6 device no.1 f1 device pace device pebble device pebble 2 device pinetime infinitime device request device sony
Sony device support device watch 9 discussion documentation duplicate enhancement feature request Gadgetbridge
Gadgetbridge good first issue
good entry level issue for new contributors help wanted i am developing my own app can you help
no, sorry icebox
An icebox for abandoned PRs. Feel free to pick it up, update and make a new PR internationalisation
metric/imperial/celsius/fahrentheit... invalid needs work network companion app
ideas pool for a network enabled companion app no feedback not a bug notifications
ideas and improvements for notifications one of the 1000 issues about disconnection pairing/connecting potentially fixed / confirm and close question research security seems abandoned
PR seems to abandoned Solved, waiting for F-Droid release suggest to close
probably should/could close task user interface / UX weather wontfix Zepp OS
No Label
device mi band 7
activity post processing
activity/health
Android 12
Android 13
android integrations
architecture
Bangle.js
bug
changes requested
charts
details not provided
developer documentation
device amazfit band 5
device amazfit bip
device amazfit cor
device Casio
device fossil
device gtr 2e
device gts 2 mini
device h30
device hplus
device Huawei
device liveview
device mi band
device mi band 2
device mi band 3
device mi band 4
device mi band 5
device mi band 6
device no.1 f1
device pace
device pebble
device pebble 2
device pinetime infinitime
device request
device sony
device support
device watch 9
discussion
documentation
duplicate
enhancement
feature request
Gadgetbridge
good first issue
help wanted
i am developing my own app can you help
icebox
internationalisation
invalid
needs work
network companion app
no feedback
not a bug
notifications
one of the 1000 issues about disconnection
pairing/connecting
potentially fixed / confirm and close
question
research
security
seems abandoned
Solved, waiting for F-Droid release
suggest to close
task
user interface / UX
weather
wontfix
Zepp OS
Milestone
Set milestone
Clear milestone
No items
No Milestone
Assignees
Assign users
Clear assignees
No Assignees
10 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
No dependencies set.
Reference: Freeyourgadget/Gadgetbridge#2387
Reference in new issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
No
Yes
OsmAnd Navigation Information are not pared to the InfiniTime Navigation App, that would be very nice feature. I did a reasearch on how it could be done, but I can't code, but maybe somebody is inspired by this :)
InfiniTime site is "solved"
@JF made a custom ble service and documented it well:
https://github.com/JF002/InfiniTime/blob/develop/doc/ble.md
The following custom services are implemented in InfiniTime:
https://github.com/JF002/InfiniTime/blob/develop/doc/NavigationService.md
This Navgiation Service has 4 UUIDs which you can directly adress with nrfConnect on Android and are displayed in the Infinitime Navigation App (see picture attached)
Flags (UUID 00010001-78fc-48fe-8e23-433b3a1942d0)
Upcoming icon name narrative (string)
Narrative (UUID 00010002-78fc-48fe-8e23-433b3a1942d0)
extual description of instruction manDist (string)
Man Dist (UUID 00010003-78fc-48fe-8e23-433b3a1942d0)
(string) - Manouvre Distance, the distance to the upcoming change progress
Progress (UUID 00010004-78fc-48fe-8e23-433b3a1942d0)
(uint8) - Percent complete of total route, value 0-100
edit: I corrected the UUIDs as it's done in PR522
This works by manualy adressing in nrfConnect on Android.
The InfiniTime Navigation App until now only works with pure Maps app on a Linux (phone) connected via Amazfish. I think the implementation in Amazfit was only/primarly done with perspective to Infinitime:
16b9ec71e1/daemon/src/navigationinterface.cpp
The Actual InfiTimeNavigationApp Code:
16b9ec71e1/daemon/src/navigationinterface.cpp
Research on the Gadgetbridge Site
Taking the logic of ble Music Service
As it is also a custom ble service as the navigation servcie, definded in:
app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pinetime/PineTimeJFConstants.java
Only Mention of the UUID_CHARACTERISTICS_MUSIC_ARTIST is in:
app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pinetime/PineTimeJFSupport.java L464ff.
Starting from OsmAnd mentions
The other side to investigate the Problem is comming from OsmAnd mentioning in Gadgetbridge Repo, this leads to "GENERIC_NAVIGATION" class or what ever it is. My understanding ends here...
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/PebbleReceiver.java L87f.
So maybe on of you brave gadgetbridge devs is able to find a solution for this?! Cheers and thanks
Ideally, someone with a PineTime is needed for this.
I have a pinetime,
how do you think we can get the information from Osmand?
The best way would be a Gadgetbridge "plugin" for Osmand, scraping that from notifications is not feasable since everything is translated already.
I guess the OSMand part should be scrutinized (maybe they already send some broadcasts) then filed as a FR.
@ildar
There are pebble broadcasts but those are also tranlated texts.
Yeah, working on the osmand side would be best
Thanks for your engagement! I try to gather Information I found about the OsmAnd Side:
OsmAnd does have a AIDL / API - Demostuff here
The methods for API Subscription for "next_turn_type" and (no_speak_)next_turn_distance have been added in this commit
I can see the values as snapshots in the OsmAnd API Demo App (installed via Aurora Store ) Screenshots are Attached. You can check the "Simulate Navigation" in the OsmAnd Navigation Menu to get realtime changing values...
You get next_turn_distance as an Integer that could be used for Man Dist (UID c7e60004-78fc-48fe-8e23-433b3a1942d0). You would need to fetch the unit somewhere as InfiniNav takes the distance as a String with unit...
Also you get next_turn_type that could be translated into the Flags (UUID c7e60002-78fc-48fe-8e23-433b3a1942d0)
The Outputs are mainly "TR" for turn right or "TL" for rurn left.
~~You also get derivate of xyzL or xyzR for sharper turns. I saw "TSHR" and "KR" - somehow I can not found the dictionary/list (?) of these values/variables(?) in OsmAnd Doku/Repo. ~~
Edith: Overall there aare 14 Turn Types that kann be matched with the list of existing Icons in the InfiNav App described here.
next_turn_name could be used as Narrative (UUID c7e60003-78fc-48fe-8e23-433b3a1942d0). That's actualy not how the Service was intended by @JF002 but to me as a cyclist the name of the street I have to turn into is very valuable. As intended a text like "turn right" under the a big Symbol showing turn right seems to be a useless redundancy and a waste of rare screen estate. Also it would keep the code simple as it could be simply token from the API maybe just with a Limiter to roundabout 30 or 35 Characters that should fit in the 2 lines... I can't finde Information "turn right" especial with it's local translation "rechts abbiegen" (GER) in the API. It could be scraped from the Notification/pebble in the language of the User, but It would need more code...
For the Progress (UUID c7e60001=5-78fc-48fe-8e23-433b3a1942d0) I have no inspiration looking at the API resoult, but maybe a initialRelease don't need's it ;)
This may be all bullshit to you as I just have a very abstract understanding of coding and how Gadgetbride and the hole Android thing works... But Maybe it's a inspiaration for you.
If there are bullshit jobs to do like creating synopsis of listes for the Flags or so tell me...
Is there anything a non-(C|C++|Java)-programmer could do to help the devs toward getting this implemented, at least in the kind of initial version (that is, without progress support) outlined by Timo?
@TimoVersemann
Thank you this is very interesting, does not sound like bullshit - I really want to have a look, as soon as time allows.
Umm, ok I had a look.
This should be doable but I have some doubts:
We are supposed to link in a binary distribution .aar file for the aidl "sdk"
8777f591c3/OsmAnd-api-sample/app/build.gradle (L50)
. Apart from the size (2MB!) it is an anti-feature for F-Droid and for me personally.Osmand says "No License issues" but how is this possible if the code is GPLv3?
I would like to just copy out the aidl stuff we need, not get the 2MB binary blob, this would have to stay GPLv3 if I am not mistaken
I created a branch named osmand-experiments and it actually works.
I copied in all the aidl stuff from osmand instead of using the binary aar,
maybe a lot could be stripped since we are only interested in naviagtion updates for now.
This only logs the distance to the destination, and there is nothing sent to a device, but it is a poc.
@TimoVersemann
Umm, were does next_turn_name come from? I did not find how I could subscribe to that...
I guess this comes from the GET_INFO intent api? Maybe we can only use that? Would save tons of aidl and java code if we can also get the next turn distace with intents instead of using the service interface.
All suggestet Things are from the "Get Info" Information I found via the GUI App OsmAnd API Demo (directlink to .APK) - see the Screenshots in my prior post.
Loking to the readme.md I assume this "Get Info" the GET_INFO as a part of the Intent Api and its OsmAndHelper.java and not of the AIDL Api and its OsmAndAidlHelper.java
I did a synopsis of the possible turn_types and Icons of InfiniNav that could correspond to it. The Icons are as .svg in the folder InfiniTime/src/displayapp/icons/navigation/unique/
The turn types are defined in: https://github.com/osmandapp/OsmAnd/blob/master/OsmAnd-java/src/main/java/net/osmand/router/TurnType.java
This would also need the +exitOut derivats and the Icons would significantly differ from reality
Thanks,
yes it seems that unfortunatly one has to use the Intent API instead of aidl. I have no clue why they send distance and turn updates but no information about the current/next location name.
The Intent API seems to be designed this way:
An intent contains an url which sould be "viewed", the result is then returned by calling an activity
8777f591c3/OsmAnd-api-sample/app/src/main/java/net/osmand/osmandapidemo/OsmAndHelper.java (L535)
Data is then processed here
8777f591c3/OsmAnd-api-sample/app/src/main/java/net/osmand/osmandapidemo/MainActivity.kt (L1239)
I doubt we can do it that way with a background service. But I will try.
I played around and I think the best way to go would be to use the aidl api and get turn/distance and "voice output"
This would result i
should work somehow
@TimoVersemann
Have it working somehome, there are some problems:
The navigation text is often so long that the green number (remaining distance to turn) is drawn above the text.
I do not know whether I got all mappings right.
Code is in the osmand-experiments branch. All checked in.
Wow, this is very awesome!
Wow, that's exceedingly awesome! I'm taking it that it's not so easy to beta-test this, though?
@ashimokawa Sounds great.
@sixtyfive I think you have to checkout the osmand-experiments branch and then you can compile it if you have setup the Android SDK Stuff properly.
https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Developer-Documentation
I failed on that yesterday will try this feedback and give feedback.
Thanks anyway!
Would it be possible to also add Organic Maps support?
OSMAnd and Organic Maps are the two biggest, if not the only popular, choices for FOSS maps based off OSM, and to offer users the choice of power (OSMAnd) and ease (Organic Maps) when using their PineTime would be great.
I can't see API documentation anywhere but you could probably contact them - they have a GitHub, email and a Telegram group
@greenprocyon_ That's really a separate issue you should open, if you want to keep track of it.
First of all, thank you very much for this crucial contribution and integration of OsmAnd via Gadgetbridge into InfiniTime Navigation as it is a killer app for me! I use it everyday :)
I successfully compiled the osmand-experiments branch and would like to share my experience:
what is the best way to fix this.
What I changed in the InfiniTime navigation app:
What I changed in the Gadgetbridge app:
I would be glad if the development regarding optimization of the navigation feature will keep going (e.g. straight arrow picture and grayed out pictures) and would be glad to support (e.g. by testing).
I just realized that there was a typo in the "continue" turn. By fixing it the navigation icon for straight direction is updated :)
I did a pull request for this minor change: #2628
Hi Ernst,
this sounds very interesting, especially the added vibration function for changes. Are all the changes you described available in your fork? If not, could you create a branch containing those changes? It would be great if I could use your solution directly without the need to do any merges manually.
@timoja45: Actually, the vibration was added to the "Navigation App" of the "InfiniTime firmware" (see pull request https://github.com/InfiniTimeOrg/InfiniTime/pull/1068).
The Gadgetbridge modifications only consider the fixed turn image for continue (see pull request above). I created a branch "osmand-experiments-0.66.0" with the merge of those modifications to the up to date version 0.66.0: https://codeberg.org/ernst/Gadgetbridge/src/branch/osmand-experiments-0.66.0. Thereby, OsmAnd is supported, straight navigation images are shown and firmware updates are working :)
Update: My pull request was approved and merged into the official branch osmand-experiments. Furthermore @ashimokawa rebased the branch to master. Thereby, it is now up to date so that firmware updates should also work here :)
Hi @ernst, could you maybe upload the modified build of the InfiniTime firmware? I would be very interested, but I didn't want to set up the development environment just to build the firmware with the added vibration.
FYI, I rebased with master after the huge mutli-device support merge.
Hi @timoja45 ,
attached you find:
b5ea9a4
from 2022-08-06)I tested both and it worked :)
It is still not perfect, but at least OsmAnd instructions are displayed on the watch.
This looks great to me, and it's really good to see this implemented in a multi-device way. I'd love to add this to the Bangle.js watch support libraries too.
What are the chances of this getting merged? Is there anything blocking it?
Also: I'd been experimenting with getting Google Maps navigation data by passing through 'local' notifications (#1827), but I think it's too hacky. As far as I can tell there's no Google Maps API, but is there interest in me attempting to add a Google Maps notification parser to Gadgetbridge that would call
onSetNavigationInfo
? It would vary on language but we could enable the parser for languages where we knew it'd work correctly?@vanous @ashimokawa do you have any thoughts on whether this could be merged? It would make a great base for navigation on Bangle.js as well
I am sorry, i am just having too much on my plate lately to be able to look at anything.
@gfwilliams
Did another rebase.
And I reverted changes done by @cpfeiffer (importing binary stuff)
We have some ways to continue here:
release as is with my back-then imported and patched osmand code import, basically I tried to import only needed files and stripped a bit code - there could be more removed I guess
add osmand as a submodule (huge) and then somehow build what we need - how?
Whatever way we choose, some apk size comparison should be done.
Great, thanks!
Wow, I see what you mean though. That diff is huge. I guess there's always the concern that OsmAnd may change something at some point and break it too?
I don't know enough about it really, but OsmAnd as a submodule doesn't sound great either.
I guess one option is to submit a PR to OsmAnd that would allow it to push navigation directions as Intents? Would that work?
Or what if for now I did a branch with just the
onSetNavigationInfo
additions, and then added a parser for Google Maps and OsmAnd notifications that would then call that.While it's not ideal (and potentially it'd need modifications to support other languages), we could probably support Navigation for 90% of Gadgetbridge users' languages pretty quick, with minimal extra overhead.