]> git.karo-electronics.de Git - oswald.git/blobdiff - ui/oswald_main.c
Lot's of stuff...
[oswald.git] / ui / oswald_main.c
index 02396d4bddab2205c9077dd4cb3097eabacb0fa1..f2e4abeeecd4a708a25af77d1d33abd06e77e7ba 100644 (file)
@@ -161,8 +161,9 @@ void oswald_handle_comm_input(uint16_t mlen, const void *mdat)
        if (icmd[0] == '$') {
                if (strncmp(icmd, "$GRT", 4) == 0) { // get current RTC
                        char rtime[16];
-                       snprintf(rtime, 10, "%02d%02d%02d\n", OswaldClk.hour, OswaldClk.minute, OswaldClk.second);
+                       snprintf(rtime, 16, "#RTC%02d%02d%02d\n", OswaldClk.hour, OswaldClk.minute, OswaldClk.second);
                        hal_bluetooth_send_data(rtime, strlen(rtime));
+               } else if (strncmp(icmd, "$SRT", 4) == 0) { // set current RTC
                } else if (strncmp(icmd, "$MSG", 4) == 0) { // message on main screen
                        char *msg = (icmd+4);
                        mlen -= 4;
@@ -170,6 +171,10 @@ void oswald_handle_comm_input(uint16_t mlen, const void *mdat)
                        strncpy(MainMessage, msg, (mlen > 147) ? 147 : mlen);
                } else if (strncmp(icmd, "$MCL", 4) == 0) { // clear message
                        memset(MainMessage, 0, 148);
+               } else if (strncmp(icmd, "$BAT", 4) == 0) { // clear message
+                       char rtime[16];
+                       snprintf(rtime, 16, "#BAT%d,%d\n", OswaldPowerState.charge_state, OswaldPowerState.percent);
+                       hal_bluetooth_send_data(rtime, strlen(rtime));
                }
        }
 }