TI's CC3100. A test demo with very little testing done!
Fork of cc3100_Test_Demo2 by
simplelink/cc3100_netcfg.h@4:5af740da0a59, 2015-02-23 (annotated)
- Committer:
- dflet
- Date:
- Mon Feb 23 21:10:13 2015 +0000
- Revision:
- 4:5af740da0a59
- Parent:
- 0:e89ba455dbcf
Added eye candy in some of the event handlers, made a few changes to SL_IPV4_BYTE to correct errors.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dflet | 0:e89ba455dbcf | 1 | /* |
dflet | 0:e89ba455dbcf | 2 | * netcfg.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 NETCFG_H_ |
dflet | 0:e89ba455dbcf | 38 | #define NETCFG_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 | |
dflet | 0:e89ba455dbcf | 49 | \addtogroup netcfg |
dflet | 0:e89ba455dbcf | 50 | @{ |
dflet | 0:e89ba455dbcf | 51 | |
dflet | 0:e89ba455dbcf | 52 | */ |
dflet | 0:e89ba455dbcf | 53 | |
dflet | 0:e89ba455dbcf | 54 | |
dflet | 0:e89ba455dbcf | 55 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 56 | /* Macro declarations */ |
dflet | 0:e89ba455dbcf | 57 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 58 | const uint8_t SL_MAC_ADDR_LEN = (6); |
dflet | 0:e89ba455dbcf | 59 | const uint8_t IPCONFIG_MODE_DISABLE_IPV4 = (0); |
dflet | 0:e89ba455dbcf | 60 | const uint8_t IPCONFIG_MODE_ENABLE_IPV4 = (1); |
dflet | 0:e89ba455dbcf | 61 | |
dflet | 0:e89ba455dbcf | 62 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 63 | /* Structure/Enum declarations */ |
dflet | 0:e89ba455dbcf | 64 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 65 | typedef enum { |
dflet | 0:e89ba455dbcf | 66 | SL_MAC_ADDRESS_SET = 1, |
dflet | 0:e89ba455dbcf | 67 | SL_MAC_ADDRESS_GET = 2, |
dflet | 0:e89ba455dbcf | 68 | SL_IPV4_STA_P2P_CL_GET_INFO = 3, |
dflet | 0:e89ba455dbcf | 69 | SL_IPV4_STA_P2P_CL_DHCP_ENABLE = 4, |
dflet | 0:e89ba455dbcf | 70 | SL_IPV4_STA_P2P_CL_STATIC_ENABLE = 5, |
dflet | 0:e89ba455dbcf | 71 | SL_IPV4_AP_P2P_GO_GET_INFO = 6, |
dflet | 0:e89ba455dbcf | 72 | SL_IPV4_AP_P2P_GO_STATIC_ENABLE = 7, |
dflet | 0:e89ba455dbcf | 73 | SL_SET_HOST_RX_AGGR = 8, |
dflet | 0:e89ba455dbcf | 74 | MAX_SETTINGS = 0xFF |
dflet | 0:e89ba455dbcf | 75 | } Sl_NetCfg_e; |
dflet | 0:e89ba455dbcf | 76 | |
dflet | 0:e89ba455dbcf | 77 | |
dflet | 0:e89ba455dbcf | 78 | typedef struct { |
dflet | 0:e89ba455dbcf | 79 | uint32_t ipV4; |
dflet | 0:e89ba455dbcf | 80 | uint32_t ipV4Mask; |
dflet | 0:e89ba455dbcf | 81 | uint32_t ipV4Gateway; |
dflet | 0:e89ba455dbcf | 82 | uint32_t ipV4DnsServer; |
dflet | 0:e89ba455dbcf | 83 | } SlNetCfgIpV4Args_t; |
dflet | 0:e89ba455dbcf | 84 | |
dflet | 0:e89ba455dbcf | 85 | class cc3100_netcfg |
dflet | 0:e89ba455dbcf | 86 | { |
dflet | 0:e89ba455dbcf | 87 | |
dflet | 0:e89ba455dbcf | 88 | public: |
dflet | 0:e89ba455dbcf | 89 | |
dflet | 0:e89ba455dbcf | 90 | cc3100_netcfg(cc3100_driver &driver); |
dflet | 0:e89ba455dbcf | 91 | |
dflet | 0:e89ba455dbcf | 92 | ~cc3100_netcfg(); |
dflet | 0:e89ba455dbcf | 93 | |
dflet | 0:e89ba455dbcf | 94 | |
dflet | 0:e89ba455dbcf | 95 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 96 | /* Function prototypes */ |
dflet | 0:e89ba455dbcf | 97 | /*****************************************************************************/ |
dflet | 0:e89ba455dbcf | 98 | |
dflet | 0:e89ba455dbcf | 99 | /*! |
dflet | 0:e89ba455dbcf | 100 | \brief Internal function for setting network configurations |
dflet | 0:e89ba455dbcf | 101 | |
dflet | 0:e89ba455dbcf | 102 | \return On success, zero is returned. On error, -1 is |
dflet | 0:e89ba455dbcf | 103 | returned |
dflet | 0:e89ba455dbcf | 104 | |
dflet | 0:e89ba455dbcf | 105 | \param[in] ConfigId configuration id |
dflet | 0:e89ba455dbcf | 106 | \param[in] ConfigOpt configurations option |
dflet | 0:e89ba455dbcf | 107 | \param[in] ConfigLen configurations len |
dflet | 0:e89ba455dbcf | 108 | \param[in] pValues configurations values |
dflet | 0:e89ba455dbcf | 109 | |
dflet | 0:e89ba455dbcf | 110 | \sa |
dflet | 0:e89ba455dbcf | 111 | \note |
dflet | 0:e89ba455dbcf | 112 | \warning |
dflet | 0:e89ba455dbcf | 113 | |
dflet | 0:e89ba455dbcf | 114 | \par Examples: |
dflet | 0:e89ba455dbcf | 115 | \code |
dflet | 0:e89ba455dbcf | 116 | SL_MAC_ADDRESS_SET: |
dflet | 0:e89ba455dbcf | 117 | |
dflet | 0:e89ba455dbcf | 118 | Setting MAC address to the Device. |
dflet | 0:e89ba455dbcf | 119 | The new MAC address will override the default MAC address and it be saved in the FileSystem. |
dflet | 0:e89ba455dbcf | 120 | Requires restarting the device for updating this setting. |
dflet | 0:e89ba455dbcf | 121 | |
dflet | 0:e89ba455dbcf | 122 | uint8_t MAC_Address[6]; |
dflet | 0:e89ba455dbcf | 123 | MAC_Address[0] = 0x8; |
dflet | 0:e89ba455dbcf | 124 | MAC_Address[1] = 0x0; |
dflet | 0:e89ba455dbcf | 125 | MAC_Address[2] = 0x28; |
dflet | 0:e89ba455dbcf | 126 | MAC_Address[3] = 0x22; |
dflet | 0:e89ba455dbcf | 127 | MAC_Address[4] = 0x69; |
dflet | 0:e89ba455dbcf | 128 | MAC_Address[5] = 0x31; |
dflet | 0:e89ba455dbcf | 129 | sl_NetCfgSet(SL_MAC_ADDRESS_SET,1,SL_MAC_ADDR_LEN,(uint8_t *)newMacAddress); |
dflet | 0:e89ba455dbcf | 130 | sl_Stop(0); |
dflet | 0:e89ba455dbcf | 131 | sl_Start(NULL,NULL,NULL); |
dflet | 0:e89ba455dbcf | 132 | \endcode |
dflet | 0:e89ba455dbcf | 133 | |
dflet | 0:e89ba455dbcf | 134 | \code |
dflet | 0:e89ba455dbcf | 135 | SL_IPV4_STA_P2P_CL_STATIC_ENABLE: |
dflet | 0:e89ba455dbcf | 136 | |
dflet | 0:e89ba455dbcf | 137 | Setting a static IP address to the device working in STA mode or P2P client. |
dflet | 0:e89ba455dbcf | 138 | The IP address will be stored in the FileSystem. |
dflet | 0:e89ba455dbcf | 139 | In order to disable the static IP and get the address assigned from DHCP one should use SL_STA_P2P_CL_IPV4_DHCP_SET |
dflet | 0:e89ba455dbcf | 140 | |
dflet | 0:e89ba455dbcf | 141 | SlNetCfgIpV4Args_t ipV4; |
dflet | 0:e89ba455dbcf | 142 | ipV4.ipV4 = (uint32_t)SL_IPV4_VAL(10,1,1,201); // uint32_t IP address |
dflet | 0:e89ba455dbcf | 143 | ipV4.ipV4Mask = (uint32_t)SL_IPV4_VAL(255,255,255,0); // uint32_t Subnet mask for this STA/P2P |
dflet | 0:e89ba455dbcf | 144 | ipV4.ipV4Gateway = (uint32_t)SL_IPV4_VAL(10,1,1,1); // uint32_t Default gateway address |
dflet | 0:e89ba455dbcf | 145 | ipV4.ipV4DnsServer = (uint32_t)SL_IPV4_VAL(8,16,32,64); // uint32_t DNS server address |
dflet | 0:e89ba455dbcf | 146 | |
dflet | 0:e89ba455dbcf | 147 | sl_NetCfgSet(SL_IPV4_STA_P2P_CL_STATIC_ENABLE,IPCONFIG_MODE_ENABLE_IPV4,sizeof(SlNetCfgIpV4Args_t),(uint8_t *)&ipV4); |
dflet | 0:e89ba455dbcf | 148 | sl_Stop(0); |
dflet | 0:e89ba455dbcf | 149 | sl_Start(NULL,NULL,NULL); |
dflet | 0:e89ba455dbcf | 150 | \endcode |
dflet | 0:e89ba455dbcf | 151 | |
dflet | 0:e89ba455dbcf | 152 | \code |
dflet | 0:e89ba455dbcf | 153 | SL_IPV4_STA_P2P_CL_DHCP_ENABLE: |
dflet | 0:e89ba455dbcf | 154 | |
dflet | 0:e89ba455dbcf | 155 | Setting IP address by DHCP to FileSystem using WLAN sta mode or P2P client. |
dflet | 0:e89ba455dbcf | 156 | This should be done once if using Serial Flash. |
dflet | 0:e89ba455dbcf | 157 | This is the system's default mode for acquiring an IP address after WLAN connection. |
dflet | 0:e89ba455dbcf | 158 | uint8_t val = 1; |
dflet | 0:e89ba455dbcf | 159 | sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,IPCONFIG_MODE_ENABLE_IPV4,1,&val); |
dflet | 0:e89ba455dbcf | 160 | sl_Stop(0); |
dflet | 0:e89ba455dbcf | 161 | sl_Start(NULL,NULL,NULL); |
dflet | 0:e89ba455dbcf | 162 | \endcode |
dflet | 0:e89ba455dbcf | 163 | |
dflet | 0:e89ba455dbcf | 164 | \code |
dflet | 0:e89ba455dbcf | 165 | SL_IPV4_AP_P2P_GO_STATIC_ENABLE: |
dflet | 0:e89ba455dbcf | 166 | |
dflet | 0:e89ba455dbcf | 167 | Setting a static IP address to the device working in AP mode or P2P go. |
dflet | 0:e89ba455dbcf | 168 | The IP address will be stored in the FileSystem. Requires restart. |
dflet | 0:e89ba455dbcf | 169 | |
dflet | 0:e89ba455dbcf | 170 | SlNetCfgIpV4Args_t ipV4; |
dflet | 0:e89ba455dbcf | 171 | ipV4.ipV4 = (uint32_t)SL_IPV4_VAL(10,1,1,201); // uint32_t IP address |
dflet | 0:e89ba455dbcf | 172 | ipV4.ipV4Mask = (uint32_t)SL_IPV4_VAL(255,255,255,0); // uint32_t Subnet mask for this AP/P2P |
dflet | 0:e89ba455dbcf | 173 | ipV4.ipV4Gateway = (uint32_t)SL_IPV4_VAL(10,1,1,1); // uint32_t Default gateway address |
dflet | 0:e89ba455dbcf | 174 | ipV4.ipV4DnsServer = (uint32_t)SL_IPV4_VAL(8,16,32,64); // uint32_t DNS server address |
dflet | 0:e89ba455dbcf | 175 | |
dflet | 0:e89ba455dbcf | 176 | sl_NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE,IPCONFIG_MODE_ENABLE_IPV4,sizeof(SlNetCfgIpV4Args_t),(uint8_t *)&ipV4); |
dflet | 0:e89ba455dbcf | 177 | sl_Stop(0); |
dflet | 0:e89ba455dbcf | 178 | sl_Start(NULL,NULL,NULL); |
dflet | 0:e89ba455dbcf | 179 | \endcode |
dflet | 0:e89ba455dbcf | 180 | |
dflet | 0:e89ba455dbcf | 181 | |
dflet | 0:e89ba455dbcf | 182 | */ |
dflet | 0:e89ba455dbcf | 183 | #if _SL_INCLUDE_FUNC(sl_NetCfgSet) |
dflet | 0:e89ba455dbcf | 184 | int32_t sl_NetCfgSet(uint8_t ConfigId ,uint8_t ConfigOpt, uint8_t ConfigLen, uint8_t *pValues); |
dflet | 0:e89ba455dbcf | 185 | #endif |
dflet | 0:e89ba455dbcf | 186 | |
dflet | 0:e89ba455dbcf | 187 | |
dflet | 0:e89ba455dbcf | 188 | /*! |
dflet | 0:e89ba455dbcf | 189 | \brief Internal function for getting network configurations |
dflet | 0:e89ba455dbcf | 190 | |
dflet | 0:e89ba455dbcf | 191 | \return On success, zero is returned. On error, -1 is |
dflet | 0:e89ba455dbcf | 192 | returned |
dflet | 0:e89ba455dbcf | 193 | |
dflet | 0:e89ba455dbcf | 194 | \param[in] ConfigId configuration id |
dflet | 0:e89ba455dbcf | 195 | |
dflet | 0:e89ba455dbcf | 196 | \param[out] pConfigOpt Get configurations option |
dflet | 0:e89ba455dbcf | 197 | |
dflet | 0:e89ba455dbcf | 198 | \param[out] pConfigLen The length of the allocated memory as input, when the |
dflet | 0:e89ba455dbcf | 199 | function complete, the value of this parameter would be |
dflet | 0:e89ba455dbcf | 200 | the len that actually read from the device.\n |
dflet | 0:e89ba455dbcf | 201 | If the device return length that is longer from the input |
dflet | 0:e89ba455dbcf | 202 | value, the function will cut the end of the returned structure |
dflet | 0:e89ba455dbcf | 203 | and will return ESMALLBUF |
dflet | 0:e89ba455dbcf | 204 | |
dflet | 0:e89ba455dbcf | 205 | \param[out] pValues - get configurations values |
dflet | 0:e89ba455dbcf | 206 | |
dflet | 0:e89ba455dbcf | 207 | \sa |
dflet | 0:e89ba455dbcf | 208 | \note |
dflet | 0:e89ba455dbcf | 209 | \warning |
dflet | 0:e89ba455dbcf | 210 | \par Examples: |
dflet | 0:e89ba455dbcf | 211 | \code |
dflet | 0:e89ba455dbcf | 212 | SL_MAC_ADDRESS_GET: |
dflet | 0:e89ba455dbcf | 213 | |
dflet | 0:e89ba455dbcf | 214 | Get the device MAC address. |
dflet | 0:e89ba455dbcf | 215 | The returned MAC address is taken from FileSystem first. If the MAC address was not set by SL_MAC_ADDRESS_SET, the default MAC address |
dflet | 0:e89ba455dbcf | 216 | is retrieved from HW. |
dflet | 0:e89ba455dbcf | 217 | |
dflet | 0:e89ba455dbcf | 218 | uint8_t macAddressVal[SL_MAC_ADDR_LEN]; |
dflet | 0:e89ba455dbcf | 219 | uint8_t macAddressLen = SL_MAC_ADDR_LEN; |
dflet | 0:e89ba455dbcf | 220 | sl_NetCfgGet(SL_MAC_ADDRESS_GET,NULL,&macAddressLen,(uint8_t *)macAddressVal); |
dflet | 0:e89ba455dbcf | 221 | |
dflet | 0:e89ba455dbcf | 222 | \endcode |
dflet | 0:e89ba455dbcf | 223 | |
dflet | 0:e89ba455dbcf | 224 | \code |
dflet | 0:e89ba455dbcf | 225 | SL_IPV4_STA_P2P_CL_GET_INFO: |
dflet | 0:e89ba455dbcf | 226 | |
dflet | 0:e89ba455dbcf | 227 | Get IP address from WLAN station or P2P client. A DHCP flag is returned to indicate if the IP address is static or from DHCP. |
dflet | 0:e89ba455dbcf | 228 | |
dflet | 0:e89ba455dbcf | 229 | uint8_t len = sizeof(SlNetCfgIpV4Args_t); |
dflet | 0:e89ba455dbcf | 230 | uint8_t dhcpIsOn = 0; |
dflet | 0:e89ba455dbcf | 231 | SlNetCfgIpV4Args_t ipV4 = {0}; |
dflet | 0:e89ba455dbcf | 232 | sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO,&dhcpIsOn,&len,(uint8_t *)&ipV4); |
dflet | 0:e89ba455dbcf | 233 | |
dflet | 0:e89ba455dbcf | 234 | printf("DHCP is %s IP %d.%d.%d.%d MASK %d.%d.%d.%d GW %d.%d.%d.%d DNS %d.%d.%d.%d\n", |
dflet | 0:e89ba455dbcf | 235 | (dhcpIsOn > 0) ? "ON" : "OFF", |
dflet | 0:e89ba455dbcf | 236 | SL_IPV4_BYTE(ipV4.ipV4,3),SL_IPV4_BYTE(ipV4.ipV4,2),SL_IPV4_BYTE(ipV4.ipV4,1),SL_IPV4_BYTE(ipV4.ipV4,0), |
dflet | 0:e89ba455dbcf | 237 | SL_IPV4_BYTE(ipV4.ipV4Mask,3),SL_IPV4_BYTE(ipV4.ipV4Mask,2),SL_IPV4_BYTE(ipV4.ipV4Mask,1),SL_IPV4_BYTE(ipV4.ipV4Mask,0), |
dflet | 0:e89ba455dbcf | 238 | SL_IPV4_BYTE(ipV4.ipV4Gateway,3),SL_IPV4_BYTE(ipV4.ipV4Gateway,2),SL_IPV4_BYTE(ipV4.ipV4Gateway,1),SL_IPV4_BYTE(ipV4.ipV4Gateway,0), |
dflet | 0:e89ba455dbcf | 239 | SL_IPV4_BYTE(ipV4.ipV4DnsServer,3),SL_IPV4_BYTE(ipV4.ipV4DnsServer,2),SL_IPV4_BYTE(ipV4.ipV4DnsServer,1),SL_IPV4_BYTE(ipV4.ipV4DnsServer,0)); |
dflet | 0:e89ba455dbcf | 240 | |
dflet | 0:e89ba455dbcf | 241 | \endcode |
dflet | 0:e89ba455dbcf | 242 | |
dflet | 0:e89ba455dbcf | 243 | \code |
dflet | 0:e89ba455dbcf | 244 | SL_IPV4_AP_P2P_GO_GET_INFO: |
dflet | 0:e89ba455dbcf | 245 | |
dflet | 0:e89ba455dbcf | 246 | Get static IP address for AP or P2P go. |
dflet | 0:e89ba455dbcf | 247 | |
dflet | 0:e89ba455dbcf | 248 | uint8_t len = sizeof(SlNetCfgIpV4Args_t); |
dflet | 0:e89ba455dbcf | 249 | uint8_t dhcpIsOn = 0; // this flag is meaningless on AP/P2P go. |
dflet | 0:e89ba455dbcf | 250 | SlNetCfgIpV4Args_t ipV4 = {0}; |
dflet | 0:e89ba455dbcf | 251 | sl_NetCfgGet(SL_IPV4_AP_P2P_GO_GET_INFO,&dhcpIsOn,&len,(uint8_t *)&ipV4); |
dflet | 0:e89ba455dbcf | 252 | |
dflet | 0:e89ba455dbcf | 253 | printf("IP %d.%d.%d.%d MASK %d.%d.%d.%d GW %d.%d.%d.%d DNS %d.%d.%d.%d\n", |
dflet | 0:e89ba455dbcf | 254 | SL_IPV4_BYTE(ipV4.ipV4,3),SL_IPV4_BYTE(ipV4.ipV4,2),SL_IPV4_BYTE(ipV4.ipV4,1),SL_IPV4_BYTE(ipV4.ipV4,0), |
dflet | 0:e89ba455dbcf | 255 | SL_IPV4_BYTE(ipV4.ipV4Mask,3),SL_IPV4_BYTE(ipV4.ipV4Mask,2),SL_IPV4_BYTE(ipV4.ipV4Mask,1),SL_IPV4_BYTE(ipV4.ipV4Mask,0), |
dflet | 0:e89ba455dbcf | 256 | SL_IPV4_BYTE(ipV4.ipV4Gateway,3),SL_IPV4_BYTE(ipV4.ipV4Gateway,2),SL_IPV4_BYTE(ipV4.ipV4Gateway,1),SL_IPV4_BYTE(ipV4.ipV4Gateway,0), |
dflet | 0:e89ba455dbcf | 257 | SL_IPV4_BYTE(ipV4.ipV4DnsServer,3),SL_IPV4_BYTE(ipV4.ipV4DnsServer,2),SL_IPV4_BYTE(ipV4.ipV4DnsServer,1),SL_IPV4_BYTE(ipV4.ipV4DnsServer,0)); |
dflet | 0:e89ba455dbcf | 258 | |
dflet | 0:e89ba455dbcf | 259 | \endcode |
dflet | 0:e89ba455dbcf | 260 | |
dflet | 0:e89ba455dbcf | 261 | |
dflet | 0:e89ba455dbcf | 262 | */ |
dflet | 0:e89ba455dbcf | 263 | #if _SL_INCLUDE_FUNC(sl_NetCfgGet) |
dflet | 0:e89ba455dbcf | 264 | int32_t sl_NetCfgGet(uint8_t ConfigId ,uint8_t *pConfigOpt, uint8_t *pConfigLen, uint8_t *pValues); |
dflet | 0:e89ba455dbcf | 265 | #endif |
dflet | 0:e89ba455dbcf | 266 | |
dflet | 0:e89ba455dbcf | 267 | uint32_t SL_IPV4_VAL(uint8_t add_3,uint8_t add_2,uint8_t add_1,uint8_t add_0); |
dflet | 4:5af740da0a59 | 268 | uint8_t SL_IPV4_BYTE(uint32_t val,uint8_t index); |
dflet | 0:e89ba455dbcf | 269 | |
dflet | 0:e89ba455dbcf | 270 | private: |
dflet | 0:e89ba455dbcf | 271 | |
dflet | 0:e89ba455dbcf | 272 | cc3100_driver &_driver; |
dflet | 0:e89ba455dbcf | 273 | |
dflet | 0:e89ba455dbcf | 274 | };//class |
dflet | 0:e89ba455dbcf | 275 | |
dflet | 0:e89ba455dbcf | 276 | }//namespace mbed_cc3100 |
dflet | 0:e89ba455dbcf | 277 | |
dflet | 0:e89ba455dbcf | 278 | /*! |
dflet | 0:e89ba455dbcf | 279 | |
dflet | 0:e89ba455dbcf | 280 | Close the Doxygen group. |
dflet | 0:e89ba455dbcf | 281 | @} |
dflet | 0:e89ba455dbcf | 282 | |
dflet | 0:e89ba455dbcf | 283 | */ |
dflet | 0:e89ba455dbcf | 284 | |
dflet | 0:e89ba455dbcf | 285 | |
dflet | 0:e89ba455dbcf | 286 | #endif /* __NETCFG_H__ */ |
dflet | 0:e89ba455dbcf | 287 | |
dflet | 0:e89ba455dbcf | 288 |