HttpServer Library for "mbed-os" which added a snapshot handler.
Dependents: GR-PEACH-webcam GR-Boards_WebCamera GR-Boards_WebCamera GR-Boards_WebCamera
Fork of HttpServer_snapshot by
Handler/SnapshotHandler.h@11:0700755d64ae, 2016-10-28 (annotated)
- Committer:
- dkato
- Date:
- Fri Oct 28 06:15:29 2016 +0000
- Revision:
- 11:0700755d64ae
- Parent:
- 6:d9e6379eefac
- Child:
- 13:d3571c244759
Change for the mbed-os.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dkato | 6:d9e6379eefac | 1 | /******************************************************************************* |
dkato | 6:d9e6379eefac | 2 | * DISCLAIMER |
dkato | 6:d9e6379eefac | 3 | * This software is supplied by Renesas Electronics Corporation and is only |
dkato | 6:d9e6379eefac | 4 | * intended for use with Renesas products. No other uses are authorized. This |
dkato | 6:d9e6379eefac | 5 | * software is owned by Renesas Electronics Corporation and is protected under |
dkato | 6:d9e6379eefac | 6 | * all applicable laws, including copyright laws. |
dkato | 6:d9e6379eefac | 7 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING |
dkato | 6:d9e6379eefac | 8 | * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT |
dkato | 6:d9e6379eefac | 9 | * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
dkato | 6:d9e6379eefac | 10 | * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. |
dkato | 6:d9e6379eefac | 11 | * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS |
dkato | 6:d9e6379eefac | 12 | * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE |
dkato | 6:d9e6379eefac | 13 | * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR |
dkato | 6:d9e6379eefac | 14 | * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE |
dkato | 6:d9e6379eefac | 15 | * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
dkato | 6:d9e6379eefac | 16 | * Renesas reserves the right, without notice, to make changes to this software |
dkato | 6:d9e6379eefac | 17 | * and to discontinue the availability of this software. By using this software, |
dkato | 6:d9e6379eefac | 18 | * you agree to the additional terms and conditions found by accessing the |
dkato | 6:d9e6379eefac | 19 | * following link: |
dkato | 6:d9e6379eefac | 20 | * http://www.renesas.com/disclaimer* |
dkato | 6:d9e6379eefac | 21 | * Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved. |
dkato | 6:d9e6379eefac | 22 | *******************************************************************************/ |
dkato | 6:d9e6379eefac | 23 | |
dkato | 6:d9e6379eefac | 24 | #ifndef SNAPSHOT_HANDLER_H |
dkato | 6:d9e6379eefac | 25 | #define SNAPSHOT_HANDLER_H |
dkato | 6:d9e6379eefac | 26 | |
dkato | 6:d9e6379eefac | 27 | #include "HTTPRequestHandler.h" |
dkato | 6:d9e6379eefac | 28 | |
dkato | 6:d9e6379eefac | 29 | class SnapshotHandler : public HTTPRequestHandler |
dkato | 6:d9e6379eefac | 30 | { |
dkato | 6:d9e6379eefac | 31 | public: |
dkato | 11:0700755d64ae | 32 | SnapshotHandler(const char* rootPath, const char* path, TCPSocket* pTCPSocket); |
dkato | 6:d9e6379eefac | 33 | virtual ~SnapshotHandler(); |
dkato | 6:d9e6379eefac | 34 | |
dkato | 6:d9e6379eefac | 35 | static void attach_req(int(*fptr)(const char ** pp_data)) { |
dkato | 6:d9e6379eefac | 36 | callback_func_req = fptr; |
dkato | 6:d9e6379eefac | 37 | } |
dkato | 6:d9e6379eefac | 38 | |
dkato | 6:d9e6379eefac | 39 | //protected: |
dkato | 11:0700755d64ae | 40 | static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new SnapshotHandler(rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one |
dkato | 6:d9e6379eefac | 41 | |
dkato | 6:d9e6379eefac | 42 | virtual void doGet(); |
dkato | 6:d9e6379eefac | 43 | virtual void doPost(); |
dkato | 6:d9e6379eefac | 44 | virtual void doHead(); |
dkato | 6:d9e6379eefac | 45 | |
dkato | 6:d9e6379eefac | 46 | virtual void onReadable(); //Data has been read |
dkato | 6:d9e6379eefac | 47 | virtual void onWriteable(); //Data has been written & buf is free |
dkato | 6:d9e6379eefac | 48 | virtual void onClose(); //Connection is closing |
dkato | 6:d9e6379eefac | 49 | |
dkato | 6:d9e6379eefac | 50 | private: |
dkato | 6:d9e6379eefac | 51 | static int (*callback_func_req)(const char ** pp_data); |
dkato | 6:d9e6379eefac | 52 | static Semaphore req_sem; |
dkato | 6:d9e6379eefac | 53 | const char * send_data_buf; |
dkato | 6:d9e6379eefac | 54 | int send_size; |
dkato | 6:d9e6379eefac | 55 | int send_index; |
dkato | 6:d9e6379eefac | 56 | bool m_err404; |
dkato | 6:d9e6379eefac | 57 | }; |
dkato | 6:d9e6379eefac | 58 | |
dkato | 6:d9e6379eefac | 59 | #endif |