diff --git a/arduino-sony-minidisc-ir-remote.ino b/arduino-sony-minidisc-ir-remote.ino index f057799..dc77f84 100644 --- a/arduino-sony-minidisc-ir-remote.ino +++ b/arduino-sony-minidisc-ir-remote.ino @@ -49,6 +49,99 @@ //------------------------------------------------ +typedef struct +{ + char *key; + uint8_t value; +} record_type; + +record_type upperCaseAlphaChar[26] = { + {"A", 0x1D}, + {"B", 0x1E}, + {"C", 0x1F}, + {"D", 0x1B}, + {"E", 0x1A}, + {"F", 0x0}, + {"G", 0x1}, + {"H", 0x2}, + {"I", 0x3}, + {"J", 0x4}, + {"K", 0x5}, + {"L", 0x6}, + {"M", 0x7}, + {"N", 0x8}, + {"O", 0x9}, + {"P", 0x40}, + {"Q", 0x41}, + {"R", 0x42}, + {"S", 0x43}, + {"T", 0x44}, + {"U", 0x45}, + {"V", 0x46}, + {"W", 0x47}, + {"X", 0x48}, + {"Y", 0x49}, + {"Z", 0x4A}}; + +record_type lowerCaseAlphaChar[26] = { + {"a", 0x1D}, + {"b", 0x1E}, + {"c", 0x1F}, + {"d", 0x1B}, + {"e", 0x1A}, + {"f", 0x0}, + {"g", 0x1}, + {"h", 0x2}, + {"i", 0x3}, + {"j", 0x4}, + {"k", 0x5}, + {"l", 0x6}, + {"m", 0x7}, + {"n", 0x8}, + {"o", 0x9}, + {"p", 0x40}, + {"q", 0x41}, + {"r", 0x42}, + {"s", 0x43}, + {"t", 0x44}, + {"u", 0x45}, + {"v", 0x46}, + {"w", 0x47}, + {"x", 0x48}, + {"y", 0x49}, + {"z", 0x4A}}; + +record_type numberChar[10] = { + {"1", 0x0}, + {"2", 0x1}, + {"3", 0x2}, + {"4", 0x3}, + {"5", 0x4}, + {"6", 0x5}, + {"7", 0x6}, + {"8", 0x7}, + {"9", 0x8}, + {"0", 0x9}}; + +record_type specialChar[8] = { + {"-", 0x4B}, + {".", 0x4D}, + {",", 0x4E}, + {"/", 0xA}, + {"?", 0x26}, + {"!", 0x27}, + {"(", 0x33}, + {")", 0x34}}; + +bool isLowercase = false; +bool isNumber = false; + +//! Vielleicht smarter immer den vorherigen zu setzen und damit zu vergleichen +bool wasLowercase = false; +bool wasNumber = false; + +//------------------------------------------------ + // Create AsyncWebServer object on port 80 AsyncWebServer server(80); // WiFiServer server(80); @@ -226,6 +319,15 @@ void nameSingleTrack(String titlestring) int s = char_array[i]; Serial.print("char: "); Serial.println(char_array[i]); + + //! Hier müssen verschiedene Sachen getestet werden: + //! Ist das Array-Ende erreicht? Ist der case ein anderer als vom vorigen char? Prüft aktuelle char und entscheidet, welches Command gesendet wird + //! Wie kann ich das in eigene Funktionen verpacken? + // Test if char is a lowerCase letter + if (isLowerCase(char_array[i])) + { + Serial.println("The character is lower case"); + } } } @@ -258,6 +360,25 @@ void initWiFi() void setup() { Serial.begin(115200); + + Serial.print("numberChar[1].value: "); + Serial.println(numberChar[1].value); + Serial.print("numberChar[1].key: "); + Serial.println(numberChar[1].key); + + Serial.print("specialChar[0].value: "); + Serial.println(specialChar[0].value); + Serial.print("specialChar[0].key: "); + Serial.println(specialChar[0].key); + + Serial.print("specialChar[2].value: "); + Serial.println(specialChar[2].value); + + Serial.print("specialChar[7].value: "); + Serial.println(specialChar[7].value); + Serial.print("specialChar[7].key: "); + Serial.println(specialChar[7].key); + initWiFi(); initSDCard();