32#define MAX_STAS MMWLAN_DEFAULT_AP_MAX_STAS
50 return "Unknown (disconnected)";
53 return "Authenticated";
62 return "Unrecognized";
98 MMLOG_APP(
"Relay depth unknown (no path to root)\n");
102 MMLOG_APP(
"Relay depth changed to %u\n", new_depth);
126 int ret = sscanf(strval,
136 for (i = 0; i < 6; i++)
138 if (temp[i] > UINT8_MAX || temp[i] < 0)
141 memset(ap_args->
bssid, 0,
sizeof(ap_args->
bssid));
145 ap_args->
bssid[i] = (uint8_t)temp[i];
153 if (uint32val <= UINT16_MAX)
159 printf(
"%s out of range\n",
"wlan.ap_dtim_period");
166 if (uint32val <= UINT16_MAX)
172 printf(
"%s out of range\n",
"wlan.ap_beacon_interval_tus");
184 uint32_t relay_depth_override;
193 MMLOG_ERR(
"Failed to set relay depth override (status %d)\n", status);
198 printf(
"%s out of range\n",
"wlan.relay_depth_override");
211 MMLOG_PRINTF(
"\n\nRelay Mode Example (Built " __DATE__
" " __TIME__
")\n\n");
225 MMLOG_ERR(
"Failed to start relay (status %d)\n", status);
233 MMLOG_ERR(
"Failed to register depth change callback (status %d)\n", status);
258 memcpy(ap_args.
ssid, sta_args.
ssid,
sizeof(ap_args.
ssid));
282 MMLOG_PRINTF(
"Failed to start AP (status %d)\n", status);
int mmconfig_read_string(const char *key, char *buffer, int bufsize)
Returns the persistent store string value identified by the key.
int mmconfig_read_uint32(const char *key, uint32_t *value)
Returns the unsigned integer stored in persistent store identified by the key.
@ MMCONFIG_OK
Operation completed successfully.
#define MMLOG_APP(fmt,...)
Display an APP level log message.
#define MMLOG_PRINTF(...)
Logging printf definition.
#define MMLOG_ERR(fmt,...)
Display an ERROR level log message.
#define MM_MAC_ADDR_FMT
Macro for format specifier to print MM_MAC_ADDR_VAL.
#define MM_MAC_ADDR_VAL(value)
Macro for printing a MAC address.
#define MMOSAL_ASSERT(expr)
Assert that the given expression evaluates to true and abort execution if not.
uint32_t mmosal_get_time_ms(void)
Get the system time in milliseconds.
mmwlan_ap_sta_state
Enumeration of STA states.
#define MMWLAN_AP_ARGS_INIT
Initializer for mmwlan_ap_args.
enum mmwlan_status mmwlan_ap_enable(const struct mmwlan_ap_args *args)
Enable AP mode.
@ MMWLAN_AP_STA_AUTHORIZED
The STA is fully connected and authorized for data transmission.
@ MMWLAN_AP_STA_ASSOCIATED
The STA is associated but not yet authorized for data transmission.
@ MMWLAN_AP_STA_UNKNOWN
The STA is not known.
@ MMWLAN_AP_STA_AUTHENTICATED
The STA is authenticated but not associated.
#define MMWLAN_RELAY_ARGS_INIT
Initializer for mmwlan_relay_args.
#define MMWLAN_RELAY_MAX_DEPTH
Maximum valid relay depth.
enum mmwlan_status mmwlan_relay_enable(const struct mmwlan_relay_args *args)
Enable S1G Relay mode.
#define MMWLAN_RELAY_DEPTH_UNKNOWN
Relay depth value returned when the depth is unknown.
enum mmwlan_status mmwlan_relay_set_depth_override(uint8_t depth)
Set the S1G Relay depth override.
enum mmwlan_status mmwlan_register_depth_change_cb(mmwlan_relay_depth_change_cb_t callback, void *arg)
Register a relay depth change callback for use in relay mode.
enum mmwlan_sta_state mmwlan_get_sta_state(void)
Gets the current WLAN STA state.
enum mmwlan_status mmwlan_set_power_save_mode(enum mmwlan_ps_mode mode)
Sets whether or not the 802.11 power save is enabled.
#define MMWLAN_STA_ARGS_INIT
Initializer for mmwlan_sta_args.
@ MMWLAN_PS_DISABLED
Power save disabled.
mmwlan_status
Enumeration of status return codes.
@ MMWLAN_SUCCESS
The operation was successful.
@ MMWLAN_SAE
Simultaneous Authentication of Equals (SAE)
Morse Micro application helper routines for initializing/de-initializing the Wireless LAN interface a...
void app_wlan_init(void)
Initializes the WLAN interface (and dependencies) using settings specified in the config store.
void app_wlan_start(void)
Starts the WLAN interface and connects to Wi-Fi using settings specified in the config store.
void load_mmwlan_sta_args(struct mmwlan_sta_args *sta_config)
Loads the provided structure with initialization parameters read from config store.
#define MAX_STAS
The maximum number of stations that can connect to the AP.
static void handle_relay_depth_change(uint8_t new_depth, void *arg)
Handler for relay depth change callback.
static char * mmwlan_ap_sta_state_to_str(enum mmwlan_ap_sta_state state)
Function to convert mmwlan_ap_sta_state enumeration to a human readable string.
static void handle_ap_sta_status(const struct mmwlan_ap_sta_status *sta_status, void *arg)
Handler for AP STA Status callback.
static void load_mmwlan_relay_settings(void)
Apply any relay mode specific settings from the config store.
static void load_relay_mmwlan_ap_args(struct mmwlan_ap_args *ap_args)
Loads the provided structure, with the subset of AP initialization parameters that are applicable to ...
void app_init(void)
Main entry point to the application.
uint32_t opaque_argument_value
A throwaway variable for checking that the opaque argument is correct.
Optional LED status indication for the Relay Mode Example Application.
void relay_led_set_connected(void)
Indicates that the app has connected to Wi-Fi.
void relay_led_set_failed(void)
Indicates that the app has failed to connect.
void relay_led_set_depth(uint8_t depth)
Indicates the current relay depth by pulsing the green LED depth times.
void relay_led_init(void)
Initializes the LED status module and starts its background task.
void relay_led_set_connecting(void)
Indicates that the app is attempting to connect to Wi-Fi.
Arguments data structure for mmwlan_ap_enable().
uint16_t beacon_interval_tus
The Beacon period in units of TUs.
void * sta_status_cb_arg
Optional opaque argument to be passed to sta_status_cb.
enum mmwlan_pmf_mode pmf_mode
Protected Management Frame mode to use (802.11w)
uint8_t max_stas
Maximum number of stations that can connect to the AP simultaneously.
uint16_t ssid_len
Length of the SSID.
uint8_t bssid[MMWLAN_MAC_ADDR_LEN]
Optional BSSID of the AP.
uint8_t ssid[MMWLAN_SSID_MAXLEN]
SSID of the AP.
mmwlan_ap_sta_status_cb_t sta_status_cb
Optional callback to be invoked when the status of a connected STA changes.
char passphrase[MMWLAN_PASSPHRASE_MAXLEN+1]
Passphrase (only used if security_type is MMWLAN_SAE, otherwise ignored.
enum mmwlan_security_type security_type
Type of security to use.
uint16_t passphrase_len
Length of passphrase.
uint16_t dtim_period
The Delivery Traffic Indication Map (DTIM) interval in beacons.
Data structure for communicating STA status information for stations connected to an AP.
uint16_t aid
The AID of the STA.
enum mmwlan_ap_sta_state state
The current state of the STA.
uint8_t mac_addr[MMWLAN_MAC_ADDR_LEN]
The MAC address of the STA.
Arguments data structure for mmwlan_relay_enable().
Arguments data structure for mmwlan_sta_enable().
uint8_t ssid[MMWLAN_SSID_MAXLEN]
SSID of the AP to connect to.
char passphrase[MMWLAN_PASSPHRASE_MAXLEN+1]
Passphrase (only used if security_type is MMWLAN_SAE, otherwise ignored.
enum mmwlan_pmf_mode pmf_mode
Protected Management Frame mode to use (802.11w)
enum mmwlan_security_type security_type
Type of security to use.
uint16_t passphrase_len
Length of passphrase.
uint16_t ssid_len
Length of the SSID.