Variable defines use in the STA Enterprise macros #define SSID_NAME Enterprise SSID NAME /* AP SSID */ #define SECURITY_KEY User enterprise pwd /* Password of the secured AP */ #define SECURITY_TYPE SL_SEC_TYPE_WPA_ENT /* Security type (ENT or WPA_WPA2*/ #define EAP_METHOD SL_ENT_EAP_METHOD_PEAP0_MSCHAPv2 /* EAP type Assumed to be PEAP type*/ #define SSID_LEN_MAX 32 #define BSSID_LEN_MAX 6 #define USER_ID enterprise UID //UID is needed #define UID_LEN_MAX 32 ********************************* void *socketsStartUp(void) { WiFi_Params wifiParams; WiFi_Handle handle; int result; /* * Board_LED1 is used as a connection indicator. It will blink until a * connection is establish with the AP. */ GPIO_write(Board_LED1, Board_LED_OFF); /* Open WiFi driver */ WiFi_Params_init(&wifiParams); wifiParams.bitRate = SPI_BIT_RATE; handle = WiFi_open(Board_WIFI, Board_WIFI_SPI, NULL, &wifiParams); if (handle == NULL) { System_abort("WiFi driver failed to open."); } /* Set the CC3X00 into station mode for this example */ if(APM == 0) { setStationMode(); //Call the station setup /* Host driver starts the network processor */ result = sl_Start(0, 0, 0); if (result < 0 || ROLE_STA != result) { System_abort("Could not initialize SimpleLink Wi-Fi"); } /* get MAC ADDR */ _u8 macAdd[SL_MAC_ADDR_LEN]; _u8 macAddLen =SL_MAC_ADDR_LEN; sl_NetCfgGet(SL_MAC_ADDRESS_GET,NULL,&macAddLen,(_u8 *)macAdd); System_printf("Mac Address %x-", macAdd[0]); System_printf("%x-", macAdd[1]); System_printf("%x-", macAdd[2]); System_printf("%x-", macAdd[3]); System_printf("%x-", macAdd[4]); System_printf("%x\n", macAdd[5]); System_flush(); //Set log in parameters for network SlSecParams_t secParams; secParams.Key = (signed char*)SECURITY_KEY; secParams.KeyLen = strlen(SECURITY_KEY); secParams.Type = SECURITY_TYPE; /* Connection action is UID is used - Uncomment if UID is used */ SlSecParamsExt_t extParams; extParams.User = (_i8 *)USER_IS; extParams.UserLen = sizeof(USER_ID); extParams.AnonUserLen = 0; extParams.EapMethod = EAP_TYPE; sl_Stop(10); sl_Start(0,0,0); result = sl_WlanConnect((signed char*)SSID_NAME, strlen(SSID_NAME), 0, &secParams, &extParams); if (result < 0) { System_abort("Could not Connect Wi-Fi"); } // Wait for WLAN Event while((!deviceConnected) || (!ipAcquired)) { // Toggle LEDs to Indicate Connection Progress GPIO_write(Board_LED1, Board_LED_ON); Task_sleep(1000); GPIO_write(Board_LED1, Board_LED_OFF); Task_sleep(1000); } GPIO_write(Board_LED1, Board_LED_OFF); wifi_icon = true; /* Print IP address */ _u8 len = sizeof(SlNetCfgIpV4Args_t); _u8 dhcpIsOn = 0; SlNetCfgIpV4Args_t ipV4 = {0}; sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO, &dhcpIsOn, &len,(unsigned char *)&ipV4); System_printf( "CC3X00 has connected to an AP and acquired an IP address.\n"); System_printf("IP Address: %d.", SL_IPV4_BYTE(ipV4.ipV4, 3)); System_printf("%d.", SL_IPV4_BYTE(ipV4.ipV4, 2)); System_printf("%d.", SL_IPV4_BYTE(ipV4.ipV4, 1)); System_printf("%d", SL_IPV4_BYTE(ipV4.ipV4, 0)); System_printf("\n"); System_flush(); } else { setApMode(); //Call the AP configure mode /* Host driver starts the network processor */ result = sl_Start(NULL, NULL, NULL); if (result < 0) { System_abort("Could not initialize SimpleLink Wi-Fi"); } /* Configure the DHCP server and start */ SlNetAppDhcpServerBasicOpt_t dhcpParams; _u8 outLen = sizeof(dhcpParams); dhcpParams.lease_time = 4096; // lease time (in seconds) of the IP Address dhcpParams.ipv4_addr_start = SL_IPV4_VAL(192,168,3,10); // first IP Address for allocation. IP Address should be set as Hex number - i.e. 0A0B0C01 for (10.11.12.1) dhcpParams.ipv4_addr_last = SL_IPV4_VAL(192,168,3,16); // last IP Address for allocation. IP Address should be set as Hex number - i.e. 0A0B0C01 for (10.11.12.1) sl_NetAppStop(SL_NET_APP_DHCP_SERVER_ID); // Stop DHCP server before settings sl_NetAppSet(SL_NET_APP_DHCP_SERVER_ID, NETAPP_SET_DHCP_SRV_BASIC_OPT, outLen, (_u8* )&dhcpParams); // set parameters sl_NetAppStart(SL_NET_APP_DHCP_SERVER_ID); // Start DHCP server with new settings //Wait for station to connect while((deviceConnected != true) || (ipLeased != true)) { // Toggle LEDs to Indicate Connection Progress GPIO_write(Board_LED1, Board_LED_ON); Task_sleep(50); GPIO_write(Board_LED1, Board_LED_OFF); Task_sleep(50); } wifi_icon = true; } /* pass back the handle to our WiFi device */ return ((void *)handle); }