SWRU368C May 2018 – January 2021 CC3100 , CC3100MOD , CC3200 , CC3200MOD
static INT32 establishConnectionWithAP()
{
char SSID[MAX_SSID_SIZE];
char password[MAX_PASSKEY_SIZE];
SlSecParams_t secParams = {0};
INT32 retVal = -1;
/************************************************************************/
/** AP is configured to WEP with 40bit Hex password of: "12345ABCDE" **/
/************************************************************************/
password[0] = 0x12;
password[1] = 0x34;
password[2] = 0x5A;
password[3] = 0xBC;
password[4] = 0xDE;
password[5] = 0;
secParams.Key = password;
secParams.KeyLen = 5; // [--strlen(password) - Don't use strlen in-order not to bump on zero/NULL in the password]
secParams.Type = SL_SEC_TYPE_WEP;
strcpy(SSID, "myApSsid");
retVal = sl_WlanConnect(SSID,strlen(SSID),0,&secParams,0);
ASSERT_ON_ERROR(__LINE__, retVal);
printf("Connecting to AP %s...\n", SSID);
/* Wait */
while((!IS_CONNECTED(g_Status)) || (!IS_IP_AQUIRED(g_Status)));
return SUCCESS;
}