fablabbcn/Smart-Citizen-Kit — pull request #20 by rodri16 (2014-08-21 12:29:06+00:00)
Title: Eliminate *Hello* message before PUT

2.3.12 set comm remote
This command sets the ASCII string that is sent to the remote TCP client when the TCP
port is opened, where is one or more characters up to a maximum of 32 (32
bytes). If you do not wish to use a string, use a zero (0) as the parameter.
Default: *HELLO*
Example: set comm remote *welcome* // Set the string to *welcome*

boolean sckConnect()
{
if (!sckReady())
{
if (sckReadintEEPROM(EE_ADDR_NUMBER_NETS)<1) return false;
if(sckEnterCommandMode())
{
sendCommand(F("set comm remote 0")); // FFR Hide Hello
sckSendCommand(F("set wlan join 1")); // Disable AP mode
sckSendCommand(F("set ip dhcp 1")); // Enable DHCP server
sckSendCommand(F("set ip proto 10")); //Modo TCP y modo HTML
sckSendCommand(F("set ftp address 198.175.253.161")); //ftp server update
sckSendCommand(F("set ftp mode 1"));
char* auth;
char* ssid;
char* pass;
char* antenna;
for (uint16_t nets = 0 ; nets < sckReadintEEPROM(EE_ADDR_NUMBER_NETS); nets++) {
auth = sckReadData(DEFAULT_ADDR_AUTH, nets, 0);
sckSendCommand(F("set wlan auth "), true);
sckSendCommand(auth);
boolean mode = true;
if ((auth==WEP)||(auth==WEP64)) mode=false;
#if debuggEnabled
if (!wait) Serial.print(auth);
#endif
ssid = sckReadData(DEFAULT_ADDR_SSID, nets, 0);
sckSendCommand(F("set wlan ssid "), true);
sckSendCommand(ssid);
#if debuggEnabled
if (!wait)
{
Serial.print(F(" "));
Serial.print(ssid);
}
#endif
pass = sckReadData(DEFAULT_ADDR_PASS, nets, 0);
if (mode) sckSendCommand(F("set wlan phrase "), true); // WPA1, WPA2, OPEN
else sckSendCommand(F("set wlan key "), true);
sckSendCommand(pass);
#if debuggEnabled
if (!wait)
{
Serial.print(F(" "));
Serial.print(pass);
}
#endif
antenna = sckReadData(DEFAULT_ADDR_ANTENNA, nets, 0);
sckSendCommand(F("set wlan ext_antenna "), true);
sckSendCommand(antenna);
#if debuggEnabled
if (!wait)
{
Serial.print(F(" "));
Serial.println(antenna);
}
#endif
sckSendCommand(F("save"), false, "Storing in config"); // Store settings
sckSendCommand(F("reboot"), false, "*READY*");
if (sckReady()) return true;
sckEnterCommandMode();
}
}
return false;
}
else return true;
}