[Banglejs] Send phone location data to banglejs, which can be used as gps data #2976

Closed
LukasEdl wants to merge 12 commits from LukasEdl:banglejs-gps-update into master
Contributor

Since the PR #2961 broke, i pushed the changes to this pr.

Original text:

With this PR, the gadgetbridge app sends the current locationd data, obtained from the gps or network provider, to a connected banglejs device as an "gps" event.

The bangle device can use this data instead of the internal gps data. Therefor saving battery energy, since the gps chip is one of the biggest energy consumers.

Furthermore it enables the banglejs device to use the location data, based on the network with which the phone is currently connected. This would be usefull if there is no gps signal.

Updates:

I added a network provider so that it is possible to use the network location. I also overload the start method of GBLocationManager so that it is now possible to select which provider should be used to get the data (currently GPS or Network) and to set a interval to determine how often the update should be run.

For the banglejs device i added a switch to enable the sending of gps data. I also added a setting, to set the interval on how often the gps data is being updated. This allows to throttle the updates of the gps data and therefore saving energy of the smartphone batterie.

To further save energy, the app now requestes the current status of the gps from the banglejs and only sends data, if the gps of the banglejs is turned on.

Since the PR #2961 broke, i pushed the changes to this pr. Original text: With this PR, the gadgetbridge app sends the current locationd data, obtained from the gps or network provider, to a connected banglejs device as an "gps" event. The bangle device can use this data instead of the internal gps data. Therefor saving battery energy, since the gps chip is one of the biggest energy consumers. Furthermore it enables the banglejs device to use the location data, based on the network with which the phone is currently connected. This would be usefull if there is no gps signal. Updates: I added a network provider so that it is possible to use the network location. I also overload the start method of GBLocationManager so that it is now possible to select which provider should be used to get the data (currently GPS or Network) and to set a interval to determine how often the update should be run. For the banglejs device i added a switch to enable the sending of gps data. I also added a setting, to set the interval on how often the gps data is being updated. This allows to throttle the updates of the gps data and therefore saving energy of the smartphone batterie. To further save energy, the app now requestes the current status of the gps from the banglejs and only sends data, if the gps of the banglejs is turned on.
LukasEdl added 6 commits 2022-11-16 17:28:27 +00:00
335c04011f add check if location was found
fix wrong data package format
ci/woodpecker/pr/can_master_build Pipeline is pending Details
ci/woodpecker/pr/run_tests Pipeline is pending Details
ea09abff92
add settings to configure the update interval
add stopping of gps update when device disconnects
refactor retrieve gps data by using the GBLocationManager
add network provider to GBLocationManager
Member

This looks great! Thanks for your work on it!

So basically this means there's no difference to what happens with the Phone's GPS at all normally now, unless a Bangle.js is connected with firmware that supports in and the GPS update checkbox is checked?

Only things I can see:

This looks great! Thanks for your work on it! So basically this means there's no difference to what happens with the Phone's GPS at all normally now, unless a Bangle.js is connected with firmware that supports in *and* the GPS update checkbox is checked? Only things I can see: * I'd have just stuck the Bangle.js GPS settings in https://codeberg.org/Freeyourgadget/Gadgetbridge/src/commit/ea09abff928ca008dd50d8e5c018d287d68a8130/app/src/main/res/xml/devicesettings_banglejs.xml as it's very Bangle-related - but maybe that's just personal preference. @vanous? * I'm not sure whether the DeviceSupport class gets disposed of when Bangle.js disconnects? @vanous? If not, it might be worth using the GBDevice.ACTION_DEVICE_CHANGED handler to detect when the device is disconnected and turn GPS off in that case: https://codeberg.org/Freeyourgadget/Gadgetbridge/src/commit/ea09abff928ca008dd50d8e5c018d287d68a8130/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java#L216
Owner

