no description

Fork of Middleware by Roberto Herrera

Sensors.cpp

Committer:
Jorge_Beltran
Date:
2015-12-07
Revision:
1:32a08ca33b00

File content as of revision 1:32a08ca33b00:

#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;
}