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