mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 02:45:05 +00:00
**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.
67 lines
1.9 KiB
C++
67 lines
1.9 KiB
C++
// SPDX-License-Identifier: Apache-2.0
|
|
#include <location/gps_provider.h>
|
|
#include <location/ip_provider.h>
|
|
#include <location/location.h>
|
|
#include <location/location_service.h>
|
|
#include <location/module.h>
|
|
|
|
#include <service/manager.h>
|
|
|
|
#include <tactility/error.h>
|
|
#include <tactility/module.h>
|
|
|
|
extern "C" {
|
|
|
|
static error_t start() {
|
|
error_t error = ip_provider_track_network();
|
|
if (error != ERROR_NONE) {
|
|
return error;
|
|
}
|
|
error = location_provider_register(&gps_location_provider);
|
|
if (error != ERROR_NONE) {
|
|
ip_provider_untrack_network();
|
|
return error;
|
|
}
|
|
error = location_provider_register(&ip_location_provider);
|
|
if (error != ERROR_NONE) {
|
|
location_provider_unregister(&gps_location_provider);
|
|
ip_provider_untrack_network();
|
|
return error;
|
|
}
|
|
return service_manager_add(&location_service_manifest, location_is_enabled());
|
|
}
|
|
|
|
static error_t stop() {
|
|
const error_t error = service_manager_stop(location_service_manifest.id);
|
|
if (error != ERROR_NONE && error != ERROR_NOT_FOUND) {
|
|
return error;
|
|
}
|
|
location_provider_unregister(&ip_location_provider);
|
|
location_provider_unregister(&gps_location_provider);
|
|
ip_provider_untrack_network();
|
|
return service_manager_remove(location_service_manifest.id);
|
|
}
|
|
|
|
static const ModuleSymbol location_module_symbols[] = {
|
|
DEFINE_MODULE_SYMBOL(location_set_enabled),
|
|
DEFINE_MODULE_SYMBOL(location_is_enabled),
|
|
DEFINE_MODULE_SYMBOL(location_set_precision),
|
|
DEFINE_MODULE_SYMBOL(location_get_precision),
|
|
DEFINE_MODULE_SYMBOL(location_get),
|
|
DEFINE_MODULE_SYMBOL(location_subscribe),
|
|
DEFINE_MODULE_SYMBOL(location_unsubscribe),
|
|
DEFINE_MODULE_SYMBOL(location_is_in_use),
|
|
MODULE_SYMBOL_TERMINATOR
|
|
};
|
|
|
|
Module location_module = {
|
|
.name = "location",
|
|
.start = start,
|
|
.stop = stop,
|
|
.drivers = nullptr,
|
|
.symbols = location_module_symbols,
|
|
.internal = nullptr,
|
|
};
|
|
|
|
}
|