Sorry, i am out of town for a few weeks, so i cannot look into this at all. There was a suggestion by @joserebelo here to utilize the existing GBLocationManager, did you look into it?

Sorry, i am out of town for a few weeks, so i cannot look into this at all. There was a suggestion by @joserebelo [here](https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2961#issuecomment-667777) to utilize the existing [GBLocationManager](https://codeberg.org/Freeyourgadget/Gadgetbridge/src/branch/master/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/gps/GBLocationManager.java), did you look into it?
LukasEdl added 2 commits 2022-11-20 19:05:28 +00:00
LukasEdl added 1 commit 2022-11-20 19:10:30 +00:00
LukasEdl added 1 commit 2022-11-20 19:13:49 +00:00
Author
Contributor

I moved the settings to the device settings of the banglejs, i didn't see them at the time of implementation.

@vanous, i moved the logic to the onLocationChanged method of the GBLocationManager.

I moved the settings to the device settings of the banglejs, i didn't see them at the time of implementation. @vanous, i moved the logic to the onLocationChanged method of the GBLocationManager.
Member

@LukasEdl Thanks! From my point of view this would be great to merge

@LukasEdl Thanks! From my point of view this would be great to merge
LukasEdl added 1 commit 2022-11-21 19:16:14 +00:00
LukasEdl closed this pull request 2022-11-21 19:22:24 +00:00
LukasEdl reopened this pull request 2022-11-21 19:22:30 +00:00
Owner

@LukasEdl

what do you mea by "PR #2961 broke". Any further details would be great.

We had a huge migration of codeberg, that could be the problem.

@LukasEdl what do you mea by "PR #2961 broke". Any further details would be great. We had a huge migration of codeberg, that could be the problem.
Author
Contributor

The branch was out of date and i tried to update it by pressing the "update branch through merge" (it's a translation since the button text is in german for me "Branch durch Mergen aktualisieren"). When i pressed it a message nothing happend and after a refresh of the page, a message that called something like "The PR is broken, due to the removal of information about the source branch" (Rough translation from german, but i don't have an example for that).

I then updated the branch on my fork and then created this PR.

The branch was out of date and i tried to update it by pressing the "update branch through merge" (it's a translation since the button text is in german for me "Branch durch Mergen aktualisieren"). When i pressed it a message nothing happend and after a refresh of the page, a message that called something like "The PR is broken, due to the removal of information about the source branch" (Rough translation from german, but i don't have an example for that). I then updated the branch on my fork and then created this PR.
Author
Contributor

Well i did it again and broke the pr, by merging the master to my branch, so that i can update it.

For the record thats the message i got (translated it says "The pull request is borken, due to fork information being deleted")

grafik

I gonna close this pr and create a new pr and link it here.

Well i did it again and broke the pr, by merging the master to my branch, so that i can update it. For the record thats the message i got (translated it says "The pull request is borken, due to fork information being deleted") ![grafik](/attachments/749eba1c-0be1-42fc-bcf6-4661ee42944c) I gonna close this pr and create a new pr and link it here.
9.6 KiB
LukasEdl closed this pull request 2022-12-04 13:38:07 +00:00
Contributor

Well i did it again and broke the pr, by merging the master to my branch, so that i can update it.

I'm wondering if this would be resolved by rebasing your branch on the main repo master, and then force pushing it?

In case you didn't see it before here're step-by-step-y instructions on how to update forks to be eligible for merges :)

>Well i did it again and broke the pr, by merging the master to my branch, so that i can update it. I'm wondering if this would be resolved by rebasing your branch on the main repo master, and then force pushing it? In case you didn't see it before [here're step-by-step-y instructions on how to update forks to be eligible for merges](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Developer-Documentation#short-introduction-to-git-and-the-related-workflow) :)
Author
Contributor

No i didn't saw that, i gonna take a look on it when i have to upadate my branch again

No i didn't saw that, i gonna take a look on it when i have to upadate my branch again

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
5 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#2976
No description provided.