Skip to content

This library provides the HTTP Client implementation that can work on the PSoC® 6 MCU platforms with Wi-Fi connectivity.

License

Notifications You must be signed in to change notification settings

Infineon/http-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP Client Library

Introduction

This library provides the HTTP Client implementation that can work on the PSoC™ 6 MCU platforms with Wi-Fi connectivity. This library supports RESTful methods such as GET, PUT, POST, and HEAD to communicate with the HTTP Server. It uses coreHTTP module of AWS IoT Device SDK for Embedded C library. Please refer to AWS IoT Device SDK for Embedded C library's readme for the HTTP protocol versions supported.

Features

  • Supports Wi-Fi and Ethernet connections.

  • Secure [with TLS security] and non-secure modes of connection.

  • Supports RESTful HTTP methods: HEAD, GET, PUT, POST, DELETE, PATCH, CONNECT, OPTIONS and TRACE.

  • Provides synchronous API to send the request and receive the response.

  • Provides utility APIs to create HTTP headers for forming the HTTP request, and to parse the HTTP headers received in the response.

  • Supports large data downloads through range requests.

  • Multiple HTTP Client instance is supported.

Limitations

  • This library does not support pipelining the HTTP requests. It supports one request-response at a time.

  • Transfer-encoding with "chunked" type is partially supported with a transfer size limit of size equal to the user-given buffer; streaming data transfer is not supported.

Supported Platforms

Supported Frameworks

This middleware library supports the ModusToolbox™ environment.

In this environment the HTTP Client Library uses the abstraction-rtos library for RTOS abstraction APIs and the secure-sockets and wifi-connection-manager libraries for network and connectivity functions.

Dependencies

Quick Start

This library is supported only on ModusToolbox™.

  1. To use http-client library with Wi-Fi kits on FreeRTOS, lwIP, and Mbed TLS combination, the application should pull http-client library and wifi-core-freertos-lwip-mbedtls library which will internally pull secure-sockets, wifi-connection-manager, FreeRTOS, lwIP, Mbed TLS and other dependent modules. To pull wifi-core-freertos-lwip-mbedtls and http-client libraries create the following .mtb files in deps folder.

  2. To use http-client library with CYW955913EVK-01 kit, the application should pull http-client library and wifi-core-threadx-cat5 library which will internally pull secure-sockets, wifi-connection-manager and other dependent modules. To pull wifi-core-threadx-cat5 and http-client libraries create the following .mtb files in deps folder.

  3. To use http-client library with Ethernet kits on FreeRTOS, lwIP, and Mbed TLS combination, the application should pull http-client library and ethernet-core-freertos-lwip-mbedtls library which will internally pull secure-sockets, ethernet-connection-manager, FreeRTOS, lwIP, Mbed TLS and other dependent modules. To pull ethernet-core-freertos-lwip-mbedtls and http-client libraries create the following .mtb files in deps folder.

  4. Review and make the required changes to the pre-defined configuration files.

  • The configuration files are bundled with the wifi-mw-core library for FreeRTOS, lwIP, and Mbed TLS. See README.md for details.
  • If the application is using bundle library then the configuration files are in the bundle library. For example if the application is using Wi-Fi core freertos lwip mbedtls bundle library, the configuration files are in wifi-core-freertos-lwip-mbedtls/configs folder. Similarly if the application is using Ethernet Core FreeRTOS lwIP mbedtls library, the configuration files are in ethernet-core-freertos-lwip-mbedtls/configs folder. Note: Configuration file changes are not required for CYW955913EVK-01.
  1. Define the following COMPONENTS in the application's Makefile for the Azure port library.

    COMPONENTS=FREERTOS MBEDTLS LWIP SECURE_SOCKETS
    

    Note: For CYW955913EVK-01 only the following COMPONENTS are required. COMPONENTS=SECURE_SOCKETS

  2. By default, the HTTP Client Library disables all the debug log messages. To enable log messages, the application must perform the following:

    1. Add the ENABLE_HTTP_CLIENT_LOGS macro to the DEFINES in the code example's Makefile. The Makefile entry would look like as follows:

      DEFINES+=ENABLE_HTTP_CLIENT_LOGS
      
    2. Call the cy_log_init() function provided by the cy-log module. cy-log is part of the connectivity-utilities library.

      See connectivity-utilities library API documentation for cy-log details.

  3. Define the following macro in the application's Makefile to configure the response header maximum length to 'N'. By default, this value will be set to 2048:

    DEFINES+=HTTP_MAX_RESPONSE_HEADERS_SIZE_BYTES=<N>
    
  4. Define the following macro in the application's Makefile to configure the user agent name in all request headers. By default, this component will be added to the request header. Update this for user-defined agent values:

    DEFINES += HTTP_USER_AGENT_VALUE="\"anycloud-http-client\""
    
  5. Define the following macro in the application's Makefile to mandatorily disable custom configuration header file:

    DEFINES += HTTP_DO_NOT_USE_CUSTOM_CONFIG
    DEFINES += MQTT_DO_NOT_USE_CUSTOM_CONFIG
    
  6. Define the following macro in the application's makefile to configure the send timeout 'M' & receive timeout 'N' for HTTP client library. By default these timeout values will be set to 10ms.

DEFINES += HTTP_SEND_RETRY_TIMEOUT_MS=<M>
DEFINES += HTTP_RECV_RETRY_TIMEOUT_MS=<N>
  1. The "aws-iot-device-sdk-port" layer includes the "coreHTTP" and "coreMQTT" modules of the "aws-iot-device-sdk-embedded-C" library by default. If the user application doesn't use MQTT client features, add the following path in the .cyignore file of the application to exclude the coreMQTT source files from the build.

    $(SEARCH_aws-iot-device-sdk-embedded-C)/libraries/standard/coreMQTT
    libs/aws-iot-device-sdk-embedded-C/libraries/standard/coreMQTT
    

Notes

cy_http_client_init will start a thread which is responsible for sending http disconnect notification to application. This thread is created with priority CY_RTOS_PRIORITY_ABOVENORMAL. It is recommended to configure a less priority for the application than the http disconnect event thread. If the application has higher priority and running busy loop, http thread might not get scheduled by the OS which will result in missing of disconnect notification.

Additional Information

About

This library provides the HTTP Client implementation that can work on the PSoC® 6 MCU platforms with Wi-Fi connectivity.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages