HTTP Driver

The HTTP driver is used to provide HTTP GET/POST functionality on capable platforms.

Data Structures

ATMO_HTTP_Header_t

Single HTTP Header

Member Name Type
headerKey const char *
headerValue const char *

ATMO_HTTP_Transaction_t

Generic HTTP transaction structure.

Member Name Type Description
url const char * URL
method ATMO_HTTP_Method_t Get/Post
contentType const char * Content type for POST. Can be NULL, will default to application/json
data const char * Data for POST. Can be NULL.
dataLen unsigned int Length of POST data.
headerOverlay ATMO_HTTP_Header_t * Array of headers to overlay.
headerOverlayLen uint8_t Length of array.

ATMO_HTTP_Config_t

Member Name Type
unused uint8_t

Enumerations

enum ATMO_HTTP_Status_t

Name Value
ATMO_HTTP_Status_Success 0x00u
ATMO_HTTP_Status_Fail 0x01u
ATMO_HTTP_Status_Initialized 0x02u
ATMO_HTTP_Status_Invalid 0x03u
ATMO_HTTP_Status_NotSupported 0x04u
ATMO_HTTP_Status_Unspecified 0x05u

enum ATMO_HTTP_Method_t

Name Value
ATMO_HTTP_GET  
ATMO_HTTP_POST  

Functions

ATMO_HTTP_Status_t ATMO_HTTP_Init(ATMO_DriverInstanceHandle_t tcpClientDriverInstance, uint8_t *packetBuf, uint32_t packetBufSize, ATMO_DriverInstanceHandle_t *httpInstance)

Initialize the HTTP driver.

Parameter Direction Type
httpInstance N/A ATMO_DriverInstanceHandle_t *
packetBufSize N/A uint32_t
packetBuf N/A uint8_t *
tcpClientDriverInstance N/A ATMO_DriverInstanceHandle_t
Return Type
ATMO_HTTP_Status_t

ATMO_HTTP_Status_t ATMO_HTTP_DeInit(ATMO_DriverInstanceHandle_t instance)

De-initialize the HTTP driver.

Parameter Direction Type
instance in ATMO_DriverInstanceHandle_t
Return Type
ATMO_HTTP_Status_t

ATMO_HTTP_Status_t ATMO_HTTP_SetConfiguration(ATMO_DriverInstanceHandle_t instance, const ATMO_HTTP_Config_t *config)

Set the HTTP configuration.

Parameter Direction Type
config in const ATMO_HTTP_Config_t *
instance N/A ATMO_DriverInstanceHandle_t
Return Type
ATMO_HTTP_Status_t

ATMO_HTTP_Status_t ATMO_HTTP_Perform(ATMO_DriverInstanceHandle_t instance, ATMO_HTTP_Transaction_t *transaction, unsigned int *respCode, unsigned int *respDataLen, unsigned int timeoutMs)

Perform a HTTP Get/Post transaction.

Parameter Direction Type
timeoutMs N/A unsigned int
respDataLen N/A unsigned int *
respCode N/A unsigned int *
transaction N/A ATMO_HTTP_Transaction_t *
instance N/A ATMO_DriverInstanceHandle_t
Return Type
ATMO_HTTP_Status_t

ATMO_HTTP_Status_t ATMO_HTTP_GetRespData(ATMO_DriverInstanceHandle_t instance, uint8_t *buf, unsigned int bufLen)

Get the HTTP response data.

Parameter Direction Type
bufLen N/A unsigned int
buf N/A uint8_t *
instance N/A ATMO_DriverInstanceHandle_t
Return Type
ATMO_HTTP_Status_t