1 /***************************************************************************/ /** 2 * @file sl_net_default_values.h 3 ******************************************************************************* 4 * # License 5 * <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b> 6 ******************************************************************************* 7 * 8 * SPDX-License-Identifier: Zlib 9 * 10 * The licensor of this software is Silicon Laboratories Inc. 11 * 12 * This software is provided 'as-is', without any express or implied 13 * warranty. In no event will the authors be held liable for any damages 14 * arising from the use of this software. 15 * 16 * Permission is granted to anyone to use this software for any purpose, 17 * including commercial applications, and to alter it and redistribute it 18 * freely, subject to the following restrictions: 19 * 20 * 1. The origin of this software must not be misrepresented; you must not 21 * claim that you wrote the original software. If you use this software 22 * in a product, an acknowledgment in the product documentation would be 23 * appreciated but is not required. 24 * 2. Altered source versions must be plainly marked as such, and must not be 25 * misrepresented as being the original software. 26 * 3. This notice may not be removed or altered from any source distribution. 27 * 28 ******************************************************************************/ 29 30 #pragma once 31 32 #include "sl_net_wifi_types.h" 33 34 #if defined(__GNUC__) 35 // Ignore warning of unused variables. It is expected that some or all of these are unused 36 #pragma GCC diagnostic push 37 #pragma GCC diagnostic ignored "-Wunused-variable" 38 #endif 39 40 #ifdef SLI_SI91X_ENABLE_IPV6 41 #define REQUIRED_IP_TYPE SL_IPV6 42 #else 43 #define REQUIRED_IP_TYPE SL_IPV4 44 #endif 45 46 #ifndef DEFAULT_WIFI_CLIENT_PROFILE_SSID 47 #define DEFAULT_WIFI_CLIENT_PROFILE_SSID "YOUR_AP_SSID" 48 #endif 49 50 #ifndef DEFAULT_WIFI_CLIENT_CREDENTIAL 51 #define DEFAULT_WIFI_CLIENT_CREDENTIAL "YOUR_AP_PASSPHRASE" 52 #endif 53 54 #ifndef DEFAULT_WIFI_AP_PROFILE_SSID 55 #define DEFAULT_WIFI_AP_PROFILE_SSID "MY_AP_SSID" 56 #endif 57 58 #ifndef DEFAULT_WIFI_AP_CREDENTIAL 59 #define DEFAULT_WIFI_AP_CREDENTIAL "MY_AP_PASSPHRASE" 60 #endif 61 62 #ifndef DEFAULT_WIFI_CLIENT_SECURITY_TYPE 63 #define DEFAULT_WIFI_CLIENT_SECURITY_TYPE SL_WIFI_WPA2 64 #endif 65 66 #ifndef DEFAULT_WIFI_CLIENT_ENCRYPTION_TYPE 67 #define DEFAULT_WIFI_CLIENT_ENCRYPTION_TYPE SL_WIFI_DEFAULT_ENCRYPTION 68 #endif 69 70 //! IP address of the module 71 //! E.g: 0x0A0AA8C0 == 192.168.10.10 72 #ifndef DEFAULT_WIFI_MODULE_IP_ADDRESS 73 #define DEFAULT_WIFI_MODULE_IP_ADDRESS 0x0A0AA8C0 74 #endif 75 76 //! IP address of netmask 77 //! E.g: 0x00FFFFFF == 255.255.255.0 78 #ifndef DEFAULT_WIFI_SN_MASK_ADDRESS 79 #define DEFAULT_WIFI_SN_MASK_ADDRESS 0x00FFFFFF 80 #endif 81 82 //! IP address of Gateway 83 //! E.g: 0x0A0AA8C0 == 192.168.10.10 84 #ifndef DEFAULT_WIFI_GATEWAY_ADDRESS 85 #define DEFAULT_WIFI_GATEWAY_ADDRESS 0x0A0AA8C0 86 #endif 87 88 #define DEFAULT_WIFI_CLIENT_PROFILE \ 89 (sl_net_wifi_client_profile_t) \ 90 { \ 91 .config = { \ 92 .ssid.value = DEFAULT_WIFI_CLIENT_PROFILE_SSID, \ 93 .ssid.length = sizeof(DEFAULT_WIFI_CLIENT_PROFILE_SSID)-1, \ 94 .channel.channel = SL_WIFI_AUTO_CHANNEL, \ 95 .channel.band = SL_WIFI_AUTO_BAND, \ 96 .channel.bandwidth = SL_WIFI_AUTO_BANDWIDTH, \ 97 .channel_bitmap.channel_bitmap_2_4 = SL_WIFI_DEFAULT_CHANNEL_BITMAP, \ 98 .bssid = {{0}}, \ 99 .bss_type = SL_WIFI_BSS_TYPE_INFRASTRUCTURE, \ 100 .security = DEFAULT_WIFI_CLIENT_SECURITY_TYPE, \ 101 .encryption = DEFAULT_WIFI_CLIENT_ENCRYPTION_TYPE, \ 102 .client_options = 0, \ 103 .credential_id = SL_NET_DEFAULT_WIFI_CLIENT_CREDENTIAL_ID, \ 104 }, \ 105 .ip = { \ 106 .mode = SL_IP_MANAGEMENT_DHCP, \ 107 .type = REQUIRED_IP_TYPE, \ 108 .host_name = NULL, \ 109 .ip = {{{0}}}, \ 110 } \ 111 } 112 113 #define DEFAULT_WIFI_ACCESS_POINT_PROFILE \ 114 (sl_net_wifi_ap_profile_t) \ 115 { \ 116 .config = { \ 117 .ssid.value = DEFAULT_WIFI_AP_PROFILE_SSID, \ 118 .ssid.length = sizeof(DEFAULT_WIFI_AP_PROFILE_SSID)-1, \ 119 .channel.channel = SL_WIFI_AUTO_CHANNEL, \ 120 .channel.band = SL_WIFI_AUTO_BAND, \ 121 .channel.bandwidth = SL_WIFI_AUTO_BANDWIDTH, \ 122 .security = SL_WIFI_WPA2, \ 123 .encryption = SL_WIFI_CCMP_ENCRYPTION, \ 124 .rate_protocol = SL_WIFI_RATE_PROTOCOL_AUTO, \ 125 .options = 0, \ 126 .credential_id = SL_NET_DEFAULT_WIFI_AP_CREDENTIAL_ID, \ 127 .keepalive_type = SL_SI91X_AP_NULL_BASED_KEEP_ALIVE, \ 128 .beacon_interval = 100, \ 129 .client_idle_timeout = 0xFF, \ 130 .dtim_beacon_count = 3, \ 131 .maximum_clients = 3, \ 132 .beacon_stop = 0, \ 133 .tdi_flags =SL_WIFI_TDI_NONE, \ 134 .is_11n_enabled = 1, \ 135 }, \ 136 .ip = { \ 137 .mode = SL_IP_MANAGEMENT_STATIC_IP, \ 138 .type = SL_IPV4, \ 139 .host_name = NULL, \ 140 .ip = { \ 141 .v4.ip_address.value = DEFAULT_WIFI_MODULE_IP_ADDRESS, \ 142 .v4.gateway.value = DEFAULT_WIFI_GATEWAY_ADDRESS, \ 143 .v4.netmask.value = DEFAULT_WIFI_SN_MASK_ADDRESS \ 144 }, \ 145 } \ 146 } 147 148 static sl_net_wifi_psk_credential_entry_t default_wifi_client_credential = { 149 .type = SL_NET_WIFI_PSK, 150 .data_length = sizeof(DEFAULT_WIFI_CLIENT_CREDENTIAL) - 1, 151 .data = DEFAULT_WIFI_CLIENT_CREDENTIAL 152 }; 153 154 static sl_net_wifi_psk_credential_entry_t default_wifi_ap_credential = { .type = SL_NET_WIFI_PSK, 155 .data_length = 156 sizeof(DEFAULT_WIFI_AP_CREDENTIAL) - 1, 157 .data = DEFAULT_WIFI_AP_CREDENTIAL }; 158 #if defined(__GNUC__) 159 // Restore GCC diagnostics 160 #pragma GCC diagnostic pop 161 #endif 162