DeepCover Embedded Security in IoT: Public-key Secured Data Paths
Dependencies: MaximInterface
wlan.h
00001 /* 00002 * wlan.h - CC31xx/CC32xx Host Driver Implementation 00003 * 00004 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * Neither the name of Texas Instruments Incorporated nor the names of 00020 * its contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 00037 /*****************************************************************************/ 00038 /* Include files */ 00039 /*****************************************************************************/ 00040 #include "simplelink.h" 00041 00042 #ifndef __WLAN_H__ 00043 #define __WLAN_H__ 00044 00045 00046 00047 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif 00051 00052 00053 /*****************************************************************************/ 00054 /* Macro declarations */ 00055 /*****************************************************************************/ 00056 00057 /*! 00058 00059 \addtogroup wlan 00060 @{ 00061 00062 */ 00063 00064 #define SL_BSSID_LENGTH (6) 00065 #define MAXIMAL_SSID_LENGTH (32) 00066 00067 #define NUM_OF_RATE_INDEXES (20) 00068 #define SIZE_OF_RSSI_HISTOGRAM (6) 00069 00070 /* WLAN Disconnect Reason Codes */ 00071 #define SL_WLAN_DISCONNECT_UNSPECIFIED_REASON (1) 00072 #define SL_WLAN_DISCONNECT_PREV_AUTH_NOT_VALID (2) 00073 #define SL_WLAN_DISCONNECT_DEAUTH_LEAVING (3) 00074 #define SL_WLAN_DISCONNECT_DISASSOC_DUE_TO_INACTIVITY (4) 00075 #define SL_WLAN_DISCONNECT_DISASSOC_AP_BUSY (5) 00076 #define SL_WLAN_DISCONNECT_CLASS2_FRAME_FROM_NONAUTH_STA (6) 00077 #define SL_WLAN_DISCONNECT_CLASS3_FRAME_FROM_NONASSOC_STA (7) 00078 #define SL_WLAN_DISCONNECT_DISASSOC_STA_HAS_LEFT (8) 00079 #define SL_WLAN_DISCONNECT_STA_REQ_ASSOC_WITHOUT_AUTH (9) 00080 #define SL_WLAN_DISCONNECT_PWR_CAPABILITY_NOT_VALID (10) 00081 #define SL_WLAN_DISCONNECT_SUPPORTED_CHANNEL_NOT_VALID (11) 00082 #define SL_WLAN_DISCONNECT_INVALID_IE (13) 00083 #define SL_WLAN_DISCONNECT_MIC_FAILURE (14) 00084 #define SL_WLAN_DISCONNECT_4WAY_HANDSHAKE_TIMEOUT (15) 00085 #define SL_WLAN_DISCONNECT_GROUP_KEY_UPDATE_TIMEOUT (16) 00086 #define SL_WLAN_DISCONNECT_IE_IN_4WAY_DIFFERS (17) 00087 #define SL_WLAN_DISCONNECT_GROUP_CIPHER_NOT_VALID (18) 00088 #define SL_WLAN_DISCONNECT_PAIRWISE_CIPHER_NOT_VALID (19) 00089 #define SL_WLAN_DISCONNECT_AKMP_NOT_VALID (20) 00090 #define SL_WLAN_DISCONNECT_UNSUPPORTED_RSN_IE_VERSION (21) 00091 #define SL_WLAN_DISCONNECT_INVALID_RSN_IE_CAPAB (22) 00092 #define SL_WLAN_DISCONNECT_IEEE_802_1X_AUTH_FAILED (23) 00093 #define SL_WLAN_DISCONNECT_CIPHER_SUITE_REJECTED (24) 00094 #define SL_WLAN_DISCONNECT_DISASSOC_LOW_ACK (34) 00095 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_NONE (100) 00096 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_LOW_TX_RATE (104) 00097 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_LOW_SNR (105) 00098 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_LOW_QUALITY (106) 00099 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_TSPEC_REJECTED (107) 00100 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_MAX_TX_RETRIES (108) 00101 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_BSS_LOSS (109) 00102 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_BSS_LOSS_DUE_TO_MAX_TX_RETRY (110) 00103 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_SWITCH_CHANNEL (111) 00104 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_AP_DISCONNECT (112) 00105 #define SL_WLAN_DISCONNECT_ROAMING_TRIGGER_SECURITY_ATTACK (113) 00106 #define SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION (200) 00107 00108 00109 /* Wlan error codes */ 00110 #define SL_ERROR_KEY_ERROR (-3) 00111 #define SL_ERROR_INVALID_ROLE (-71) 00112 #define SL_ERROR_INVALID_SECURITY_TYPE (-84) 00113 #define SL_ERROR_PASSPHRASE_TOO_LONG (-85) 00114 #define SL_ERROR_WPS_NO_PIN_OR_WRONG_PIN_LEN (-87) 00115 #define SL_ERROR_EAP_WRONG_METHOD (-88) 00116 #define SL_ERROR_PASSWORD_ERROR (-89) 00117 #define SL_ERROR_EAP_ANONYMOUS_LEN_ERROR (-90) 00118 #define SL_ERROR_SSID_LEN_ERROR (-91) 00119 #define SL_ERROR_USER_ID_LEN_ERROR (-92) 00120 #define SL_ERROR_ILLEGAL_WEP_KEY_INDEX (-95) 00121 #define SL_ERROR_INVALID_DWELL_TIME_VALUES (-96) 00122 #define SL_ERROR_INVALID_POLICY_TYPE (-97) 00123 #define SL_ERROR_PM_POLICY_INVALID_OPTION (-98) 00124 #define SL_ERROR_PM_POLICY_INVALID_PARAMS (-99) 00125 #define SL_ERROR_WIFI_ALREADY_DISCONNECTED (-129) 00126 #define SL_ERROR_WIFI_NOT_CONNECTED (-59) 00127 00128 00129 00130 #define SL_SEC_TYPE_OPEN (0) 00131 #define SL_SEC_TYPE_WEP (1) 00132 #define SL_SEC_TYPE_WPA (2) /* deprecated */ 00133 #define SL_SEC_TYPE_WPA_WPA2 (2) 00134 #define SL_SEC_TYPE_WPS_PBC (3) 00135 #define SL_SEC_TYPE_WPS_PIN (4) 00136 #define SL_SEC_TYPE_WPA_ENT (5) 00137 #define SL_SEC_TYPE_P2P_PBC (6) 00138 #define SL_SEC_TYPE_P2P_PIN_KEYPAD (7) 00139 #define SL_SEC_TYPE_P2P_PIN_DISPLAY (8) 00140 #define SL_SEC_TYPE_P2P_PIN_AUTO (9) /* NOT Supported yet */ 00141 00142 00143 00144 #define SL_SCAN_SEC_TYPE_OPEN (0) 00145 #define SL_SCAN_SEC_TYPE_WEP (1) 00146 #define SL_SCAN_SEC_TYPE_WPA (2) 00147 #define SL_SCAN_SEC_TYPE_WPA2 (3) 00148 00149 00150 #define TLS (0x1) 00151 #define MSCHAP (0x0) 00152 #define PSK (0x2) 00153 #define TTLS (0x10) 00154 #define PEAP0 (0x20) 00155 #define PEAP1 (0x40) 00156 #define FAST (0x80) 00157 00158 #define FAST_AUTH_PROVISIONING (0x02) 00159 #define FAST_UNAUTH_PROVISIONING (0x01) 00160 #define FAST_NO_PROVISIONING (0x00) 00161 00162 #define EAPMETHOD_PHASE2_SHIFT (8) 00163 #define EAPMETHOD_PAIRWISE_CIPHER_SHIFT (19) 00164 #define EAPMETHOD_GROUP_CIPHER_SHIFT (27) 00165 00166 #define WPA_CIPHER_CCMP (0x1) 00167 #define WPA_CIPHER_TKIP (0x2) 00168 #define CC31XX_DEFAULT_CIPHER (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP) 00169 00170 #define EAPMETHOD(phase1,phase2,pairwise_cipher,group_cipher) \ 00171 ((phase1) | \ 00172 ((phase2) << EAPMETHOD_PHASE2_SHIFT ) |\ 00173 ((_u32)(pairwise_cipher) << EAPMETHOD_PAIRWISE_CIPHER_SHIFT ) |\ 00174 ((_u32)(group_cipher) << EAPMETHOD_GROUP_CIPHER_SHIFT )) 00175 00176 /* phase1 phase2 pairwise_cipher group_cipher */ 00177 #define SL_ENT_EAP_METHOD_TLS EAPMETHOD(TLS , 0 , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00178 #define SL_ENT_EAP_METHOD_TTLS_TLS EAPMETHOD(TTLS , TLS , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00179 #define SL_ENT_EAP_METHOD_TTLS_MSCHAPv2 EAPMETHOD(TTLS , MSCHAP , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00180 #define SL_ENT_EAP_METHOD_TTLS_PSK EAPMETHOD(TTLS , PSK , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00181 #define SL_ENT_EAP_METHOD_PEAP0_TLS EAPMETHOD(PEAP0 , TLS , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00182 #define SL_ENT_EAP_METHOD_PEAP0_MSCHAPv2 EAPMETHOD(PEAP0 , MSCHAP , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00183 #define SL_ENT_EAP_METHOD_PEAP0_PSK EAPMETHOD(PEAP0 , PSK , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00184 #define SL_ENT_EAP_METHOD_PEAP1_TLS EAPMETHOD(PEAP1 , TLS , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00185 #define SL_ENT_EAP_METHOD_PEAP1_MSCHAPv2 EAPMETHOD(PEAP1 , MSCHAP , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00186 #define SL_ENT_EAP_METHOD_PEAP1_PSK EAPMETHOD(PEAP1 , PSK , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00187 #define SL_ENT_EAP_METHOD_FAST_AUTH_PROVISIONING EAPMETHOD(FAST , FAST_AUTH_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00188 #define SL_ENT_EAP_METHOD_FAST_UNAUTH_PROVISIONING EAPMETHOD(FAST , FAST_UNAUTH_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00189 #define SL_ENT_EAP_METHOD_FAST_NO_PROVISIONING EAPMETHOD(FAST , FAST_NO_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER) 00190 00191 #define SL_LONG_PREAMBLE (0) 00192 #define SL_SHORT_PREAMBLE (1) 00193 00194 #define SL_RAW_RF_TX_PARAMS_CHANNEL_SHIFT (0) 00195 #define SL_RAW_RF_TX_PARAMS_RATE_SHIFT (6) 00196 #define SL_RAW_RF_TX_PARAMS_POWER_SHIFT (11) 00197 #define SL_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT (15) 00198 00199 #define SL_RAW_RF_TX_PARAMS(chan,rate,power,preamble) \ 00200 ((chan << SL_RAW_RF_TX_PARAMS_CHANNEL_SHIFT) | \ 00201 (rate << SL_RAW_RF_TX_PARAMS_RATE_SHIFT) | \ 00202 (power << SL_RAW_RF_TX_PARAMS_POWER_SHIFT) | \ 00203 (preamble << SL_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT)) 00204 00205 00206 /* wlan config application IDs */ 00207 #define SL_WLAN_CFG_AP_ID (0) 00208 #define SL_WLAN_CFG_GENERAL_PARAM_ID (1) 00209 #define SL_WLAN_CFG_P2P_PARAM_ID (2) 00210 00211 /* wlan AP Config set/get options */ 00212 #define WLAN_AP_OPT_SSID (0) 00213 #define WLAN_AP_OPT_CHANNEL (3) 00214 #define WLAN_AP_OPT_HIDDEN_SSID (4) 00215 #define WLAN_AP_OPT_SECURITY_TYPE (6) 00216 #define WLAN_AP_OPT_PASSWORD (7) 00217 #define WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE (9) 00218 #define WLAN_GENERAL_PARAM_OPT_STA_TX_POWER (10) 00219 #define WLAN_GENERAL_PARAM_OPT_AP_TX_POWER (11) 00220 00221 #define WLAN_P2P_OPT_DEV_NAME (12) 00222 #define WLAN_P2P_OPT_DEV_TYPE (13) 00223 #define WLAN_P2P_OPT_CHANNEL_N_REGS (14) 00224 #define WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT (16) 00225 #define WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS (18) /* change the scan channels and RSSI threshold using this configuration option */ 00226 00227 /* SmartConfig CIPHER options */ 00228 #define SMART_CONFIG_CIPHER_SFLASH (0) /* password is not delivered by the application. The Simple Manager should */ 00229 /* check if the keys are stored in the Flash. */ 00230 #define SMART_CONFIG_CIPHER_AES (1) /* AES (other types are not supported) */ 00231 #define SMART_CONFIG_CIPHER_NONE (0xFF) /* do not check in the flash */ 00232 00233 00234 #define SL_POLICY_CONNECTION (0x10) 00235 #define SL_POLICY_SCAN (0x20) 00236 #define SL_POLICY_PM (0x30) 00237 #define SL_POLICY_P2P (0x40) 00238 00239 #define VAL_2_MASK(position,value) ((1 & (value))<<(position)) 00240 #define MASK_2_VAL(position,mask) (((1 << position) & (mask)) >> (position)) 00241 00242 #define SL_CONNECTION_POLICY(Auto,Fast,Open,anyP2P,autoSmartConfig) (VAL_2_MASK(0,Auto) | VAL_2_MASK(1,Fast) | VAL_2_MASK(2,Open) | VAL_2_MASK(3,anyP2P) | VAL_2_MASK(4,autoSmartConfig)) 00243 #define SL_SCAN_POLICY_EN(policy) (MASK_2_VAL(0,policy)) 00244 #define SL_SCAN_POLICY(Enable) (VAL_2_MASK(0,Enable)) 00245 00246 00247 #define SL_NORMAL_POLICY (0) 00248 #define SL_LOW_LATENCY_POLICY (1) 00249 #define SL_LOW_POWER_POLICY (2) 00250 #define SL_ALWAYS_ON_POLICY (3) 00251 #define SL_LONG_SLEEP_INTERVAL_POLICY (4) 00252 00253 #define SL_P2P_ROLE_NEGOTIATE (3) 00254 #define SL_P2P_ROLE_GROUP_OWNER (15) 00255 #define SL_P2P_ROLE_CLIENT (0) 00256 00257 #define SL_P2P_NEG_INITIATOR_ACTIVE (0) 00258 #define SL_P2P_NEG_INITIATOR_PASSIVE (1) 00259 #define SL_P2P_NEG_INITIATOR_RAND_BACKOFF (2) 00260 00261 #define POLICY_VAL_2_OPTIONS(position,mask,policy) ((mask & policy) << position ) 00262 00263 #define SL_P2P_POLICY(p2pNegType,p2pNegInitiator) (POLICY_VAL_2_OPTIONS(0,0xF,(p2pNegType > SL_P2P_ROLE_GROUP_OWNER ? SL_P2P_ROLE_GROUP_OWNER : p2pNegType)) | \ 00264 POLICY_VAL_2_OPTIONS(4,0x1,(p2pNegType > SL_P2P_ROLE_GROUP_OWNER ? 1:0)) | \ 00265 POLICY_VAL_2_OPTIONS(5,0x3, p2pNegInitiator)) 00266 00267 00268 /* Info elements */ 00269 00270 #define INFO_ELEMENT_DEFAULT_ID (0) /* 221 will be used */ 00271 00272 /* info element size is up to 252 bytes (+ 3 bytes of OUI). */ 00273 #define INFO_ELEMENT_MAX_SIZE (252) 00274 00275 /* For AP - the total length of all info elements is 300 bytes (for example - 4 info elements of 75 bytes each) */ 00276 #define INFO_ELEMENT_MAX_TOTAL_LENGTH_AP (300) 00277 /* For P2P - the total length of all info elements is 150 bytes (for example - 4 info elements of 40 bytes each) */ 00278 #define INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO (160) 00279 00280 #define INFO_ELEMENT_AP_ROLE (0) 00281 #define INFO_ELEMENT_P2P_GO_ROLE (1) 00282 00283 /* we support up to 4 info elements per Role. */ 00284 #define MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED (4) 00285 00286 #define INFO_ELEMENT_DEFAULT_OUI_0 (0x08) 00287 #define INFO_ELEMENT_DEFAULT_OUI_1 (0x00) 00288 #define INFO_ELEMENT_DEFAULT_OUI_2 (0x28) 00289 00290 #define INFO_ELEMENT_DEFAULT_OUI (0x000000) /* 08, 00, 28 will be used */ 00291 00292 00293 00294 00295 /************************************************** 00296 For backward compatability (version 1.0.0.10) 00297 **************************************************/ 00298 #define SL_DISCONNECT_UNSPECIFIED_REASON SL_WLAN_DISCONNECT_UNSPECIFIED_REASON 00299 #define SL_PREVIOUS_AUTHENTICATION_NO_LONGER_VALID SL_WLAN_DISCONNECT_PREV_AUTH_NOT_VALID 00300 #define SL_DEAUTHENTICATED_BECAUSE_SENDING_STATION_IS_LEAVING SL_WLAN_DISCONNECT_DEAUTH_LEAVING 00301 #define SL_DISASSOCIATED_DUE_TO_INACTIVITY SL_WLAN_DISCONNECT_DISASSOC_DUE_TO_INACTIVITY 00302 #define SL_DISASSOCIATED_BECAUSE_AP_IS_UNABLE_TO_HANDLE_ALL_CURRENTLY_ASSOCIATED_STATIONS SL_WLAN_DISCONNECT_DISASSOC_AP_BUSY 00303 #define SL_CLASS_2_FRAME_RECEIVED_FROM_NONAUTHENTICATED_STATION SL_WLAN_DISCONNECT_CLASS2_FRAME_FROM_NONAUTH_STA 00304 #define SL_CLASS_3_FRAME_RECEIVED_FROM_NONASSOCIATED_STATION SL_WLAN_DISCONNECT_CLASS3_FRAME_FROM_NONASSOC_STA 00305 #define SL_DISASSOCIATED_BECAUSE_SENDING_STATION_IS_LEAVING_BSS SL_WLAN_DISCONNECT_DISASSOC_STA_HAS_LEFT 00306 #define SL_STATION_REQUESTING_ASSOCIATION_IS_NOT_AUTHENTICATED_WITH_RESPONDING_STATION SL_WLAN_DISCONNECT_STA_REQ_ASSOC_WITHOUT_AUTH 00307 #define SL_DISASSOCIATED_BECAUSE_THE_INFORMATION_IN_THE_POWER_CAPABILITY_ELEMENT_IS_UNACCEPTABLE SL_WLAN_DISCONNECT_PWR_CAPABILITY_NOT_VALID 00308 #define SL_DISASSOCIATED_BECAUSE_THE_INFORMATION_IN_THE_SUPPORTED_CHANNELS_ELEMENT_IS_UNACCEPTABLE SL_WLAN_DISCONNECT_SUPPORTED_CHANNEL_NOT_VALID 00309 #define SL_INVALID_INFORMATION_ELEMENT SL_WLAN_DISCONNECT_INVALID_IE 00310 #define SL_MESSAGE_INTEGRITY_CODE_MIC_FAILURE SL_WLAN_DISCONNECT_MIC_FAILURE 00311 #define SL_FOUR_WAY_HANDSHAKE_TIMEOUT SL_WLAN_DISCONNECT_4WAY_HANDSHAKE_TIMEOUT 00312 #define SL_GROUP_KEY_HANDSHAKE_TIMEOUT SL_WLAN_DISCONNECT_GROUP_KEY_UPDATE_TIMEOUT 00313 #define SL_RE_ASSOCIATION_REQUEST_PROBE_RESPONSE_BEACON_FRAME SL_WLAN_DISCONNECT_IE_IN_4WAY_DIFFERS 00314 #define SL_INVALID_GROUP_CIPHER SL_WLAN_DISCONNECT_GROUP_CIPHER_NOT_VALID 00315 #define SL_INVALID_PAIRWISE_CIPHER SL_WLAN_DISCONNECT_PAIRWISE_CIPHER_NOT_VALID 00316 #define SL_INVALID_AKMP SL_WLAN_DISCONNECT_AKMP_NOT_VALID 00317 #define SL_UNSUPPORTED_RSN_INFORMATION_ELEMENT_VERSION SL_WLAN_DISCONNECT_UNSUPPORTED_RSN_IE_VERSION 00318 #define SL_INVALID_RSN_INFORMATION_ELEMENT_CAPABILITIES SL_WLAN_DISCONNECT_INVALID_RSN_IE_CAPAB 00319 #define SL_IEEE_802_1X_AUTHENTICATION_FAILED SL_WLAN_DISCONNECT_IEEE_802_1X_AUTH_FAILED 00320 #define SL_CIPHER_SUITE_REJECTED_BECAUSE_OF_THE_SECURITY_POLICY SL_WLAN_DISCONNECT_CIPHER_SUITE_REJECTED 00321 #define SL_USER_INITIATED_DISCONNECTION SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION 00322 00323 00324 #define SL_DISCONNECT_RESERVED_0 (0) 00325 #define SL_DISCONNECT_RESERVED_1 (12) 00326 #define SL_DISCONNECT_RESERVED_2 (26) 00327 #define SL_DISCONNECT_RESERVED_3 (27) 00328 #define SL_DISCONNECT_RESERVED_4 (28) 00329 #define SL_DISCONNECT_RESERVED_5 (29) 00330 #define SL_DISCONNECT_RESERVED_6 (30) 00331 #define SL_DISCONNECT_RESERVED_7 (31) 00332 #define SL_DISCONNECT_RESERVED_8 (32) 00333 00334 /****************************** 00335 End of backward compatability. 00336 *******************************/ 00337 00338 00339 /*****************************************************************************/ 00340 /* Structure/Enum declarations */ 00341 /*****************************************************************************/ 00342 00343 typedef enum 00344 { 00345 RATE_1M = 1, 00346 RATE_2M = 2, 00347 RATE_5_5M = 3, 00348 RATE_11M = 4, 00349 RATE_6M = 6, 00350 RATE_9M = 7, 00351 RATE_12M = 8, 00352 RATE_18M = 9, 00353 RATE_24M = 10, 00354 RATE_36M = 11, 00355 RATE_48M = 12, 00356 RATE_54M = 13, 00357 RATE_MCS_0 = 14, 00358 RATE_MCS_1 = 15, 00359 RATE_MCS_2 = 16, 00360 RATE_MCS_3 = 17, 00361 RATE_MCS_4 = 18, 00362 RATE_MCS_5 = 19, 00363 RATE_MCS_6 = 20, 00364 RATE_MCS_7 = 21, 00365 MAX_NUM_RATES = 0xFF 00366 }SlRateIndex_e; 00367 00368 typedef enum { 00369 DEV_PW_DEFAULT=0, 00370 DEV_PW_PIN_KEYPAD=1, 00371 DEV_PW_PUSH_BUTTON=4, 00372 DEV_PW_PIN_DISPLAY=5 00373 } sl_p2p_dev_password_method; 00374 00375 00376 typedef struct 00377 { 00378 _u32 status; 00379 _u32 ssid_len; 00380 _u8 ssid[32]; 00381 _u32 private_token_len; 00382 _u8 private_token[32]; 00383 }slSmartConfigStartAsyncResponse_t; 00384 00385 typedef struct 00386 { 00387 _u16 status; 00388 _u16 padding; 00389 }slSmartConfigStopAsyncResponse_t; 00390 00391 typedef struct 00392 { 00393 _u16 status; 00394 _u16 padding; 00395 }slWlanConnFailureAsyncResponse_t; 00396 00397 typedef struct 00398 { 00399 _u8 connection_type;/* 0-STA,3-P2P_CL */ 00400 _u8 ssid_len; 00401 _u8 ssid_name[32]; 00402 _u8 go_peer_device_name_len; 00403 _u8 go_peer_device_name[32]; 00404 _u8 bssid[6]; 00405 _u8 reason_code; 00406 _u8 padding[2]; 00407 } slWlanConnectAsyncResponse_t; 00408 00409 typedef struct 00410 { 00411 _u8 go_peer_device_name[32]; 00412 _u8 mac[6]; 00413 _u8 go_peer_device_name_len; 00414 _u8 wps_dev_password_id; 00415 _u8 own_ssid[32];/* relevant for event sta-connected only */ 00416 _u8 own_ssid_len;/* relevant for event sta-connected only */ 00417 _u8 padding[3]; 00418 }slPeerInfoAsyncResponse_t; 00419 00420 00421 typedef union 00422 { 00423 slSmartConfigStartAsyncResponse_t smartConfigStartResponse; /*SL_WLAN_SMART_CONFIG_COMPLETE_EVENT*/ 00424 slSmartConfigStopAsyncResponse_t smartConfigStopResponse; /*SL_WLAN_SMART_CONFIG_STOP_EVENT */ 00425 slPeerInfoAsyncResponse_t APModeStaConnected; /* SL_WLAN_STA_CONNECTED_EVENT - relevant only in AP mode - holds information regarding a new STA connection */ 00426 slPeerInfoAsyncResponse_t APModestaDisconnected; /* SL_WLAN_STA_DISCONNECTED_EVENT - relevant only in AP mode - holds information regarding a STA disconnection */ 00427 slWlanConnectAsyncResponse_t STAandP2PModeWlanConnected; /* SL_WLAN_CONNECT_EVENT - relevant only in STA and P2P mode - holds information regarding a new connection */ 00428 slWlanConnectAsyncResponse_t STAandP2PModeDisconnected; /* SL_WLAN_DISCONNECT_EVENT - relevant only in STA and P2P mode - holds information regarding a disconnection */ 00429 slPeerInfoAsyncResponse_t P2PModeDevFound; /* SL_WLAN_P2P_DEV_FOUND_EVENT - relevant only in P2P mode */ 00430 slPeerInfoAsyncResponse_t P2PModeNegReqReceived; /* SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT - relevant only in P2P mode */ 00431 slWlanConnFailureAsyncResponse_t P2PModewlanConnectionFailure; /* SL_WLAN_CONNECTION_FAILED_EVENT - relevant only in P2P mode */ 00432 00433 } SlWlanEventData_u; 00434 00435 typedef struct 00436 { 00437 _u32 Event; 00438 SlWlanEventData_u EventData; 00439 } SlWlanEvent_t; 00440 00441 00442 typedef struct 00443 { 00444 _u32 ReceivedValidPacketsNumber; /* sum of the packets that been received OK (include filtered) */ 00445 _u32 ReceivedFcsErrorPacketsNumber; /* sum of the packets that been dropped due to FCS error */ 00446 _u32 ReceivedAddressMismatchPacketsNumber; /* sum of the packets that been received but filtered out by one of the HW filters */ 00447 _i16 AvarageDataCtrlRssi; /* average RSSI for all valid data packets received */ 00448 _i16 AvarageMgMntRssi; /* average RSSI for all valid management packets received */ 00449 _u16 RateHistogram[NUM_OF_RATE_INDEXES]; /* rate histogram for all valid packets received */ 00450 _u16 RssiHistogram[SIZE_OF_RSSI_HISTOGRAM]; /* RSSI histogram from -40 until -87 (all below and above\n RSSI will appear in the first and last cells */ 00451 _u32 StartTimeStamp; /* the time stamp started collecting the statistics in uSec */ 00452 _u32 GetTimeStamp; /* the time stamp called the get statistics command */ 00453 }SlGetRxStatResponse_t; 00454 00455 00456 typedef struct 00457 { 00458 _u8 ssid[MAXIMAL_SSID_LENGTH]; 00459 _u8 ssid_len; 00460 _u8 sec_type; 00461 _u8 bssid[SL_BSSID_LENGTH]; 00462 _i8 rssi; 00463 _i8 reserved[3]; 00464 }Sl_WlanNetworkEntry_t; 00465 00466 00467 typedef struct 00468 { 00469 _u8 Type; 00470 _i8* Key; 00471 _u8 KeyLen; 00472 }SlSecParams_t; 00473 00474 typedef struct 00475 { 00476 _i8* User; 00477 _u8 UserLen; 00478 _i8* AnonUser; 00479 _u8 AnonUserLen; 00480 _u8 CertIndex; /* not supported */ 00481 _u32 EapMethod; 00482 }SlSecParamsExt_t; 00483 00484 typedef struct 00485 { 00486 _i8 User[32]; 00487 _u8 UserLen; 00488 _i8 AnonUser[32]; 00489 _u8 AnonUserLen; 00490 _u8 CertIndex; /* not supported */ 00491 _u32 EapMethod; 00492 }SlGetSecParamsExt_t; 00493 00494 typedef enum 00495 { 00496 ROLE_STA = 0, 00497 ROLE_UNKNOWN = 1, 00498 ROLE_AP = 2, 00499 ROLE_P2P = 3, 00500 ROLE_STA_ERR = -1, /* Failure to load MAC/PHY in STA role */ 00501 ROLE_AP_ERR = -2, /* Failure to load MAC/PHY in AP role */ 00502 ROLE_P2P_ERR = -3, /* Failure to load MAC/PHY in P2P role */ 00503 INIT_CALIB_FAIL = -4 /* Failure of calibration */ 00504 }SlWlanMode_e; 00505 00506 00507 typedef struct 00508 { 00509 _u32 G_Channels_mask; 00510 _i32 rssiThershold; 00511 }slWlanScanParamCommand_t; 00512 00513 00514 typedef struct 00515 { 00516 _u8 id; 00517 _u8 oui[3]; 00518 _u16 length; 00519 _u8 data[252]; 00520 } sl_protocol_InfoElement_t; 00521 00522 typedef struct 00523 { 00524 _u8 index; /* 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED */ 00525 _u8 role; /* bit0: AP = 0, GO = 1 */ 00526 sl_protocol_InfoElement_t ie; 00527 } sl_protocol_WlanSetInfoElement_t; 00528 00529 00530 /*****************************************************************************/ 00531 /* Function prototypes */ 00532 /*****************************************************************************/ 00533 00534 00535 /*! 00536 \brief Connect to wlan network as a station 00537 00538 \param[in] pName up to 32 bytes in case of STA the name is the SSID of the Access Point 00539 \param[in] NameLen name length 00540 \param[in] pMacAddr 6 bytes for MAC address 00541 \param[in] pSecParams Security parameters (use NULL key for SL_SEC_TYPE_OPEN) 00542 Security types options: \n 00543 - SL_SEC_TYPE_OPEN 00544 - SL_SEC_TYPE_WEP 00545 - SL_SEC_TYPE_WPA_WPA2 00546 - SL_SEC_TYPE_WPA_ENT 00547 - SL_SEC_TYPE_WPS_PBC 00548 - SL_SEC_TYPE_WPS_PIN 00549 00550 \param[in] pSecExtParams Enterprise parameters (set NULL in case Enterprise parameters is not in use) 00551 00552 \return On success, zero is returned. On error, negative is returned 00553 In case error number (-71) is returned, it indicates a connection was activated while the device it running in AP role 00554 00555 \sa sl_WlanDisconnect 00556 \note belongs to \ref ext_api 00557 \warning In this version only single enterprise mode could be used 00558 SL_SEC_TYPE_WPA is a deprecated definition, the new definition is SL_SEC_TYPE_WPA_WPA2 00559 */ 00560 #if _SL_INCLUDE_FUNC(sl_WlanConnect) 00561 _i16 sl_WlanConnect(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlSecParams_t* pSecParams ,const SlSecParamsExt_t* pSecExtParams); 00562 #endif 00563 00564 /*! 00565 \brief wlan disconnect 00566 00567 Disconnect connection 00568 00569 \return 0 disconnected done, other already disconnected 00570 00571 \sa sl_WlanConnect 00572 \note belongs to \ref ext_api 00573 \warning 00574 */ 00575 #if _SL_INCLUDE_FUNC(sl_WlanDisconnect) 00576 _i16 sl_WlanDisconnect(void); 00577 #endif 00578 00579 /*! 00580 \brief add profile 00581 00582 When auto start is enabled, the device connects to a 00583 station from the profiles table. Up to 7 profiles are 00584 supported. If several profiles configured the device chose 00585 the highest priority profile, within each priority group, 00586 device will chose profile based on security policy, signal 00587 strength, etc parameters. 00588 00589 00590 \param[in] pName up to 32 bytes in case of STA the name is the 00591 SSID of the Access Point 00592 in case of P2P the name is the remote device name 00593 \param[in] NameLen name length 00594 \param[in] pMacAddr 6 bytes for MAC address 00595 \param[in] pSecParams Security parameters - security type 00596 (SL_SEC_TYPE_OPEN,SL_SEC_TYPE_WEP,SL_SEC_TYPE_WPA_WPA2, 00597 SL_SEC_TYPE_P2P_PBC,SL_SEC_TYPE_P2P_PIN_KEYPAD,SL_SEC_TYPE_P2P_PIN_DISPLAY, SL_SEC_TYPE_WPA_ENT), key, and key length 00598 in case of p2p security type pin the key refers to pin code 00599 \param[in] pSecExtParams Enterprise parameters - identity, identity length, 00600 Anonymous, Anonymous length, CertIndex (not supported, 00601 certificates need to be placed in a specific file ID), 00602 EapMethod.Use NULL in case Enterprise parameters is not in use 00603 00604 \param[in] Priority profile priority. Lowest priority: 0 00605 \param[in] Options Not supported 00606 00607 \return On success, profile stored index is returned. On error, negative value is returned 00608 00609 \sa sl_WlanProfileGet , sl_WlanProfileDel 00610 \note belongs to \ref ext_api 00611 \warning Only one Enterprise profile is supported. 00612 Please Note that in case of adding an existing profile (compared by pName,pMACAddr and security type) 00613 the old profile will be deleted and the same index will be returned. 00614 SL_SEC_TYPE_WPA is a deprecated definition, the new definition is SL_SEC_TYPE_WPA_WPA2 00615 00616 */ 00617 #if _SL_INCLUDE_FUNC(sl_WlanProfileAdd) 00618 _i16 sl_WlanProfileAdd(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlSecParams_t* pSecParams ,const SlSecParamsExt_t* pSecExtParams,const _u32 Priority,const _u32 Options); 00619 #endif 00620 00621 /*! 00622 \brief get profile 00623 00624 read profile from the device 00625 00626 \param[in] Index profile stored index, if index does not exists 00627 error is return 00628 \param[out] pName up to 32 bytes, in case of sta mode the name of the Access Point 00629 in case of p2p mode the name of the Remote Device 00630 \param[out] pNameLen name length 00631 \param[out] pMacAddr 6 bytes for MAC address 00632 \param[out] pSecParams security parameters - security type 00633 (SL_SEC_TYPE_OPEN, SL_SEC_TYPE_WEP, SL_SEC_TYPE_WPA_WPA2 or 00634 SL_SEC_TYPE_WPS_PBC, SL_SEC_TYPE_WPS_PIN, SL_SEC_TYPE_WPA_ENT,SL_SEC_TYPE_P2P_PBC,SL_SEC_TYPE_P2P_PIN_KEYPAD or SL_SEC_TYPE_P2P_PIN_DISPLAY), key and key length are not 00635 in case of p2p security type pin the key refers to pin code 00636 return due to security reasons. 00637 \param[out] pSecExtParams enterprise parameters - identity, identity 00638 length, Anonymous, Anonymous length 00639 CertIndex (not supported), EapMethod. 00640 \param[out] Priority profile priority 00641 00642 \return On success, Profile security type is returned (0 or positive number). On error, -1 is 00643 returned 00644 00645 \sa sl_WlanProfileAdd , sl_WlanProfileDel 00646 \note belongs to \ref ext_api 00647 \warning 00648 */ 00649 #if _SL_INCLUDE_FUNC(sl_WlanProfileGet) 00650 _i16 sl_WlanProfileGet(const _i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams, SlGetSecParamsExt_t* pSecExtParams, _u32 *pPriority); 00651 #endif 00652 00653 /*! 00654 \brief Delete WLAN profile 00655 00656 Delete WLAN profile 00657 00658 \param[in] index number of profile to delete.Possible values are 0 to 6. 00659 Index value 255 will delete all saved profiles 00660 00661 \return On success, zero is returned. On error, -1 is 00662 returned 00663 00664 \sa sl_WlanProfileAdd , sl_WlanProfileGet 00665 \note belongs to \ref ext_api 00666 \warning 00667 */ 00668 #if _SL_INCLUDE_FUNC(sl_WlanProfileDel) 00669 _i16 sl_WlanProfileDel(const _i16 Index); 00670 #endif 00671 00672 /*! 00673 \brief Set policy values 00674 00675 \param[in] Type Type of policy to be modified. The Options are:\n 00676 - SL_POLICY_CONNECTION 00677 - SL_POLICY_SCAN 00678 - SL_POLICY_PM 00679 - SL_POLICY_P2P 00680 \param[in] Policy The option value which depends on action type 00681 \param[in] pVal An optional value pointer 00682 \param[in] ValLen An optional value length, in bytes 00683 \return On success, zero is returned. On error, -1 is 00684 returned 00685 \sa sl_WlanPolicyGet 00686 \note belongs to \ref ext_api 00687 \warning 00688 \par 00689 SL_POLICY_CONNECTION type defines three options available to connect the CC31xx device to the AP: \n 00690 00691 - If Auto Connect is set, the CC31xx device tries to automatically reconnect to one of its stored profiles, each time the connection fails or the device is rebooted.\n 00692 To set this option, use: \n 00693 <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(1,0,0,0,0),NULL,0) </b> 00694 - If Fast Connect is set, the CC31xx device tries to establish a fast connection to AP. \n 00695 To set this option, use: \n 00696 <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,1,0,0,0),NULL,0) </b> 00697 - (relevant for P2P mode only) - If Any P2P is set, CC31xx/CC32xx device tries to automatically connect to the first P2P device available, \n 00698 supporting push button only. To set this option, use: \n 00699 <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,1,0),NULL,0) </b> 00700 - For auto smart config upon restart (any command from Host will end this state) use: \n 00701 <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,0,1),NULL,0) </b> \n 00702 The options above could be combined to a single action, if more than one action is required. \n 00703 \par 00704 SL_POLICY_SCAN defines system scan time interval.Default interval is 10 minutes. \n 00705 After settings scan interval, an immediate scan is activated. The next scan will be based on the interval settings. \n 00706 - For example, setting scan interval to 1 minute interval use: \n 00707 _u32 intervalInSeconds = 60; \n 00708 #define SL_SCAN_ENABLE 1 \n<b> 00709 sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_ENABLE, (_u8 *)&intervalInSeconds,sizeof(intervalInSeconds)); </b>\n 00710 00711 - For example, disable scan: \n 00712 #define SL_SCAN_DISABLE 0 \n<b> 00713 sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_DISABLE,0,0); </b>\n 00714 \par 00715 SL_POLICY_PM defines a power management policy for Station mode only: 00716 - For setting normal power management (default) policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL,0) </b> 00717 - For setting low latency power management policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_LATENCY_POLICY, NULL,0) </b> 00718 - For setting low power management policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_POWER_POLICY, NULL,0) </b> 00719 - For setting always on power management policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_ALWAYS_ON_POLICY, NULL,0) </b> 00720 - For setting Long Sleep Interval policy use: \n 00721 _u16 PolicyBuff[4] = {0,0,800,0}; // PolicyBuff[2] is max sleep time in mSec \n<b> 00722 sl_WlanPolicySet(SL_POLICY_PM , SL_LONG_SLEEP_INTERVAL_POLICY, (_u8*)PolicyBuff,sizeof(PolicyBuff)); </b>\n 00723 00724 SL_POLICY_P2P defines p2p negotiation policy parameters for P2P role: 00725 - To set intent negotiation value, set on of the following: 00726 SL_P2P_ROLE_NEGOTIATE - intent 3 00727 SL_P2P_ROLE_GROUP_OWNER - intent 15 00728 SL_P2P_ROLE_CLIENT - intent 0 00729 - To set negotiation initiator value (initiator policy of first negotiation action frame), set on of the following: 00730 SL_P2P_NEG_INITIATOR_ACTIVE 00731 SL_P2P_NEG_INITIATOR_PASSIVE 00732 SL_P2P_NEG_INITIATOR_RAND_BACKOFF 00733 For example: \n 00734 <b>sl_WlanPolicySet(SL_POLICY_P2P, SL_P2P_POLICY(SL_P2P_ROLE_NEGOTIATE,SL_P2P_NEG_INITIATOR_RAND_BACKOFF),NULL,0) </b> 00735 00736 */ 00737 #if _SL_INCLUDE_FUNC(sl_WlanPolicySet) 00738 _i16 sl_WlanPolicySet(const _u8 Type , const _u8 Policy, _u8 *pVal,const _u8 ValLen); 00739 #endif 00740 /*! 00741 \brief get policy values 00742 00743 \param[in] Type SL_POLICY_CONNECTION, SL_POLICY_SCAN, SL_POLICY_PM,SL_POLICY_P2P \n 00744 00745 \param[in] Policy argument may be set to any value \n 00746 00747 \param[out] The returned values, depends on each policy type, will be stored in the allocated buffer pointed by pVal 00748 with a maximum buffer length set by the calling function and pointed to by argument *pValLen 00749 00750 \return On success, zero is returned. On error, -1 is returned 00751 00752 \sa sl_WlanPolicySet 00753 00754 \note belongs to \ref ext_api 00755 00756 \warning The value pointed by the argument *pValLen should be set to a value different from 0 and 00757 greater than the buffer length returned from the SL device. Otherwise, an error will be returned. 00758 00759 */ 00760 #if _SL_INCLUDE_FUNC(sl_WlanPolicyGet) 00761 _i16 sl_WlanPolicyGet(const _u8 Type , _u8 Policy,_u8 *pVal,_u8 *pValLen); 00762 #endif 00763 /*! 00764 \brief Gets the WLAN scan operation results 00765 00766 Gets scan results , gets entry from scan result table 00767 00768 \param[in] Index - Starting index identifier (range 0-19) for getting scan results 00769 \param[in] Count - How many entries to fetch. Max is (20-"Index"). 00770 \param[out] pEntries - pointer to an allocated Sl_WlanNetworkEntry_t. 00771 the number of array items should match "Count" 00772 sec_type: SL_SCAN_SEC_TYPE_OPEN, SL_SCAN_SEC_TYPE_WEP, SL_SCAN_SEC_TYPE_WPA or SL_SCAN_SEC_TYPE_WPA2 00773 00774 00775 \return Number of valid networks list items 00776 00777 \sa 00778 \note belongs to \ref ext_api 00779 \warning This command do not initiate any active scanning action 00780 \par Example: 00781 \code An example of fetching max 10 results: 00782 00783 Sl_WlanNetworkEntry_t netEntries[10]; 00784 _i16 resultsCount = sl_WlanGetNetworkList(0,10,&netEntries[0]); 00785 for(i=0; i< resultsCount; i++) 00786 { 00787 printf("%s\n",netEntries[i].ssid); 00788 } 00789 \endcode 00790 */ 00791 #if _SL_INCLUDE_FUNC(sl_WlanGetNetworkList) 00792 _i16 sl_WlanGetNetworkList(const _u8 Index,const _u8 Count, Sl_WlanNetworkEntry_t *pEntries); 00793 #endif 00794 00795 /*! 00796 \brief Start collecting wlan RX statistics, for unlimited time. 00797 00798 \return On success, zero is returned. On error, -1 is returned 00799 00800 \sa sl_WlanRxStatStop sl_WlanRxStatGet 00801 \note belongs to \ref ext_api 00802 \warning 00803 \par Example: 00804 \code Getting wlan RX statistics: 00805 00806 void RxStatCollectTwice() 00807 { 00808 SlGetRxStatResponse_t rxStat; 00809 _i16 rawSocket; 00810 _i8 DataFrame[200]; 00811 struct SlTimeval_t timeval; 00812 timeval.tv_sec = 0; // Seconds 00813 timeval.tv_usec = 20000; // Microseconds. 10000 microseconds resolution 00814 00815 sl_WlanRxStatStart(); // set statistics mode 00816 00817 rawSocket = sl_Socket(SL_AF_RF, SL_SOCK_RAW, eChannel); 00818 // set timeout - in case we have no activity for the specified channel 00819 sl_SetSockOpt(rawSocket,SL_SOL_SOCKET,SL_SO_RCVTIMEO, &timeval, sizeof(timeval)); // Enable receive timeout 00820 status = sl_Recv(rawSocket, DataFrame, sizeof(DataFrame), 0); 00821 00822 Sleep(1000); // sleep for 1 sec 00823 sl_WlanRxStatGet(&rxStat,0); // statistics has been cleared upon read 00824 Sleep(1000); // sleep for 1 sec 00825 sl_WlanRxStatGet(&rxStat,0); 00826 00827 } 00828 \endcode 00829 */ 00830 #if _SL_INCLUDE_FUNC(sl_WlanRxStatStart) 00831 _i16 sl_WlanRxStatStart(void); 00832 #endif 00833 00834 00835 /*! 00836 \brief Stop collecting wlan RX statistic, (if previous called sl_WlanRxStatStart) 00837 00838 \return On success, zero is returned. On error, -1 is returned 00839 00840 \sa sl_WlanRxStatStart sl_WlanRxStatGet 00841 \note belongs to \ref ext_api 00842 \warning 00843 */ 00844 #if _SL_INCLUDE_FUNC(sl_WlanRxStatStop) 00845 _i16 sl_WlanRxStatStop(void); 00846 #endif 00847 00848 00849 /*! 00850 \brief Get wlan RX statistics. upon calling this command, the statistics counters will be cleared. 00851 00852 \param[in] Flags should be 0 ( not applicable right now, will be added the future ) 00853 \param[in] pRxStat a pointer to SlGetRxStatResponse_t filled with Rx statistics results 00854 \return On success, zero is returned. On error, -1 is returned 00855 00856 \sa sl_WlanRxStatStart sl_WlanRxStatStop 00857 \note belongs to \ref ext_api 00858 \warning 00859 */ 00860 #if _SL_INCLUDE_FUNC(sl_WlanRxStatGet) 00861 _i16 sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat,const _u32 Flags); 00862 #endif 00863 00864 00865 /*! 00866 \brief Stop Smart Config procedure. Once Smart Config will be stopped, 00867 Asynchronous event will be received - SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE. 00868 00869 \param[in] none 00870 \param[out] none 00871 00872 \return 0 - if Stop Smart Config is about to be executed without errors. 00873 00874 \sa sl_WlanSmartConfigStart 00875 \note belongs to \ref ext_api 00876 \warning 00877 00878 */ 00879 #if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStop) 00880 _i16 sl_WlanSmartConfigStop(void); 00881 #endif 00882 00883 /*! 00884 \brief Start Smart Config procedure 00885 \par 00886 The target of the procedure is to let the \n 00887 device to gain the network parameters: SSID and Password (if network is secured) \n 00888 and to connect to it once located in the network range. \n 00889 An external application should be used on a device connected to any mobile network. \n 00890 The external application will transmit over the air the network parameters in secured manner.\n 00891 The Password may be decrypted using a Key. \n 00892 The decryption method may be decided in the command or embedded in the Flash. \n 00893 The procedure can be activated for 1-3 group ID in the range of BIT_0 - BIT_15 where the default group ID id 0 (BIT_0) \n 00894 Once Smart Config has ended successfully, Asynchronous event will be received - \n 00895 SL_OPCODE_WLAN_SMART_CONFIG_START_ASYNC_RESPONSE. \n 00896 The Event will hold the SSID and an extra field that might have been delivered as well (i.e. - device name) 00897 00898 \param[in] groupIdBitmask - each bit represent a group ID that should be searched. 00899 The Default group ID id BIT_0. 2 more group can be searched 00900 in addition. The range is BIT_0 - BIT_15. 00901 \param[in] chiper - 0: check in flash, 1 - AES, 0xFF - do not check in flash 00902 \param[in] publicKeyLen - public key len (used for the default group ID - BIT_0) 00903 \param[in] group1KeyLen - group ID1 length 00904 \param[in] group2KeyLen - group ID2 length 00905 \param[in] publicKey - public key (used for the default group ID - BIT_0) 00906 \param[in] group1Key - group ID1 key 00907 \param[in] group2Key - group ID2 key 00908 00909 \param[out] none 00910 00911 \return 0 - if Smart Config started successfully. 00912 00913 \sa sl_WlanSmartConfigStop 00914 \note belongs to \ref ext_api 00915 \warning 00916 \par 00917 \code An example of starting smart Config on group ID's 0 + 1 + 2 00918 00919 sl_WlanSmartConfigStart(7, //group ID's (BIT_0 | BIT_1 | BIT_2) 00920 1, //decrypt key by AES method 00921 16, //decryption key length for group ID0 00922 16, //decryption key length for group ID1 00923 16, //decryption key length for group ID2 00924 "Key0Key0Key0Key0", //decryption key for group ID0 00925 "Key1Key1Key1Key1", //decryption key for group ID1 00926 "Key2Key2Key2Key2" //decryption key for group ID2 00927 ); 00928 \endcode 00929 */ 00930 #if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStart) 00931 _i16 sl_WlanSmartConfigStart(const _u32 groupIdBitmask, 00932 const _u8 cipher, 00933 const _u8 publicKeyLen, 00934 const _u8 group1KeyLen, 00935 const _u8 group2KeyLen, 00936 const _u8* publicKey, 00937 const _u8* group1Key, 00938 const _u8* group2Key); 00939 #endif 00940 00941 00942 /*! 00943 \brief Wlan set mode 00944 00945 Setting WLAN mode 00946 00947 \param[in] mode - WLAN mode to start the CC31xx device. Possible options are: 00948 - ROLE_STA - for WLAN station mode 00949 - ROLE_AP - for WLAN AP mode 00950 - ROLE_P2P -for WLAN P2P mode 00951 \return 0 - if mode was set correctly 00952 \sa sl_Start sl_Stop 00953 \note belongs to \ref ext_api 00954 \warning After setting the mode the system must be restarted for activating the new mode 00955 \par Example: 00956 \code 00957 //Switch from any role to STA: 00958 sl_WlanSetMode(ROLE_STA); 00959 sl_Stop(0); 00960 sl_Start(NULL,NULL,NULL); 00961 \endcode 00962 00963 */ 00964 #if _SL_INCLUDE_FUNC(sl_WlanSetMode) 00965 _i16 sl_WlanSetMode(const _u8 mode); 00966 #endif 00967 00968 00969 /*! 00970 \brief Internal function for setting WLAN configurations 00971 00972 \return On success, zero is returned. On error one of the following error codes returned: 00973 - CONF_ERROR (-1) 00974 - CONF_NVMEM_ACCESS_FAILED (-2) 00975 - CONF_OLD_FILE_VERSION (-3) 00976 - CONF_ERROR_NO_SUCH_COUNTRY_CODE (-4) 00977 00978 00979 \param[in] ConfigId - configuration id 00980 - <b>SL_WLAN_CFG_AP_ID</b> 00981 - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b> 00982 - <b>SL_WLAN_CFG_P2P_PARAM_ID</b> 00983 00984 \param[in] ConfigOpt - configurations option 00985 - <b>SL_WLAN_CFG_AP_ID</b> 00986 - <b>WLAN_AP_OPT_SSID</b> \n 00987 Set SSID for AP mode. \n 00988 This options takes <b>_u8</b> buffer as parameter 00989 - <b>WLAN_AP_OPT_CHANNEL</b> \n 00990 Set channel for AP mode. \n 00991 The channel is dependant on the country code which is set. i.e. for "US" the channel should be in the range of [1-11] \n 00992 This option takes <b>_u8</b> as a parameter 00993 - <b>WLAN_AP_OPT_HIDDEN_SSID</b> \n 00994 Set Hidden SSID Mode for AP mode.Hidden options: \n 00995 0: disabled \n 00996 1: Send empty (length=0) SSID in beacon and ignore probe request for broadcast SSID \n 00997 2: Clear SSID (ASCII 0), but keep the original length (this may be required with some \n 00998 clients that do not support empty SSID) and ignore probe requests for broadcast SSID \n 00999 This option takes <b>_u8</b> as a parameter 01000 - <b>WLAN_AP_OPT_SECURITY_TYPE</b> \n 01001 Set Security type for AP mode. Security options are: 01002 - Open security: SL_SEC_TYPE_OPEN 01003 - WEP security: SL_SEC_TYPE_WEP 01004 - WPA security: SL_SEC_TYPE_WPA_WPA2 \n 01005 This option takes <b>_u8</b> pointer as a parameter 01006 - <b>WLAN_AP_OPT_PASSWORD</b> \n 01007 Set Password for for AP mode (for WEP or for WPA): \n 01008 Password - for WPA: 8 - 63 characters \n 01009 for WEP: 5 / 13 characters (ascii) \n 01010 This options takes <b>_u8</b> buffer as parameter 01011 - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b> 01012 - <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS </b> \n 01013 Set scan parameters. 01014 This option uses slWlanScanParamCommand_t as parameter 01015 - <b>WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE</b> \n 01016 Set Country Code for AP mode \n 01017 This options takes <b>_u8</b> 2 bytes buffer as parameter 01018 - <b>WLAN_GENERAL_PARAM_OPT_STA_TX_POWER</b> \n 01019 Set STA mode Tx power level \n 01020 Number between 0-15, as dB offset from max power (0 will set MAX power) \n 01021 This options takes <b>_u8</b> as parameter 01022 - <b>WLAN_GENERAL_PARAM_OPT_AP_TX_POWER</b> 01023 Set AP mode Tx power level \n 01024 Number between 0-15, as dB offset from max power (0 will set MAX power) \n 01025 This options takes <b>_u8</b> as parameter 01026 - <b>WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT</b> 01027 Set Info Element for AP mode. \n 01028 The Application can set up to MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED info elements per Role (AP / P2P GO). \n 01029 To delete an info element use the relevant index and length = 0. \n 01030 The Application can set up to MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED to the same role. \n 01031 However, for AP - no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_AP bytes can be stored for all info elements. \n 01032 For P2P GO - no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO bytes can be stored for all info elements. \n 01033 This option takes sl_protocol_WlanSetInfoElement_t as parameter 01034 - <b>SL_WLAN_CFG_P2P_PARAM_ID</b> 01035 - <b>WLAN_P2P_OPT_DEV_TYPE</b> \n 01036 Set P2P Device type.Maximum length of 17 characters. Device type is published under P2P I.E, \n 01037 allows to make devices easier to recognize. \n 01038 In case no device type is set, the default type is "1-0050F204-1" \n 01039 This options takes <b>_u8</b> buffer as parameter 01040 - <b>WLAN_P2P_OPT_CHANNEL_N_REGS</b> \n 01041 Set P2P Channels. \n 01042 listen channel (either 1/6/11 for 2.4GHz) \n 01043 listen regulatory class (81 for 2.4GHz) \n 01044 oper channel (either 1/6/11 for 2.4GHz) \n 01045 oper regulatory class (81 for 2.4GHz) \n 01046 listen channel and regulatory class will determine the device listen channel during p2p find listen phase \n 01047 oper channel and regulatory class will determine the operating channel preferred by this device (in case it is group owner this will be the operating channel) \n 01048 channels should be one of the social channels (1/6/11). In case no listen/oper channel selected, a random 1/6/11 will be selected. 01049 This option takes pointer to <b>_u8[4]</b> as parameter 01050 01051 \param[in] ConfigLen - configurations len 01052 01053 \param[in] pValues - configurations values 01054 01055 \sa 01056 \note 01057 \warning 01058 \par Examples: 01059 \par 01060 <b> WLAN_AP_OPT_SSID: </b> 01061 \code 01062 _u8 str[33]; 01063 memset(str, 0, 33); 01064 memcpy(str, ssid, len); // ssid string of 32 characters 01065 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid), str); 01066 \endcode 01067 \par 01068 <b> WLAN_AP_OPT_CHANNEL: </b> 01069 \code 01070 _u8 val = channel; 01071 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, (_u8 *)&val); 01072 \endcode 01073 \par 01074 <b> WLAN_AP_OPT_HIDDEN_SSID: </b> 01075 \code 01076 _u8 val = hidden; 01077 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_HIDDEN_SSID, 1, (_u8 *)&val); 01078 \endcode 01079 \par 01080 <b> WLAN_AP_OPT_SECURITY_TYPE: </b> 01081 \code 01082 _u8 val = SL_SEC_TYPE_WPA_WPA2; 01083 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (_u8 *)&val); 01084 \endcode 01085 \par 01086 <b> WLAN_AP_OPT_PASSWORD: </b> 01087 \code 01088 _u8 str[65]; 01089 _u16 len = strlen(password); 01090 memset(str, 0, 65); 01091 memcpy(str, password, len); 01092 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, len, (_u8 *)str); 01093 \endcode 01094 \par 01095 <b> WLAN_GENERAL_PARAM_OPT_STA_TX_POWER: </b> 01096 \code 01097 _u8 stapower=(_u8)power; 01098 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER,1,(_u8 *)&stapower); 01099 \endcode 01100 \par 01101 <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS: </b> 01102 \code 01103 slWlanScanParamCommand_t ScanParamConfig; 01104 ScanParamConfig.G_Channels_mask = 0x01; // bit mask for channels:1 means channel 1 is enabled, 3 means channels 1 + 2 are enabled 01105 ScanParamConfig.rssiThershold = -70; // only for RSSI level which is higher than -70 01106 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID ,WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS,sizeof(slWlanScanParamCommand_t),(_u8*)&ScanParamConfig); 01107 \endcode 01108 01109 \par 01110 <b> WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE: </b> 01111 \code 01112 _u8* str = (_u8 *) country; // string of 2 characters. i.e. - "US" 01113 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2, str); 01114 \endcode 01115 \par 01116 <b> WLAN_GENERAL_PARAM_OPT_AP_TX_POWER: </b> 01117 \code 01118 _u8 appower=(_u8)power; 01119 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_AP_TX_POWER,1,(_u8 *)&appower); 01120 \endcode 01121 \par 01122 <b> WLAN_P2P_OPT_DEV_TYPE: </b> 01123 \code 01124 _u8 str[17]; 01125 _u16 len = strlen(device_type); 01126 memset(str, 0, 17); 01127 memcpy(str, device_type, len); 01128 sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_DEV_TYPE, len, str); 01129 \endcode 01130 \par 01131 <b> WLAN_P2P_OPT_CHANNEL_N_REGS: </b> 01132 \code 01133 _u8 str[4]; 01134 str[0] = (_u8)11; // listen channel 01135 str[1] = (_u8)81; // listen regulatory class 01136 str[2] = (_u8)6; // oper channel 01137 str[3] = (_u8)81; // oper regulatory class 01138 sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_CHANNEL_N_REGS, 4, str); 01139 \endcode 01140 \par 01141 <b> WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT: </b> 01142 \code 01143 sl_protocol_WlanSetInfoElement_t infoele; 01144 infoele.index = Index; // Index of the info element. range: 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED 01145 infoele.role = Role; // INFO_ELEMENT_AP_ROLE (0) or INFO_ELEMENT_P2P_GO_ROLE (1) 01146 infoele.ie.id = Id; // Info element ID. if INFO_ELEMENT_DEFAULT_ID (0) is set, ID will be set to 221. 01147 // Organization unique ID. If all 3 bytes are zero - it will be replaced with 08,00,28. 01148 infoele.ie.oui[0] = Oui0; // Organization unique ID first Byte 01149 infoele.ie.oui[1] = Oui1; // Organization unique ID second Byte 01150 infoele.ie.oui[2] = Oui2; // Organization unique ID third Byte 01151 infoele.ie.length = Len; // Length of the info element. must be smaller than 253 bytes 01152 memset(infoele.ie.data, 0, INFO_ELEMENT_MAX_SIZE); 01153 if ( Len <= INFO_ELEMENT_MAX_SIZE ) 01154 { 01155 memcpy(infoele.ie.data, IE, Len); // Info element. length of the info element is [0-252] 01156 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(_u8* ) &infoele); 01157 } 01158 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(_u8* ) &infoele); 01159 \endcode 01160 01161 */ 01162 #if _SL_INCLUDE_FUNC(sl_WlanSet) 01163 _i16 sl_WlanSet(const _u16 ConfigId ,const _u16 ConfigOpt,const _u16 ConfigLen,const _u8 *pValues); 01164 #endif 01165 01166 /*! 01167 \brief Internal function for getting WLAN configurations 01168 01169 \return On success, zero is returned. On error, -1 is 01170 returned 01171 01172 \param[in] ConfigId - configuration id 01173 - <b>SL_WLAN_CFG_AP_ID</b> 01174 - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b> 01175 - <b>SL_WLAN_CFG_P2P_PARAM_ID</b> 01176 01177 \param[out] pConfigOpt - get configurations option 01178 - <b>SL_WLAN_CFG_AP_ID</b> 01179 - <b>WLAN_AP_OPT_SSID</b> \n 01180 Get SSID for AP mode. \n 01181 Get up to 32 characters of SSID \n 01182 This options takes <b>_u8</b> as parameter 01183 - <b>WLAN_AP_OPT_CHANNEL</b> \n 01184 Get channel for AP mode. \n 01185 This option takes <b>_u8</b> as a parameter 01186 - <b>WLAN_AP_OPT_HIDDEN_SSID</b> \n 01187 Get Hidden SSID Mode for AP mode.Hidden options: \n 01188 0: disabled \n 01189 1: Send empty (length=0) SSID in beacon and ignore probe request for broadcast SSID \n 01190 2: Clear SSID (ASCII 0), but keep the original length (this may be required with some \n 01191 clients that do not support empty SSID) and ignore probe requests for broadcast SSID \n 01192 This option takes <b>_u8</b> as a parameter 01193 - <b>WLAN_AP_OPT_SECURITY_TYPE</b> \n 01194 Get Security type for AP mode. Security options are: 01195 - Open security: SL_SEC_TYPE_OPEN 01196 - WEP security: SL_SEC_TYPE_WEP 01197 - WPA security: SL_SEC_TYPE_WPA_WPA2 \n 01198 This option takes <b>_u8</b> as a parameter 01199 - <b>WLAN_AP_OPT_PASSWORD</b> \n 01200 Get Password for for AP mode (for WEP or for WPA): \n 01201 Returns password - string, fills up to 64 characters. \n 01202 This options takes <b>_u8</b> buffer as parameter 01203 - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b> 01204 - <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS </b> \n 01205 Get scan parameters. 01206 This option uses slWlanScanParamCommand_t as parameter 01207 - <b>WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE</b> \n 01208 Get Country Code for AP mode \n 01209 This options takes <b>_u8</b> buffer as parameter 01210 - <b>WLAN_GENERAL_PARAM_OPT_STA_TX_POWER</b> \n 01211 Get STA mode Tx power level \n 01212 Number between 0-15, as dB offset from max power (0 indicates MAX power) \n 01213 This options takes <b>_u8</b> as parameter 01214 - <b>WLAN_GENERAL_PARAM_OPT_AP_TX_POWER</b> 01215 Get AP mode Tx power level \n 01216 Number between 0-15, as dB offset from max power (0 indicates MAX power) \n 01217 This options takes <b>_u8</b> as parameter 01218 - <b>SL_WLAN_CFG_P2P_PARAM_ID</b> 01219 - <b>WLAN_P2P_OPT_CHANNEL_N_REGS</b> \n 01220 Get P2P Channels. \n 01221 listen channel (either 1/6/11 for 2.4GHz) \n 01222 listen regulatory class (81 for 2.4GHz) \n 01223 oper channel (either 1/6/11 for 2.4GHz) \n 01224 oper regulatory class (81 for 2.4GHz) \n 01225 listen channel and regulatory class will determine the device listen channel during p2p find listen phase \n 01226 oper channel and regulatory class will determine the operating channel preferred by this device (in case it is group owner this will be the operating channel) \n 01227 channels should be one of the social channels (1/6/11). In case no listen/oper channel selected, a random 1/6/11 will be selected. \n 01228 This option takes pointer to <b>_u8[4]</b> as parameter 01229 01230 \param[out] pConfigLen - The length of the allocated memory as input, when the 01231 function complete, the value of this parameter would be 01232 the len that actually read from the device. 01233 If the device return length that is longer from the input 01234 value, the function will cut the end of the returned structure 01235 and will return SL_ESMALLBUF. 01236 01237 01238 \param[out] pValues - get configurations values 01239 01240 \sa sl_WlanSet 01241 01242 \note 01243 01244 \warning 01245 01246 \par Examples: 01247 \par 01248 <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS: </b> 01249 \code 01250 slWlanScanParamCommand_t ScanParamConfig; 01251 _u16 Option = WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS; 01252 _u16 OptionLen = sizeof(slWlanScanParamCommand_t); 01253 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&ScanParamConfig); 01254 \endcode 01255 \par 01256 <b> WLAN_GENERAL_PARAM_OPT_AP_TX_POWER: </b> 01257 \code 01258 _i8 TXPower = 0; 01259 _u16 Option = WLAN_GENERAL_PARAM_OPT_AP_TX_POWER; 01260 _u16 OptionLen = sizeof(_i8); 01261 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower); 01262 \endcode 01263 \par 01264 <b> WLAN_GENERAL_PARAM_OPT_STA_TX_POWER: </b> 01265 \code 01266 _i8 TXPower = 0; 01267 _u16 Option = WLAN_GENERAL_PARAM_OPT_STA_TX_POWER; 01268 _u16 OptionLen = sizeof(_i8); 01269 01270 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower); 01271 \endcode 01272 \par 01273 <b> WLAN_P2P_OPT_DEV_TYPE: </b> 01274 \code 01275 _i8 device_type[18]; 01276 _u16 len = 18; 01277 _u16 config_opt = WLAN_P2P_OPT_DEV_TYPE; 01278 sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt , &len, (_u8* )device_type); 01279 \endcode 01280 \par 01281 <b> WLAN_AP_OPT_SSID: </b> 01282 \code 01283 _i8 ssid[32]; 01284 _u16 len = 32; 01285 _u16 config_opt = WLAN_AP_OPT_SSID; 01286 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt , &len, (_u8* )ssid); 01287 \endcode 01288 \par 01289 <b> WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE: </b> 01290 \code 01291 _i8 country[3]; 01292 _u16 len = 3; 01293 _u16 config_opt = WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE; 01294 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID, &config_opt, &len, (_u8* )country); 01295 \endcode 01296 \par 01297 <b> WLAN_AP_OPT_CHANNEL: </b> 01298 \code 01299 _i8 channel; 01300 _u16 len = 1; 01301 _u16 config_opt = WLAN_AP_OPT_CHANNEL; 01302 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )&channel); 01303 \endcode 01304 \par 01305 <b> WLAN_AP_OPT_HIDDEN_SSID: </b> 01306 \code 01307 _u8 hidden; 01308 _u16 len = 1; 01309 _u16 config_opt = WLAN_AP_OPT_HIDDEN_SSID; 01310 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )&hidden); 01311 \endcode 01312 \par 01313 <b> WLAN_AP_OPT_SECURITY_TYPE: </b> 01314 \code 01315 _u8 sec_type; 01316 _u16 len = 1; 01317 _u16 config_opt = WLAN_AP_OPT_SECURITY_TYPE; 01318 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )&sec_type); 01319 \endcode 01320 \par 01321 <b> WLAN_AP_OPT_PASSWORD: </b> 01322 \code 01323 _u8 password[64]; 01324 _u16 len = 64; 01325 memset(password,0,64); 01326 _u16 config_opt = WLAN_AP_OPT_PASSWORD; 01327 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )password); 01328 01329 \endcode 01330 \par 01331 <b> WLAN_P2P_OPT_CHANNEL_N_REGS: </b> 01332 \code 01333 _u16 listen_channel,listen_reg,oper_channel,oper_reg; 01334 _u16 len = 4; 01335 _u16 config_opt = WLAN_P2P_OPT_CHANNEL_N_REGS; 01336 _u8 channel_n_regs[4]; 01337 sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt, &len, (_u8* )channel_n_regs); 01338 listen_channel = channel_n_regs[0]; 01339 listen_reg = channel_n_regs[1]; 01340 oper_channel = channel_n_regs[2]; 01341 oper_reg = channel_n_regs[3]; 01342 \endcode 01343 */ 01344 01345 #if _SL_INCLUDE_FUNC(sl_WlanGet) 01346 _i16 sl_WlanGet(const _u16 ConfigId, _u16 *pConfigOpt,_u16 *pConfigLen, _u8 *pValues); 01347 #endif 01348 /*! 01349 01350 Close the Doxygen group. 01351 @} 01352 01353 */ 01354 01355 01356 #ifdef __cplusplus 01357 } 01358 #endif /* __cplusplus */ 01359 01360 #endif /* __WLAN_H__ */ 01361
Generated on Tue Jul 12 2022 12:06:50 by 1.7.2