40 lines
1.2 KiB
C
40 lines
1.2 KiB
C
|
#ifndef __WIFLYUDP_H__
|
||
|
#define __WIFLYUDP_H__
|
||
|
|
||
|
#include <Arduino.h>
|
||
|
|
||
|
#define SCAN_SSID_BUFFER_SIZE 33 //
|
||
|
|
||
|
class network_results {
|
||
|
public:
|
||
|
char ssid[10][SCAN_SSID_BUFFER_SIZE];
|
||
|
};
|
||
|
|
||
|
class WiFlyUDP {
|
||
|
public:
|
||
|
WiFlyUDP(Stream* newUart);
|
||
|
void begin(char* ssid, char* pass, char* ip_host, uint16_t remote_Port,
|
||
|
uint16_t local_Port);
|
||
|
boolean join();
|
||
|
const char * ip();
|
||
|
byte scan(network_results *networks);
|
||
|
boolean reboot();
|
||
|
boolean reset();
|
||
|
boolean enterCommandMode();
|
||
|
boolean baudrate(long baudrate);
|
||
|
private:
|
||
|
Stream* uart;
|
||
|
boolean findInResponse(const char *toMatch, unsigned int timeOut);
|
||
|
void skipRemainderOfResponse();
|
||
|
boolean sendCommand(const char *command,
|
||
|
boolean isMultipartCommand, // Has default value
|
||
|
const char *expectedResponse); // Has default value
|
||
|
boolean sendCommand(const __FlashStringHelper *command,
|
||
|
boolean isMultipartCommand, // Has default value
|
||
|
const char *expectedResponse); // Has default value
|
||
|
void setConfiguration(char* ssid, char* pass, char* ip_host, uint16_t remote_Port,
|
||
|
uint16_t local_Port);
|
||
|
};
|
||
|
#endif
|
||
|
|