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

Committer:
dflet
Date:
Sun Sep 06 15:19:36 2015 +0000
Revision:
0:400d8e75a8d0
TI's websocket Camera demo, also uses Arducam mini 0v5642 camera.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 0:400d8e75a8d0 1 //*****************************************************************************
dflet 0:400d8e75a8d0 2 // Copyright (C) 2014 Texas Instruments Incorporated
dflet 0:400d8e75a8d0 3 //
dflet 0:400d8e75a8d0 4 // All rights reserved. Property of Texas Instruments Incorporated.
dflet 0:400d8e75a8d0 5 // Restricted rights to use, duplicate or disclose this code are
dflet 0:400d8e75a8d0 6 // granted through contract.
dflet 0:400d8e75a8d0 7 // The program may not be used without the written permission of
dflet 0:400d8e75a8d0 8 // Texas Instruments Incorporated or against the terms and conditions
dflet 0:400d8e75a8d0 9 // stipulated in the agreement under which this program has been supplied,
dflet 0:400d8e75a8d0 10 // and under no circumstances can it be used with non-TI connectivity device.
dflet 0:400d8e75a8d0 11 //
dflet 0:400d8e75a8d0 12 //*****************************************************************************
dflet 0:400d8e75a8d0 13
dflet 0:400d8e75a8d0 14
dflet 0:400d8e75a8d0 15 /**
dflet 0:400d8e75a8d0 16 * @defgroup WebSocketHandler
dflet 0:400d8e75a8d0 17 *
dflet 0:400d8e75a8d0 18 * @{
dflet 0:400d8e75a8d0 19 */
dflet 0:400d8e75a8d0 20
dflet 0:400d8e75a8d0 21 #ifndef __WEBSOCKHANDLER__
dflet 0:400d8e75a8d0 22 #define __WEBSOCKHANDLER__
dflet 0:400d8e75a8d0 23
dflet 0:400d8e75a8d0 24 #define FRAGMENT_LENGTH HTTP_CORE_MAX_PACKET_SIZE_SEND
dflet 0:400d8e75a8d0 25
dflet 0:400d8e75a8d0 26
dflet 0:400d8e75a8d0 27 //*****************************************************************************
dflet 0:400d8e75a8d0 28 //
dflet 0:400d8e75a8d0 29 // If building with a C++ compiler, make all of the definitions in this header
dflet 0:400d8e75a8d0 30 // have a C binding.
dflet 0:400d8e75a8d0 31 //
dflet 0:400d8e75a8d0 32 //*****************************************************************************
dflet 0:400d8e75a8d0 33 #ifdef __cplusplus
dflet 0:400d8e75a8d0 34 extern "C"
dflet 0:400d8e75a8d0 35 {
dflet 0:400d8e75a8d0 36 #endif
dflet 0:400d8e75a8d0 37
dflet 0:400d8e75a8d0 38 /*!
dflet 0:400d8e75a8d0 39 * \brief Parse entire websocket packet and forward only the payload to the user API.
dflet 0:400d8e75a8d0 40 * The API can handle packets received in parts. It is blocked till entire packet is received.
dflet 0:400d8e75a8d0 41 *
dflet 0:400d8e75a8d0 42 *
dflet 0:400d8e75a8d0 43 * \param[in] uConnection Connection number on HTTP server. The library supports 4.
dflet 0:400d8e75a8d0 44 * \param[in] *pData Pointer to the HttpBlob structure that holds the data.
dflet 0:400d8e75a8d0 45 *
dflet 0:400d8e75a8d0 46 * \return 1 - If packet was successfully received, parsed and sent to the user API
dflet 0:400d8e75a8d0 47 * 0 - Error
dflet 0:400d8e75a8d0 48 */
dflet 0:400d8e75a8d0 49
dflet 0:400d8e75a8d0 50 int WSCore_DataRecv(UINT16 uConnection, struct HttpBlob* pData);
dflet 0:400d8e75a8d0 51
dflet 0:400d8e75a8d0 52 /*!
dflet 0:400d8e75a8d0 53 * \brief Returns status string according to status code.
dflet 0:400d8e75a8d0 54 *
dflet 0:400d8e75a8d0 55 * \param[in] WSStatus Status code of the websocket packet
dflet 0:400d8e75a8d0 56 * \param[in] *status String pointer to the message for the status
dflet 0:400d8e75a8d0 57 *
dflet 0:400d8e75a8d0 58 * \return void
dflet 0:400d8e75a8d0 59 */
dflet 0:400d8e75a8d0 60
dflet 0:400d8e75a8d0 61 void WSStatusString(UINT32 WSStatus, struct HttpBlob* status);
dflet 0:400d8e75a8d0 62
dflet 0:400d8e75a8d0 63
dflet 0:400d8e75a8d0 64
dflet 0:400d8e75a8d0 65 /*!
dflet 0:400d8e75a8d0 66 * \brief Sends data to a websocket client . *
dflet 0:400d8e75a8d0 67 *
dflet 0:400d8e75a8d0 68 * \param[in] uConnection Connection number on HTTP server.
dflet 0:400d8e75a8d0 69 * \param[in] PayLoad Structure holding the payload data and the size of the data
dflet 0:400d8e75a8d0 70 * \param[in] Opcode User provides data type (text/binary/ping/pong/close).
dflet 0:400d8e75a8d0 71 *
dflet 0:400d8e75a8d0 72 * \return 1 - If packet was successfully received, parsed and sent to the user API
dflet 0:400d8e75a8d0 73 * 0 - Error
dflet 0:400d8e75a8d0 74 */
dflet 0:400d8e75a8d0 75
dflet 0:400d8e75a8d0 76 int WSCore_DataSend(UINT16 uConnection, struct HttpBlob PayLoad, UINT8 Opcode);
dflet 0:400d8e75a8d0 77
dflet 0:400d8e75a8d0 78
dflet 0:400d8e75a8d0 79 /*!
dflet 0:400d8e75a8d0 80 * \brief Parses the payload length to the header if it is more than 125 ie (16 bit/64 bit)
dflet 0:400d8e75a8d0 81 *
dflet 0:400d8e75a8d0 82 * \param[in] *pData Pointer to the websocket packet
dflet 0:400d8e75a8d0 83 * \param[in] iter iter = 2 for 16 bit length
dflet 0:400d8e75a8d0 84 * iter = 8 for 64 bit length
dflet 0:400d8e75a8d0 85 *
dflet 0:400d8e75a8d0 86 *
dflet 0:400d8e75a8d0 87 * \return size of the payload
dflet 0:400d8e75a8d0 88 */
dflet 0:400d8e75a8d0 89 int Payloadlength(struct HttpBlob * pData, UINT8 iter);
dflet 0:400d8e75a8d0 90
dflet 0:400d8e75a8d0 91 #define sl_WebSocketHandshakeEvtHdlr WebSocketHandshakeEventHandler
dflet 0:400d8e75a8d0 92 #define sl_WebSocketRecvEvtHdlr WebSocketRecvEventHandler
dflet 0:400d8e75a8d0 93 #define sl_WebSocketSend WSCore_DataSend
dflet 0:400d8e75a8d0 94 /*
dflet 0:400d8e75a8d0 95 * This is a call back function from the library. User is informed that the connection has been closed.
dflet 0:400d8e75a8d0 96 */
dflet 0:400d8e75a8d0 97 #define sl_WebSocketCloseEvtHdlr WebSocketCloseSessionHandler
dflet 0:400d8e75a8d0 98
dflet 0:400d8e75a8d0 99 #ifdef __cplusplus
dflet 0:400d8e75a8d0 100 }
dflet 0:400d8e75a8d0 101 #endif /* __cplusplus */
dflet 0:400d8e75a8d0 102 #endif
dflet 0:400d8e75a8d0 103
dflet 0:400d8e75a8d0 104