WE310F5  39.00.000
M2MB FWUP Plugin HTTP Client

This section describes the M2MB APIs for FWUP Plugin for HTTP Client. More...

#define M2MB_FWUP_HTTPC_DEFAULT_MAX_BODY_LEN   1500
 
#define M2MB_FWUP_HTTPC_DEFAULT_MAX_HEADER_LEN   1500
 
typedef struct M2M_FWUP_HTTP_CLIENT M2M_FWUP_HTTP_CLIENT_T
 HTTP client structure for FWUP. More...
 
M2M_FWUP_HTTP_CLIENT_Tm2m_fwup_http_client_init (UINT8 is_sslEn, M2MB_FWUP_USER_CB_T user_cb, void *user_ctx)
 FWUP module initialization for HTTP Client mode. More...
 
M2MB_STATUS_T m2m_fwup_http_client_start (HANDLE fwupHandle, INT8 *SrvAddr, UINT32 SrvPort, UINT8 *url, UINT32 Timeout, INT8 *username, INT8 *password)
 
VOID m2m_fwup_http_client_deinit (HANDLE pFWUPHTTPcCtx)
 FWUP module de-initialization for HTTP Client mode. More...
 

Detailed Description

This section describes the M2MB APIs for FWUP Plugin for HTTP Client.

Macro Definition Documentation

◆ M2MB_FWUP_HTTPC_DEFAULT_MAX_BODY_LEN

#define M2MB_FWUP_HTTPC_DEFAULT_MAX_BODY_LEN   1500

Maximum body size supported for HTTPc

Definition at line 52 of file m2mb_fwup_plugin_httpclient.h.

◆ M2MB_FWUP_HTTPC_DEFAULT_MAX_HEADER_LEN

#define M2MB_FWUP_HTTPC_DEFAULT_MAX_HEADER_LEN   1500

Maximum header size supported for HTTPc

Definition at line 53 of file m2mb_fwup_plugin_httpclient.h.

Typedef Documentation

◆ M2M_FWUP_HTTP_CLIENT_T

HTTP client structure for FWUP.

Structure for storing HTTP client related information for FWUP operations.

Function Documentation

◆ m2m_fwup_http_client_deinit()

VOID m2m_fwup_http_client_deinit ( HANDLE  pFWUPHTTPcCtx)

FWUP module de-initialization for HTTP Client mode.

This API de-initializes FWUP module for HTTP Client mode.

Parameters
[in]pFWUPHTTPcCtxPointer to HTTPc Context returned by m2m_fwup_http_clinet_init.
Returns

m2m_fwup_http_clinet_deinit( M2MB_HTTPC_CTX_T *pFWUPHTTPcCtx );

VOID m2m_fwup_httpc_resp_cb( UINT32 response_code )
{
resp_code = response_code;
if(M2MB_FWUP_OK_E == resp_code)
{
//Give success indication to host
}
else
{
//Give failure indicatino to host
}
}
int main()
{
M2MB_HTTPC_CTX_T *pCtx = NULL;
...
pCtx = m2m_fwup_http_clinet_init( "192.168.20.3", 80, 10000, 0, m2m_fwup_httpc_resp_cb,
NULL, NULL );
if( pCtx == NULL )
{
return M2MB_ERROR;
}
...
m2m_fwup_http_clinet_deinit(pCtx);
return M2MB_OK;
}

◆ m2m_fwup_http_client_init()

M2M_FWUP_HTTP_CLIENT_T* m2m_fwup_http_client_init ( UINT8  is_sslEn,
M2MB_FWUP_USER_CB_T  user_cb,
void *  user_ctx 
)

FWUP module initialization for HTTP Client mode.

This API initializes FWUP module for HTTP Client mode.

Parameters
[in]SrvAddrAddress of HTTP server.
[in]SrvPortPort number of HTTP server.
[in]TimeoutTimeout in milliseconds.
[in]sslEnableFlagFlag to enable/disable SSL.
[in]user_cbUser callback to capture FWUP operational status.
[in]usernameUsername for HTTP server with authentication.
[in]passwordPassword for HTTP server with authentication.
Returns
Returns pointer to HTTPc context (M2MB_HTTPC_CTX_T) on success, NULL on failure.

m2m_fwup_http_clinet_init( INT8 *SrvAddr, UINT32 SrvPort, UINT32 Timeout, UINT32 sslEnableFlag, M2MB_FWUP_USER_CB_T user_cb, INT8 *username, INT8 *password );

VOID m2m_fwup_httpc_resp_cb( UINT32 response_code )
{
resp_code = response_code;
if(M2MB_FWUP_OK_E == resp_code)
{
//Give success indication to host
}
else
{
//Give failure indicatino to host
}
}
int main()
{
M2MB_HTTPC_CTX_T *pCtx = NULL;
...
pCtx = m2m_fwup_http_clinet_init( "192.168.20.3", 80, 10000, 0, m2m_fwup_httpc_resp_cb,
NULL, NULL );
if( pCtx == NULL )
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2m_fwup_http_client_start()

M2MB_STATUS_T m2m_fwup_http_client_start ( HANDLE  fwupHandle,
INT8 SrvAddr,
UINT32  SrvPort,
UINT8 url,
UINT32  Timeout,
INT8 username,
INT8 password 
)