A Port of TI's Webserver for the CC3000

Dependencies:   mbed

Committer:
dflet
Date:
Mon Sep 16 18:37:14 2013 +0000
Revision:
2:e6a185df9e4c
Parent:
0:6ad60d78b315
ADC and Leds now work on board and config.html page.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 0:6ad60d78b315 1 /*****************************************************************************
dflet 0:6ad60d78b315 2 *
dflet 0:6ad60d78b315 3 * wlan.h - CC3000 Host Driver Implementation.
dflet 0:6ad60d78b315 4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
dflet 0:6ad60d78b315 5 *
dflet 0:6ad60d78b315 6 * Redistribution and use in source and binary forms, with or without
dflet 0:6ad60d78b315 7 * modification, are permitted provided that the following conditions
dflet 0:6ad60d78b315 8 * are met:
dflet 0:6ad60d78b315 9 *
dflet 0:6ad60d78b315 10 * Redistributions of source code must retain the above copyright
dflet 0:6ad60d78b315 11 * notice, this list of conditions and the following disclaimer.
dflet 0:6ad60d78b315 12 *
dflet 0:6ad60d78b315 13 * Redistributions in binary form must reproduce the above copyright
dflet 0:6ad60d78b315 14 * notice, this list of conditions and the following disclaimer in the
dflet 0:6ad60d78b315 15 * documentation and/or other materials provided with the
dflet 0:6ad60d78b315 16 * distribution.
dflet 0:6ad60d78b315 17 *
dflet 0:6ad60d78b315 18 * Neither the name of Texas Instruments Incorporated nor the names of
dflet 0:6ad60d78b315 19 * its contributors may be used to endorse or promote products derived
dflet 0:6ad60d78b315 20 * from this software without specific prior written permission.
dflet 0:6ad60d78b315 21 *
dflet 0:6ad60d78b315 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dflet 0:6ad60d78b315 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dflet 0:6ad60d78b315 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
dflet 0:6ad60d78b315 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
dflet 0:6ad60d78b315 26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dflet 0:6ad60d78b315 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dflet 0:6ad60d78b315 28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
dflet 0:6ad60d78b315 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
dflet 0:6ad60d78b315 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
dflet 0:6ad60d78b315 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
dflet 0:6ad60d78b315 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dflet 0:6ad60d78b315 33 *
dflet 0:6ad60d78b315 34 *****************************************************************************/
dflet 0:6ad60d78b315 35 #ifndef __WLAN_H__
dflet 0:6ad60d78b315 36 #define __WLAN_H__
dflet 0:6ad60d78b315 37
dflet 0:6ad60d78b315 38 #include "cc3000_common.h"
dflet 0:6ad60d78b315 39
dflet 0:6ad60d78b315 40 //*****************************************************************************
dflet 0:6ad60d78b315 41 //
dflet 0:6ad60d78b315 42 // If building with a C++ compiler, make all of the definitions in this header
dflet 0:6ad60d78b315 43 // have a C binding.
dflet 0:6ad60d78b315 44 //
dflet 0:6ad60d78b315 45 //*****************************************************************************
dflet 0:6ad60d78b315 46 #ifdef __cplusplus
dflet 0:6ad60d78b315 47 extern "C" {
dflet 0:6ad60d78b315 48 #endif
dflet 0:6ad60d78b315 49
dflet 0:6ad60d78b315 50 #define WLAN_SEC_UNSEC (0)
dflet 0:6ad60d78b315 51 #define WLAN_SEC_WEP (1)
dflet 0:6ad60d78b315 52 #define WLAN_SEC_WPA (2)
dflet 0:6ad60d78b315 53 #define WLAN_SEC_WPA2 (3)
dflet 0:6ad60d78b315 54 //*****************************************************************************
dflet 0:6ad60d78b315 55 //
dflet 0:6ad60d78b315 56 //! \addtogroup wlan_api
dflet 0:6ad60d78b315 57 //! @{
dflet 0:6ad60d78b315 58 //
dflet 0:6ad60d78b315 59 //*****************************************************************************
dflet 0:6ad60d78b315 60
dflet 0:6ad60d78b315 61
dflet 0:6ad60d78b315 62 //*****************************************************************************
dflet 0:6ad60d78b315 63 //
dflet 0:6ad60d78b315 64 //! wlan_init
dflet 0:6ad60d78b315 65 //!
dflet 0:6ad60d78b315 66 //! @param sWlanCB Asynchronous events callback.
dflet 0:6ad60d78b315 67 //! 0 no event call back.
dflet 0:6ad60d78b315 68 //! -call back parameters:
dflet 0:6ad60d78b315 69 //! 1) event_type: HCI_EVNT_WLAN_UNSOL_CONNECT connect event,
dflet 0:6ad60d78b315 70 //! HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event,
dflet 0:6ad60d78b315 71 //! HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE config done,
dflet 0:6ad60d78b315 72 //! HCI_EVNT_WLAN_UNSOL_DHCP dhcp report,
dflet 0:6ad60d78b315 73 //! HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report OR
dflet 0:6ad60d78b315 74 //! HCI_EVNT_WLAN_KEEPALIVE keepalive.
dflet 0:6ad60d78b315 75 //! 2) data: pointer to extra data that received by the event
dflet 0:6ad60d78b315 76 //! (NULL no data).
dflet 0:6ad60d78b315 77 //! 3) length: data length.
dflet 0:6ad60d78b315 78 //! -Events with extra data:
dflet 0:6ad60d78b315 79 //! HCI_EVNT_WLAN_UNSOL_DHCP: 4 bytes IP, 4 bytes Mask,
dflet 0:6ad60d78b315 80 //! 4 bytes default gateway, 4 bytes DHCP server and 4 bytes
dflet 0:6ad60d78b315 81 //! for DNS server.
dflet 0:6ad60d78b315 82 //! HCI_EVNT_WLAN_ASYNC_PING_REPORT: 4 bytes Packets sent,
dflet 0:6ad60d78b315 83 //! 4 bytes Packets received, 4 bytes Min round time,
dflet 0:6ad60d78b315 84 //! 4 bytes Max round time and 4 bytes for Avg round time.
dflet 0:6ad60d78b315 85 //!
dflet 0:6ad60d78b315 86 //! @param sFWPatches 0 no patch or pointer to FW patches
dflet 0:6ad60d78b315 87 //! @param sDriverPatches 0 no patch or pointer to driver patches
dflet 0:6ad60d78b315 88 //! @param sBootLoaderPatches 0 no patch or pointer to bootloader patches
dflet 0:6ad60d78b315 89 //! @param sReadWlanInterruptPin init callback. the callback read wlan
dflet 0:6ad60d78b315 90 //! interrupt status.
dflet 0:6ad60d78b315 91 //! @param sWlanInterruptEnable init callback. the callback enable wlan
dflet 0:6ad60d78b315 92 //! interrupt.
dflet 0:6ad60d78b315 93 //! @param sWlanInterruptDisable init callback. the callback disable wlan
dflet 0:6ad60d78b315 94 //! interrupt.
dflet 0:6ad60d78b315 95 //! @param sWriteWlanPin init callback. the callback write value
dflet 0:6ad60d78b315 96 //! to device pin.
dflet 0:6ad60d78b315 97 //!
dflet 0:6ad60d78b315 98 //! @return none
dflet 0:6ad60d78b315 99 //!
dflet 0:6ad60d78b315 100 //! @sa wlan_set_event_mask , wlan_start , wlan_stop
dflet 0:6ad60d78b315 101 //!
dflet 0:6ad60d78b315 102 //! @brief Initialize wlan driver
dflet 0:6ad60d78b315 103 //!
dflet 0:6ad60d78b315 104 //! @warning This function must be called before ANY other wlan driver function
dflet 0:6ad60d78b315 105 //
dflet 0:6ad60d78b315 106 //*****************************************************************************
dflet 0:6ad60d78b315 107 extern void wlan_init( tWlanCB sWlanCB,
dflet 0:6ad60d78b315 108 tFWPatches sFWPatches,
dflet 0:6ad60d78b315 109 tDriverPatches sDriverPatches,
dflet 0:6ad60d78b315 110 tBootLoaderPatches sBootLoaderPatches,
dflet 0:6ad60d78b315 111 tWlanReadInteruptPin sReadWlanInterruptPin,
dflet 0:6ad60d78b315 112 tWlanInterruptEnable sWlanInterruptEnable,
dflet 0:6ad60d78b315 113 tWlanInterruptDisable sWlanInterruptDisable,
dflet 0:6ad60d78b315 114 tWriteWlanPin sWriteWlanPin);
dflet 0:6ad60d78b315 115
dflet 0:6ad60d78b315 116
dflet 0:6ad60d78b315 117
dflet 0:6ad60d78b315 118 //*****************************************************************************
dflet 0:6ad60d78b315 119 //
dflet 0:6ad60d78b315 120 //! wlan_start
dflet 0:6ad60d78b315 121 //!
dflet 0:6ad60d78b315 122 //! @param usPatchesAvailableAtHost - flag to indicate if patches available
dflet 0:6ad60d78b315 123 //! from host or from EEPROM. Due to the
dflet 0:6ad60d78b315 124 //! fact the patches are burn to the EEPROM
dflet 0:6ad60d78b315 125 //! using the patch programmer utility, the
dflet 0:6ad60d78b315 126 //! patches will be available from the EEPROM
dflet 0:6ad60d78b315 127 //! and not from the host.
dflet 0:6ad60d78b315 128 //!
dflet 0:6ad60d78b315 129 //! @return none
dflet 0:6ad60d78b315 130 //!
dflet 0:6ad60d78b315 131 //! @brief Start WLAN device. This function asserts the enable pin of
dflet 0:6ad60d78b315 132 //! the device (WLAN_EN), starting the HW initialization process.
dflet 0:6ad60d78b315 133 //! The function blocked until device Initialization is completed.
dflet 0:6ad60d78b315 134 //! Function also configure patches (FW, driver or bootloader)
dflet 0:6ad60d78b315 135 //! and calls appropriate device callbacks.
dflet 0:6ad60d78b315 136 //!
dflet 0:6ad60d78b315 137 //! @Note Prior calling the function wlan_init shall be called.
dflet 0:6ad60d78b315 138 //! @Warning This function must be called after wlan_init and before any
dflet 0:6ad60d78b315 139 //! other wlan API
dflet 0:6ad60d78b315 140 //! @sa wlan_init , wlan_stop
dflet 0:6ad60d78b315 141 //!
dflet 0:6ad60d78b315 142 //
dflet 0:6ad60d78b315 143 //*****************************************************************************
dflet 0:6ad60d78b315 144 extern void wlan_start(unsigned short usPatchesAvailableAtHost);
dflet 0:6ad60d78b315 145
dflet 0:6ad60d78b315 146 //*****************************************************************************
dflet 0:6ad60d78b315 147 //
dflet 0:6ad60d78b315 148 //! wlan_stop
dflet 0:6ad60d78b315 149 //!
dflet 0:6ad60d78b315 150 //! @param none
dflet 0:6ad60d78b315 151 //!
dflet 0:6ad60d78b315 152 //! @return none
dflet 0:6ad60d78b315 153 //!
dflet 0:6ad60d78b315 154 //! @brief Stop WLAN device by putting it into reset state.
dflet 0:6ad60d78b315 155 //!
dflet 0:6ad60d78b315 156 //! @sa wlan_start
dflet 0:6ad60d78b315 157 //
dflet 0:6ad60d78b315 158 //*****************************************************************************
dflet 0:6ad60d78b315 159 extern void wlan_stop(void);
dflet 0:6ad60d78b315 160
dflet 0:6ad60d78b315 161 //*****************************************************************************
dflet 0:6ad60d78b315 162 //
dflet 0:6ad60d78b315 163 //! wlan_connect
dflet 0:6ad60d78b315 164 //!
dflet 0:6ad60d78b315 165 //! @param sec_type security options:
dflet 0:6ad60d78b315 166 //! WLAN_SEC_UNSEC,
dflet 0:6ad60d78b315 167 //! WLAN_SEC_WEP (ASCII support only),
dflet 0:6ad60d78b315 168 //! WLAN_SEC_WPA or WLAN_SEC_WPA2
dflet 0:6ad60d78b315 169 //! @param ssid up to 32 bytes and is ASCII SSID of the AP
dflet 0:6ad60d78b315 170 //! @param ssid_len length of the SSID
dflet 0:6ad60d78b315 171 //! @param bssid 6 bytes specified the AP bssid
dflet 0:6ad60d78b315 172 //! @param key up to 16 bytes specified the AP security key
dflet 0:6ad60d78b315 173 //! @param key_len key length
dflet 0:6ad60d78b315 174 //!
dflet 0:6ad60d78b315 175 //! @return On success, zero is returned. On error, negative is returned.
dflet 0:6ad60d78b315 176 //! Note that even though a zero is returned on success to trigger
dflet 0:6ad60d78b315 177 //! connection operation, it does not mean that CCC3000 is already
dflet 0:6ad60d78b315 178 //! connected. An asynchronous "Connected" event is generated when
dflet 0:6ad60d78b315 179 //! actual association process finishes and CC3000 is connected to
dflet 0:6ad60d78b315 180 //! the AP. If DHCP is set, An asynchronous "DHCP" event is
dflet 0:6ad60d78b315 181 //! generated when DHCP process is finish.
dflet 0:6ad60d78b315 182 //!
dflet 0:6ad60d78b315 183 //!
dflet 0:6ad60d78b315 184 //! @brief Connect to AP
dflet 0:6ad60d78b315 185 //! @warning Please Note that when connection to AP configured with security
dflet 0:6ad60d78b315 186 //! type WEP, please confirm that the key is set as ASCII and not
dflet 0:6ad60d78b315 187 //! as HEX.
dflet 0:6ad60d78b315 188 //! @sa wlan_disconnect
dflet 0:6ad60d78b315 189 //
dflet 0:6ad60d78b315 190 //*****************************************************************************
dflet 0:6ad60d78b315 191 #ifndef CC3000_TINY_DRIVER
dflet 0:6ad60d78b315 192 extern long wlan_connect(unsigned long ulSecType, char *ssid, long ssid_len,
dflet 0:6ad60d78b315 193 unsigned char *bssid, unsigned char *key, long key_len);
dflet 0:6ad60d78b315 194 #else
dflet 0:6ad60d78b315 195 extern long wlan_connect(char *ssid, long ssid_len);
dflet 0:6ad60d78b315 196
dflet 0:6ad60d78b315 197 #endif
dflet 0:6ad60d78b315 198
dflet 0:6ad60d78b315 199 //*****************************************************************************
dflet 0:6ad60d78b315 200 //
dflet 0:6ad60d78b315 201 //! wlan_disconnect
dflet 0:6ad60d78b315 202 //!
dflet 0:6ad60d78b315 203 //! @return 0 disconnected done, other CC3000 already disconnected
dflet 0:6ad60d78b315 204 //!
dflet 0:6ad60d78b315 205 //! @brief Disconnect connection from AP.
dflet 0:6ad60d78b315 206 //!
dflet 0:6ad60d78b315 207 //! @sa wlan_connect
dflet 0:6ad60d78b315 208 //
dflet 0:6ad60d78b315 209 //*****************************************************************************
dflet 0:6ad60d78b315 210
dflet 0:6ad60d78b315 211 extern long wlan_disconnect(void);
dflet 0:6ad60d78b315 212
dflet 0:6ad60d78b315 213 //*****************************************************************************
dflet 0:6ad60d78b315 214 //
dflet 0:6ad60d78b315 215 //! wlan_add_profile
dflet 0:6ad60d78b315 216 //!
dflet 0:6ad60d78b315 217 //! @param ulSecType WLAN_SEC_UNSEC,WLAN_SEC_WEP,WLAN_SEC_WPA,WLAN_SEC_WPA2
dflet 0:6ad60d78b315 218 //! @param ucSsid ssid SSID up to 32 bytes
dflet 0:6ad60d78b315 219 //! @param ulSsidLen ssid length
dflet 0:6ad60d78b315 220 //! @param ucBssid bssid 6 bytes
dflet 0:6ad60d78b315 221 //! @param ulPriority ulPriority profile priority. Lowest priority:0.
dflet 0:6ad60d78b315 222 //! @param ulPairwiseCipher_Or_TxKeyLen key length for WEP security
dflet 0:6ad60d78b315 223 //! @param ulGroupCipher_TxKeyIndex key index
dflet 0:6ad60d78b315 224 //! @param ulKeyMgmt KEY management
dflet 0:6ad60d78b315 225 //! @param ucPf_OrKey security key
dflet 0:6ad60d78b315 226 //! @param ulPassPhraseLen security key length for WPA\WPA2
dflet 0:6ad60d78b315 227 //!
dflet 0:6ad60d78b315 228 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 229 //!
dflet 0:6ad60d78b315 230 //! @brief When auto start is enabled, the device connects to
dflet 0:6ad60d78b315 231 //! station from the profiles table. Up to 7 profiles are supported.
dflet 0:6ad60d78b315 232 //! If several profiles configured the device choose the highest
dflet 0:6ad60d78b315 233 //! priority profile, within each priority group, device will choose
dflet 0:6ad60d78b315 234 //! profile based on security policy, signal strength, etc
dflet 0:6ad60d78b315 235 //! parameters. All the profiles are stored in CC3000 NVMEM.
dflet 0:6ad60d78b315 236 //!
dflet 0:6ad60d78b315 237 //! @sa wlan_ioctl_del_profile
dflet 0:6ad60d78b315 238 //
dflet 0:6ad60d78b315 239 //*****************************************************************************
dflet 0:6ad60d78b315 240
dflet 0:6ad60d78b315 241 extern long wlan_add_profile(unsigned long ulSecType, unsigned char* ucSsid,
dflet 0:6ad60d78b315 242 unsigned long ulSsidLen,
dflet 0:6ad60d78b315 243 unsigned char *ucBssid,
dflet 0:6ad60d78b315 244 unsigned long ulPriority,
dflet 0:6ad60d78b315 245 unsigned long ulPairwiseCipher_Or_Key,
dflet 0:6ad60d78b315 246 unsigned long ulGroupCipher_TxKeyLen,
dflet 0:6ad60d78b315 247 unsigned long ulKeyMgmt,
dflet 0:6ad60d78b315 248 unsigned char* ucPf_OrKey,
dflet 0:6ad60d78b315 249 unsigned long ulPassPhraseLen);
dflet 0:6ad60d78b315 250
dflet 0:6ad60d78b315 251
dflet 0:6ad60d78b315 252
dflet 0:6ad60d78b315 253 //*****************************************************************************
dflet 0:6ad60d78b315 254 //
dflet 0:6ad60d78b315 255 //! wlan_ioctl_del_profile
dflet 0:6ad60d78b315 256 //!
dflet 0:6ad60d78b315 257 //! @param index number of profile to delete
dflet 0:6ad60d78b315 258 //!
dflet 0:6ad60d78b315 259 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 260 //!
dflet 0:6ad60d78b315 261 //! @brief Delete WLAN profile
dflet 0:6ad60d78b315 262 //!
dflet 0:6ad60d78b315 263 //! @Note In order to delete all stored profile, set index to 255.
dflet 0:6ad60d78b315 264 //!
dflet 0:6ad60d78b315 265 //! @sa wlan_add_profile
dflet 0:6ad60d78b315 266 //
dflet 0:6ad60d78b315 267 //*****************************************************************************
dflet 0:6ad60d78b315 268 extern long wlan_ioctl_del_profile(unsigned long ulIndex);
dflet 0:6ad60d78b315 269
dflet 0:6ad60d78b315 270 //*****************************************************************************
dflet 0:6ad60d78b315 271 //
dflet 0:6ad60d78b315 272 //! wlan_set_event_mask
dflet 0:6ad60d78b315 273 //!
dflet 0:6ad60d78b315 274 //! @param mask mask option:
dflet 0:6ad60d78b315 275 //! HCI_EVNT_WLAN_UNSOL_CONNECT connect event
dflet 0:6ad60d78b315 276 //! HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event
dflet 0:6ad60d78b315 277 //! HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE smart config done
dflet 0:6ad60d78b315 278 //! HCI_EVNT_WLAN_UNSOL_INIT init done
dflet 0:6ad60d78b315 279 //! HCI_EVNT_WLAN_UNSOL_DHCP dhcp event report
dflet 0:6ad60d78b315 280 //! HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report
dflet 0:6ad60d78b315 281 //! HCI_EVNT_WLAN_KEEPALIVE keepalive
dflet 0:6ad60d78b315 282 //! HCI_EVNT_WLAN_TX_COMPLETE - disable information on end of transmission
dflet 0:6ad60d78b315 283 //! Saved: no.
dflet 0:6ad60d78b315 284 //!
dflet 0:6ad60d78b315 285 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 286 //!
dflet 0:6ad60d78b315 287 //! @brief Mask event according to bit mask. In case that event is
dflet 0:6ad60d78b315 288 //! masked (1), the device will not send the masked event to host.
dflet 0:6ad60d78b315 289 //
dflet 0:6ad60d78b315 290 //*****************************************************************************
dflet 0:6ad60d78b315 291 extern long wlan_set_event_mask(unsigned long ulMask);
dflet 0:6ad60d78b315 292
dflet 0:6ad60d78b315 293 //*****************************************************************************
dflet 0:6ad60d78b315 294 //
dflet 0:6ad60d78b315 295 //! wlan_ioctl_statusget
dflet 0:6ad60d78b315 296 //!
dflet 0:6ad60d78b315 297 //! @param none
dflet 0:6ad60d78b315 298 //!
dflet 0:6ad60d78b315 299 //! @return WLAN_STATUS_DISCONNECTED, WLAN_STATUS_SCANING,
dflet 0:6ad60d78b315 300 //! STATUS_CONNECTING or WLAN_STATUS_CONNECTED
dflet 0:6ad60d78b315 301 //!
dflet 0:6ad60d78b315 302 //! @brief get wlan status: disconnected, scanning, connecting or connected
dflet 0:6ad60d78b315 303 //
dflet 0:6ad60d78b315 304 //*****************************************************************************
dflet 0:6ad60d78b315 305 extern long wlan_ioctl_statusget(void);
dflet 0:6ad60d78b315 306
dflet 0:6ad60d78b315 307
dflet 0:6ad60d78b315 308 //*****************************************************************************
dflet 0:6ad60d78b315 309 //
dflet 0:6ad60d78b315 310 //! wlan_ioctl_set_connection_policy
dflet 0:6ad60d78b315 311 //!
dflet 0:6ad60d78b315 312 //! @param should_connect_to_open_ap enable(1), disable(0) connect to any
dflet 0:6ad60d78b315 313 //! available AP. This parameter corresponds to the configuration of
dflet 0:6ad60d78b315 314 //! item # 3 in the brief description.
dflet 0:6ad60d78b315 315 //! @param should_use_fast_connect enable(1), disable(0). if enabled, tries
dflet 0:6ad60d78b315 316 //! to connect to the last connected AP. This parameter corresponds
dflet 0:6ad60d78b315 317 //! to the configuration of item # 1 in the brief description.
dflet 0:6ad60d78b315 318 //! @param auto_start enable(1), disable(0) auto connect
dflet 0:6ad60d78b315 319 //! after reset and periodically reconnect if needed. This
dflet 0:6ad60d78b315 320 //! configuration configures option 2 in the above description.
dflet 0:6ad60d78b315 321 //!
dflet 0:6ad60d78b315 322 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 323 //!
dflet 0:6ad60d78b315 324 //! @brief When auto is enabled, the device tries to connect according
dflet 0:6ad60d78b315 325 //! the following policy:
dflet 0:6ad60d78b315 326 //! 1) If fast connect is enabled and last connection is valid,
dflet 0:6ad60d78b315 327 //! the device will try to connect to it without the scanning
dflet 0:6ad60d78b315 328 //! procedure (fast). The last connection will be marked as
dflet 0:6ad60d78b315 329 //! invalid, due to adding/removing profile.
dflet 0:6ad60d78b315 330 //! 2) If profile exists, the device will try to connect it
dflet 0:6ad60d78b315 331 //! (Up to seven profiles).
dflet 0:6ad60d78b315 332 //! 3) If fast and profiles are not found, and open mode is
dflet 0:6ad60d78b315 333 //! enabled, the device will try to connect to any AP.
dflet 0:6ad60d78b315 334 //! * Note that the policy settings are stored in the CC3000 NVMEM.
dflet 0:6ad60d78b315 335 //!
dflet 0:6ad60d78b315 336 //! @sa wlan_add_profile , wlan_ioctl_del_profile
dflet 0:6ad60d78b315 337 //
dflet 0:6ad60d78b315 338 //*****************************************************************************
dflet 0:6ad60d78b315 339 extern long wlan_ioctl_set_connection_policy(
dflet 0:6ad60d78b315 340 unsigned long should_connect_to_open_ap,
dflet 0:6ad60d78b315 341 unsigned long should_use_fast_connect,
dflet 0:6ad60d78b315 342 unsigned long ulUseProfiles);
dflet 0:6ad60d78b315 343
dflet 0:6ad60d78b315 344 //*****************************************************************************
dflet 0:6ad60d78b315 345 //
dflet 0:6ad60d78b315 346 //! wlan_ioctl_get_scan_results
dflet 0:6ad60d78b315 347 //!
dflet 0:6ad60d78b315 348 //! @param[in] scan_timeout parameter not supported
dflet 0:6ad60d78b315 349 //! @param[out] ucResults scan result (_wlan_full_scan_results_args_t)
dflet 0:6ad60d78b315 350 //!
dflet 0:6ad60d78b315 351 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 352 //!
dflet 0:6ad60d78b315 353 //! @brief Gets entry from scan result table.
dflet 0:6ad60d78b315 354 //! The scan results are returned one by one, and each entry
dflet 0:6ad60d78b315 355 //! represents a single AP found in the area. The following is a
dflet 0:6ad60d78b315 356 //! format of the scan result:
dflet 0:6ad60d78b315 357 //! - 4 Bytes: number of networks found
dflet 0:6ad60d78b315 358 //! - 4 Bytes: The status of the scan: 0 - aged results,
dflet 0:6ad60d78b315 359 //! 1 - results valid, 2 - no results
dflet 0:6ad60d78b315 360 //! - 42 bytes: Result entry, where the bytes are arranged as follows:
dflet 0:6ad60d78b315 361 //!
dflet 0:6ad60d78b315 362 //! - 1 bit isValid - is result valid or not
dflet 0:6ad60d78b315 363 //! - 7 bits rssi - RSSI value;
dflet 0:6ad60d78b315 364 //! - 2 bits: securityMode - security mode of the AP:
dflet 0:6ad60d78b315 365 //! 0 - Open, 1 - WEP, 2 WPA, 3 WPA2
dflet 0:6ad60d78b315 366 //! - 6 bits: SSID name length
dflet 0:6ad60d78b315 367 //! - 2 bytes: the time at which the entry has entered into
dflet 0:6ad60d78b315 368 //! scans result table
dflet 0:6ad60d78b315 369 //! - 32 bytes: SSID name
dflet 0:6ad60d78b315 370 //! - 6 bytes: BSSID
dflet 0:6ad60d78b315 371 //!
dflet 0:6ad60d78b315 372 //! @Note scan_timeout, is not supported on this version.
dflet 0:6ad60d78b315 373 //!
dflet 0:6ad60d78b315 374 //! @sa wlan_ioctl_set_scan_params
dflet 0:6ad60d78b315 375 //
dflet 0:6ad60d78b315 376 //*****************************************************************************
dflet 0:6ad60d78b315 377
dflet 0:6ad60d78b315 378
dflet 0:6ad60d78b315 379 extern long wlan_ioctl_get_scan_results(unsigned long ulScanTimeout,
dflet 0:6ad60d78b315 380 unsigned char *ucResults);
dflet 0:6ad60d78b315 381
dflet 0:6ad60d78b315 382 //*****************************************************************************
dflet 0:6ad60d78b315 383 //
dflet 0:6ad60d78b315 384 //! wlan_ioctl_set_scan_params
dflet 0:6ad60d78b315 385 //!
dflet 0:6ad60d78b315 386 //! @param uiEnable - start/stop application scan:
dflet 0:6ad60d78b315 387 //! 1 = start scan with default interval value of 10 min.
dflet 0:6ad60d78b315 388 //! in order to set a different scan interval value apply the value
dflet 0:6ad60d78b315 389 //! in milliseconds. minimum 1 second. 0=stop). Wlan reset
dflet 0:6ad60d78b315 390 //! (wlan_stop() wlan_start()) is needed when changing scan interval
dflet 0:6ad60d78b315 391 //! value. Saved: No
dflet 0:6ad60d78b315 392 //! @param uiMinDwellTime minimum dwell time value to be used for each
dflet 0:6ad60d78b315 393 //! channel, in milliseconds. Saved: yes
dflet 0:6ad60d78b315 394 //! Recommended Value: 100 (Default: 20)
dflet 0:6ad60d78b315 395 //! @param uiMaxDwellTime maximum dwell time value to be used for each
dflet 0:6ad60d78b315 396 //! channel, in milliseconds. Saved: yes
dflet 0:6ad60d78b315 397 //! Recommended Value: 100 (Default: 30)
dflet 0:6ad60d78b315 398 //! @param uiNumOfProbeRequests max probe request between dwell time.
dflet 0:6ad60d78b315 399 //! Saved: yes. Recommended Value: 5 (Default:2)
dflet 0:6ad60d78b315 400 //! @param uiChannelMask bitwise, up to 13 channels (0x1fff).
dflet 0:6ad60d78b315 401 //! Saved: yes. Default: 0x7ff
dflet 0:6ad60d78b315 402 //! @param uiRSSIThreshold RSSI threshold. Saved: yes (Default: -80)
dflet 0:6ad60d78b315 403 //! @param uiSNRThreshold NSR threshold. Saved: yes (Default: 0)
dflet 0:6ad60d78b315 404 //! @param uiDefaultTxPower probe Tx power. Saved: yes (Default: 205)
dflet 0:6ad60d78b315 405 //! @param aiIntervalList pointer to array with 16 entries (16 channels)
dflet 0:6ad60d78b315 406 //! each entry (unsigned long) holds timeout between periodic scan
dflet 0:6ad60d78b315 407 //! (connection scan) - in milliseconds. Saved: yes. Default 2000ms.
dflet 0:6ad60d78b315 408 //!
dflet 0:6ad60d78b315 409 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 410 //!
dflet 0:6ad60d78b315 411 //! @brief start and stop scan procedure. Set scan parameters.
dflet 0:6ad60d78b315 412 //!
dflet 0:6ad60d78b315 413 //! @Note uiDefaultTxPower, is not supported on this version.
dflet 0:6ad60d78b315 414 //!
dflet 0:6ad60d78b315 415 //! @sa wlan_ioctl_get_scan_results
dflet 0:6ad60d78b315 416 //
dflet 0:6ad60d78b315 417 //*****************************************************************************
dflet 0:6ad60d78b315 418 extern long wlan_ioctl_set_scan_params(unsigned long uiEnable, unsigned long
dflet 0:6ad60d78b315 419 uiMinDwellTime,unsigned long uiMaxDwellTime,
dflet 0:6ad60d78b315 420 unsigned long uiNumOfProbeRequests,
dflet 0:6ad60d78b315 421 unsigned long uiChannelMask,
dflet 0:6ad60d78b315 422 long iRSSIThreshold,unsigned long uiSNRThreshold,
dflet 0:6ad60d78b315 423 unsigned long uiDefaultTxPower,
dflet 0:6ad60d78b315 424 unsigned long *aiIntervalList);
dflet 0:6ad60d78b315 425
dflet 0:6ad60d78b315 426
dflet 0:6ad60d78b315 427 //*****************************************************************************
dflet 0:6ad60d78b315 428 //
dflet 0:6ad60d78b315 429 //! wlan_smart_config_start
dflet 0:6ad60d78b315 430 //!
dflet 0:6ad60d78b315 431 //! @param algoEncryptedFlag indicates whether the information is encrypted
dflet 0:6ad60d78b315 432 //!
dflet 0:6ad60d78b315 433 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 434 //!
dflet 0:6ad60d78b315 435 //! @brief Start to acquire device profile. The device acquire its own
dflet 0:6ad60d78b315 436 //! profile, if profile message is found. The acquired AP information
dflet 0:6ad60d78b315 437 //! is stored in CC3000 EEPROM only in case AES128 encryption is used.
dflet 0:6ad60d78b315 438 //! In case AES128 encryption is not used, a profile is created by
dflet 0:6ad60d78b315 439 //! CC3000 internally.
dflet 0:6ad60d78b315 440 //!
dflet 0:6ad60d78b315 441 //! @Note An asynchronous event - Smart Config Done will be generated as soon
dflet 0:6ad60d78b315 442 //! as the process finishes successfully.
dflet 0:6ad60d78b315 443 //!
dflet 0:6ad60d78b315 444 //! @sa wlan_smart_config_set_prefix , wlan_smart_config_stop
dflet 0:6ad60d78b315 445 //
dflet 0:6ad60d78b315 446 //*****************************************************************************
dflet 0:6ad60d78b315 447 extern long wlan_smart_config_start(unsigned long algoEncryptedFlag);
dflet 0:6ad60d78b315 448
dflet 0:6ad60d78b315 449
dflet 0:6ad60d78b315 450 //*****************************************************************************
dflet 0:6ad60d78b315 451 //
dflet 0:6ad60d78b315 452 //! wlan_smart_config_stop
dflet 0:6ad60d78b315 453 //!
dflet 0:6ad60d78b315 454 //! @param algoEncryptedFlag indicates whether the information is encrypted
dflet 0:6ad60d78b315 455 //!
dflet 0:6ad60d78b315 456 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 457 //!
dflet 0:6ad60d78b315 458 //! @brief Stop the acquire profile procedure
dflet 0:6ad60d78b315 459 //!
dflet 0:6ad60d78b315 460 //! @sa wlan_smart_config_start , wlan_smart_config_set_prefix
dflet 0:6ad60d78b315 461 //
dflet 0:6ad60d78b315 462 //*****************************************************************************
dflet 0:6ad60d78b315 463 extern long wlan_smart_config_stop(void);
dflet 0:6ad60d78b315 464
dflet 0:6ad60d78b315 465 //*****************************************************************************
dflet 0:6ad60d78b315 466 //
dflet 0:6ad60d78b315 467 //! wlan_smart_config_set_prefix
dflet 0:6ad60d78b315 468 //!
dflet 0:6ad60d78b315 469 //! @param newPrefix 3 bytes identify the SSID prefix for the Smart Config.
dflet 0:6ad60d78b315 470 //!
dflet 0:6ad60d78b315 471 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 472 //!
dflet 0:6ad60d78b315 473 //! @brief Configure station ssid prefix. The prefix is used internally
dflet 0:6ad60d78b315 474 //! in CC3000. It should always be TTT.
dflet 0:6ad60d78b315 475 //!
dflet 0:6ad60d78b315 476 //! @Note The prefix is stored in CC3000 NVMEM
dflet 0:6ad60d78b315 477 //!
dflet 0:6ad60d78b315 478 //! @sa wlan_smart_config_start , wlan_smart_config_stop
dflet 0:6ad60d78b315 479 //
dflet 0:6ad60d78b315 480 //*****************************************************************************
dflet 0:6ad60d78b315 481 extern long wlan_smart_config_set_prefix(char* cNewPrefix);
dflet 0:6ad60d78b315 482
dflet 0:6ad60d78b315 483 //*****************************************************************************
dflet 0:6ad60d78b315 484 //
dflet 0:6ad60d78b315 485 //! wlan_smart_config_process
dflet 0:6ad60d78b315 486 //!
dflet 0:6ad60d78b315 487 //! @param none
dflet 0:6ad60d78b315 488 //!
dflet 0:6ad60d78b315 489 //! @return On success, zero is returned. On error, -1 is returned
dflet 0:6ad60d78b315 490 //!
dflet 0:6ad60d78b315 491 //! @brief process the acquired data and store it as a profile. The acquired
dflet 0:6ad60d78b315 492 //! AP information is stored in CC3000 EEPROM encrypted.
dflet 0:6ad60d78b315 493 //! The encrypted data is decrypted and stored as a profile.
dflet 0:6ad60d78b315 494 //! behavior is as defined by connection policy.
dflet 0:6ad60d78b315 495 //
dflet 0:6ad60d78b315 496 //*****************************************************************************
dflet 0:6ad60d78b315 497 extern long wlan_smart_config_process(void);
dflet 0:6ad60d78b315 498
dflet 0:6ad60d78b315 499 //*****************************************************************************
dflet 0:6ad60d78b315 500 //
dflet 0:6ad60d78b315 501 // Close the Doxygen group.
dflet 0:6ad60d78b315 502 //! @}
dflet 0:6ad60d78b315 503 //
dflet 0:6ad60d78b315 504 //*****************************************************************************
dflet 0:6ad60d78b315 505
dflet 0:6ad60d78b315 506
dflet 0:6ad60d78b315 507
dflet 0:6ad60d78b315 508 //*****************************************************************************
dflet 0:6ad60d78b315 509 //
dflet 0:6ad60d78b315 510 // Mark the end of the C bindings section for C++ compilers.
dflet 0:6ad60d78b315 511 //
dflet 0:6ad60d78b315 512 //*****************************************************************************
dflet 0:6ad60d78b315 513 #ifdef __cplusplus
dflet 0:6ad60d78b315 514 }
dflet 0:6ad60d78b315 515 #endif // __cplusplus
dflet 0:6ad60d78b315 516
dflet 0:6ad60d78b315 517 #endif // __WLAN_H__
dflet 0:6ad60d78b315 518