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: custom webpage

Part Number: CC3200

I just wanted to know about out_of_box example, where it serves a webpage as mysimplelink.net . There is provision to add profiles(different SSID) with password. I just wanted to know where in C code of OOB example, they are stored? How they are linked to C code from html page? Basically I wanted to build a custom webpage which should accept SSID name and password from web client and  will be saved this in Sflash. I also want to change the domain name. I've gone through the Chapter-12 HTTP Server of SWRU368a.pdf. I can't see any token that gets or posts the SSID and password in OOB example

If anyone has done this before please guide, would appreciate any help on this.

  • Hi Techinspired,

    To store SSID, password are used predefined tokens (e.g. __SL_P_P.A). This tokens are internaly served by NWP and from this reason you not see code for this tokens in webserver handler.

    For your purpose you can use this predefined tokens in your webpage or you can create own user tokens and save profiles by sl_ API calls. But do not forgot that you cannot call sl_ API call from handler context.

    Jan
  • Hi Jan,

    Thanks for your reply!

    If I will use the predefined  token(__SL_P_P.A,__SL_P_P.B, __SL_P_P.C) to get SSID, security type and security key directly in SimpleLinkHttpServerCallback in OOB example as

     POST_token[] = "__SL_P_P.A";

    POST_token[] = "__SL_P_P.B";

    POST_token[] = "__SL_P_P.C";

    and get them in handler like:

    case SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT:
            {
                
                unsigned char *ptr = pSlHttpServerEvent->EventData.httpPostData.token_name.data;

               
                if(memcmp(ptr, POST_token, strlen((const char *)POST_token)) == 0)
            {
                    ptr = pSlHttpServerEvent->EventData.httpPostData.token_value.data;

    }

    }

    So would I get the SSID,security key security type in ptr my C code.....Correct me if I am wrong here, as I'm not familiar with this programming practices?

    Best Regards,

    Techinspired

  • Hi Techinspired,

    No, this is not possible. Handler SimpleLink HttpServer Callback() is only for user tokens. Predefined tokens are served by NWP (network processor) internally and handler is not called.

    Jan
  • Dear Jan,

    Thanks a lot for your reply!
    could you please explain in detail or guide how should I get the SSID, security type, security key from custom webpage. How do I link them to my C code as variable from a handler's context?

    Best Regards.
  • Hi Techinspired,

    If you don't want to use predefined tokens (why you not want use it?), than you have two options:

    - use user tokens (how to use user tokens you find at httpserver example in SDK). Inside you webpage(s) you will have user tokens. User tokens are served by SimpleLinkHttpServerCallback handler. In this handler you will receive information/parameter, set some flag and save it by sl_ API in your main or other task.
    - use http server in application processor (see websock_camera example in SDK).

    Jan

  • Dear Jan,

    Thanks a lot for your reply!

    Jan Dospel said:
    If you don't want to use predefined tokens (why you not want use it?

    I wanted to use predefined token, but they are served internally by the NWP, so I assumed that I can not use then in my main C code...am I right ? So I decided to use User tokens.

    If one can use predefined token in main C code, could you please explain me how to do that with an example?

    Best Regards,

    Techinspired

  • Hi Techinspired,

    It is correct that predefined tokens cannot be served by your C code. But if you use for connection auto connection policy and profiles, than predefined tokens can be used perfectly. For manual connection by sl_WlanConnect() you need know parameters inside your firmware and you need to use user tokens.

    Jan
  • Dear Jan,

    Jan Dospel said:
    But if you use for connection auto connection policy and profiles, than predefined tokens can be used perfectly. For manual connection by sl_WlanConnect() you need know parameters inside your firmware and you need to use user tokens.

    If the connection policy is set to Auto though, the profile SSID names and security keys, must get stored somewhere as variables behind C code...am I correct? if yes, then we can use it. If no, then how would I use user token in C code to post the" SSID, password and security type"  filled by the user on a webpage to a http server. Currently I connecting through a manual connection by sl_WlanConnect(). Basically I want cc3200 should serve a webpage where a web client can fill up the SSID,Password and security types so that cc3200 will connect to that AP when it is in station mode and then would be a different field for SSID name on the same webpage ,when it will be in AP mode.

    Thanks,

    Techinspired

  • Hi Techinspired,

    Predefined tokens are served internally by NWP. What this means? When you use predefined token at webpage, and you save values from page, token is served by NWP and profile is saved without any touch of your C code. Connection profiles can be maintained by sl_ API sl_WlanProfileAdd(), sl_WlanProfileDel() and sl_WlanProfileGet() from your firmware.

    With connection profiles is only one issue. Due to security restrictions is not possible read connection password stored in profile.

    Jan
  • Dear Jan ,

    Thanks a lot for your reply! your explanation cleared some of my queries/doubts. Now I've to rethink how to do the above task from the new perspective. I will go through the Chapter-12 HTTP Server of SWRU368a.pdf once again, and will get back to you if I have other query :).

    Best Regards,
    Techinspired
  • Dear Jan,

    The predefined tokens are served internally by the NWP and the values set by webclient like SSID and key are stored in NWP. So can application processor communicate with NWP, use these value returned by the predefined tokens in NWP? Are there any API that are used to communicate with the application processor and NWP? I also want set data sampling rate through webpage.


    Best Regards,
    Techinspired
  • Hi Techinspired,

    Please read my previous answer - e2e.ti.com/.../2218964

    Jan