TI's CC3100 websocket camera demo with Arducam mini ov5642 and freertos. Should work with other M3's. Work in progress test demo.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

WebSockHandler

WebSockHandler

Functions

int Payloadlength (struct HttpBlob *pData, UINT8 iter)
 Parses the payload length to the header if it is more than 125 ie (16 bit/64 bit)
int WSCore_DataRecv (UINT16 uConnection, struct HttpBlob *pData)
 Parse entire websocket packet and forward only the payload to the user API. The API can handle packets received in parts. It is blocked till entire packet is received.
int WSCore_DataSend (UINT16 uConnection, struct HttpBlob PayLoad, UINT8 Opcode)
 Sends data to a websocket client.
void WSStatusString (UINT32 WS_Status, struct HttpBlob *status)
 Returns status string according to status code - CHANGE.

Function Documentation

int Payloadlength ( struct HttpBlob *  pData,
UINT8  iter 
)

Parses the payload length to the header if it is more than 125 ie (16 bit/64 bit)

Parameters:
[in]*pDataPointer to the websocket packet
[in]iteriter = 2 for 16 bit length iter = 8 for 64 bit length
Returns:
size of the payload

Definition at line 86 of file WebSockHandler.cpp.

int WSCore_DataRecv ( UINT16  uConnection,
struct HttpBlob *  pData 
)

Parse entire websocket packet and forward only the payload to the user API. The API can handle packets received in parts. It is blocked till entire packet is received.

Parameters:
[in]uConnectionConnection number on HTTP server. The library supports 4.
[in]*pDataPointer to the HttpBlob structure that holds the data.
Returns:
1 - If packet was successfully received, parsed and sent to the user API 0 - Error

If header supports extension, send back error Send error frame : TODO

Definition at line 104 of file WebSockHandler.cpp.

int WSCore_DataSend ( UINT16  uConnection,
struct HttpBlob  PayLoad,
UINT8  Opcode 
)

Sends data to a websocket client.

Sends data to a websocket client . *.

Parameters:
[in]uConnectionConnection number on HTTP server.
[in]PayLoadStructure holding the payload data and the size of the data
[in]OpcodeUser provides data type (text/binary/ping/pong/close).
Returns:
1 - If packet was successfully received, parsed and sent to the user API 0 - Error

Is this the final packet?

Add opcode to the header

Add this byte to the sendpacket

Reset byte

Mask bit is always set to 0 from server to client

PayloadLen field

Add this byte to the sendpacket

If payload length is more than 125 bytes, we need 16 bits to represent it.

Reset byte

Definition at line 291 of file WebSockHandler.cpp.

void WSStatusString ( UINT32  WS_Status,
struct HttpBlob *  status 
)

Returns status string according to status code - CHANGE.

Returns status string according to status code.

Definition at line 385 of file WebSockHandler.cpp.