Update revision to use TI's mqtt and Freertos.

Dependencies:   mbed client server

Fork of cc3100_Test_mqtt_CM3 by David Fletcher

Committer:
dflet
Date:
Thu Sep 03 14:02:37 2015 +0000
Revision:
3:a8c249046181
SPI Mode change 1 to 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 3:a8c249046181 1 /*
dflet 3:a8c249046181 2 * wlan.h - CC31xx/CC32xx Host Driver Implementation
dflet 3:a8c249046181 3 *
dflet 3:a8c249046181 4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
dflet 3:a8c249046181 5 *
dflet 3:a8c249046181 6 *
dflet 3:a8c249046181 7 * Redistribution and use in source and binary forms, with or without
dflet 3:a8c249046181 8 * modification, are permitted provided that the following conditions
dflet 3:a8c249046181 9 * are met:
dflet 3:a8c249046181 10 *
dflet 3:a8c249046181 11 * Redistributions of source code must retain the above copyright
dflet 3:a8c249046181 12 * notice, this list of conditions and the following disclaimer.
dflet 3:a8c249046181 13 *
dflet 3:a8c249046181 14 * Redistributions in binary form must reproduce the above copyright
dflet 3:a8c249046181 15 * notice, this list of conditions and the following disclaimer in the
dflet 3:a8c249046181 16 * documentation and/or other materials provided with the
dflet 3:a8c249046181 17 * distribution.
dflet 3:a8c249046181 18 *
dflet 3:a8c249046181 19 * Neither the name of Texas Instruments Incorporated nor the names of
dflet 3:a8c249046181 20 * its contributors may be used to endorse or promote products derived
dflet 3:a8c249046181 21 * from this software without specific prior written permission.
dflet 3:a8c249046181 22 *
dflet 3:a8c249046181 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dflet 3:a8c249046181 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dflet 3:a8c249046181 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
dflet 3:a8c249046181 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
dflet 3:a8c249046181 27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dflet 3:a8c249046181 28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dflet 3:a8c249046181 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
dflet 3:a8c249046181 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
dflet 3:a8c249046181 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
dflet 3:a8c249046181 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
dflet 3:a8c249046181 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dflet 3:a8c249046181 34 *
dflet 3:a8c249046181 35 */
dflet 3:a8c249046181 36
dflet 3:a8c249046181 37 /*****************************************************************************/
dflet 3:a8c249046181 38 /* Include files */
dflet 3:a8c249046181 39 /*****************************************************************************/
dflet 3:a8c249046181 40 #include "cc3100_simplelink.h"
dflet 3:a8c249046181 41
dflet 3:a8c249046181 42 #ifndef WLAN_H_
dflet 3:a8c249046181 43 #define WLAN_H_
dflet 3:a8c249046181 44
dflet 3:a8c249046181 45 namespace mbed_cc3100 {
dflet 3:a8c249046181 46
dflet 3:a8c249046181 47 /*****************************************************************************/
dflet 3:a8c249046181 48 /* Macro declarations */
dflet 3:a8c249046181 49 /*****************************************************************************/
dflet 3:a8c249046181 50
dflet 3:a8c249046181 51 /*!
dflet 3:a8c249046181 52
dflet 3:a8c249046181 53 \addtogroup wlan
dflet 3:a8c249046181 54 @{
dflet 3:a8c249046181 55
dflet 3:a8c249046181 56 */
dflet 3:a8c249046181 57
dflet 3:a8c249046181 58 const uint8_t SL_BSSID_LENGTH = (6);
dflet 3:a8c249046181 59 const uint8_t MAXIMAL_SSID_LENGTH = (32);
dflet 3:a8c249046181 60
dflet 3:a8c249046181 61 const uint8_t NUM_OF_RATE_INDEXES = (20);
dflet 3:a8c249046181 62 const uint8_t SIZE_OF_RSSI_HISTOGRAM = (6);
dflet 3:a8c249046181 63
dflet 3:a8c249046181 64 /* WLAN Disconnect Reason Codes */
dflet 3:a8c249046181 65 const uint8_t SL_DISCONNECT_RESERVED_0 = (0);
dflet 3:a8c249046181 66 const uint8_t SL_DISCONNECT_UNSPECIFIED_REASON = (1);
dflet 3:a8c249046181 67 const uint8_t SL_PREVIOUS_AUTHENTICATION_NO_LONGER_VALID = (2);
dflet 3:a8c249046181 68 const uint8_t SL_DEAUTHENTICATED_BECAUSE_SENDING_STATION_IS_LEAVING = (3);
dflet 3:a8c249046181 69 const uint8_t SL_DISASSOCIATED_DUE_TO_INACTIVITY = (4);
dflet 3:a8c249046181 70 const uint8_t SL_DISASSOCIATED_BECAUSE_AP_IS_UNABLE_TO_HANDLE_ALL_CURRENTLY_ASSOCIATED_STATIONS = (5);
dflet 3:a8c249046181 71 const uint8_t SL_CLASS_2_FRAME_RECEIVED_FROM_NONAUTHENTICATED_STATION = (6);
dflet 3:a8c249046181 72 const uint8_t SL_CLASS_3_FRAME_RECEIVED_FROM_NONASSOCIATED_STATION = (7);
dflet 3:a8c249046181 73 const uint8_t SL_DISASSOCIATED_BECAUSE_SENDING_STATION_IS_LEAVING_BSS = (8);
dflet 3:a8c249046181 74 const uint8_t SL_STATION_REQUESTING_ASSOCIATION_IS_NOT_AUTHENTICATED_WITH_RESPONDING_STATION = (9);
dflet 3:a8c249046181 75 const uint8_t SL_DISASSOCIATED_BECAUSE_THE_INFORMATION_IN_THE_POWER_CAPABILITY_ELEMENT_IS_UNACCEPTABLE = (10);
dflet 3:a8c249046181 76 const uint8_t SL_DISASSOCIATED_BECAUSE_THE_INFORMATION_IN_THE_SUPPORTED_CHANNELS_ELEMENT_IS_UNACCEPTABLE = (11);
dflet 3:a8c249046181 77 const uint8_t SL_DISCONNECT_RESERVED_1 = (12);
dflet 3:a8c249046181 78 const uint8_t SL_INVALID_INFORMATION_ELEMENT = (13);
dflet 3:a8c249046181 79 const uint8_t SL_MESSAGE_INTEGRITY_CODE_MIC_FAILURE = (14);
dflet 3:a8c249046181 80 const uint8_t SL_FOUR_WAY_HANDSHAKE_TIMEOUT = (15);
dflet 3:a8c249046181 81 const uint8_t SL_GROUP_KEY_HANDSHAKE_TIMEOUT = (16);
dflet 3:a8c249046181 82 const uint8_t SL_RE_ASSOCIATION_REQUEST_PROBE_RESPONSE_BEACON_FRAME = (17);
dflet 3:a8c249046181 83 const uint8_t SL_INVALID_GROUP_CIPHER = (18);
dflet 3:a8c249046181 84 const uint8_t SL_INVALID_PAIRWISE_CIPHER = (19);
dflet 3:a8c249046181 85 const uint8_t SL_INVALID_AKMP = (20);
dflet 3:a8c249046181 86 const uint8_t SL_UNSUPPORTED_RSN_INFORMATION_ELEMENT_VERSION = (21);
dflet 3:a8c249046181 87 const uint8_t SL_INVALID_RSN_INFORMATION_ELEMENT_CAPABILITIES = (22);
dflet 3:a8c249046181 88 const uint8_t SL_IEEE_802_1X_AUTHENTICATION_FAILED = (23);
dflet 3:a8c249046181 89 const uint8_t SL_CIPHER_SUITE_REJECTED_BECAUSE_OF_THE_SECURITY_POLICY = (24);
dflet 3:a8c249046181 90 const uint8_t SL_DISCONNECT_RESERVED_2 = (25);
dflet 3:a8c249046181 91 const uint8_t SL_DISCONNECT_RESERVED_3 = (26);
dflet 3:a8c249046181 92 const uint8_t SL_DISCONNECT_RESERVED_4 = (27);
dflet 3:a8c249046181 93 const uint8_t SL_DISCONNECT_RESERVED_5 = (28);
dflet 3:a8c249046181 94 const uint8_t SL_DISCONNECT_RESERVED_6 = (29);
dflet 3:a8c249046181 95 const uint8_t SL_DISCONNECT_RESERVED_7 = (30);
dflet 3:a8c249046181 96 const uint8_t SL_DISCONNECT_RESERVED_8 = (31);
dflet 3:a8c249046181 97 const uint8_t SL_USER_INITIATED_DISCONNECTION = (200);
dflet 3:a8c249046181 98
dflet 3:a8c249046181 99 /* Wlan error codes */
dflet 3:a8c249046181 100 const int8_t SL_ERROR_KEY_ERROR = (-3);
dflet 3:a8c249046181 101 const int8_t SL_ERROR_INVALID_ROLE = (-71);
dflet 3:a8c249046181 102 const int8_t SL_ERROR_INVALID_SECURITY_TYPE = (-84);
dflet 3:a8c249046181 103 const int8_t SL_ERROR_PASSPHRASE_TOO_LONG = (-85);
dflet 3:a8c249046181 104 const int8_t SL_ERROR_WPS_NO_PIN_OR_WRONG_PIN_LEN = (-87);
dflet 3:a8c249046181 105 const int8_t SL_ERROR_EAP_WRONG_METHOD = (-88);
dflet 3:a8c249046181 106 const int8_t SL_ERROR_PASSWORD_ERROR = (-89);
dflet 3:a8c249046181 107 const int8_t SL_ERROR_EAP_ANONYMOUS_LEN_ERROR = (-90);
dflet 3:a8c249046181 108 const int8_t SL_ERROR_SSID_LEN_ERROR = (-91);
dflet 3:a8c249046181 109 const int8_t SL_ERROR_USER_ID_LEN_ERROR = (-92);
dflet 3:a8c249046181 110 const int8_t SL_ERROR_ILLEGAL_WEP_KEY_INDEX = (-95);
dflet 3:a8c249046181 111 const int8_t SL_ERROR_INVALID_DWELL_TIME_VALUES = (-96);
dflet 3:a8c249046181 112 const int8_t SL_ERROR_INVALID_POLICY_TYPE = (-97);
dflet 3:a8c249046181 113 const int8_t SL_ERROR_PM_POLICY_INVALID_OPTION = (-98);
dflet 3:a8c249046181 114 const int8_t SL_ERROR_PM_POLICY_INVALID_PARAMS = (-99);
dflet 3:a8c249046181 115 const int16_t SL_ERROR_WIFI_ALREADY_DISCONNECTED = (-129);
dflet 3:a8c249046181 116 const int8_t SL_ERROR_WIFI_NOT_CONNECTED = (-59);
dflet 3:a8c249046181 117
dflet 3:a8c249046181 118
dflet 3:a8c249046181 119
dflet 3:a8c249046181 120 const uint8_t SL_SEC_TYPE_OPEN = (0);
dflet 3:a8c249046181 121 const uint8_t SL_SEC_TYPE_WEP = (1);
dflet 3:a8c249046181 122 const uint8_t SL_SEC_TYPE_WPA = (2); /* deprecated */
dflet 3:a8c249046181 123 const uint8_t SL_SEC_TYPE_WPA_WPA2 = (2);
dflet 3:a8c249046181 124 const uint8_t SL_SEC_TYPE_WPS_PBC = (3);
dflet 3:a8c249046181 125 const uint8_t SL_SEC_TYPE_WPS_PIN = (4);
dflet 3:a8c249046181 126 const uint8_t SL_SEC_TYPE_WPA_ENT = (5);
dflet 3:a8c249046181 127 const uint8_t SL_SEC_TYPE_P2P_PBC = (6);
dflet 3:a8c249046181 128 const uint8_t SL_SEC_TYPE_P2P_PIN_KEYPAD = (7);
dflet 3:a8c249046181 129 const uint8_t SL_SEC_TYPE_P2P_PIN_DISPLAY = (8);
dflet 3:a8c249046181 130 const uint8_t SL_SEC_TYPE_P2P_PIN_AUTO = (9); /* NOT Supported yet */
dflet 3:a8c249046181 131
dflet 3:a8c249046181 132
dflet 3:a8c249046181 133
dflet 3:a8c249046181 134 const uint8_t SL_SCAN_SEC_TYPE_OPEN = (0);
dflet 3:a8c249046181 135 const uint8_t SL_SCAN_SEC_TYPE_WEP = (1);
dflet 3:a8c249046181 136 const uint8_t SL_SCAN_SEC_TYPE_WPA = (2);
dflet 3:a8c249046181 137 const uint8_t SL_SCAN_SEC_TYPE_WPA2 = (3);
dflet 3:a8c249046181 138
dflet 3:a8c249046181 139
dflet 3:a8c249046181 140
dflet 3:a8c249046181 141 const uint8_t TLS = (0x1);
dflet 3:a8c249046181 142 const uint8_t MSCHAP = (0x0);
dflet 3:a8c249046181 143 const uint8_t PSK = (0x2);
dflet 3:a8c249046181 144 const uint8_t TTLS = (0x10);
dflet 3:a8c249046181 145 const uint8_t PEAP0 = (0x20);
dflet 3:a8c249046181 146 const uint8_t PEAP1 = (0x40);
dflet 3:a8c249046181 147 const uint8_t FAST = (0x80);
dflet 3:a8c249046181 148
dflet 3:a8c249046181 149 const uint8_t FAST_AUTH_PROVISIONING = (0x02);
dflet 3:a8c249046181 150 const uint8_t FAST_UNAUTH_PROVISIONING = (0x01);
dflet 3:a8c249046181 151 const uint8_t FAST_NO_PROVISIONING = (0x00);
dflet 3:a8c249046181 152
dflet 3:a8c249046181 153 const uint8_t EAPMETHOD_PHASE2_SHIFT = (8);
dflet 3:a8c249046181 154 const uint8_t EAPMETHOD_PAIRWISE_CIPHER_SHIFT = (19);
dflet 3:a8c249046181 155 const uint8_t EAPMETHOD_GROUP_CIPHER_SHIFT = (27);
dflet 3:a8c249046181 156
dflet 3:a8c249046181 157 const uint8_t WPA_CIPHER_CCMP = (0x1);
dflet 3:a8c249046181 158 const uint8_t WPA_CIPHER_TKIP = (0x2);
dflet 3:a8c249046181 159 const uint8_t CC31XX_DEFAULT_CIPHER = (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP);
dflet 3:a8c249046181 160
dflet 3:a8c249046181 161 #define EAPMETHOD(phase1,phase2,pairwise_cipher,group_cipher) \
dflet 3:a8c249046181 162 ((phase1) | \
dflet 3:a8c249046181 163 ((phase2) << EAPMETHOD_PHASE2_SHIFT ) |\
dflet 3:a8c249046181 164 ((uint32_t)(pairwise_cipher) << EAPMETHOD_PAIRWISE_CIPHER_SHIFT ) |\
dflet 3:a8c249046181 165 ((uint32_t)(group_cipher) << EAPMETHOD_GROUP_CIPHER_SHIFT ))
dflet 3:a8c249046181 166
dflet 3:a8c249046181 167 /* phase1 phase2 pairwise_cipher group_cipher */
dflet 3:a8c249046181 168 #define SL_ENT_EAP_METHOD_TLS EAPMETHOD(TLS , 0 , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 169 #define SL_ENT_EAP_METHOD_TTLS_TLS EAPMETHOD(TTLS , TLS , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 170 #define SL_ENT_EAP_METHOD_TTLS_MSCHAPv2 EAPMETHOD(TTLS , MSCHAP , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 171 #define SL_ENT_EAP_METHOD_TTLS_PSK EAPMETHOD(TTLS , PSK , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 172 #define SL_ENT_EAP_METHOD_PEAP0_TLS EAPMETHOD(PEAP0 , TLS , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 173 #define SL_ENT_EAP_METHOD_PEAP0_MSCHAPv2 EAPMETHOD(PEAP0 , MSCHAP , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 174 #define SL_ENT_EAP_METHOD_PEAP0_PSK EAPMETHOD(PEAP0 , PSK , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 175 #define SL_ENT_EAP_METHOD_PEAP1_TLS EAPMETHOD(PEAP1 , TLS , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 176 #define SL_ENT_EAP_METHOD_PEAP1_MSCHAPv2 EAPMETHOD(PEAP1 , MSCHAP , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 177 #define SL_ENT_EAP_METHOD_PEAP1_PSK EAPMETHOD(PEAP1 , PSK , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 178 #define SL_ENT_EAP_METHOD_FAST_AUTH_PROVISIONING EAPMETHOD(FAST , FAST_AUTH_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 179 #define SL_ENT_EAP_METHOD_FAST_UNAUTH_PROVISIONING EAPMETHOD(FAST , FAST_UNAUTH_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 180 #define SL_ENT_EAP_METHOD_FAST_NO_PROVISIONING EAPMETHOD(FAST , FAST_NO_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
dflet 3:a8c249046181 181
dflet 3:a8c249046181 182 const uint8_t SL_LONG_PREAMBLE = (0);
dflet 3:a8c249046181 183 const uint8_t SL_SHORT_PREAMBLE = (1);
dflet 3:a8c249046181 184
dflet 3:a8c249046181 185 const uint8_t SL_RAW_RF_TX_PARAMS_CHANNEL_SHIFT = (0);
dflet 3:a8c249046181 186 const uint8_t SL_RAW_RF_TX_PARAMS_RATE_SHIFT = (6);
dflet 3:a8c249046181 187 const uint8_t SL_RAW_RF_TX_PARAMS_POWER_SHIFT = (11);
dflet 3:a8c249046181 188 const uint8_t SL_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT = (15);
dflet 3:a8c249046181 189
dflet 3:a8c249046181 190 #define SL_RAW_RF_TX_PARAMS(chan,rate,power,preamble) \
dflet 3:a8c249046181 191 ((chan << SL_RAW_RF_TX_PARAMS_CHANNEL_SHIFT) | \
dflet 3:a8c249046181 192 (rate << SL_RAW_RF_TX_PARAMS_RATE_SHIFT) | \
dflet 3:a8c249046181 193 (power << SL_RAW_RF_TX_PARAMS_POWER_SHIFT) | \
dflet 3:a8c249046181 194 (preamble << SL_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT))
dflet 3:a8c249046181 195
dflet 3:a8c249046181 196
dflet 3:a8c249046181 197 /* wlan config application IDs */
dflet 3:a8c249046181 198 const uint8_t SL_WLAN_CFG_AP_ID = (0);
dflet 3:a8c249046181 199 const uint8_t SL_WLAN_CFG_GENERAL_PARAM_ID = (1);
dflet 3:a8c249046181 200 const uint8_t SL_WLAN_CFG_P2P_PARAM_ID = (2);
dflet 3:a8c249046181 201
dflet 3:a8c249046181 202 /* wlan AP Config set/get options */
dflet 3:a8c249046181 203 const uint8_t WLAN_AP_OPT_SSID = (0);
dflet 3:a8c249046181 204 const uint8_t WLAN_AP_OPT_CHANNEL = (3);
dflet 3:a8c249046181 205 const uint8_t WLAN_AP_OPT_HIDDEN_SSID = (4);
dflet 3:a8c249046181 206 const uint8_t WLAN_AP_OPT_SECURITY_TYPE = (6);
dflet 3:a8c249046181 207 const uint8_t WLAN_AP_OPT_PASSWORD = (7);
dflet 3:a8c249046181 208 const uint8_t WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE = (9);
dflet 3:a8c249046181 209 const uint8_t WLAN_GENERAL_PARAM_OPT_STA_TX_POWER = (10);
dflet 3:a8c249046181 210 const uint8_t WLAN_GENERAL_PARAM_OPT_AP_TX_POWER = (11);
dflet 3:a8c249046181 211
dflet 3:a8c249046181 212 const uint8_t WLAN_P2P_OPT_DEV_NAME = (12);
dflet 3:a8c249046181 213 const uint8_t WLAN_P2P_OPT_DEV_TYPE = (13);
dflet 3:a8c249046181 214 const uint8_t WLAN_P2P_OPT_CHANNEL_N_REGS = (14);
dflet 3:a8c249046181 215 const uint8_t WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT = (16);
dflet 3:a8c249046181 216 const uint8_t WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS = (18); /* change the scan channels and RSSI threshold using this configuration option */
dflet 3:a8c249046181 217
dflet 3:a8c249046181 218 /* SmartConfig CIPHER options */
dflet 3:a8c249046181 219 const uint8_t SMART_CONFIG_CIPHER_SFLASH = (0); /* password is not delivered by the application. The Simple Manager should */
dflet 3:a8c249046181 220 /* check if the keys are stored in the Flash. */
dflet 3:a8c249046181 221 const uint8_t SMART_CONFIG_CIPHER_AES = (1); /* AES (other types are not supported) */
dflet 3:a8c249046181 222 const uint8_t SMART_CONFIG_CIPHER_NONE = (0xFF); /* do not check in the flash */
dflet 3:a8c249046181 223
dflet 3:a8c249046181 224
dflet 3:a8c249046181 225 const uint8_t SL_POLICY_CONNECTION = (0x10);
dflet 3:a8c249046181 226 const uint8_t SL_POLICY_SCAN = (0x20);
dflet 3:a8c249046181 227 const uint8_t SL_POLICY_PM = (0x30);
dflet 3:a8c249046181 228 const uint8_t SL_POLICY_P2P = (0x40);
dflet 3:a8c249046181 229
dflet 3:a8c249046181 230 #define VAL_2_MASK(position,value) ((1 & (value))<<(position))
dflet 3:a8c249046181 231 #define MASK_2_VAL(position,mask) (((1 << position) & (mask)) >> (position))
dflet 3:a8c249046181 232
dflet 3:a8c249046181 233 #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))
dflet 3:a8c249046181 234 #define SL_SCAN_POLICY_EN(policy) (MASK_2_VAL(0,policy))
dflet 3:a8c249046181 235 #define SL_SCAN_POLICY(Enable) (VAL_2_MASK(0,Enable))
dflet 3:a8c249046181 236
dflet 3:a8c249046181 237
dflet 3:a8c249046181 238 const uint8_t SL_NORMAL_POLICY = (0);
dflet 3:a8c249046181 239 const uint8_t SL_LOW_LATENCY_POLICY = (1);
dflet 3:a8c249046181 240 const uint8_t SL_LOW_POWER_POLICY = (2);
dflet 3:a8c249046181 241 const uint8_t SL_ALWAYS_ON_POLICY = (3);
dflet 3:a8c249046181 242 const uint8_t SL_LONG_SLEEP_INTERVAL_POLICY = (4);
dflet 3:a8c249046181 243
dflet 3:a8c249046181 244 const uint8_t SL_P2P_ROLE_NEGOTIATE = (3);
dflet 3:a8c249046181 245 const uint8_t SL_P2P_ROLE_GROUP_OWNER = (15);
dflet 3:a8c249046181 246 const uint8_t SL_P2P_ROLE_CLIENT = (0);
dflet 3:a8c249046181 247
dflet 3:a8c249046181 248 const uint8_t SL_P2P_NEG_INITIATOR_ACTIVE = (0);
dflet 3:a8c249046181 249 const uint8_t SL_P2P_NEG_INITIATOR_PASSIVE = (1);
dflet 3:a8c249046181 250 const uint8_t SL_P2P_NEG_INITIATOR_RAND_BACKOFF = (2);
dflet 3:a8c249046181 251
dflet 3:a8c249046181 252 #define POLICY_VAL_2_OPTIONS(position,mask,policy) ((mask & policy) << position )
dflet 3:a8c249046181 253
dflet 3:a8c249046181 254 #define SL_P2P_POLICY(p2pNegType,p2pNegInitiator) (POLICY_VAL_2_OPTIONS(0,0xF,(p2pNegType > SL_P2P_ROLE_GROUP_OWNER ? SL_P2P_ROLE_GROUP_OWNER : p2pNegType)) | \
dflet 3:a8c249046181 255 POLICY_VAL_2_OPTIONS(4,0x1,(p2pNegType > SL_P2P_ROLE_GROUP_OWNER ? 1:0)) | \
dflet 3:a8c249046181 256 POLICY_VAL_2_OPTIONS(5,0x3, p2pNegInitiator))
dflet 3:a8c249046181 257
dflet 3:a8c249046181 258
dflet 3:a8c249046181 259 /* Info elements */
dflet 3:a8c249046181 260
dflet 3:a8c249046181 261 const uint8_t INFO_ELEMENT_DEFAULT_ID = (0); /* 221 will be used */
dflet 3:a8c249046181 262
dflet 3:a8c249046181 263 /* info element size is up to 252 bytes (+ 3 bytes of OUI). */
dflet 3:a8c249046181 264 const uint8_t INFO_ELEMENT_MAX_SIZE = (252);
dflet 3:a8c249046181 265
dflet 3:a8c249046181 266 /* For AP - the total length of all info elements is 300 bytes (for example - 4 info elements of 75 bytes each) */
dflet 3:a8c249046181 267 const uint16_t INFO_ELEMENT_MAX_TOTAL_LENGTH_AP = (300);
dflet 3:a8c249046181 268 /* For P2P - the total length of all info elements is 150 bytes (for example - 4 info elements of 40 bytes each) */
dflet 3:a8c249046181 269 const uint8_t INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO (160);
dflet 3:a8c249046181 270
dflet 3:a8c249046181 271 const uint8_t INFO_ELEMENT_AP_ROLE = (0);
dflet 3:a8c249046181 272 const uint8_t INFO_ELEMENT_P2P_GO_ROLE = (1);
dflet 3:a8c249046181 273
dflet 3:a8c249046181 274 /* we support up to 4 info elements per Role. */
dflet 3:a8c249046181 275 const uint8_t MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED = (4);
dflet 3:a8c249046181 276
dflet 3:a8c249046181 277 const uint8_t INFO_ELEMENT_DEFAULT_OUI_0 = (0x08);
dflet 3:a8c249046181 278 const uint8_t INFO_ELEMENT_DEFAULT_OUI_1 = (0x00);
dflet 3:a8c249046181 279 const uint8_t INFO_ELEMENT_DEFAULT_OUI_2 = (0x28);
dflet 3:a8c249046181 280
dflet 3:a8c249046181 281 const uint32_t INFO_ELEMENT_DEFAULT_OUI = (0x000000); /* 08, 00, 28 will be used */
dflet 3:a8c249046181 282
dflet 3:a8c249046181 283
dflet 3:a8c249046181 284 /*****************************************************************************/
dflet 3:a8c249046181 285 /* Structure/Enum declarations */
dflet 3:a8c249046181 286 /*****************************************************************************/
dflet 3:a8c249046181 287
dflet 3:a8c249046181 288 typedef enum {
dflet 3:a8c249046181 289 RATE_1M = 1,
dflet 3:a8c249046181 290 RATE_2M = 2,
dflet 3:a8c249046181 291 RATE_5_5M = 3,
dflet 3:a8c249046181 292 RATE_11M = 4,
dflet 3:a8c249046181 293 RATE_6M = 6,
dflet 3:a8c249046181 294 RATE_9M = 7,
dflet 3:a8c249046181 295 RATE_12M = 8,
dflet 3:a8c249046181 296 RATE_18M = 9,
dflet 3:a8c249046181 297 RATE_24M = 10,
dflet 3:a8c249046181 298 RATE_36M = 11,
dflet 3:a8c249046181 299 RATE_48M = 12,
dflet 3:a8c249046181 300 RATE_54M = 13,
dflet 3:a8c249046181 301 RATE_MCS_0 = 14,
dflet 3:a8c249046181 302 RATE_MCS_1 = 15,
dflet 3:a8c249046181 303 RATE_MCS_2 = 16,
dflet 3:a8c249046181 304 RATE_MCS_3 = 17,
dflet 3:a8c249046181 305 RATE_MCS_4 = 18,
dflet 3:a8c249046181 306 RATE_MCS_5 = 19,
dflet 3:a8c249046181 307 RATE_MCS_6 = 20,
dflet 3:a8c249046181 308 RATE_MCS_7 = 21,
dflet 3:a8c249046181 309 MAX_NUM_RATES = 0xFF
dflet 3:a8c249046181 310 } SlRateIndex_e;
dflet 3:a8c249046181 311
dflet 3:a8c249046181 312 typedef enum {
dflet 3:a8c249046181 313 DEV_PW_DEFAULT=0,
dflet 3:a8c249046181 314 DEV_PW_PIN_KEYPAD=1,
dflet 3:a8c249046181 315 DEV_PW_PUSH_BUTTON=4,
dflet 3:a8c249046181 316 DEV_PW_PIN_DISPLAY=5
dflet 3:a8c249046181 317 } sl_p2p_dev_password_method;
dflet 3:a8c249046181 318
dflet 3:a8c249046181 319
dflet 3:a8c249046181 320 typedef struct {
dflet 3:a8c249046181 321 uint32_t status;
dflet 3:a8c249046181 322 uint32_t ssid_len;
dflet 3:a8c249046181 323 uint8_t ssid[32];
dflet 3:a8c249046181 324 uint32_t private_token_len;
dflet 3:a8c249046181 325 uint8_t private_token[32];
dflet 3:a8c249046181 326 } slSmartConfigStartAsyncResponse_t;
dflet 3:a8c249046181 327
dflet 3:a8c249046181 328 typedef struct {
dflet 3:a8c249046181 329 uint16_t status;
dflet 3:a8c249046181 330 uint16_t padding;
dflet 3:a8c249046181 331 } slSmartConfigStopAsyncResponse_t;
dflet 3:a8c249046181 332
dflet 3:a8c249046181 333 typedef struct {
dflet 3:a8c249046181 334 uint16_t status;
dflet 3:a8c249046181 335 uint16_t padding;
dflet 3:a8c249046181 336 } slWlanConnFailureAsyncResponse_t;
dflet 3:a8c249046181 337
dflet 3:a8c249046181 338 typedef struct {
dflet 3:a8c249046181 339 uint8_t connection_type;/* 0-STA,3-P2P_CL */
dflet 3:a8c249046181 340 uint8_t ssid_len;
dflet 3:a8c249046181 341 uint8_t ssid_name[32];
dflet 3:a8c249046181 342 uint8_t go_peer_device_name_len;
dflet 3:a8c249046181 343 uint8_t go_peer_device_name[32];
dflet 3:a8c249046181 344 uint8_t bssid[6];
dflet 3:a8c249046181 345 uint8_t reason_code;
dflet 3:a8c249046181 346 uint8_t padding[2];
dflet 3:a8c249046181 347 } slWlanConnectAsyncResponse_t;
dflet 3:a8c249046181 348
dflet 3:a8c249046181 349 typedef struct {
dflet 3:a8c249046181 350 uint8_t go_peer_device_name[32];
dflet 3:a8c249046181 351 uint8_t mac[6];
dflet 3:a8c249046181 352 uint8_t go_peer_device_name_len;
dflet 3:a8c249046181 353 uint8_t wps_dev_password_id;
dflet 3:a8c249046181 354 uint8_t own_ssid[32];/* relevant for event sta-connected only */
dflet 3:a8c249046181 355 uint8_t own_ssid_len;/* relevant for event sta-connected only */
dflet 3:a8c249046181 356 uint8_t padding[3];
dflet 3:a8c249046181 357 } slPeerInfoAsyncResponse_t;
dflet 3:a8c249046181 358
dflet 3:a8c249046181 359
dflet 3:a8c249046181 360 typedef union {
dflet 3:a8c249046181 361 slSmartConfigStartAsyncResponse_t smartConfigStartResponse; /*SL_WLAN_SMART_CONFIG_COMPLETE_EVENT*/
dflet 3:a8c249046181 362 slSmartConfigStopAsyncResponse_t smartConfigStopResponse; /*SL_WLAN_SMART_CONFIG_STOP_EVENT */
dflet 3:a8c249046181 363 slPeerInfoAsyncResponse_t APModeStaConnected; /* SL_WLAN_STA_CONNECTED_EVENT - relevant only in AP mode - holds information regarding a new STA connection */
dflet 3:a8c249046181 364 slPeerInfoAsyncResponse_t APModestaDisconnected; /* SL_WLAN_STA_DISCONNECTED_EVENT - relevant only in AP mode - holds information regarding a STA disconnection */
dflet 3:a8c249046181 365 slWlanConnectAsyncResponse_t STAandP2PModeWlanConnected; /* SL_WLAN_CONNECT_EVENT - relevant only in STA and P2P mode - holds information regarding a new connection */
dflet 3:a8c249046181 366 slWlanConnectAsyncResponse_t STAandP2PModeDisconnected; /* SL_WLAN_DISCONNECT_EVENT - relevant only in STA and P2P mode - holds information regarding a disconnection */
dflet 3:a8c249046181 367 slPeerInfoAsyncResponse_t P2PModeDevFound; /* SL_WLAN_P2P_DEV_FOUND_EVENT - relevant only in P2P mode */
dflet 3:a8c249046181 368 slPeerInfoAsyncResponse_t P2PModeNegReqReceived; /* SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT - relevant only in P2P mode */
dflet 3:a8c249046181 369 slWlanConnFailureAsyncResponse_t P2PModewlanConnectionFailure; /* SL_WLAN_CONNECTION_FAILED_EVENT - relevant only in P2P mode */
dflet 3:a8c249046181 370
dflet 3:a8c249046181 371 } SlWlanEventData_u;
dflet 3:a8c249046181 372
dflet 3:a8c249046181 373 typedef struct {
dflet 3:a8c249046181 374 uint32_t Event;
dflet 3:a8c249046181 375 SlWlanEventData_u EventData;
dflet 3:a8c249046181 376 } SlWlanEvent_t;
dflet 3:a8c249046181 377
dflet 3:a8c249046181 378
dflet 3:a8c249046181 379 typedef struct {
dflet 3:a8c249046181 380 uint32_t ReceivedValidPacketsNumber; /* sum of the packets that been received OK (include filtered) */
dflet 3:a8c249046181 381 uint32_t ReceivedFcsErrorPacketsNumber; /* sum of the packets that been dropped due to FCS error */
dflet 3:a8c249046181 382 uint32_t ReceivedAddressMismatchPacketsNumber; /* sum of the packets that been received but filtered out by one of the HW filters */
dflet 3:a8c249046181 383 int16_t AvarageDataCtrlRssi; /* average RSSI for all valid data packets received */
dflet 3:a8c249046181 384 int16_t AvarageMgMntRssi; /* average RSSI for all valid management packets received */
dflet 3:a8c249046181 385 uint16_t RateHistogram[NUM_OF_RATE_INDEXES]; /* rate histogram for all valid packets received */
dflet 3:a8c249046181 386 uint16_t 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 */
dflet 3:a8c249046181 387 uint32_t StartTimeStamp; /* the time stamp started collecting the statistics in uSec */
dflet 3:a8c249046181 388 uint32_t GetTimeStamp; /* the time stamp called the get statistics command */
dflet 3:a8c249046181 389 } SlGetRxStatResponse_t;
dflet 3:a8c249046181 390
dflet 3:a8c249046181 391
dflet 3:a8c249046181 392 typedef struct {
dflet 3:a8c249046181 393 uint8_t ssid[MAXIMAL_SSID_LENGTH];
dflet 3:a8c249046181 394 uint8_t ssid_len;
dflet 3:a8c249046181 395 uint8_t sec_type;
dflet 3:a8c249046181 396 uint8_t bssid[SL_BSSID_LENGTH];
dflet 3:a8c249046181 397 int8_t rssi;
dflet 3:a8c249046181 398 int8_t reserved[3];
dflet 3:a8c249046181 399 } Sl_WlanNetworkEntry_t;
dflet 3:a8c249046181 400
dflet 3:a8c249046181 401
dflet 3:a8c249046181 402 typedef struct {
dflet 3:a8c249046181 403 uint8_t Type;
dflet 3:a8c249046181 404 int8_t* Key;
dflet 3:a8c249046181 405 uint8_t KeyLen;
dflet 3:a8c249046181 406 } SlSecParams_t;
dflet 3:a8c249046181 407
dflet 3:a8c249046181 408 typedef struct {
dflet 3:a8c249046181 409 int8_t* User;
dflet 3:a8c249046181 410 uint8_t UserLen;
dflet 3:a8c249046181 411 int8_t* AnonUser;
dflet 3:a8c249046181 412 uint8_t AnonUserLen;
dflet 3:a8c249046181 413 uint8_t CertIndex; /* not supported */
dflet 3:a8c249046181 414 uint32_t EapMethod;
dflet 3:a8c249046181 415 } SlSecParamsExt_t;
dflet 3:a8c249046181 416
dflet 3:a8c249046181 417 typedef struct {
dflet 3:a8c249046181 418 int8_t User[32];
dflet 3:a8c249046181 419 uint8_t UserLen;
dflet 3:a8c249046181 420 int8_t AnonUser[32];
dflet 3:a8c249046181 421 uint8_t AnonUserLen;
dflet 3:a8c249046181 422 uint8_t CertIndex; //not supported
dflet 3:a8c249046181 423 uint32_t EapMethod;
dflet 3:a8c249046181 424 } SlGetSecParamsExt_t;
dflet 3:a8c249046181 425
dflet 3:a8c249046181 426 typedef enum {
dflet 3:a8c249046181 427 ROLE_STA = 0,
dflet 3:a8c249046181 428 ROLE_AP = 2,
dflet 3:a8c249046181 429 ROLE_P2P = 3,
dflet 3:a8c249046181 430 ROLE_STA_ERR = -1, /* Failure to load MAC/PHY in STA role */
dflet 3:a8c249046181 431 ROLE_AP_ERR = -ROLE_AP, /* Failure to load MAC/PHY in AP role */
dflet 3:a8c249046181 432 ROLE_P2P_ERR = -ROLE_P2P /* Failure to load MAC/PHY in P2P role */
dflet 3:a8c249046181 433 } SlWlanMode_t;
dflet 3:a8c249046181 434
dflet 3:a8c249046181 435 typedef struct {
dflet 3:a8c249046181 436 uint32_t G_Channels_mask;
dflet 3:a8c249046181 437 int32_t rssiThershold;
dflet 3:a8c249046181 438 } slWlanScanParamCommand_t;
dflet 3:a8c249046181 439
dflet 3:a8c249046181 440
dflet 3:a8c249046181 441 typedef struct {
dflet 3:a8c249046181 442 uint8_t id;
dflet 3:a8c249046181 443 uint8_t oui[3];
dflet 3:a8c249046181 444 uint16_t length;
dflet 3:a8c249046181 445 uint8_t data[252];
dflet 3:a8c249046181 446 } sl_protocol_InfoElement_t;
dflet 3:a8c249046181 447
dflet 3:a8c249046181 448 typedef struct {
dflet 3:a8c249046181 449 uint8_t index; /* 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED */
dflet 3:a8c249046181 450 uint8_t role; /* bit0: AP = 0, GO = 1 */
dflet 3:a8c249046181 451 sl_protocol_InfoElement_t ie;
dflet 3:a8c249046181 452 } sl_protocol_WlanSetInfoElement_t;
dflet 3:a8c249046181 453
dflet 3:a8c249046181 454
dflet 3:a8c249046181 455 class cc3100_wlan_rx_filters;
dflet 3:a8c249046181 456 class cc3100_wlan
dflet 3:a8c249046181 457 {
dflet 3:a8c249046181 458
dflet 3:a8c249046181 459 public:
dflet 3:a8c249046181 460
dflet 3:a8c249046181 461 cc3100_wlan(cc3100_driver &driver, cc3100_wlan_rx_filters &wlan_rx_filters);
dflet 3:a8c249046181 462
dflet 3:a8c249046181 463 ~cc3100_wlan();
dflet 3:a8c249046181 464
dflet 3:a8c249046181 465
dflet 3:a8c249046181 466 /*****************************************************************************/
dflet 3:a8c249046181 467 /* Function prototypes */
dflet 3:a8c249046181 468 /*****************************************************************************/
dflet 3:a8c249046181 469
dflet 3:a8c249046181 470
dflet 3:a8c249046181 471 /*!
dflet 3:a8c249046181 472 \brief Connect to wlan network as a station
dflet 3:a8c249046181 473
dflet 3:a8c249046181 474 \param[in] pName up to 32 bytes in case of STA the name is the SSID of the Access Point
dflet 3:a8c249046181 475 \param[in] NameLen name length
dflet 3:a8c249046181 476 \param[in] pMacAddr 6 bytes for MAC address
dflet 3:a8c249046181 477 \param[in] pSecParams Security parameters (use NULL key for SL_SEC_TYPE_OPEN)
dflet 3:a8c249046181 478 Security types options: \n
dflet 3:a8c249046181 479 - SL_SEC_TYPE_OPEN
dflet 3:a8c249046181 480 - SL_SEC_TYPE_WEP
dflet 3:a8c249046181 481 - SL_SEC_TYPE_WPA_WPA2
dflet 3:a8c249046181 482 - SL_SEC_TYPE_WPA_ENT
dflet 3:a8c249046181 483 - SL_SEC_TYPE_WPS_PBC
dflet 3:a8c249046181 484 - SL_SEC_TYPE_WPS_PIN
dflet 3:a8c249046181 485 \param[in] pSecExtParams Enterprise parameters (set NULL in case Enterprise parameters is not in use)
dflet 3:a8c249046181 486
dflet 3:a8c249046181 487 \return On success, zero is returned. On error, negative is returned
dflet 3:a8c249046181 488 In case error number (-71) is returned, it indicates a connection was activated while the device it running in AP role
dflet 3:a8c249046181 489
dflet 3:a8c249046181 490 \sa sl_WlanDisconnect
dflet 3:a8c249046181 491 \note belongs to \ref ext_api
dflet 3:a8c249046181 492 \warning In this version only single enterprise mode could be used
dflet 3:a8c249046181 493 SL_SEC_TYPE_WPA is a deprecated definition, the new definition is SL_SEC_TYPE_WPA_WPA2
dflet 3:a8c249046181 494 */
dflet 3:a8c249046181 495 #if _SL_INCLUDE_FUNC(sl_WlanConnect)
dflet 3:a8c249046181 496 int16_t sl_WlanConnect(const signed char* pName, const int16_t NameLen, const uint8_t *pMacAddr, const SlSecParams_t* pSecParams, const SlSecParamsExt_t* pSecExtParams);
dflet 3:a8c249046181 497 #endif
dflet 3:a8c249046181 498
dflet 3:a8c249046181 499 /*!
dflet 3:a8c249046181 500 \brief wlan disconnect
dflet 3:a8c249046181 501
dflet 3:a8c249046181 502 Disconnect connection
dflet 3:a8c249046181 503
dflet 3:a8c249046181 504 \return 0 disconnected done, other already disconnected
dflet 3:a8c249046181 505
dflet 3:a8c249046181 506 \sa sl_WlanConnect
dflet 3:a8c249046181 507 \note belongs to \ref ext_api
dflet 3:a8c249046181 508 \warning
dflet 3:a8c249046181 509 */
dflet 3:a8c249046181 510 #if _SL_INCLUDE_FUNC(sl_WlanDisconnect)
dflet 3:a8c249046181 511 int16_t sl_WlanDisconnect(void);
dflet 3:a8c249046181 512 #endif
dflet 3:a8c249046181 513
dflet 3:a8c249046181 514 /*!
dflet 3:a8c249046181 515 \brief add profile
dflet 3:a8c249046181 516
dflet 3:a8c249046181 517 When auto start is enabled, the device connects to a
dflet 3:a8c249046181 518 station from the profiles table. Up to 7 profiles are
dflet 3:a8c249046181 519 supported. If several profiles configured the device chose
dflet 3:a8c249046181 520 the highest priority profile, within each priority group,
dflet 3:a8c249046181 521 device will chose profile based on security policy, signal
dflet 3:a8c249046181 522 strength, etc parameters.
dflet 3:a8c249046181 523
dflet 3:a8c249046181 524
dflet 3:a8c249046181 525 \param[in] pName up to 32 bytes in case of STA the name is the
dflet 3:a8c249046181 526 SSID of the Access Point
dflet 3:a8c249046181 527 in case of P2P the name is the remote device name
dflet 3:a8c249046181 528 \param[in] NameLen name length
dflet 3:a8c249046181 529 \param[in] pMacAddr 6 bytes for MAC address
dflet 3:a8c249046181 530 \param[in] pSecParams Security parameters - security type
dflet 3:a8c249046181 531 (SL_SEC_TYPE_OPEN,SL_SEC_TYPE_WEP,SL_SEC_TYPE_WPA_WPA2,
dflet 3:a8c249046181 532 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
dflet 3:a8c249046181 533 in case of p2p security type pin the key refers to pin code
dflet 3:a8c249046181 534 \param[in] pSecExtParams Enterprise parameters - identity, identity length,
dflet 3:a8c249046181 535 Anonymous, Anonymous length, CertIndex (not supported,
dflet 3:a8c249046181 536 certificates need to be placed in a specific file ID),
dflet 3:a8c249046181 537 EapMethod.Use NULL in case Enterprise parameters is not in use
dflet 3:a8c249046181 538
dflet 3:a8c249046181 539 \param[in] Priority profile priority. Lowest priority: 0
dflet 3:a8c249046181 540 \param[in] Options Not supported
dflet 3:a8c249046181 541
dflet 3:a8c249046181 542 \return On success, profile stored index is returned. On error, negative value is returned
dflet 3:a8c249046181 543
dflet 3:a8c249046181 544 \sa sl_WlanProfileGet , sl_WlanProfileDel
dflet 3:a8c249046181 545 \note belongs to \ref ext_api
dflet 3:a8c249046181 546 \warning Only one Enterprise profile is supported.
dflet 3:a8c249046181 547 Please Note that in case of adding an existing profile (compared by pName,pMACAddr and security type)
dflet 3:a8c249046181 548 the old profile will be deleted and the same index will be returned.
dflet 3:a8c249046181 549 SL_SEC_TYPE_WPA is a deprecated definition, the new definition is SL_SEC_TYPE_WPA_WPA2
dflet 3:a8c249046181 550
dflet 3:a8c249046181 551 */
dflet 3:a8c249046181 552 #if _SL_INCLUDE_FUNC(sl_WlanProfileAdd)
dflet 3:a8c249046181 553 int16_t sl_WlanProfileAdd(const int8_t* pName,
dflet 3:a8c249046181 554 const int16_t NameLen,
dflet 3:a8c249046181 555 const uint8_t *pMacAddr,
dflet 3:a8c249046181 556 const SlSecParams_t* pSecParams ,
dflet 3:a8c249046181 557 const SlSecParamsExt_t* pSecExtParams,
dflet 3:a8c249046181 558 const uint32_t Priority,
dflet 3:a8c249046181 559 const uint32_t Options);
dflet 3:a8c249046181 560 #endif
dflet 3:a8c249046181 561
dflet 3:a8c249046181 562 /*!
dflet 3:a8c249046181 563 \brief get profile
dflet 3:a8c249046181 564
dflet 3:a8c249046181 565 read profile from the device
dflet 3:a8c249046181 566
dflet 3:a8c249046181 567 \param[in] Index profile stored index, if index does not exists
dflet 3:a8c249046181 568 error is return
dflet 3:a8c249046181 569 \param[out] pName up to 32 bytes, in case of sta mode the name of the Access Point
dflet 3:a8c249046181 570 in case of p2p mode the name of the Remote Device
dflet 3:a8c249046181 571 \param[out] pNameLen name length
dflet 3:a8c249046181 572 \param[out] pMacAddr 6 bytes for MAC address
dflet 3:a8c249046181 573 \param[out] pSecParams security parameters - security type
dflet 3:a8c249046181 574 (SL_SEC_TYPE_OPEN, SL_SEC_TYPE_WEP, SL_SEC_TYPE_WPA_WPA2 or
dflet 3:a8c249046181 575 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),
dflet 3:a8c249046181 576 key and key length are not
dflet 3:a8c249046181 577 in case of p2p security type pin the key refers to pin code
dflet 3:a8c249046181 578 return due to security reasons.
dflet 3:a8c249046181 579 \param[out] pSecExtParams enterprise parameters - identity, identity
dflet 3:a8c249046181 580 length, Anonymous, Anonymous length
dflet 3:a8c249046181 581 CertIndex (not supported), EapMethod.
dflet 3:a8c249046181 582 \param[out] Priority profile priority
dflet 3:a8c249046181 583
dflet 3:a8c249046181 584 \return On success, Profile security type is returned (0 or positive number). On error, -1 is
dflet 3:a8c249046181 585 returned
dflet 3:a8c249046181 586
dflet 3:a8c249046181 587 \sa sl_WlanProfileAdd , sl_WlanProfileDel
dflet 3:a8c249046181 588 \note belongs to \ref ext_api
dflet 3:a8c249046181 589 \warning
dflet 3:a8c249046181 590 */
dflet 3:a8c249046181 591 #if _SL_INCLUDE_FUNC(sl_WlanProfileGet)
dflet 3:a8c249046181 592 int16_t sl_WlanProfileGet(const int16_t Index,int8_t* pName, int16_t *pNameLen, uint8_t *pMacAddr, SlSecParams_t* pSecParams, SlGetSecParamsExt_t* pSecExtParams, uint32_t *pPriority);
dflet 3:a8c249046181 593 #endif
dflet 3:a8c249046181 594
dflet 3:a8c249046181 595 /*!
dflet 3:a8c249046181 596 \brief Delete WLAN profile
dflet 3:a8c249046181 597
dflet 3:a8c249046181 598 Delete WLAN profile
dflet 3:a8c249046181 599
dflet 3:a8c249046181 600 \param[in] index number of profile to delete.Possible values are 0 to 6.
dflet 3:a8c249046181 601 Index value 255 will delete all saved profiles
dflet 3:a8c249046181 602
dflet 3:a8c249046181 603 \return On success, zero is returned. On error, -1 is
dflet 3:a8c249046181 604 returned
dflet 3:a8c249046181 605
dflet 3:a8c249046181 606 \sa sl_WlanProfileAdd , sl_WlanProfileGet
dflet 3:a8c249046181 607 \note belongs to \ref ext_api
dflet 3:a8c249046181 608 \warning
dflet 3:a8c249046181 609 */
dflet 3:a8c249046181 610 #if _SL_INCLUDE_FUNC(sl_WlanProfileDel)
dflet 3:a8c249046181 611 int16_t sl_WlanProfileDel(const int16_t Index);
dflet 3:a8c249046181 612 #endif
dflet 3:a8c249046181 613
dflet 3:a8c249046181 614 /*!
dflet 3:a8c249046181 615 \brief Set policy values
dflet 3:a8c249046181 616
dflet 3:a8c249046181 617 \param[in] Type Type of policy to be modified. The Options are:\n
dflet 3:a8c249046181 618 - SL_POLICY_CONNECTION
dflet 3:a8c249046181 619 - SL_POLICY_SCAN
dflet 3:a8c249046181 620 - SL_POLICY_PM
dflet 3:a8c249046181 621 - SL_POLICY_P2P
dflet 3:a8c249046181 622 \param[in] Policy The option value which depends on action type
dflet 3:a8c249046181 623 \param[in] pVal An optional value pointer
dflet 3:a8c249046181 624 \param[in] ValLen An optional value length, in bytes
dflet 3:a8c249046181 625 \return On success, zero is returned. On error, -1 is
dflet 3:a8c249046181 626 returned
dflet 3:a8c249046181 627 \sa sl_WlanPolicyGet
dflet 3:a8c249046181 628 \note belongs to \ref ext_api
dflet 3:a8c249046181 629 \warning
dflet 3:a8c249046181 630 \par
dflet 3:a8c249046181 631 SL_POLICY_CONNECTION type defines three options available to connect the CC31xx device to the AP: \n
dflet 3:a8c249046181 632
dflet 3:a8c249046181 633 - 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
dflet 3:a8c249046181 634 To set this option, use: \n
dflet 3:a8c249046181 635 <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(1,0,0,0,0),NULL,0) </b>
dflet 3:a8c249046181 636 - If Fast Connect is set, the CC31xx device tries to establish a fast connection to AP. \n
dflet 3:a8c249046181 637 To set this option, use: \n
dflet 3:a8c249046181 638 <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,1,0,0,0),NULL,0) </b>
dflet 3:a8c249046181 639 - (relevant for P2P mode only) - If Any P2P is set, CC31xx/CC32xx device tries to automatically connect to the first P2P device available, \n
dflet 3:a8c249046181 640 supporting push button only. To set this option, use: \n
dflet 3:a8c249046181 641 <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,1,0),NULL,0) </b>
dflet 3:a8c249046181 642 - For auto smart config upon restart (any command from Host will end this state) use: \n
dflet 3:a8c249046181 643 <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,0,1),NULL,0) </b> \n
dflet 3:a8c249046181 644 The options above could be combined to a single action, if more than one action is required. \n
dflet 3:a8c249046181 645 \par
dflet 3:a8c249046181 646 SL_POLICY_SCAN defines system scan time interval.Default interval is 10 minutes. \n
dflet 3:a8c249046181 647 After settings scan interval, an immediate scan is activated. The next scan will be based on the interval settings. \n
dflet 3:a8c249046181 648 - For example, setting scan interval to 1 minute interval use: \n
dflet 3:a8c249046181 649 uint32_t intervalInSeconds = 60; \n
dflet 3:a8c249046181 650 #define SL_SCAN_ENABLE 1 \n<b>
dflet 3:a8c249046181 651 sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_ENABLE, (uint8_t *)&intervalInSeconds,sizeof(intervalInSeconds)); </b>\n
dflet 3:a8c249046181 652
dflet 3:a8c249046181 653 - For example, disable scan: \n
dflet 3:a8c249046181 654 #define SL_SCAN_DISABLE 0 \n<b>
dflet 3:a8c249046181 655 sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_DISABLE,0,0); </b>\n
dflet 3:a8c249046181 656 \par
dflet 3:a8c249046181 657 SL_POLICY_PM defines a power management policy for Station mode only:
dflet 3:a8c249046181 658 - For setting normal power management (default) policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL,0) </b>
dflet 3:a8c249046181 659 - For setting low latency power management policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_LATENCY_POLICY, NULL,0) </b>
dflet 3:a8c249046181 660 - For setting low power management policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_POWER_POLICY, NULL,0) </b>
dflet 3:a8c249046181 661 - For setting always on power management policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_ALWAYS_ON_POLICY, NULL,0) </b>
dflet 3:a8c249046181 662 - For setting Long Sleep Interval policy use: \n
dflet 3:a8c249046181 663 uint16_t PolicyBuff[4] = {0,0,800,0}; // PolicyBuff[2] is max sleep time in mSec \n<b>
dflet 3:a8c249046181 664 sl_WlanPolicySet(SL_POLICY_PM , SL_LONG_SLEEP_INTERVAL_POLICY, (uint8_t*)PolicyBuff,sizeof(PolicyBuff)); </b>\n
dflet 3:a8c249046181 665
dflet 3:a8c249046181 666 SL_POLICY_P2P defines p2p negotiation policy parameters for P2P role:
dflet 3:a8c249046181 667 - To set intent negotiation value, set on of the following:
dflet 3:a8c249046181 668 SL_P2P_ROLE_NEGOTIATE - intent 3
dflet 3:a8c249046181 669 SL_P2P_ROLE_GROUP_OWNER - intent 15
dflet 3:a8c249046181 670 SL_P2P_ROLE_CLIENT - intent 0
dflet 3:a8c249046181 671 - To set negotiation initiator value (initiator policy of first negotiation action frame), set on of the following:
dflet 3:a8c249046181 672 SL_P2P_NEG_INITIATOR_ACTIVE
dflet 3:a8c249046181 673 SL_P2P_NEG_INITIATOR_PASSIVE
dflet 3:a8c249046181 674 SL_P2P_NEG_INITIATOR_RAND_BACKOFF
dflet 3:a8c249046181 675 For example: \n
dflet 3:a8c249046181 676 <b>sl_WlanPolicySet(SL_POLICY_P2P, SL_P2P_POLICY(SL_P2P_ROLE_NEGOTIATE,SL_P2P_NEG_INITIATOR_RAND_BACKOFF),NULL,0) </b>
dflet 3:a8c249046181 677
dflet 3:a8c249046181 678 */
dflet 3:a8c249046181 679 #if _SL_INCLUDE_FUNC(sl_WlanPolicySet)
dflet 3:a8c249046181 680 int16_t sl_WlanPolicySet(const uint8_t Type , const uint8_t Policy, uint8_t *pVal,const uint8_t ValLen);
dflet 3:a8c249046181 681 #endif
dflet 3:a8c249046181 682 /*!
dflet 3:a8c249046181 683 \brief get policy values
dflet 3:a8c249046181 684
dflet 3:a8c249046181 685 \param[in] Type SL_POLICY_CONNECTION, SL_POLICY_SCAN, SL_POLICY_PM,SL_POLICY_P2P \n
dflet 3:a8c249046181 686
dflet 3:a8c249046181 687 \param[in] Policy argument may be set to any value \n
dflet 3:a8c249046181 688
dflet 3:a8c249046181 689 \param[out] The returned values, depends on each policy type, will be stored in the allocated buffer pointed by pVal
dflet 3:a8c249046181 690 with a maximum buffer length set by the calling function and pointed to by argument *pValLen
dflet 3:a8c249046181 691
dflet 3:a8c249046181 692 \return On success, zero is returned. On error, -1 is returned
dflet 3:a8c249046181 693
dflet 3:a8c249046181 694 \sa sl_WlanPolicySet
dflet 3:a8c249046181 695
dflet 3:a8c249046181 696 \note belongs to \ref ext_api
dflet 3:a8c249046181 697
dflet 3:a8c249046181 698 \warning The value pointed by the argument *pValLen should be set to a value different from 0 and
dflet 3:a8c249046181 699 greater than the buffer length returned from the SL device. Otherwise, an error will be returned.
dflet 3:a8c249046181 700
dflet 3:a8c249046181 701 */
dflet 3:a8c249046181 702 #if _SL_INCLUDE_FUNC(sl_WlanPolicyGet)
dflet 3:a8c249046181 703 int16_t sl_WlanPolicyGet(const uint8_t Type , uint8_t Policy,uint8_t *pVal,uint8_t *pValLen);
dflet 3:a8c249046181 704 #endif
dflet 3:a8c249046181 705 /*!
dflet 3:a8c249046181 706 \brief Gets the WLAN scan operation results
dflet 3:a8c249046181 707
dflet 3:a8c249046181 708 Gets scan results , gets entry from scan result table
dflet 3:a8c249046181 709
dflet 3:a8c249046181 710 \param[in] Index - Starting index identifier (range 0-19) for getting scan results
dflet 3:a8c249046181 711 \param[in] Count - How many entries to fetch. Max is (20-"Index").
dflet 3:a8c249046181 712 \param[out] pEntries - pointer to an allocated Sl_WlanNetworkEntry_t.
dflet 3:a8c249046181 713 the number of array items should match "Count"
dflet 3:a8c249046181 714 sec_type: SL_SCAN_SEC_TYPE_OPEN, SL_SCAN_SEC_TYPE_WEP, SL_SCAN_SEC_TYPE_WPA or SL_SCAN_SEC_TYPE_WPA2
dflet 3:a8c249046181 715
dflet 3:a8c249046181 716
dflet 3:a8c249046181 717 \return Number of valid networks list items
dflet 3:a8c249046181 718
dflet 3:a8c249046181 719 \sa
dflet 3:a8c249046181 720 \note belongs to \ref ext_api
dflet 3:a8c249046181 721 \warning This command do not initiate any active scanning action
dflet 3:a8c249046181 722 \par Example:
dflet 3:a8c249046181 723 \code An example of fetching max 10 results:
dflet 3:a8c249046181 724
dflet 3:a8c249046181 725 Sl_WlanNetworkEntry_t netEntries[10];
dflet 3:a8c249046181 726 int16_t resultsCount = sl_WlanGetNetworkList(0,10,&netEntries[0]);
dflet 3:a8c249046181 727 for(i=0; i< resultsCount; i++)
dflet 3:a8c249046181 728 {
dflet 3:a8c249046181 729 printf("%s\n",netEntries[i].ssid);
dflet 3:a8c249046181 730 }
dflet 3:a8c249046181 731 \endcode
dflet 3:a8c249046181 732 */
dflet 3:a8c249046181 733 #if _SL_INCLUDE_FUNC(sl_WlanGetNetworkList)
dflet 3:a8c249046181 734 int16_t sl_WlanGetNetworkList(const uint8_t Index, const uint8_t Count, Sl_WlanNetworkEntry_t *pEntries);
dflet 3:a8c249046181 735 #endif
dflet 3:a8c249046181 736
dflet 3:a8c249046181 737 /*!
dflet 3:a8c249046181 738 \brief Start collecting wlan RX statistics, for unlimited time.
dflet 3:a8c249046181 739
dflet 3:a8c249046181 740 \return On success, zero is returned. On error, -1 is returned
dflet 3:a8c249046181 741
dflet 3:a8c249046181 742 \sa sl_WlanRxStatStop sl_WlanRxStatGet
dflet 3:a8c249046181 743 \note belongs to \ref ext_api
dflet 3:a8c249046181 744 \warning
dflet 3:a8c249046181 745 \par Example:
dflet 3:a8c249046181 746 \code Getting wlan RX statistics:
dflet 3:a8c249046181 747
dflet 3:a8c249046181 748 void RxStatCollectTwice()
dflet 3:a8c249046181 749 {
dflet 3:a8c249046181 750 SlGetRxStatResponse_t rxStat;
dflet 3:a8c249046181 751 int16_t rawSocket;
dflet 3:a8c249046181 752 int8_t DataFrame[200];
dflet 3:a8c249046181 753 struct SlTimeval_t timeval;
dflet 3:a8c249046181 754 timeval.tv_sec = 0; // Seconds
dflet 3:a8c249046181 755 timeval.tv_usec = 20000; // Microseconds. 10000 microseconds resolution
dflet 3:a8c249046181 756
dflet 3:a8c249046181 757 sl_WlanRxStatStart(); // set statistics mode
dflet 3:a8c249046181 758
dflet 3:a8c249046181 759 rawSocket = sl_Socket(SL_AF_RF, SL_SOCK_RAW, eChannel);
dflet 3:a8c249046181 760 // set timeout - in case we have no activity for the specified channel
dflet 3:a8c249046181 761 sl_SetSockOpt(rawSocket,SL_SOL_SOCKET,SL_SO_RCVTIMEO, &timeval, sizeof(timeval)); // Enable receive timeout
dflet 3:a8c249046181 762 status = sl_Recv(rawSocket, DataFrame, sizeof(DataFrame), 0);
dflet 3:a8c249046181 763
dflet 3:a8c249046181 764 Sleep(1000); // sleep for 1 sec
dflet 3:a8c249046181 765 sl_WlanRxStatGet(&rxStat,0); // statistics has been cleared upon read
dflet 3:a8c249046181 766 Sleep(1000); // sleep for 1 sec
dflet 3:a8c249046181 767 sl_WlanRxStatGet(&rxStat,0);
dflet 3:a8c249046181 768
dflet 3:a8c249046181 769 }
dflet 3:a8c249046181 770 \endcode
dflet 3:a8c249046181 771 */
dflet 3:a8c249046181 772 #if _SL_INCLUDE_FUNC(sl_WlanRxStatStart)
dflet 3:a8c249046181 773 int16_t sl_WlanRxStatStart(void);
dflet 3:a8c249046181 774 #endif
dflet 3:a8c249046181 775
dflet 3:a8c249046181 776
dflet 3:a8c249046181 777 /*!
dflet 3:a8c249046181 778 \brief Stop collecting wlan RX statistic, (if previous called sl_WlanRxStatStart)
dflet 3:a8c249046181 779
dflet 3:a8c249046181 780 \return On success, zero is returned. On error, -1 is returned
dflet 3:a8c249046181 781
dflet 3:a8c249046181 782 \sa sl_WlanRxStatStart sl_WlanRxStatGet
dflet 3:a8c249046181 783 \note belongs to \ref ext_api
dflet 3:a8c249046181 784 \warning
dflet 3:a8c249046181 785 */
dflet 3:a8c249046181 786 #if _SL_INCLUDE_FUNC(sl_WlanRxStatStop)
dflet 3:a8c249046181 787 int16_t sl_WlanRxStatStop(void);
dflet 3:a8c249046181 788 #endif
dflet 3:a8c249046181 789
dflet 3:a8c249046181 790
dflet 3:a8c249046181 791 /*!
dflet 3:a8c249046181 792 \brief Get wlan RX statistics. upon calling this command, the statistics counters will be cleared.
dflet 3:a8c249046181 793
dflet 3:a8c249046181 794 \param[in] Flags should be 0 ( not applicable right now, will be added the future )
dflet 3:a8c249046181 795 \param[in] pRxStat a pointer to SlGetRxStatResponse_t filled with Rx statistics results
dflet 3:a8c249046181 796 \return On success, zero is returned. On error, -1 is returned
dflet 3:a8c249046181 797
dflet 3:a8c249046181 798 \sa sl_WlanRxStatStart sl_WlanRxStatStop
dflet 3:a8c249046181 799 \note belongs to \ref ext_api
dflet 3:a8c249046181 800 \warning
dflet 3:a8c249046181 801 */
dflet 3:a8c249046181 802 #if _SL_INCLUDE_FUNC(sl_WlanRxStatGet)
dflet 3:a8c249046181 803 int16_t sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat, const uint32_t Flags);
dflet 3:a8c249046181 804 #endif
dflet 3:a8c249046181 805
dflet 3:a8c249046181 806
dflet 3:a8c249046181 807 /*!
dflet 3:a8c249046181 808 \brief Stop Smart Config procedure. Once Smart Config will be stopped,
dflet 3:a8c249046181 809 Asynchronous event will be received - SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE.
dflet 3:a8c249046181 810
dflet 3:a8c249046181 811 \param[in] none
dflet 3:a8c249046181 812 \param[out] none
dflet 3:a8c249046181 813
dflet 3:a8c249046181 814 \return 0 - if Stop Smart Config is about to be executed without errors.
dflet 3:a8c249046181 815
dflet 3:a8c249046181 816 \sa sl_WlanSmartConfigStart
dflet 3:a8c249046181 817 \note belongs to \ref ext_api
dflet 3:a8c249046181 818 \warning
dflet 3:a8c249046181 819
dflet 3:a8c249046181 820 */
dflet 3:a8c249046181 821 #if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStop)
dflet 3:a8c249046181 822 int16_t sl_WlanSmartConfigStop(void);
dflet 3:a8c249046181 823 #endif
dflet 3:a8c249046181 824
dflet 3:a8c249046181 825 /*!
dflet 3:a8c249046181 826 \brief Start Smart Config procedure
dflet 3:a8c249046181 827 \par
dflet 3:a8c249046181 828 The target of the procedure is to let the \n
dflet 3:a8c249046181 829 device to gain the network parameters: SSID and Password (if network is secured) \n
dflet 3:a8c249046181 830 and to connect to it once located in the network range. \n
dflet 3:a8c249046181 831 An external application should be used on a device connected to any mobile network. \n
dflet 3:a8c249046181 832 The external application will transmit over the air the network parameters in secured manner.\n
dflet 3:a8c249046181 833 The Password may be decrypted using a Key. \n
dflet 3:a8c249046181 834 The decryption method may be decided in the command or embedded in the Flash. \n
dflet 3:a8c249046181 835 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
dflet 3:a8c249046181 836 Once Smart Config has ended successfully, Asynchronous event will be received - \n
dflet 3:a8c249046181 837 SL_OPCODE_WLAN_SMART_CONFIG_START_ASYNC_RESPONSE. \n
dflet 3:a8c249046181 838 The Event will hold the SSID and an extra field that might have been delivered as well (i.e. - device name)
dflet 3:a8c249046181 839
dflet 3:a8c249046181 840 \param[in] groupIdBitmask - each bit represent a group ID that should be searched.
dflet 3:a8c249046181 841 The Default group ID id BIT_0. 2 more group can be searched
dflet 3:a8c249046181 842 in addition. The range is BIT_0 - BIT_15.
dflet 3:a8c249046181 843 \param[in] chiper - 0: check in flash, 1 - AES, 0xFF - do not check in flash
dflet 3:a8c249046181 844 \param[in] publicKeyLen - public key len (used for the default group ID - BIT_0)
dflet 3:a8c249046181 845 \param[in] group1KeyLen - group ID1 length
dflet 3:a8c249046181 846 \param[in] group2KeyLen - group ID2 length
dflet 3:a8c249046181 847 \param[in] publicKey - public key (used for the default group ID - BIT_0)
dflet 3:a8c249046181 848 \param[in] group1Key - group ID1 key
dflet 3:a8c249046181 849 \param[in] group2Key - group ID2 key
dflet 3:a8c249046181 850
dflet 3:a8c249046181 851 \param[out] none
dflet 3:a8c249046181 852
dflet 3:a8c249046181 853 \return 0 - if Smart Config started successfully.
dflet 3:a8c249046181 854
dflet 3:a8c249046181 855 \sa sl_WlanSmartConfigStop
dflet 3:a8c249046181 856 \note belongs to \ref ext_api
dflet 3:a8c249046181 857 \warning
dflet 3:a8c249046181 858 \par
dflet 3:a8c249046181 859 \code An example of starting smart Config on group ID's 0 + 1 + 2
dflet 3:a8c249046181 860
dflet 3:a8c249046181 861 sl_WlanSmartConfigStart(7, //group ID's (BIT_0 | BIT_1 | BIT_2)
dflet 3:a8c249046181 862 1, //decrypt key by AES method
dflet 3:a8c249046181 863 16, //decryption key length for group ID0
dflet 3:a8c249046181 864 16, //decryption key length for group ID1
dflet 3:a8c249046181 865 16, //decryption key length for group ID2
dflet 3:a8c249046181 866 "Key0Key0Key0Key0", //decryption key for group ID0
dflet 3:a8c249046181 867 "Key1Key1Key1Key1", //decryption key for group ID1
dflet 3:a8c249046181 868 "Key2Key2Key2Key2" //decryption key for group ID2
dflet 3:a8c249046181 869 );
dflet 3:a8c249046181 870 \endcode
dflet 3:a8c249046181 871 */
dflet 3:a8c249046181 872 #if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStart)
dflet 3:a8c249046181 873 int16_t sl_WlanSmartConfigStart(const uint32_t groupIdBitmask,
dflet 3:a8c249046181 874 const uint8_t cipher,
dflet 3:a8c249046181 875 const uint8_t publicKeyLen,
dflet 3:a8c249046181 876 const uint8_t group1KeyLen,
dflet 3:a8c249046181 877 const uint8_t group2KeyLen,
dflet 3:a8c249046181 878 const uint8_t* publicKey,
dflet 3:a8c249046181 879 const uint8_t* group1Key,
dflet 3:a8c249046181 880 const uint8_t* group2Key);
dflet 3:a8c249046181 881 #endif
dflet 3:a8c249046181 882
dflet 3:a8c249046181 883
dflet 3:a8c249046181 884 /*!
dflet 3:a8c249046181 885 \brief Wlan set mode
dflet 3:a8c249046181 886
dflet 3:a8c249046181 887 Setting WLAN mode
dflet 3:a8c249046181 888
dflet 3:a8c249046181 889 \param[in] mode - WLAN mode to start the CC31xx device. Possible options are:
dflet 3:a8c249046181 890 - ROLE_STA - for WLAN station mode
dflet 3:a8c249046181 891 - ROLE_AP - for WLAN AP mode
dflet 3:a8c249046181 892 - ROLE_P2P -for WLAN P2P mode
dflet 3:a8c249046181 893 \return 0 - if mode was set correctly
dflet 3:a8c249046181 894 \sa sl_Start sl_Stop
dflet 3:a8c249046181 895 \note belongs to \ref ext_api
dflet 3:a8c249046181 896 \warning After setting the mode the system must be restarted for activating the new mode
dflet 3:a8c249046181 897 \par Example:
dflet 3:a8c249046181 898 \code
dflet 3:a8c249046181 899 //Switch from any role to STA:
dflet 3:a8c249046181 900 sl_WlanSetMode(ROLE_STA);
dflet 3:a8c249046181 901 sl_Stop(0);
dflet 3:a8c249046181 902 sl_Start(NULL,NULL,NULL);
dflet 3:a8c249046181 903 \endcode
dflet 3:a8c249046181 904
dflet 3:a8c249046181 905 */
dflet 3:a8c249046181 906 #if _SL_INCLUDE_FUNC(sl_WlanSetMode)
dflet 3:a8c249046181 907 int16_t sl_WlanSetMode(const uint8_t mode);
dflet 3:a8c249046181 908 #endif
dflet 3:a8c249046181 909
dflet 3:a8c249046181 910
dflet 3:a8c249046181 911 /*!
dflet 3:a8c249046181 912 \brief Internal function for setting WLAN configurations
dflet 3:a8c249046181 913
dflet 3:a8c249046181 914 \return On success, zero is returned. On error one of the following error codes returned:
dflet 3:a8c249046181 915 - CONF_ERROR (-1)
dflet 3:a8c249046181 916 - CONF_NVMEM_ACCESS_FAILED (-2)
dflet 3:a8c249046181 917 - CONF_OLD_FILE_VERSION (-3)
dflet 3:a8c249046181 918 - CONF_ERROR_NO_SUCH_COUNTRY_CODE (-4)
dflet 3:a8c249046181 919
dflet 3:a8c249046181 920
dflet 3:a8c249046181 921 \param[in] ConfigId - configuration id
dflet 3:a8c249046181 922 - <b>SL_WLAN_CFG_AP_ID</b>
dflet 3:a8c249046181 923 - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b>
dflet 3:a8c249046181 924 - <b>SL_WLAN_CFG_P2P_PARAM_ID</b>
dflet 3:a8c249046181 925
dflet 3:a8c249046181 926 \param[in] ConfigOpt - configurations option
dflet 3:a8c249046181 927 - <b>SL_WLAN_CFG_AP_ID</b>
dflet 3:a8c249046181 928 - <b>WLAN_AP_OPT_SSID</b> \n
dflet 3:a8c249046181 929 Set SSID for AP mode. \n
dflet 3:a8c249046181 930 This options takes <b>uint8_t</b> buffer as parameter
dflet 3:a8c249046181 931 - <b>WLAN_AP_OPT_CHANNEL</b> \n
dflet 3:a8c249046181 932 Set channel for AP mode. \n
dflet 3:a8c249046181 933 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
dflet 3:a8c249046181 934 This option takes <b>uint8_t</b> as a parameter
dflet 3:a8c249046181 935 - <b>WLAN_AP_OPT_HIDDEN_SSID</b> \n
dflet 3:a8c249046181 936 Set Hidden SSID Mode for AP mode.Hidden options: \n
dflet 3:a8c249046181 937 0: disabled \n
dflet 3:a8c249046181 938 1: Send empty (length=0) SSID in beacon and ignore probe request for broadcast SSID \n
dflet 3:a8c249046181 939 2: Clear SSID (ASCII 0), but keep the original length (this may be required with some \n
dflet 3:a8c249046181 940 clients that do not support empty SSID) and ignore probe requests for broadcast SSID \n
dflet 3:a8c249046181 941 This option takes <b>uint8_t</b> as a parameter
dflet 3:a8c249046181 942 - <b>WLAN_AP_OPT_SECURITY_TYPE</b> \n
dflet 3:a8c249046181 943 Set Security type for AP mode. Security options are:
dflet 3:a8c249046181 944 - Open security: SL_SEC_TYPE_OPEN
dflet 3:a8c249046181 945 - WEP security: SL_SEC_TYPE_WEP
dflet 3:a8c249046181 946 - WPA security: SL_SEC_TYPE_WPA_WPA2 \n
dflet 3:a8c249046181 947 This option takes <b>uint8_t</b> pointer as a parameter
dflet 3:a8c249046181 948 - <b>WLAN_AP_OPT_PASSWORD</b> \n
dflet 3:a8c249046181 949 Set Password for for AP mode (for WEP or for WPA): \n
dflet 3:a8c249046181 950 Password - for WPA: 8 - 63 characters \n
dflet 3:a8c249046181 951 for WEP: 5 / 13 characters (ascii) \n
dflet 3:a8c249046181 952 This options takes <b>uint8_t</b> buffer as parameter
dflet 3:a8c249046181 953 - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b>
dflet 3:a8c249046181 954 - <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS </b> \n
dflet 3:a8c249046181 955 Set scan parameters.
dflet 3:a8c249046181 956 This option uses slWlanScanParamCommand_t as parameter
dflet 3:a8c249046181 957 - <b>WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE</b> \n
dflet 3:a8c249046181 958 Set Country Code for AP mode \n
dflet 3:a8c249046181 959 This options takes <b>uint8_t</b> 2 bytes buffer as parameter
dflet 3:a8c249046181 960 - <b>WLAN_GENERAL_PARAM_OPT_STA_TX_POWER</b> \n
dflet 3:a8c249046181 961 Set STA mode Tx power level \n
dflet 3:a8c249046181 962 Number between 0-15, as dB offset from max power (0 will set MAX power) \n
dflet 3:a8c249046181 963 This options takes <b>uint8_t</b> as parameter
dflet 3:a8c249046181 964 - <b>WLAN_GENERAL_PARAM_OPT_AP_TX_POWER</b>
dflet 3:a8c249046181 965 Set AP mode Tx power level \n
dflet 3:a8c249046181 966 Number between 0-15, as dB offset from max power (0 will set MAX power) \n
dflet 3:a8c249046181 967 This options takes <b>uint8_t</b> as parameter
dflet 3:a8c249046181 968 - <b>WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT</b>
dflet 3:a8c249046181 969 Set Info Element for AP mode. \n
dflet 3:a8c249046181 970 The Application can set up to MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED info elements per Role (AP / P2P GO). \n
dflet 3:a8c249046181 971 To delete an info element use the relevant index and length = 0. \n
dflet 3:a8c249046181 972 The Application can set up to MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED to the same role. \n
dflet 3:a8c249046181 973 However, for AP - no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_AP bytes can be stored for all info elements. \n
dflet 3:a8c249046181 974 For P2P GO - no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO bytes can be stored for all info elements. \n
dflet 3:a8c249046181 975 This option takes sl_protocol_WlanSetInfoElement_t as parameter
dflet 3:a8c249046181 976 - <b>SL_WLAN_CFG_P2P_PARAM_ID</b>
dflet 3:a8c249046181 977 - <b>WLAN_P2P_OPT_DEV_TYPE</b> \n
dflet 3:a8c249046181 978 Set P2P Device type.Maximum length of 17 characters. Device type is published under P2P I.E, \n
dflet 3:a8c249046181 979 allows to make devices easier to recognize. \n
dflet 3:a8c249046181 980 In case no device type is set, the default type is "1-0050F204-1" \n
dflet 3:a8c249046181 981 This options takes <b>uint8_t</b> buffer as parameter
dflet 3:a8c249046181 982 - <b>WLAN_P2P_OPT_CHANNEL_N_REGS</b> \n
dflet 3:a8c249046181 983 Set P2P Channels. \n
dflet 3:a8c249046181 984 listen channel (either 1/6/11 for 2.4GHz) \n
dflet 3:a8c249046181 985 listen regulatory class (81 for 2.4GHz) \n
dflet 3:a8c249046181 986 oper channel (either 1/6/11 for 2.4GHz) \n
dflet 3:a8c249046181 987 oper regulatory class (81 for 2.4GHz) \n
dflet 3:a8c249046181 988 listen channel and regulatory class will determine the device listen channel during p2p find listen phase \n
dflet 3:a8c249046181 989 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
dflet 3:a8c249046181 990 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.
dflet 3:a8c249046181 991 This option takes pointer to <b>uint8_t[4]</b> as parameter
dflet 3:a8c249046181 992
dflet 3:a8c249046181 993 \param[in] ConfigLen - configurations len
dflet 3:a8c249046181 994
dflet 3:a8c249046181 995 \param[in] pValues - configurations values
dflet 3:a8c249046181 996
dflet 3:a8c249046181 997 \sa
dflet 3:a8c249046181 998 \note
dflet 3:a8c249046181 999 \warning
dflet 3:a8c249046181 1000 \par Examples:
dflet 3:a8c249046181 1001 \par
dflet 3:a8c249046181 1002 <b> WLAN_AP_OPT_SSID: </b>
dflet 3:a8c249046181 1003 \code
dflet 3:a8c249046181 1004 uint8_t str[33];
dflet 3:a8c249046181 1005 memset(str, 0, 33);
dflet 3:a8c249046181 1006 memcpy(str, ssid, len); // ssid string of 32 characters
dflet 3:a8c249046181 1007 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid), str);
dflet 3:a8c249046181 1008 \endcode
dflet 3:a8c249046181 1009 \par
dflet 3:a8c249046181 1010 <b> WLAN_AP_OPT_CHANNEL: </b>
dflet 3:a8c249046181 1011 \code
dflet 3:a8c249046181 1012 uint8_t val = channel;
dflet 3:a8c249046181 1013 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, (uint8_t *)&val);
dflet 3:a8c249046181 1014 \endcode
dflet 3:a8c249046181 1015 \par
dflet 3:a8c249046181 1016 <b> WLAN_AP_OPT_HIDDEN_SSID: </b>
dflet 3:a8c249046181 1017 \code
dflet 3:a8c249046181 1018 uint8_t val = hidden;
dflet 3:a8c249046181 1019 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_HIDDEN_SSID, 1, (uint8_t *)&val);
dflet 3:a8c249046181 1020 \endcode
dflet 3:a8c249046181 1021 \par
dflet 3:a8c249046181 1022 <b> WLAN_AP_OPT_SECURITY_TYPE: </b>
dflet 3:a8c249046181 1023 \code
dflet 3:a8c249046181 1024 uint8_t val = SL_SEC_TYPE_WPA_WPA2;
dflet 3:a8c249046181 1025 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (uint8_t *)&val);
dflet 3:a8c249046181 1026 \endcode
dflet 3:a8c249046181 1027 \par
dflet 3:a8c249046181 1028 <b> WLAN_AP_OPT_PASSWORD: </b>
dflet 3:a8c249046181 1029 \code
dflet 3:a8c249046181 1030 uint8_t str[65];
dflet 3:a8c249046181 1031 uint16_t len = strlen(password);
dflet 3:a8c249046181 1032 memset(str, 0, 65);
dflet 3:a8c249046181 1033 memcpy(str, password, len);
dflet 3:a8c249046181 1034 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, len, (uint8_t *)str);
dflet 3:a8c249046181 1035 \endcode
dflet 3:a8c249046181 1036 \par
dflet 3:a8c249046181 1037 <b> WLAN_GENERAL_PARAM_OPT_STA_TX_POWER: </b>
dflet 3:a8c249046181 1038 \code
dflet 3:a8c249046181 1039 uint8_t stapower=(uint8_t)power;
dflet 3:a8c249046181 1040 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER,1,(uint8_t *)&stapower);
dflet 3:a8c249046181 1041 \endcode
dflet 3:a8c249046181 1042 \par
dflet 3:a8c249046181 1043 <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS: </b>
dflet 3:a8c249046181 1044 \code
dflet 3:a8c249046181 1045 slWlanScanParamCommand_t ScanParamConfig;
dflet 3:a8c249046181 1046 ScanParamConfig.G_Channels_mask = 0x01; // bit mask for channels:1 means channel 1 is enabled, 3 means channels 1 + 2 are enabled
dflet 3:a8c249046181 1047 ScanParamConfig.rssiThershold = -70; // only for RSSI level which is higher than -70
dflet 3:a8c249046181 1048 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID ,WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS,sizeof(slWlanScanParamCommand_t),(_u8*)&ScanParamConfig);
dflet 3:a8c249046181 1049 \endcode
dflet 3:a8c249046181 1050 \par
dflet 3:a8c249046181 1051 <b> WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE: </b>
dflet 3:a8c249046181 1052 \code
dflet 3:a8c249046181 1053 uint8_t* str = (uint8_t *) country; // string of 2 characters. i.e. - "US"
dflet 3:a8c249046181 1054 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2, str);
dflet 3:a8c249046181 1055 \endcode
dflet 3:a8c249046181 1056 \par
dflet 3:a8c249046181 1057 <b> WLAN_GENERAL_PARAM_OPT_AP_TX_POWER: </b>
dflet 3:a8c249046181 1058 \code
dflet 3:a8c249046181 1059 uint8_t appower=(uint8_t)power;
dflet 3:a8c249046181 1060 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_AP_TX_POWER,1,(uint8_t *)&appower);
dflet 3:a8c249046181 1061 \endcode
dflet 3:a8c249046181 1062 \par
dflet 3:a8c249046181 1063 <b> WLAN_P2P_OPT_DEV_TYPE: </b>
dflet 3:a8c249046181 1064 \code
dflet 3:a8c249046181 1065 uint8_t str[17];
dflet 3:a8c249046181 1066 uint16_t len = strlen(device_type);
dflet 3:a8c249046181 1067 memset(str, 0, 17);
dflet 3:a8c249046181 1068 memcpy(str, device_type, len);
dflet 3:a8c249046181 1069 sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_DEV_TYPE, len, str);
dflet 3:a8c249046181 1070 \endcode
dflet 3:a8c249046181 1071 \par
dflet 3:a8c249046181 1072 <b> WLAN_P2P_OPT_CHANNEL_N_REGS: </b>
dflet 3:a8c249046181 1073 \code
dflet 3:a8c249046181 1074 uint8_t str[4];
dflet 3:a8c249046181 1075 str[0] = (uint8_t)11; // listen channel
dflet 3:a8c249046181 1076 str[1] = (uint8_t)81; // listen regulatory class
dflet 3:a8c249046181 1077 str[2] = (uint8_t)6; // oper channel
dflet 3:a8c249046181 1078 str[3] = (uint8_t)81; // oper regulatory class
dflet 3:a8c249046181 1079 sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_CHANNEL_N_REGS, 4, str);
dflet 3:a8c249046181 1080 \endcode
dflet 3:a8c249046181 1081 \par
dflet 3:a8c249046181 1082 <b> WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT: </b>
dflet 3:a8c249046181 1083 \code
dflet 3:a8c249046181 1084 sl_protocol_WlanSetInfoElement_t infoele;
dflet 3:a8c249046181 1085 infoele.index = Index; // Index of the info element. range: 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED
dflet 3:a8c249046181 1086 infoele.role = Role; // INFO_ELEMENT_AP_ROLE (0) or INFO_ELEMENT_P2P_GO_ROLE (1)
dflet 3:a8c249046181 1087 infoele.ie.id = Id; // Info element ID. if INFO_ELEMENT_DEFAULT_ID (0) is set, ID will be set to 221.
dflet 3:a8c249046181 1088 // Organization unique ID. If all 3 bytes are zero - it will be replaced with 08,00,28.
dflet 3:a8c249046181 1089 infoele.ie.oui[0] = Oui0; // Organization unique ID first Byte
dflet 3:a8c249046181 1090 infoele.ie.oui[1] = Oui1; // Organization unique ID second Byte
dflet 3:a8c249046181 1091 infoele.ie.oui[2] = Oui2; // Organization unique ID third Byte
dflet 3:a8c249046181 1092 infoele.ie.length = Len; // Length of the info element. must be smaller than 253 bytes
dflet 3:a8c249046181 1093 memset(infoele.ie.data, 0, INFO_ELEMENT_MAX_SIZE);
dflet 3:a8c249046181 1094 if ( Len <= INFO_ELEMENT_MAX_SIZE )
dflet 3:a8c249046181 1095 {
dflet 3:a8c249046181 1096 memcpy(infoele.ie.data, IE, Len); // Info element. length of the info element is [0-252]
dflet 3:a8c249046181 1097 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(uint8_t* ) &infoele);
dflet 3:a8c249046181 1098 }
dflet 3:a8c249046181 1099 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(uint8_t* ) &infoele);
dflet 3:a8c249046181 1100 \endcode
dflet 3:a8c249046181 1101
dflet 3:a8c249046181 1102 */
dflet 3:a8c249046181 1103 #if _SL_INCLUDE_FUNC(sl_WlanSet)
dflet 3:a8c249046181 1104 int16_t sl_WlanSet(const uint16_t ConfigId ,const uint16_t ConfigOpt, const uint16_t ConfigLen, const uint8_t *pValues);
dflet 3:a8c249046181 1105 #endif
dflet 3:a8c249046181 1106
dflet 3:a8c249046181 1107 /*!
dflet 3:a8c249046181 1108 \brief Internal function for getting WLAN configurations
dflet 3:a8c249046181 1109
dflet 3:a8c249046181 1110 \return On success, zero is returned. On error, -1 is
dflet 3:a8c249046181 1111 returned
dflet 3:a8c249046181 1112
dflet 3:a8c249046181 1113 \param[in] ConfigId - configuration id
dflet 3:a8c249046181 1114 - <b>SL_WLAN_CFG_AP_ID</b>
dflet 3:a8c249046181 1115 - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b>
dflet 3:a8c249046181 1116 - <b>SL_WLAN_CFG_P2P_PARAM_ID</b>
dflet 3:a8c249046181 1117
dflet 3:a8c249046181 1118 \param[out] pConfigOpt - get configurations option
dflet 3:a8c249046181 1119 - <b>SL_WLAN_CFG_AP_ID</b>
dflet 3:a8c249046181 1120 - <b>WLAN_AP_OPT_SSID</b> \n
dflet 3:a8c249046181 1121 Get SSID for AP mode. \n
dflet 3:a8c249046181 1122 Get up to 32 characters of SSID \n
dflet 3:a8c249046181 1123 This options takes <b>uint8_t</b> as parameter
dflet 3:a8c249046181 1124 - <b>WLAN_AP_OPT_CHANNEL</b> \n
dflet 3:a8c249046181 1125 Get channel for AP mode. \n
dflet 3:a8c249046181 1126 This option takes <b>uint8_t</b> as a parameter
dflet 3:a8c249046181 1127 - <b>WLAN_AP_OPT_HIDDEN_SSID</b> \n
dflet 3:a8c249046181 1128 Get Hidden SSID Mode for AP mode.Hidden options: \n
dflet 3:a8c249046181 1129 0: disabled \n
dflet 3:a8c249046181 1130 1: Send empty (length=0) SSID in beacon and ignore probe request for broadcast SSID \n
dflet 3:a8c249046181 1131 2: Clear SSID (ASCII 0), but keep the original length (this may be required with some \n
dflet 3:a8c249046181 1132 clients that do not support empty SSID) and ignore probe requests for broadcast SSID \n
dflet 3:a8c249046181 1133 This option takes <b>uint8_t</b> as a parameter
dflet 3:a8c249046181 1134 - <b>WLAN_AP_OPT_SECURITY_TYPE</b> \n
dflet 3:a8c249046181 1135 Get Security type for AP mode. Security options are:
dflet 3:a8c249046181 1136 - Open security: SL_SEC_TYPE_OPEN
dflet 3:a8c249046181 1137 - WEP security: SL_SEC_TYPE_WEP
dflet 3:a8c249046181 1138 - WPA security: SL_SEC_TYPE_WPA_WPA2 \n
dflet 3:a8c249046181 1139 This option takes <b>uint8_t</b> as a parameter
dflet 3:a8c249046181 1140 - <b>WLAN_AP_OPT_PASSWORD</b> \n
dflet 3:a8c249046181 1141 Get Password for for AP mode (for WEP or for WPA): \n
dflet 3:a8c249046181 1142 Returns password - string, fills up to 64 characters. \n
dflet 3:a8c249046181 1143 This options takes <b>uint8_t</b> buffer as parameter
dflet 3:a8c249046181 1144 - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b>
dflet 3:a8c249046181 1145 - <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS </b> \n
dflet 3:a8c249046181 1146 Get scan parameters.
dflet 3:a8c249046181 1147 This option uses slWlanScanParamCommand_t as parameter
dflet 3:a8c249046181 1148 - <b>WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE</b> \n
dflet 3:a8c249046181 1149 Get Country Code for AP mode \n
dflet 3:a8c249046181 1150 This options takes <b>uint8_t</b> buffer as parameter
dflet 3:a8c249046181 1151 - <b>WLAN_GENERAL_PARAM_OPT_STA_TX_POWER</b> \n
dflet 3:a8c249046181 1152 Get STA mode Tx power level \n
dflet 3:a8c249046181 1153 Number between 0-15, as dB offset from max power (0 indicates MAX power) \n
dflet 3:a8c249046181 1154 This options takes <b>uint8_t</b> as parameter
dflet 3:a8c249046181 1155 - <b>WLAN_GENERAL_PARAM_OPT_AP_TX_POWER</b>
dflet 3:a8c249046181 1156 Get AP mode Tx power level \n
dflet 3:a8c249046181 1157 Number between 0-15, as dB offset from max power (0 indicates MAX power) \n
dflet 3:a8c249046181 1158 This options takes <b>uint8_t</b> as parameter
dflet 3:a8c249046181 1159 - <b>SL_WLAN_CFG_P2P_PARAM_ID</b>
dflet 3:a8c249046181 1160 - <b>WLAN_P2P_OPT_CHANNEL_N_REGS</b> \n
dflet 3:a8c249046181 1161 Get P2P Channels. \n
dflet 3:a8c249046181 1162 listen channel (either 1/6/11 for 2.4GHz) \n
dflet 3:a8c249046181 1163 listen regulatory class (81 for 2.4GHz) \n
dflet 3:a8c249046181 1164 oper channel (either 1/6/11 for 2.4GHz) \n
dflet 3:a8c249046181 1165 oper regulatory class (81 for 2.4GHz) \n
dflet 3:a8c249046181 1166 listen channel and regulatory class will determine the device listen channel during p2p find listen phase \n
dflet 3:a8c249046181 1167 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
dflet 3:a8c249046181 1168 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
dflet 3:a8c249046181 1169 This option takes pointer to <b>uint8_t[4]</b> as parameter
dflet 3:a8c249046181 1170
dflet 3:a8c249046181 1171 \param[out] pConfigLen - The length of the allocated memory as input, when the
dflet 3:a8c249046181 1172 function complete, the value of this parameter would be
dflet 3:a8c249046181 1173 the len that actually read from the device.
dflet 3:a8c249046181 1174 If the device return length that is longer from the input
dflet 3:a8c249046181 1175 value, the function will cut the end of the returned structure
dflet 3:a8c249046181 1176 and will return SL_ESMALLBUF.
dflet 3:a8c249046181 1177
dflet 3:a8c249046181 1178
dflet 3:a8c249046181 1179 \param[out] pValues - get configurations values
dflet 3:a8c249046181 1180
dflet 3:a8c249046181 1181 \sa sl_WlanSet
dflet 3:a8c249046181 1182
dflet 3:a8c249046181 1183 \note
dflet 3:a8c249046181 1184
dflet 3:a8c249046181 1185 \warning
dflet 3:a8c249046181 1186
dflet 3:a8c249046181 1187 \par Examples:
dflet 3:a8c249046181 1188 \par
dflet 3:a8c249046181 1189 <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS: </b>
dflet 3:a8c249046181 1190 \code
dflet 3:a8c249046181 1191 slWlanScanParamCommand_t ScanParamConfig;
dflet 3:a8c249046181 1192 uint16_t Option = WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS;
dflet 3:a8c249046181 1193 uint16_t OptionLen = sizeof(slWlanScanParamCommand_t);
dflet 3:a8c249046181 1194 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(uint8_t *)&ScanParamConfig);
dflet 3:a8c249046181 1195 \endcode
dflet 3:a8c249046181 1196 \par
dflet 3:a8c249046181 1197 <b> WLAN_GENERAL_PARAM_OPT_AP_TX_POWER: </b>
dflet 3:a8c249046181 1198 \code
dflet 3:a8c249046181 1199 _i8 TXPower = 0;
dflet 3:a8c249046181 1200 _u16 Option = WLAN_GENERAL_PARAM_OPT_AP_TX_POWER;
dflet 3:a8c249046181 1201 _u16 OptionLen = sizeof(_i8);
dflet 3:a8c249046181 1202 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower);
dflet 3:a8c249046181 1203 \endcode
dflet 3:a8c249046181 1204 \par
dflet 3:a8c249046181 1205 <b> WLAN_GENERAL_PARAM_OPT_STA_TX_POWER: </b>
dflet 3:a8c249046181 1206 \code
dflet 3:a8c249046181 1207 _i8 TXPower = 0;
dflet 3:a8c249046181 1208 _u16 Option = WLAN_GENERAL_PARAM_OPT_STA_TX_POWER;
dflet 3:a8c249046181 1209 _u16 OptionLen = sizeof(_i8);
dflet 3:a8c249046181 1210
dflet 3:a8c249046181 1211 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(uint8_t *)&TXPower);
dflet 3:a8c249046181 1212 \endcode
dflet 3:a8c249046181 1213 \par
dflet 3:a8c249046181 1214 <b> WLAN_P2P_OPT_DEV_TYPE: </b>
dflet 3:a8c249046181 1215 \code
dflet 3:a8c249046181 1216 int8_t device_type[18];
dflet 3:a8c249046181 1217 uint16_t len = 18;
dflet 3:a8c249046181 1218 uint16_t config_opt = WLAN_P2P_OPT_DEV_TYPE;
dflet 3:a8c249046181 1219 sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt , &len, (uint8_t* )device_type);
dflet 3:a8c249046181 1220 \endcode
dflet 3:a8c249046181 1221 \par
dflet 3:a8c249046181 1222 <b> WLAN_AP_OPT_SSID: </b>
dflet 3:a8c249046181 1223 \code
dflet 3:a8c249046181 1224 int8_t ssid[32];
dflet 3:a8c249046181 1225 uint16_t len = 32;
dflet 3:a8c249046181 1226 uint16_t config_opt = WLAN_AP_OPT_SSID;
dflet 3:a8c249046181 1227 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt , &len, (uint8_t* )ssid);
dflet 3:a8c249046181 1228 \endcode
dflet 3:a8c249046181 1229 \par
dflet 3:a8c249046181 1230 <b> WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE: </b>
dflet 3:a8c249046181 1231 \code
dflet 3:a8c249046181 1232 int8_t country[3];
dflet 3:a8c249046181 1233 uint16_t len = 3;
dflet 3:a8c249046181 1234 uint16_t config_opt = WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE;
dflet 3:a8c249046181 1235 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID, &config_opt, &len, (uint8_t* )country);
dflet 3:a8c249046181 1236 \endcode
dflet 3:a8c249046181 1237 \par
dflet 3:a8c249046181 1238 <b> WLAN_AP_OPT_CHANNEL: </b>
dflet 3:a8c249046181 1239 \code
dflet 3:a8c249046181 1240 int8_t channel;
dflet 3:a8c249046181 1241 uint16_t len = 1;
dflet 3:a8c249046181 1242 uint16_t config_opt = WLAN_AP_OPT_CHANNEL;
dflet 3:a8c249046181 1243 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )&channel);
dflet 3:a8c249046181 1244 \endcode
dflet 3:a8c249046181 1245 \par
dflet 3:a8c249046181 1246 <b> WLAN_AP_OPT_HIDDEN_SSID: </b>
dflet 3:a8c249046181 1247 \code
dflet 3:a8c249046181 1248 uint8_t hidden;
dflet 3:a8c249046181 1249 uint16_t len = 1;
dflet 3:a8c249046181 1250 uint16_t config_opt = WLAN_AP_OPT_HIDDEN_SSID;
dflet 3:a8c249046181 1251 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )&hidden);
dflet 3:a8c249046181 1252 \endcode
dflet 3:a8c249046181 1253 \par
dflet 3:a8c249046181 1254 <b> WLAN_AP_OPT_SECURITY_TYPE: </b>
dflet 3:a8c249046181 1255 \code
dflet 3:a8c249046181 1256 uint8_t sec_type;
dflet 3:a8c249046181 1257 uint16_t len = 1;
dflet 3:a8c249046181 1258 uint16_t config_opt = WLAN_AP_OPT_SECURITY_TYPE;
dflet 3:a8c249046181 1259 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )&sec_type);
dflet 3:a8c249046181 1260 \endcode
dflet 3:a8c249046181 1261 \par
dflet 3:a8c249046181 1262 <b> WLAN_AP_OPT_PASSWORD: </b>
dflet 3:a8c249046181 1263 \code
dflet 3:a8c249046181 1264 uint8_t password[64];
dflet 3:a8c249046181 1265 uint16_t len = 64;
dflet 3:a8c249046181 1266 memset(password,0,64);
dflet 3:a8c249046181 1267 uint16_t config_opt = WLAN_AP_OPT_PASSWORD;
dflet 3:a8c249046181 1268 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )password);
dflet 3:a8c249046181 1269
dflet 3:a8c249046181 1270 \endcode
dflet 3:a8c249046181 1271 \par
dflet 3:a8c249046181 1272 <b> WLAN_P2P_OPT_CHANNEL_N_REGS: </b>
dflet 3:a8c249046181 1273 \code
dflet 3:a8c249046181 1274 uint16_t listen_channel,listen_reg,oper_channel,oper_reg;
dflet 3:a8c249046181 1275 uint16_t len = 4;
dflet 3:a8c249046181 1276 uint16_t config_opt = WLAN_P2P_OPT_CHANNEL_N_REGS;
dflet 3:a8c249046181 1277 uint8_t channel_n_regs[4];
dflet 3:a8c249046181 1278 sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt, &len, (uint8_t* )channel_n_regs);
dflet 3:a8c249046181 1279 listen_channel = channel_n_regs[0];
dflet 3:a8c249046181 1280 listen_reg = channel_n_regs[1];
dflet 3:a8c249046181 1281 oper_channel = channel_n_regs[2];
dflet 3:a8c249046181 1282 oper_reg = channel_n_regs[3];
dflet 3:a8c249046181 1283 \endcode
dflet 3:a8c249046181 1284 */
dflet 3:a8c249046181 1285
dflet 3:a8c249046181 1286 #if _SL_INCLUDE_FUNC(sl_WlanGet)
dflet 3:a8c249046181 1287 int16_t sl_WlanGet(const uint16_t ConfigId, uint16_t *pConfigOpt,uint16_t *pConfigLen, uint8_t *pValues);
dflet 3:a8c249046181 1288 #endif
dflet 3:a8c249046181 1289
dflet 3:a8c249046181 1290 private:
dflet 3:a8c249046181 1291
dflet 3:a8c249046181 1292 cc3100_driver &_driver;
dflet 3:a8c249046181 1293 cc3100_wlan_rx_filters &_wlan_filters;
dflet 3:a8c249046181 1294
dflet 3:a8c249046181 1295 /*!
dflet 3:a8c249046181 1296
dflet 3:a8c249046181 1297 Close the Doxygen group.
dflet 3:a8c249046181 1298 @}
dflet 3:a8c249046181 1299
dflet 3:a8c249046181 1300 */
dflet 3:a8c249046181 1301
dflet 3:a8c249046181 1302 };//class
dflet 3:a8c249046181 1303
dflet 3:a8c249046181 1304 }//namespace mbed_cc3100
dflet 3:a8c249046181 1305
dflet 3:a8c249046181 1306 #endif /* __WLAN_H__ */
dflet 3:a8c249046181 1307
dflet 3:a8c249046181 1308