NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

CC3200 HTTP Client Demo

From Texas Instruments Wiki
Jump to: navigation, search
Cc31xx cc32xx return home.png
Cc32xx return sample apps.png

Overview[edit]

HTTP client library can be used to communicate and exchange data with the HTTP web server.
HTTP client library support two modes

  1. Minimum mode: HTTP client library in minimum mode supports synchronous mode, redirection handling, chunked transfer encoding, proxy and TLS. HTTPCli_LIBTYPE_MIN flag should be used to build the library in minimum mode.
  2. Full Mode: HTTP Client library in full mode supports all the features of the minimal mode along with asynchronous mode and content handling and requires RTOS support. HTTPCli_LIBTYPE_FULL flag should be used to build the library in full mode.

This sample application demonstrates the HTTP Client library API for HTTP based application development in minimum mode. This application explain user to how to:

  • Connect to an access point
  • Connect to a HTTP Server with and without proxy
  • Do POST, GET, PUT and DELETE
  • Parse JSON data using “Jasmine JSON Parser”

To enable the secure connection ( in example) user need to add the follow code snippet

   SlDateTime_t dt;
   struct HTTPCli_SecureParams sparams;
   
   /* Set current Date to validate certificate */
   dt.sl_tm_day = DATE;
   dt.sl_tm_mon = MONTH;
   dt.sl_tm_year = YEAR;
   dt.sl_tm_hour = HOUR;
   dt.sl_tm_min = MINUTE;
   dt.sl_tm_sec = SECOND;
   sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,
             			SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
                               sizeof(SlDateTime_t), (unsigned char *)(&dt));
   
   /* Security parameters */
   sparams.method.secureMethod = SL_SO_SEC_METHOD_TLSV1_2;
   sparams.mask.secureMask  = SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA;
   strncpy(sparams.cafile, SL_SSL_CA_CERT, sizeof(SL_SSL_CA_CERT));
   sparams.privkey[0] = 0;
   sparams.cert[0] = 0;
   sparams.dhkey[0] = 0;
   HTTPCli_setSecureParams(&sparams);

And HTTPCli_connect function should be called with HTTPCli_TYPE_TLS option.

   HTTPCli_connect(&cli, (struct sockaddr *)&addr, HTTPCli_TYPE_TLS, NULL);

User can change the proxy by changing the MACRO 'PROXY_IP', ‘PROXY_PORT'. To enable proxy user need to define USE_PROXY macro in project properties.

HTTP Client library API details are provided in SDK under docs folder.



Usage[edit]

Prerequisite: This application requires an access-point with internet connectivity

  • Connect the board to a Windows-PC and configure the terminal-program for seeing the logs.
  • Open sl_common.h and and change SSID_NAME, SEC_TYPE and PASSKEY as per your access-point's properties. SimpleLink device will connect to this AP when the application is executed
  • Open main.c and change HOST_NAME and HOST_PORT as per your server properties. Other HTTP request parameters may also change depending upon the server. This example is tested with httpbin.org host and 80 port.
  • Build and launch the project, the application tries to connect to AP.
  • Upon connection application tries to connect to the http host.
  • Upon successful connection application will send POST, DELETE, PUT and GET request and check and parse the response.
  • See the self explanatory logs on the terminal-program's console. On success, below message will be displayed on the terminal
Http client demo.png

Limitations/Known Issues[edit]

  • HTTP connection timeout is not supported.
  • Only IPV4 is supported

Links[edit]

{{#invoke: Navbox | navbox }} {{#invoke: Navbox | navbox }}

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article CC3200 HTTP Client Demo here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article CC3200 HTTP Client Demo here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article CC3200 HTTP Client Demo here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article CC3200 HTTP Client Demo here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article CC3200 HTTP Client Demo here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC3200 HTTP Client Demo here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC3200 HTTP Client Demo here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article CC3200 HTTP Client Demo here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article CC3200 HTTP Client Demo here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity