Example #1
0
boolean NanoESP::configWifiAP( String ssid, String password)
{
  boolean success = true;
  this->setTimeout(20000);
  if (password == "") success &= (sendCom("AT+CWSAP=\"" + String(ssid) + "\",\"\",5,0", "OK"));
  else  success &= (sendCom("AT+CWSAP=\"" + String(ssid) + "\",\"" + String(password) + "\",5,4", "OK"));
  this->setTimeout(1000);
  return success;
}
Example #2
0
boolean NanoESP::sendData(int id, String msg) {
  boolean success = true;

  success &= sendCom("AT+CIPSEND=" + String(id) + "," + String(msg.length() + 2), ">");
  if (success)
  {
    success &= sendCom(msg, "OK");
  }
  return success;
}
Example #3
0
boolean NanoESP::sendDataClose(int id, String msg) {
  boolean success = true;

  success &= sendCom(at+cip+"SEND=" + String(id) + "," + String(msg.length() + 2), ">");
  if (success)
  {
    success &= sendCom(msg, ok);
    success &= closeConnection(id);
  }
  return success;
}
Example #4
0
boolean NanoESP::newConnection(int id, String type, String ip ,unsigned int port) {  //single direction
  boolean success = true;
  this->setTimeout(10000);
  success &= sendCom(at+cip+"START=" + String(id) + ",\"" + String(type) + "\",\"" + String(ip) + "\"," + String(port), ok); 
  this->setTimeout(1000);
  return success;
}
Example #5
0
boolean NanoESP::reset() {
  boolean success = true;
  this->setTimeout(5000);
  success &= sendCom("AT+RST", "ready");
  this->setTimeout(1000);
  return success;
}
Example #6
0
boolean NanoESP::configWifiStation(String ssid, String password)
{
  boolean success = true;
  this->setTimeout(20000);
  success &= (sendCom("AT+CWJAP=\"" + String(ssid) + "\",\"" + String(password) + "\"", "OK"));
  this->setTimeout(1000);
  return success;
}
Example #7
0
boolean NanoESP::configWifiAP( String ssid, String password, int channel, int crypt)
{
  boolean success = true;
  this->setTimeout(20000);
  success &= (sendCom("AT+CWSAP=\"" + String(ssid) + "\",\"" + String(password) + "\"," + String(channel) + "," + String(crypt), "OK"));
  this->setTimeout(1000);
  return success;
}
Example #8
0
String ESP8266::listAccessPoints()
{
    //Send AT command to list access points
    sendCom(LIST_AP);
    //Get list of access points as a string
    
    //Return string
    
}
Example #9
0
void ESP8266::setMode(int mode)
{
    //Send AT command to set the mode
    //of the ESP8266
    cmd = MODE;
    cmd += "=";
    cmd += String(mode);
    sendCom(cmd);
}
Example #10
0
void ESP8266::setConnectionMode(int mode)
{
    //Send the AT command to set the connection mode
    cmd = MODE;
    cmd += "=";
    if(mode == SINGLE) cmd += String(SINGLE);
    else if(mode == MULTIPLE) cmd += String(MULTIPLE);
    sendCom(cmd);
}
Example #11
0
int ESP8266::moduleTest()
{
    //Send the test signal
    sendCom(TST);
    //Receive the reply from the module
    //If the reply is "OK" return 1
    //If there is an error return 0
    if(esplink.find("OK")) return 1;
    else return 0;    
}
Example #12
0
void ESP8266::createAccessPoint(String SSID, String password)
{
    //Set the parameters of the ESP8266
    //in access point mode
    cmd = SET_AP_PARAMS;
    cmd += "=\"";
    cmd += SSID;
    cmd += "\",\"";
    //cmd += ",\"";
    cmd += password;
    cmd += "\"";
    cmd += String(2);
    cmd += String(1);
    sendCom(cmd);
}
Example #13
0
boolean NanoESP::newConnection(int id, String type, String ip , int port) {  //single direction
  boolean success = true;
  success &= sendCom("AT+CIPSTART=" + String(id) + ",\"" + String(type) + "\",\"" + String(ip) + "\"," + String(port), "OK"); 
  return success;
}
Example #14
0
boolean NanoESP::startUdpServer(int id, String ip ,unsigned int port,unsigned int  recvport, int mode) { //dual direction
  boolean success = true;
  success &= sendCom(at+cip+"START=" + String(id) + ",\"UDP\",\"" + String(ip) + "\"," + String(port) + "," + String(recvport) + "," + String(mode), ok);
  return success;
}
Example #15
0
boolean NanoESP::closeConnection(int id) {
  boolean success = true;
  success &= sendCom(at+cip+"CLOSE=" + String(id), ok);
  return success;
}
Example #16
0
boolean NanoESP::startTcpServer(unsigned int port) {
  boolean success = true;
  success &= sendCom(at+cip+"SERVER=1," + String(port), ok);
  return success;
}
Example #17
0
boolean NanoESP::configWifiMode(int modus)
{
  return (sendCom("AT+CWMODE=" + String(modus), "OK"));
}
Example #18
0
boolean NanoESP::setMultipleConnections() {
  boolean success = true;
  success &= sendCom("AT+CIPMUX=1", "OK"); //Allways multiple connections
  return success;
}
Example #19
0
boolean NanoESP::setTransferMode() {
  boolean success = true;
  success &= sendCom("AT+CIPMODE=0", "OK"); //Normal trasfer mode
  return success;
}
Example #20
0
boolean NanoESP::endTcpServer() {
  boolean success = true;
  success &= sendCom(at+cip+"SERVER=0", ok);
  success &= init(); //Restart?!?
  return success;
}
Example #21
0
boolean NanoESP::ping(String address) {
  boolean success = true;
  success &= sendCom("AT+PING=" + String(address), "OK");
  return success;
}
Example #22
0
boolean NanoESP::startTcpServer(int port) {
  boolean success = true;
  success &= sendCom("AT+CIPSERVER=1," + String(port), "OK");
  return success;
}
Example #23
0
boolean NanoESP::endTcpServer() {
  boolean success = true;
  success &= sendCom("AT+CIPSERVER=0", "OK");
  success &= init(); //Restart?!?
  return success;
}
Example #24
0
boolean NanoESP::startUdpServer(int id, String ip , int port, int recvport, int mode) { //dual direction
  boolean success = true;
  success &= sendCom("AT+CIPSTART=" + String(id) + ",\"UDP\",\"" + String(ip) + "\"," + String(port) + "," + String(recvport) + "," + String(mode), "OK");
  return success;
}
Example #25
0
boolean NanoESP::setMultipleConnections() {
  boolean success = true;
  success &= sendCom(at+cip+"MUX=1", ok); //Allways multiple connections
  return success;
}
Example #26
0
boolean NanoESP::setTransferMode() {
  boolean success = true;
  success &= sendCom(at+cip+"MODE=0", ok); //Normal trasfer mode
  return success;
}
Example #27
0
String NanoESP::getIp()
{
  return sendCom("AT+CIFSR");
}
Example #28
0
boolean NanoESP::disconnectWifi()
{
  boolean success = true;
  success &= (sendCom("AT+CWWAP", "OK"));
  return success;
}
Example #29
0
boolean NanoESP::closeConnection(int id) {
  boolean success = true;
  success &= sendCom("AT+CIPCLOSE=" + String(id), "OK");
  return success;
}
Example #30
0
String NanoESP::getIp()
{
  return sendCom(at+"CIFSR");
}