Skip to content
Snippets Groups Projects
Commit fcb0c113 authored by OleL's avatar OleL
Browse files
parents 64513d12 1031a16d
No related branches found
No related tags found
No related merge requests found
......@@ -81,39 +81,6 @@ void hostGame() {
#endif
}
bool isNumber(char number){
return number >= 0x30 && number <= 0x39;
}
bool isValidIp(String ip){
unsigned short pos0 = ip.indexOf('.');
unsigned short pos1 = ip.indexOf('.', pos0+1);
unsigned short pos2 = ip.indexOf('.', pos1+1);
String tuple0 = ip.substring(0, pos0);
String tuple1 = ip.substring(pos0 + 1, pos1);
String tuple2 = ip.substring(pos1 + 1, pos2);
String tuple3 = ip.substring(pos2 + 1, ip.length() - 1);
bool isValid = true;
for (int i = 0; i < tuple0.length(); i++){
Serial.printf("tuple0: %d -> %c\n", i, tuple0[i]);
isValid &= isNumber(tuple0[i]);
}
for (int i = 0; i < tuple1.length(); i++){
Serial.printf("tuple1: %d -> %c\n", i, tuple1[i]);
}
for (int i = 0; i < tuple2.length(); i++){
Serial.printf("tuple2: %d -> %c\n", i, tuple2[i]);
}
for (int i = 0; i < tuple3.length(); i++){
Serial.printf("tuple3: %d -> %c\n", i, tuple3[i]);
}
}
String recv_ir() {
badge.setGPIO(IR_EN, HIGH);
Serial.println("Entering receive mode");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment