mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2026-03-24 13:34:25 +00:00
Send last known location in Background Service (#350)
Changes to location sending and accuracy.
This commit is contained in:
@@ -33,11 +33,13 @@ From version 2.6 the application includes reporting your location. The location
|
|||||||
You get whatever your device provides at the moment, i.e. at the accuracy the device currently provides. If your watch is not calibrated you get poor data. It might mean that you get more accurate location data when you are in a location tracking activity (i.e. not swimming pool lengths). The device [indicates an accuracy](https://developer.garmin.com/connect-iq/api-docs/Toybox/Position.html#Quality-module) in units of:
|
You get whatever your device provides at the moment, i.e. at the accuracy the device currently provides. If your watch is not calibrated you get poor data. It might mean that you get more accurate location data when you are in a location tracking activity (i.e. not swimming pool lengths). The device [indicates an accuracy](https://developer.garmin.com/connect-iq/api-docs/Toybox/Position.html#Quality-module) in units of:
|
||||||
|
|
||||||
- `Position.QUALITY_NOT_AVAILABLE` - No update provided
|
- `Position.QUALITY_NOT_AVAILABLE` - No update provided
|
||||||
- `Position.QUALITY_LAST_KNOWN` - No update provided
|
- `Position.QUALITY_LAST_KNOWN` - We translate that to 200 m arbitrarily
|
||||||
- `Position.QUALITY_POOR` - We translate that to 500 m arbitrarily
|
- `Position.QUALITY_POOR` - We translate that to 100 m arbitrarily
|
||||||
- `Position.QUALITY_USABLE` - We translate that to 100 m arbitrarily
|
- `Position.QUALITY_USABLE` - We translate that to 50 m arbitrarily
|
||||||
- `Position.QUALITY_GOOD` - We translate that to 10 m arbitrarily
|
- `Position.QUALITY_GOOD` - We translate that to 10 m arbitrarily
|
||||||
|
|
||||||
|
NB. These values have been revised as of Ver 3.12.
|
||||||
|
|
||||||
**You cannot rely on the radius of the circle of accuracy in any resulting maps as any meaningful indication of error.**
|
**You cannot rely on the radius of the circle of accuracy in any resulting maps as any meaningful indication of error.**
|
||||||
|
|
||||||
## Activity Reporting
|
## Activity Reporting
|
||||||
|
|||||||
@@ -57,3 +57,4 @@
|
|||||||
| 3.9 | Small update to warn users with empty menu definitions to read the instructions! |
|
| 3.9 | Small update to warn users with empty menu definitions to read the instructions! |
|
||||||
| 3.10 | Bug avoidance for a fatal _"Error: Out Of Memory Error"_ in the glance when caching the menu to [`Storage`](https://developer.garmin.com/connect-iq/api-docs/Toybox/Application/Storage.html). This is now delayed until the main application is opened. Added support for two new devices, D2 Mach 2 and eTrex Touch. |
|
| 3.10 | Bug avoidance for a fatal _"Error: Out Of Memory Error"_ in the glance when caching the menu to [`Storage`](https://developer.garmin.com/connect-iq/api-docs/Toybox/Application/Storage.html). This is now delayed until the main application is opened. Added support for two new devices, D2 Mach 2 and eTrex Touch. |
|
||||||
| 3.11 | <img src="images/Venu2_glance_default.png" width="200" title="Default Glance"/><br/>Better handling of menus larger than the Glance view can handle. As a result the Glance can no longer verify the availability of the JSON menu as fetching it might cause an _"Error: Out Of Memory Error"_. Provide two user supplied HTTP Headers. Bug fix for the numeric picker. |
|
| 3.11 | <img src="images/Venu2_glance_default.png" width="200" title="Default Glance"/><br/>Better handling of menus larger than the Glance view can handle. As a result the Glance can no longer verify the availability of the JSON menu as fetching it might cause an _"Error: Out Of Memory Error"_. Provide two user supplied HTTP Headers. Bug fix for the numeric picker. |
|
||||||
|
| 3.12 | Amended GPS accuracy values used by the background service. |
|
||||||
|
|||||||
@@ -115,15 +115,18 @@ class BackgroundServiceDelegate extends System.ServiceDelegate {
|
|||||||
// System.println("BackgroundServiceDelegate onTemporalEvent(): Activity : " + Activity.getProfileInfo().name);
|
// System.println("BackgroundServiceDelegate onTemporalEvent(): Activity : " + Activity.getProfileInfo().name);
|
||||||
|
|
||||||
// Don't use Settings.* here as the object lasts < 30 secs and is recreated each time the background service is run
|
// Don't use Settings.* here as the object lasts < 30 secs and is recreated each time the background service is run
|
||||||
|
if (position.accuracy != Position.QUALITY_NOT_AVAILABLE) {
|
||||||
if (position.accuracy != Position.QUALITY_NOT_AVAILABLE && position.accuracy != Position.QUALITY_LAST_KNOWN) {
|
|
||||||
var accuracy = 0;
|
var accuracy = 0;
|
||||||
switch (position.accuracy) {
|
switch (position.accuracy) {
|
||||||
|
case Position.QUALITY_LAST_KNOWN:
|
||||||
|
// Location is no longer tied to the timestamp, hence the larger inaccuracy.
|
||||||
|
accuracy = 200;
|
||||||
|
break;
|
||||||
case Position.QUALITY_POOR:
|
case Position.QUALITY_POOR:
|
||||||
accuracy = 500;
|
accuracy = 100;
|
||||||
break;
|
break;
|
||||||
case Position.QUALITY_USABLE:
|
case Position.QUALITY_USABLE:
|
||||||
accuracy = 100;
|
accuracy = 50;
|
||||||
break;
|
break;
|
||||||
case Position.QUALITY_GOOD:
|
case Position.QUALITY_GOOD:
|
||||||
accuracy = 10;
|
accuracy = 10;
|
||||||
|
|||||||
Reference in New Issue
Block a user