Sensos Module Updated
Fork of Middleware by
Diff: Sensors.cpp
- Revision:
- 1:fd355dc296b1
- Child:
- 3:1704050210b5
diff -r d1ff330c5128 -r fd355dc296b1 Sensors.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sensors.cpp Wed Dec 09 04:44:37 2015 +0000 @@ -0,0 +1,100 @@ +#include "Sensors.h" +#include "Initial.h" + + +/*Functions*/ + +//PRESCENCE DETECTION FUNCTION +bool GetPrescenceStatus(){ + static bool RoomStatus = FALSE; + + if(PIR1==TRUE || PIR2==TRUE) + { + RoomStatus = TRUE; + } + else + { + RoomStatus = FALSE; + } + + return RoomStatus; +} + +//DOOR STATUS FUNCION +bool GetDoorStatus(){ + static bool DoorStatus = CLOSED; + + if(DOORSensor == TRUE) + DoorStatus = OPEN; + else + DoorStatus = CLOSED; + + return DoorStatus; +} + + +//WINDOW STATUS FUNCTION +int GetWindowStatus(int window){ + static int WindowStatus = CLOSED; + + switch(window) + { + case 1: + if(W1) + WindowStatus = OPEN; + else + WindowStatus = CLOSED; + break; + case 2: + if(W2) + WindowStatus = OPEN; + else + WindowStatus = CLOSED; + break; + case 3: + if(W3) + WindowStatus = OPEN; + else + WindowStatus = CLOSED; + break; + default: + WindowStatus = BAD_PARAMETER; + break; + } + + return WindowStatus; +} + +//LIGHT CONTROL FUNCTION +int SetLight(bool Light){ + static int LightStatus = 0; + + switch(Light) + { + case 0: + LightStatus = OFF; + LightControl = OFF; + break; + case 1: + LightStatus = ON; + LightControl = ON; + break; + default: + LightStatus = BAD_PARAMETER; + break; + } + + return LightStatus; +} + +//PERSON COUNTER FUNCTION +unsigned int GetPersonStatus(){ + static unsigned int PersonNumber = 0; + + //TODO Insert code here + /*** TODO ***/ + /*** TODO ***/ + /*** TODO ***/ + + return PersonNumber; +} \ No newline at end of file