TCPIP_HTTP_CurrentConnectionPostSmSet Function

C

void TCPIP_HTTP_CurrentConnectionPostSmSet(
    HTTP_CONN_HANDLE connHandle, 
    uint16_t state
);

Description

This function sets the POST state machine state for the connection defined by connHandle. This state is maintained by the HTTP connection and can be used by the user of the HTTP to maintain its own POST state machine. The values of the POST state machine have significance only for the user of the HTTP connection.

Preconditions

None.

Parameters

ParametersDescription
connHandleHTTP connection handle.
state16-bit integer state for POST state machine.

Returns

None.

Remarks

None.

Example

uint8_t* httpDataBuff;
uint16_t httpBuffSize;
#define SM_POST_LCD_READ_NAME   1
#define SM_POST_LCD_READ_VALUE  2

switch(TCPIP_HTTP_CurrentConnectionPostSmGet(connHandle))
{
    // Find the name
    case SM_POST_LCD_READ_NAME:

        // Read a name
        httpBuffSize = TCPIP_HTTP_CurrentConnectionDataBufferSizeGet(connHandle);
        if(TCPIP_HTTP_PostNameRead(connHandle, httpDataBuff, httpBuffSize) == HTTP_READ_INCOMPLETE)
            return HTTP_IO_NEED_DATA;

        TCPIP_HTTP_CurrentConnectionPostSmSet(connHandle, SM_POST_LCD_READ_VALUE);
        // No break...continue reading value

    // Found the value, so store the LCD and return
    case SM_POST_LCD_READ_VALUE:
    .
    .
    .
}