commit

Dependencies:   MPU6050_SIM5320_TEST

Fork of MPU_SDCARD by Suad Suljic

Revision:
1:75966605a6a3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CaseFSM/DeviceFull.cpp	Fri Nov 10 15:35:26 2017 +0000
@@ -0,0 +1,50 @@
+#include <DeviceEmpty.h>
+#include <DeviceFull.h>
+#include <CaseFsm.h>
+
+
+
+DeviceFull::DeviceFull(CaseFsmStates& states, Timer& timer) : CaseState(states,timer)
+{
+}
+
+CaseState* DeviceFull::handle(SwitchPosition& event)
+{
+    printf("Odoh u DEVICE EMPTY STATE\r\n");
+    return states_.deviceEmptyState();
+}
+
+
+
+CaseState* DeviceFull::handle(RFIDEvent& event)
+{
+    int count=0;
+    uint8_t tag[]= {0xDB,0x6C,0x10,0x2B};
+    //printf("%d\r\n",event.cardType);
+    for(int i=0; i<event.size; i++) {
+        if(tag[i]==event.uid[i]) {
+      //      printf(" %x  count=%d",event.uid[i], count);
+            count++;
+        }
+    }
+        
+       //printf(" count %d\r\n",count);
+        
+        if(count==4) { //Je li to validan TAG
+        printf("Odoh u PHONE DETECTED STATE\r\n");
+           
+            return states_.phoneDetectedState();  //TAG je validan idem u detected
+            
+        } else {
+             printf("Odoh u PHONE UNDETECTED STATE\r\n");
+            return states_.phoneUndetectedState(); //Ako nije idem u undetected
+            
+        }
+}
+CaseState* DeviceFull::handle(TimerEnd& event)
+{
+    printf("Odoh u DEVICE UNDETECTED STATE\r\n");
+    return states_.phoneUndetectedState();
+}
+
+