This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3200 check WLAN station connection.

Other Parts Discussed in Thread: CC3200

Hello all,

I have configured my CC3200 as station and connected to an AP.

I want to monitor whether my CC3200 remains connected to the AP.

I am monitoring the connection status at some intervals of time (say 60 seconds).

I have referred to the thread by , and continuing it further.

As suggested in the thread, i used the following lines of code to get the connection status:-

long statusWlan;
unsigned char pConfigOpt;
unsigned char pConfigLen;
pConfigOpt = SL_EVENT_CLASS_WLAN;
sl_DevGet(SL_DEVICE_STATUS,&pConfigOpt,&pConfigLen,(unsigned char *)(&statusWlan));

Here, the statusWlan always returns the value 0x80000000 which corresponds to

#define STATUS_WLAN_STA_CONNECTED                         (0x80000000L)

Now, since i am using pConfigOpt = SL_EVENT_CLASS_WLAN; the returned events will be from:-

/******************  WLAN CLASS status ****************/
#define EVENT_DROPPED_WLAN_WLANASYNCONNECTEDRESPONSE             (0x00000001L)
#define EVENT_DROPPED_WLAN_WLANASYNCDISCONNECTEDRESPONSE   (0x00000002L)
#define EVENT_DROPPED_WLAN_STA_CONNECTED                                                (0x00000004L)
#define EVENT_DROPPED_WLAN_STA_DISCONNECTED                                         (0x00000008L)
#define STATUS_WLAN_STA_CONNECTED                                                                     (0x80000000L)

My question is, if my device disconnects from the AP, which event would i get ??

Is there any other way of monitoring the connection status between station(CC3200) and the AP ??

Kindly reply.

Warm regards,

Abhishek.

  • Hi Abhishek,


    Please refer SimpleLinkWlanEventHandler() function in getting_started_with_wlan_station example code.


    Regards,
    Aashish
  • Hello Aashish,

    Thank you for replying.

    Yes, i had referred getting_started_with_wlan_station example code before creating this thread.

    Actually, the case that is checked in SimpleLinkWlanEventHandler() function is: case SL_WLAN_DISCONNECT_EVENT:

    But SL_WLAN_DISCONNECT_EVENT is not defined in these definations of SL_EVENT_CLASS_WLAN (refer device.h) :-

    /******************  WLAN CLASS status ****************/

    #define EVENT_DROPPED_WLAN_WLANASYNCONNECTEDRESPONSE             (0x00000001L)

    #define EVENT_DROPPED_WLAN_WLANASYNCDISCONNECTEDRESPONSE    (0x00000002L)

    #define EVENT_DROPPED_WLAN_STA_CONNECTED                                                (0x00000004L)

    #define EVENT_DROPPED_WLAN_STA_DISCONNECTED                                         (0x00000008L)

    #define STATUS_WLAN_STA_CONNECTED                                                                     (0x80000000L)

    And, since pConfigOpt = SL_EVENT_CLASS_WLAN;

    Would

    sl_DevGet(SL_DEVICE_STATUS,&pConfigOpt,&pConfigLen,(unsigned char *)(&statusWlan));

    return the error code SL_WLAN_DISCONNECT_EVENT if CC3200(station) gets disconnected from AP ??

    Kindly reply.

    Warm regards,

    Abhishek.

  • Hi Abhishek,


    sl_DevGet can't be use to know whether device is connected to AP or not. Please use SimpleLinkWlanEventHandler() for connection status.

    SL_EVENT_CLASS_WLAN is meant for some other purpose. SL_WLAN_DISCONNECT_EVENT event doesn't have any relation with WLAN Class status.



    Regards,
    Aashish
  • Hello Aashish,

    Thank you for replying.

    I will use SimpleLinkWlanEventHandler() to get the connection status of CC3200(in Station mode) to the AP.

    Will implement and get back.

    Warm regards,

    Abhishek.

  • Hello Aashish,

    You are saying that

    "SL_EVENT_CLASS_WLAN is meant for some other purpose. SL_WLAN_DISCONNECT_EVENT event doesn't have any relation with WLAN Class status."

    But if you refer the file device.h, you will see that SL_WLAN_DISCONNECT_EVENT is listed in SL_EVENT_CLASS_WLAN.

    Moreover, the function void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent) has return type void, and hence does not return the status of the connection.

    How do i exactly use this function for my purpose then ??

    Please reply.

    Warm regards,

    Abhishek.

  • Hi Abhishek,

    Abhishek Ekhare said:
    SL_EVENT_CLASS_WLAN is meant for some other purpose. SL_WLAN_DISCONNECT_EVENT event doesn't have any relation with WLAN Class status."

    Sorry for typo. Its WLAN Class status meant for some other purpose. SL_EVENT_CLASS_WLAN and WLAN Class status are two different thing. Please dont confuse with these.

    Abhishek Ekhare said:
    Moreover, the function void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent) has return type void, and hence does not return the status of the connection.

    SimpleLinkWlanEventHandler() it's a callback function that call by driver whenever wlan status change. Whenever device disconnected from AP this callback will be called by driver to notify user that device disconnected from AP. Please refer SimpleLinkWlanEventHandler() function in getting_started_with_wlan_station example code. In this function g_ulStatus set using "SET_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION)" on connection and clear  "CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION)"  on disconnect. You just need to check this particular bit wheter device is connected or not

    CheckConnectionStatus()
    {
       if(GET_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION) )
       {
          return connected
       } 
       else
       {
          return disconnected
       }
    }

    Regards,

    Aashish



  • Hello Aashish,
    Thank you very much for such a brilliant answer.
    I will implement this and get back.

    Warm regards,
    Abhishek.