this will take a image from C328 serial camera and store those images in mbed flash as html and this html page is uploaded into the server at ip:192.168.1.2

Dependencies:   mbed

Committer:
mitesh2patel
Date:
Wed Dec 15 15:01:56 2010 +0000
Revision:
0:e1a0471e5ffb

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mitesh2patel 0:e1a0471e5ffb 1 #ifndef _SERIAL_BUFFERED_H_
mitesh2patel 0:e1a0471e5ffb 2 #define _SERIAL_BUFFERED_H_
mitesh2patel 0:e1a0471e5ffb 3
mitesh2patel 0:e1a0471e5ffb 4 /**
mitesh2patel 0:e1a0471e5ffb 5 * Buffered serial class.
mitesh2patel 0:e1a0471e5ffb 6 */
mitesh2patel 0:e1a0471e5ffb 7 class SerialBuffered : public Serial {
mitesh2patel 0:e1a0471e5ffb 8 public:
mitesh2patel 0:e1a0471e5ffb 9 /**
mitesh2patel 0:e1a0471e5ffb 10 * Create a buffered serial class.
mitesh2patel 0:e1a0471e5ffb 11 *
mitesh2patel 0:e1a0471e5ffb 12 * @param tx A pin for transmit.
mitesh2patel 0:e1a0471e5ffb 13 * @param rx A pin for receive.
mitesh2patel 0:e1a0471e5ffb 14 */
mitesh2patel 0:e1a0471e5ffb 15 SerialBuffered(PinName tx, PinName rx);
mitesh2patel 0:e1a0471e5ffb 16
mitesh2patel 0:e1a0471e5ffb 17 /**
mitesh2patel 0:e1a0471e5ffb 18 * Destroy.
mitesh2patel 0:e1a0471e5ffb 19 */
mitesh2patel 0:e1a0471e5ffb 20 virtual ~SerialBuffered();
mitesh2patel 0:e1a0471e5ffb 21
mitesh2patel 0:e1a0471e5ffb 22 /**
mitesh2patel 0:e1a0471e5ffb 23 * Get a character.
mitesh2patel 0:e1a0471e5ffb 24 *
mitesh2patel 0:e1a0471e5ffb 25 * @return A character. (-1:timeout)
mitesh2patel 0:e1a0471e5ffb 26 */
mitesh2patel 0:e1a0471e5ffb 27 int getc();
mitesh2patel 0:e1a0471e5ffb 28
mitesh2patel 0:e1a0471e5ffb 29 /**
mitesh2patel 0:e1a0471e5ffb 30 * Returns 1 if there is a character available to read, 0 otherwise.
mitesh2patel 0:e1a0471e5ffb 31 */
mitesh2patel 0:e1a0471e5ffb 32 int readable();
mitesh2patel 0:e1a0471e5ffb 33
mitesh2patel 0:e1a0471e5ffb 34 /**
mitesh2patel 0:e1a0471e5ffb 35 * Set timeout for getc().
mitesh2patel 0:e1a0471e5ffb 36 *
mitesh2patel 0:e1a0471e5ffb 37 * @param ms milliseconds. (-1:Disable timeout)
mitesh2patel 0:e1a0471e5ffb 38 */
mitesh2patel 0:e1a0471e5ffb 39 void setTimeout(int ms);
mitesh2patel 0:e1a0471e5ffb 40
mitesh2patel 0:e1a0471e5ffb 41 /**
mitesh2patel 0:e1a0471e5ffb 42 * Read requested bytes.
mitesh2patel 0:e1a0471e5ffb 43 *
mitesh2patel 0:e1a0471e5ffb 44 * @param bytes A pointer to a buffer.
mitesh2patel 0:e1a0471e5ffb 45 * @param requested Length.
mitesh2patel 0:e1a0471e5ffb 46 *
mitesh2patel 0:e1a0471e5ffb 47 * @return Readed byte length.
mitesh2patel 0:e1a0471e5ffb 48 */
mitesh2patel 0:e1a0471e5ffb 49 size_t readBytes(uint8_t *bytes, size_t requested);
mitesh2patel 0:e1a0471e5ffb 50
mitesh2patel 0:e1a0471e5ffb 51 private:
mitesh2patel 0:e1a0471e5ffb 52 void handleInterrupt();
mitesh2patel 0:e1a0471e5ffb 53 static const int BUFFERSIZE = 4096;
mitesh2patel 0:e1a0471e5ffb 54 uint8_t buffer[BUFFERSIZE]; // points at a circular buffer, containing data from m_contentStart, for m_contentSize bytes, wrapping when you get to the end
mitesh2patel 0:e1a0471e5ffb 55 uint16_t indexContentStart; // index of first bytes of content
mitesh2patel 0:e1a0471e5ffb 56 uint16_t indexContentEnd; // index of bytes after last byte of content
mitesh2patel 0:e1a0471e5ffb 57 int timeout;
mitesh2patel 0:e1a0471e5ffb 58 Timer timer;
mitesh2patel 0:e1a0471e5ffb 59 };
mitesh2patel 0:e1a0471e5ffb 60
mitesh2patel 0:e1a0471e5ffb 61 #endif