Ken Van Hoeylandt 6e437d3288
Location services, kernel Device improvements, de-incubate devices, and more (#691)
**New Features**
  * Added location services with GPS and network-based positioning, approximate or precise accuracy, and live status updates.
  * Added a Location Settings app to view status, control location access and accuracy, and manage GPS devices.
  * Added location choices during device setup and a location toggle in the system menu.
  * Added support for thread stacks in external memory when available, with fallback to existing memory options.

**Improvements**
  * Wi-Fi and Bluetooth enabled states are saved when changed and applied at startup; separate “Enable on boot” switches are no longer shown in their management screens.
  * GPS setup can stop promptly when interrupted.
  * Improved device removal handling during startup and while references are outstanding.
  * Updated several device listings to no longer be marked as incubating.
2026-10-13 23:13:30 +02:00

42 lines
1.4 KiB
C

// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <location/provider.h>
#include <stddef.h>
/**
* Fallback provider that looks up the location of the public IP address with ip-api.com.
* The result is reused while the network (local IP address and gateway) is unchanged.
*/
extern const LocationProviderApi ip_location_provider;
/** Start tracking the network that the device is connected to, also while the provider doesn't run */
error_t ip_provider_track_network(void);
/** Stop tracking the network and release the cached result. The provider must not run. */
void ip_provider_untrack_network(void);
#define IP_API_MESSAGE_MAX_LENGTH 63
struct IpApiResponse {
/** HTTP status code */
int status_code;
/** Requests left in the rate limit window, -1 when unknown */
int rate_remaining;
/** Seconds until the rate limit window resets, -1 when unknown */
int rate_reset_seconds;
bool success;
/** Reason of failure, empty on success */
char message[IP_API_MESSAGE_MAX_LENGTH + 1];
double latitude;
double longitude;
};
/**
* Parse an HTTP response of the newline separated ip-api endpoint, requested with fields "status,message,lat,lon"
* @param[in] response the NUL-terminated response, including the status line and headers
* @return false when the response is malformed
*/
bool ip_api_parse_response(const char* response, IpApiResponse* out);