32#ifndef STATIC_LOCAL_IP
34#define STATIC_LOCAL_IP "192.168.1.1"
38#define STATIC_GATEWAY "192.168.1.1"
42#define STATIC_NETMASK "255.255.255.0"
54#define SOFTAP_SSID SoftAP
60#define SAE_PASSPHRASE 12345678
66#define SECURITY_TYPE MMWLAN_SAE
72#define PMF_MODE MMWLAN_PMF_REQUIRED
95#define S1G_CHANNEL (44)
107#define PRIMARY_BW_MHZ (0)
110#ifndef PRIMARY_1MHZ_CHANNEL_INDEX
112#define PRIMARY_1MHZ_CHANNEL_INDEX (0)
117#define _STRINGIFY(x) #x
119#define STRINGIFY(x) _STRINGIFY(x)
139 printf(
"STA status updated\n");
184 sizeof(softap_args->
ssid));
186 softap_args->
ssid_len = strlen((
char*)softap_args->
ssid);
199 if (strncmp(
"sae", strval,
sizeof(strval)) == 0)
203 else if (strncmp(
"owe", strval,
sizeof(strval)) == 0)
207 else if (strncmp(
"open", strval,
sizeof(strval)) == 0)
213 printf(
"Invalid value of %s read from config store: %s\n",
214 "wlan.security", strval);
222 if (strncmp(
"disabled", strval,
sizeof(strval)) == 0)
224 printf(
"PMF disabled\n");
227 else if (strncmp(
"required", strval,
sizeof(strval)) == 0)
233 printf(
"Invalid value of %s read from config store: %s\n",
234 "wlan.pmf_mode", strval);
244 int ret = sscanf(strval,
"%x:%x:%x:%x:%x:%x",
245 &temp[0], &temp[1], &temp[2],
246 &temp[3], &temp[4], &temp[5]);
249 for (i = 0; i < 6; i++)
251 if (temp[i] > UINT8_MAX || temp[i] < 0)
254 memset(softap_args->
bssid, 0,
sizeof(softap_args->
bssid));
258 softap_args->
bssid[i] = (uint8_t)temp[i];
266 if (uint32val <= UINT8_MAX)
272 printf(
"%s out of range\n",
"wlan.op_class");
279 if (uint32val <= UINT8_MAX)
285 printf(
"%s out of range\n",
"wlan.s1g_chan_num");
292 if (uint32val <= UINT8_MAX)
298 printf(
"%s out of range\n",
"wlan.pri_bw_mhz");
305 if (uint32val <= UINT8_MAX)
311 printf(
"%s out of range\n",
"wlan.pri_1mhz_chan_idx");
359 uint32_t health_check_min = 0;
376 printf(
"\n\nSoftAP Example (Built " __DATE__
" " __TIME__
")\n\n");
393 printf(
"Error initializing network interface.\n");
409 printf(
"Soft AP started successfully\n");
413 printf(
"Failed to start Soft 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_int(const char *key, int *value)
Returns the integer stored in persistent store identified by the key.
int mmconfig_read_bool(const char *key, bool *value)
Returns the boolean value stored in persistent store 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.
enum mmipal_status mmipal_init(const struct mmipal_init_args *args)
Initialize the IP stack and enable the MMWLAN interface.
#define MMIPAL_INIT_ARGS_DEFAULT
Default values for mmipal_init_args.
@ MMIPAL_IP6_DISABLED
Disabled.
@ MMIPAL_SUCCESS
Completed successfully.
@ MMIPAL_STATIC
Static IP address.
#define MMOSAL_ASSERT(expr)
Assert that the given expression evaluates to true and abort execution if not.
static bool mmosal_safer_strcpy(char *dst, const char *src, size_t size)
A safer version of strncpy.
#define MM_UNUSED(_x)
Casts the given expression to void to avoid "unused" warnings from the compiler.
enum mmwlan_status mmwlan_boot(const struct mmwlan_boot_args *args)
Boot the Morse Micro transceiver and leave it in an idle state.
#define MMWLAN_SOFTAP_ARGS_INIT
Initializer for mmwlan_softap_args.
enum mmwlan_status mmwlan_set_ampdu_enabled(bool ampdu_enabled)
Sets whether or not Aggregated MAC Protocol Data Unit (A-MPDU) support is enabled.
enum mmwlan_status mmwlan_set_sgi_enabled(bool sgi_enabled)
Sets whether or not Short Guard Interval (SGI) support is enabled.
enum mmwlan_status mmwlan_set_power_save_mode(enum mmwlan_ps_mode mode)
Sets whether or not the 802.11 power save is enabled.
enum mmwlan_status mmwlan_softap_enable(const struct mmwlan_softap_args *args)
Enable Soft AP mode.
enum mmwlan_status mmwlan_set_subbands_enabled(bool subbands_enabled)
Sets whether or not sub-band support is enabled for transmit.
enum mmwlan_status mmwlan_set_fragment_threshold(unsigned fragment_threshold)
Set the Fragmentation threshold.
enum mmwlan_status mmwlan_set_rts_threshold(unsigned rts_threshold)
Set the RTS threshold.
enum mmwlan_status mmwlan_set_health_check_interval(uint32_t min_interval_ms, uint32_t max_interval_ms)
Specify the upper and lower bound for the periodic health check interval.
void mmwlan_init(void)
Initialize the MMWLAN subsystem.
enum mmwlan_status mmwlan_set_channel_list(const struct mmwlan_s1g_channel_list *channel_list)
Set the list of channels that are supported by the regulatory domain in which the device resides.
mmwlan_status
Enumeration of status return codes.
@ MMWLAN_SUCCESS
The operation was successful.
@ MMWLAN_PMF_DISABLED
No protected management frames.
@ MMWLAN_PMF_REQUIRED
Protected management frames must be used.
@ MMWLAN_OPEN
Open (no security)
@ MMWLAN_SAE
Simultaneous Authentication of Equals (SAE)
@ MMWLAN_OWE
Opportunistic Wireless Encryption (OWE)
@ MMWLAN_PS_DISABLED
Power save disabled.
Morse Micro application helper routines for initializing/de-initializing the Wireless LAN interface a...
void app_print_version_info(void)
Prints various version information.
const struct mmwlan_s1g_channel_list * load_channel_list(void)
Looks up country code and returns appropriate channel list.
#define PRIMARY_BW_MHZ
Primary Bandwidth to use for Soft AP.
#define SECURITY_TYPE
Security type (.
static void load_softap_mmipal_init_args(struct mmipal_init_args *args)
Loads the provided structure with initialization parameters read from config store.
#define S1G_CHANNEL
S1G Channel to use for Soft AP.
#define STATIC_NETMASK
Statically configured netmask.
static void handle_softap_sta_status(const struct mmwlan_softap_sta_status *sta_status, void *arg)
Handler for Soft AP STA Status callback.
#define PMF_MODE
Protected Management Frames (PMF) mode (.
#define STRINGIFY(x)
Convert the content of the given macro to a string.
#define SAE_PASSPHRASE
Passphrase of the AP (ignored if security type is not SAE).
#define SOFTAP_SSID
SSID of the AP.
#define OP_CLASS
Operating Class to use for Soft AP.
#define PRIMARY_1MHZ_CHANNEL_INDEX
Primary 1 MHz Channel Index to use for Soft AP.
#define STATIC_GATEWAY
Statically configured gateway address.
void app_init(void)
Main entry point to the application.
uint32_t opaque_argument_value
A throw away variable for checking that the opaque argument is correct.
#define STATIC_LOCAL_IP
Statically configured IP address.
static void load_mmwlan_settings_softap(void)
Loads various WLAN Soft AP specific settings from config store and applies them.
void load_mmwlan_softap_args(struct mmwlan_softap_args *softap_args)
Loads the provided structure with initialization parameters read from config store.
Initialize arguments structure.
enum mmipal_ip6_addr_mode ip6_mode
IPv6 address allocation mode to use.
mmipal_ip_addr_t gateway_addr
Gateway IP address to use (if mode is MMIPAL_STATIC).
enum mmipal_addr_mode mode
IP address allocation mode to use.
mmipal_ip_addr_t netmask
Netmask to use (if mode is MMIPAL_STATIC).
mmipal_ip_addr_t ip_addr
IP address to use (if mode is MMIPAL_STATIC).
Arguments data structure for mmwlan_softap_enable().
char passphrase[MMWLAN_PASSPHRASE_MAXLEN+1]
Passphrase (only used if security_type is MMWLAN_SAE, otherwise ignored.
uint8_t bssid[MMWLAN_MAC_ADDR_LEN]
Optional BSSID of the AP.
uint16_t passphrase_len
Length of passphrase.
uint16_t op_class
Operating Class to use (S1G or Global).
uint8_t pri_1mhz_chan_idx
Index of the primary 1 Mhz channel within the operating channel.
mmwlan_softap_sta_status_cb_t sta_status_cb
Optional callback to be invoked when the status of a connected STA changes.
uint8_t pri_bw_mhz
Bandwidth to use for the primary channel.
uint16_t s1g_chan_num
S1G channel number of the channel to use.
uint16_t ssid_len
Length of the SSID.
enum mmwlan_pmf_mode pmf_mode
Protected Management Frame mode to use (802.11w)
void * sta_status_cb_arg
Optional opaque argument to be passed to sta_status_cb.
uint8_t ssid[MMWLAN_SSID_MAXLEN]
SSID of the AP.
enum mmwlan_security_type security_type
Type of security to use.
Data structure for communicating STA status information for stations connected to a Soft AP.