3rd Repo, trying to figure this out.

Dependencies:   LPS25H hts221

Fork of SOFT253_Template_Weather_OS_54 by Stage-1 Students SoCEM

Revision:
48:a8219954b3f2
Parent:
47:468a89d62c23
Child:
49:83bea7fb2728
--- a/main.cpp	Thu Apr 06 15:46:00 2017 +0000
+++ b/main.cpp	Thu Apr 06 16:12:12 2017 +0000
@@ -173,7 +173,7 @@
                     else if (strtol(charPos,NULL,10) != 0)
                     {
                         listBuffer->DeleteX(atoi(charPos));
-                        printf("\r\n D O N E ! \r\n");
+                        printf("\r\nD O N E ! \r\n");
                     }
                        
                 }
@@ -182,6 +182,67 @@
                     char *ptr = localDate->ToString();
                     printf("\r\n STATUS: \r\n # of measures: %i \r\n SAMPLING: ON \r\n Current Date: %s \r\n", listBuffer->GetSize(),ptr);   
                 }
+                else if (CompareCommands(charPos,"settime",7) == 1)
+                {
+                    int h,m,s;
+                    charPos = strtok(NULL," ,");
+                    if(strtol(charPos,NULL,10) != 0)
+                    {
+                        h = atoi(charPos);   
+                    }
+                    charPos = strtok(NULL," ,");
+                    if(strtol(charPos,NULL,10) != 0)
+                    {
+                        m = atoi(charPos);   
+                    }
+                    charPos = strtok(NULL," ,");
+                    if(strtol(charPos,NULL,10) != 0)
+                    {
+                        s = atoi(charPos);   
+                    }
+                    if((h>=0 && h < 24) && (m>=0 && m<60) && (s>=0 && s<60))
+                    {
+                        localDate->hour = h;
+                        localDate->min = m;   
+                        localDate->sec = s;
+                        printf("\r\n D O N E ! \r\n");
+                    } 
+                    else
+                    {
+                        printf("\r\nWrong format! \r\n");   
+                    }
+                }
+                else if (CompareCommands(charPos,"setdate",7) == 1)
+                {
+                    int d,m,y;
+                    charPos = strtok(NULL," ,");
+                    if(strtol(charPos,NULL,10) != 0)
+                    {
+                        d = atoi(charPos);   
+                    }
+                    charPos = strtok(NULL," ,");
+                    if(strtol(charPos,NULL,10) != 0)
+                    {
+                        m = atoi(charPos);   
+                    }
+                    charPos = strtok(NULL," ,");
+                    if(strtol(charPos,NULL,10) != 0)
+                    {
+                        y = atoi(charPos);   
+                    }
+                    if((d>=0 && d < 31) && (m>=0 && m<13))
+                    {
+                        localDate->day = d;
+                        localDate->month = m;   
+                        localDate->year = y;
+                        printf("\r\n D O N E ! \r\n");
+                    } 
+                    else
+                    {
+                        printf("\r\nWrong format! \r\n");   
+                    }
+                }
+                
               //  printf("%s \r\n", charPos);
               //  charPos = strtok(NULL," -,");