mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 10:55:06 +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.
84 lines
2.6 KiB
C
84 lines
2.6 KiB
C
// SPDX-License-Identifier: Apache-2.0
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include <tactility/error.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** 32 characters/octets, according to IEEE 802.11-2020 spec */
|
|
#define WIFI_SETTINGS_SSID_LIMIT 32
|
|
/** 64 characters/octets, according to IEEE 802.11-2020 spec */
|
|
#define WIFI_SETTINGS_PASSWORD_LIMIT 64
|
|
/** Default auto-connect setting for new access points */
|
|
#define WIFI_SETTINGS_AUTO_CONNECT_DEFAULT true
|
|
|
|
/** The persisted settings of an access point. */
|
|
struct WifiApSettings {
|
|
char ssid[WIFI_SETTINGS_SSID_LIMIT + 1];
|
|
char password[WIFI_SETTINGS_PASSWORD_LIMIT + 1];
|
|
bool auto_connect;
|
|
/** The Wi-Fi channel, or 0 for any */
|
|
int32_t channel;
|
|
};
|
|
|
|
/**
|
|
* @param[in] ssid the access point to look for
|
|
* @return true if settings exist for the provided SSID
|
|
*/
|
|
bool wifi_settings_contains(const char* ssid);
|
|
|
|
/**
|
|
* Load the settings for the provided SSID.
|
|
* @param[in] ssid the access point to look for
|
|
* @param[out] settings the loaded settings
|
|
* @retval ERROR_NOT_FOUND no settings exist for the SSID
|
|
* @retval ERROR_RESOURCE the settings could not be read or decrypted
|
|
* @retval ERROR_NONE on success
|
|
*/
|
|
error_t wifi_settings_load(const char* ssid, struct WifiApSettings* settings);
|
|
|
|
/**
|
|
* Save the settings of an access point. The password is stored encrypted.
|
|
* @param[in] settings the settings to save
|
|
* @retval ERROR_INVALID_ARGUMENT the SSID is empty
|
|
* @retval ERROR_RESOURCE the settings could not be written
|
|
* @retval ERROR_NONE on success
|
|
*/
|
|
error_t wifi_settings_save(const struct WifiApSettings* settings);
|
|
|
|
/**
|
|
* Remove settings that were saved previously.
|
|
* @param[in] ssid the access point to remove the settings for
|
|
* @retval ERROR_NOT_FOUND no settings exist for the SSID
|
|
* @retval ERROR_RESOURCE the settings could not be removed
|
|
* @retval ERROR_NONE on success
|
|
*/
|
|
error_t wifi_settings_remove(const char* ssid);
|
|
|
|
/**
|
|
* Iterate over the SSIDs of all saved access points.
|
|
* @param[in] context passed through to on_ssid, can be NULL
|
|
* @param[in] on_ssid called once per saved access point, return false to stop iterating
|
|
*/
|
|
void wifi_settings_for_each(void* context, bool (*on_ssid)(const char* ssid, void* context));
|
|
|
|
/**
|
|
* Persist whether Wi-Fi is on. The radio is turned on when booting while it's enabled.
|
|
* @param[in] enable whether Wi-Fi is on
|
|
* @retval ERROR_RESOURCE the setting could not be written
|
|
* @retval ERROR_NONE on success
|
|
*/
|
|
error_t wifi_settings_set_enable(bool enable);
|
|
|
|
/** @return true when Wi-Fi is on, see wifi_settings_set_enable() */
|
|
bool wifi_settings_get_enable(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|