Suad Suljic / Mbed OS KOPIRANO_cell_locker

Dependencies:   MPU6050_SIM5320_TEST

Fork of MPU_SDCARD by Suad Suljic

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DeviceFull.cpp Source File

DeviceFull.cpp

00001 #include <DeviceEmpty.h>
00002 #include <DeviceFull.h>
00003 #include <CaseFsm.h>
00004 
00005 
00006 
00007 DeviceFull::DeviceFull(CaseFsmStates& states, Timer& timer) : CaseState(states,timer)
00008 {
00009 }
00010 
00011 CaseState* DeviceFull::handle(SwitchPosition& event)
00012 {
00013     printf("Odoh u DEVICE EMPTY STATE\r\n");
00014     return states_.deviceEmptyState();
00015 }
00016 
00017 
00018 
00019 CaseState* DeviceFull::handle(RFIDEvent& event)
00020 {
00021     int count=0;
00022     uint8_t tag[]= {0xDB,0x6C,0x10,0x2B};
00023     //printf("%d\r\n",event.cardType);
00024     for(int i=0; i<event.size; i++) {
00025         if(tag[i]==event.uid[i]) {
00026       //      printf(" %x  count=%d",event.uid[i], count);
00027             count++;
00028         }
00029     }
00030         
00031        //printf(" count %d\r\n",count);
00032         
00033         if(count==4) { //Je li to validan TAG
00034         printf("Odoh u PHONE DETECTED STATE\r\n");
00035            
00036             return states_.phoneDetectedState();  //TAG je validan idem u detected
00037             
00038         } else {
00039              printf("Odoh u PHONE UNDETECTED STATE\r\n");
00040             return states_.phoneUndetectedState(); //Ako nije idem u undetected
00041             
00042         }
00043 }
00044 CaseState* DeviceFull::handle(TimerEnd& event)
00045 {
00046     printf("Odoh u DEVICE UNDETECTED STATE\r\n");
00047     return states_.phoneUndetectedState();
00048 }
00049 
00050