TI SDK library sl_common.h
Answer
1/9/19 6:09 PM

Hello

i was checking a library sl_common.h in TI SDK1.3.0 and not exists in the eclipse XDK enviroment

how i do to add this library to XDK software ?
or please any function to check if the wifi is connected to Access Point

please let me know

0 (0 Votes)
RE: TI SDK library sl_common.h
Answer
1/10/19 8:19 AM as a reply to Carmen Vazquez.

Hello Carmen,

i had a look to this header file online. So i assume you want to do some stuff with WLAN connection, like checking the connection status.

For the management of the WLAN functionality of the XDK i would recommend the BCDS Wlan Connect API. You can find the header file under the following directory:

--> yourProject/SDK/xdk110/Platform/Wlan/include/BCDS_WlanConnect.h

This API provides all necessary functions to connect the XDK to an WLAN network and check the connection status. For this i recommend the two functions:

WlanConnect_GetStatus(): The function returns the status of the current WLAN connection

WlanConnect_GetCurrentNwStatus(): This function returns on of the following values:

--> CONNECTED_AND_IPV4_ACQUIRED

--> CONNECTED_AND_IP_NOT_ACQURED

--> DISCONNECTED_AND_IPV4_ACQUIRED

--> DISCONNECTED_IP_NOT_ACQUIRED

To check your connection you can call one of these functions and check the return value.

I hope this was helpfull.

Best regards,

Christian

0 (0 Votes)
RE: TI SDK library sl_common.h
Answer
1/10/19 4:02 PM as a reply to Christian Köhler.
Dear Carmen,

First, I would like to welcome you to the XDK community.

It can appear that certain interfaces provided by the TI SDK are not integrated into the SDK of the XDK. This happens often because of the indifferences between the SDK versions of the used SDKs. While the SDK of TI might got an update, the version within the SDK of the XDK could be much older than the most recent one from TI.

But if you're interested in checking for an active connection to a Wi-Fi hotspot, I recommend following Christian's explanation about the interface BCDS_WlanConnect() .

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Votes)
RE: TI SDK library sl_common.h
Answer
1/10/19 4:05 PM as a reply to Christian Köhler.

Hello Christian

actually i did test with both function but always return same result

annex my funciton may be i have something wrong

static void SetAndGetIp(void)
{
    /* local variables */
    NetworkConfig_IpSettings_T myIpGet;
    Retcode_T retcode = RETCODE_OK;

    /* ************************************************************************/
    /*   Connect to a WLAN WPA network
     **************************************************************************/
#if (ZERO == NCI_DHCP_MODE || TWO == NCI_DHCP_MODE)
    if (!(CONNECTED_AND_IPV4_ACQUIRED == WlanConnect_GetCurrentNwStatus()()))
        {
            printf("\n\r[NCA] : XDK will connect to %s network.\n\r",
            WLANSetupInfo.SSID);
            int slReturn = -1;
            retcode = WLAN_Enable();
            if (RETCODE_OK == retcode)
            {
                printf("[NCA] : Connected successfully.\n\r");
            }
        /* By default auto-connect profile is enable. Reset the profile in order to disconnect */
            //slReturn = sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(0, 0, 0, 0, 0), NULL, 0); /* reset policy */
            //if (SL_RET_CODE_OK > slReturn)
            //    {
            //        printf("WLANPersonalWPA2Connect : failed to reset connection policy\r\n");
            //    }
            //if (RETCODE_OK == retcode)
            //    {
                    /* Get Static IP settings and store them locally*/
                    retcode = NetworkConfig_GetIpSettings(&myIpGet);
                    if (RETCODE_OK == retcode)
                    {
                        printf("[NCA] :  - The static IP was retrieved : %u.%u.%u.%u \n\r",
                            (unsigned int) (NetworkConfig_Ipv4Byte(myIpGet.ipV4, 3)),
                            (unsigned int) (NetworkConfig_Ipv4Byte(myIpGet.ipV4, 2)),
                            (unsigned int) (NetworkConfig_Ipv4Byte(myIpGet.ipV4, 1)),
                            (unsigned int) (NetworkConfig_Ipv4Byte(myIpGet.ipV4, 0)));
                    }
                    else
                    {
                        printf("[NCA] : NetworkConfig_GetIpSettings API has failed\n\r");
                    }
            //    }
                static_assert((portTICK_RATE_MS != 0), "Tick rate MS is zero");
                vTaskDelay((portTickType) DELAY_5_SEC / portTICK_RATE_MS);
        }

 

}

 

 

0 (0 Votes)
RE: TI SDK library sl_common.h
Answer
1/11/19 9:11 AM as a reply to Carmen Vazquez.
Retcode_T retcode = (Retcode_T) RETCODE_SUCCESS;

//If you want to use DHCP
WLAN_Setup_T wlanParams = {

   .IsEnterprise = false,
   .SSID = "yourWlanSsid",
   .Password = "yourWlanPassword",
   .IsStatic = false,
};

//If you want to set a static IP
WLAN_Setup_T wlanParams = {

   .IsEnterprise = false,
   .SSID = "yourWlanSsid",
   .Password = "yourWlanPassword",
   .IsStatic = true,
   .IpAddr = yourIpAddressAsAnInteger,
   .GwAddr = yourGatewayAddressAsAnInteger,
   .DnsAddr = yourDnsAddressAsAnInteger,
   .Mask = yourMaskAsAsInteger
};

//Call WLAN_Setup()
retcode = WLAN_Setup(&wlanParams);
if(RETCODE_SUCCESS == retcode){

retcode = WLAN_Enable();

}
if(RETCODE_SUCCESS != retcode){

printf("Error: WLAN_Enable() failed \r\n");
}

Hello Carmen,

I am sorry to hear that.

Because of the function WLAN_Enable(), i assume you are using the XDK_WLAN.h header to connect your XDK to a personal WPA Wi-Fi. That should work fine, because the XDK_Enable() is a wrapper function which executes the BCDS_WlanConnect.h functions and a few function from TI library as well.

But i you want to use the WLAN_Enable() function you have to call the WLAN_Setup() function with the initialising parameter first.

The code snippet above should be able to connect your XDK properly to a personal WPA Wi-Fi.

I hope this is helping you with your problem.

If you have more questions feel free to ask.

Best regards,

Christian
 

0 (0 Votes)
RE: TI SDK library sl_common.h
Answer
1/11/19 3:25 PM as a reply to Christian Köhler.
Dear Carmen,

Could you please go more into detail about your use case and what actually is going wrong? Are you trying to modify the WlanNetworkManagement example to suit your use case?

Please note if you are only interested in connecting to an Wi-Fi hotspot and monitor the connection, then this can be implemented as Christian stated with the XDK_WLAN.h interface as well as with the BCDS_WlanConnect.h interface.

Kind regards,
Franjo
0 (0 Votes)
RE: TI SDK library sl_common.h
Answer
1/11/19 10:01 PM as a reply to Franjo Stjepandic.

Hello Franjo

I solve the problem it was a global variable IpStatus the same name

ipStatus = WlanConnect_GetStatus();

i' m really sorry

0 (0 Votes)
RE: TI SDK library sl_common.h
Answer
1/14/19 5:07 PM as a reply to Carmen Vazquez.
Dear Carmen,

There is nothing to be sorry about. Furthermore, I am glad to hear that you were able to solve the issue by yourself.

Please feel free to open up new threads for new questions, if you have any kind of issue or further concern.

Kind regards,
Franjo
0 (0 Votes)