posilani dat

Dependencies:   FatFileSystemCpp mbed PowerControl USBHostLite

wifi.h

Committer:
jkaderka
Date:
2015-04-29
Revision:
9:8839ecc02e0e
Parent:
6:c16e8b17092a
Child:
11:137108e3403e

File content as of revision 9:8839ecc02e0e:

/*
 * Wifi communication
 *
 * Uses dhcp to obtain the ip and communicates on port 2000
 *
*/
#ifndef __RF_H_
#define __RF_H_

#include "mbed.h"
#include "WiflyInterface.h"

#define BUFFER_SIZE        (sizeof(int) + sizeof(short)*3 + sizeof(float)*3)

class Wifi {
    public:
        Wifi (PinName tx, PinName rx, PinName reset, PinName status,
            const char * ssid, const char * phrase);

        /*
         * Returns received command (without #), just the one char
         */
        char getCmd(void);
        
        /*
        * Format: (int) -1 (int) -1 (int) swimmer_id
        *   many times (char) 0xAA (int) count 3*(short) acc 3*(float)gyro
        *         (int) -1 (int) -1        
        */
        int sendFile(const char *fname, int swimmer_id);

    private:
        WiflyInterface wifi_;
       
        void bufferSend(char *buffer, size_t size);       
};

#endif