Bender Robotics / Mbed 2 deprecated PLAUCI_full

Dependencies:   FatFileSystemCpp mbed PowerControl USBHostLite

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers wifi.h Source File

wifi.h

00001 /*
00002  * Wifi communication
00003  *
00004  * Uses dhcp to obtain the ip and communicates on port 2000
00005  *
00006 */
00007 #ifndef __RF_H_
00008 #define __RF_H_
00009 
00010 #include "mbed.h"
00011 //#include "WiflyInterface.h"
00012 #define FRAME_HEADER_LEN 6
00013 #define SEND_SIZE 1024
00014 
00015 class Wifi {
00016     public:
00017         Wifi (PinName tx, PinName rx, PinName cts, PinName reset);
00018         /*
00019          * Serves as constructor (we're changing PLL frequency)
00020          */
00021         void init(void);
00022         /*
00023          * Returns received command (without #), just the one char
00024          */
00025         int getCmd(char* cmd_header, char* cmd_data);
00026         
00027         /*
00028          * Sends one char to wifly
00029          */
00030         void sendByte(char byte);
00031         
00032         /*
00033          * Sends one char to wifly
00034          */
00035         char readByte(void);
00036         
00037         /*
00038         * Format: (int) -1 (int) -1 (int) swimmer_id
00039         *   many times (int) count 3*(short) acc 3*(float)gyro
00040         *         (int) -1 (int) -1    up to 1023 zeros   
00041         */
00042         //int sendFile(const char *fname, int swimmer_id);
00043         int sendFile(const char *fname);
00044         bool readable(void);
00045         void sendAck(void);
00046         void sendNack(void);
00047         void sendFail(void);
00048         int waitForAck(void);
00049 
00050     private:
00051         Serial wifi_;
00052         int in_buf;
00053         char buffer[SEND_SIZE];
00054         void bufferSend(size_t size);
00055         int bufferSendVerify(char byte); 
00056         int bufferFlush(void);
00057 };
00058 
00059 #endif