/**
* \file  resource.c
*
* \brief This is the implementation of LoRaWAN resource module
*		
* Copyright (c) 2021 Europalab Devices ApS
*
* \asf_license_start
*
* \page License
*
* This file is part of Sendcomm.
*
* Sendcomm is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sendcomm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Sendcomm. If not, see <https://www.gnu.org/licenses/>.
*
* \asf_license_stop
*
*/


/****************************** INCLUDES **************************************/
#include "asf.h"
#include "resources.h"
#include "temp_sensor.h"
#include "LED.h"

/*************************STATIC FUNCTIONS ************************************/

/****************************** VARIABLES *************************************/

/*************************FUNCTION PROTOTYPES *********************************/

/*********************************************************************//**
 \brief      Function to get different resource data
 \param[in]  resource - Type of resource (Motor, Light, Temperature)
 \param[out] *data    - Pointer to the data from different resource
*************************************************************************/
void get_resource_data(const resourceType_t resource,uint8_t * data)
{

    switch(resource)
    {

        case TEMP_SENSOR:
        {
            get_temp_sensor_data(data);
            break;
        }
        default:
        {
            *data = UNSUPPORTED_RESOURCE;
            break;
        }
    }
}

/************************************************************************
 \brief      Function to set data to resource
 \param[in]  resourceType_t - Type of resource (Temperature)
 \param[out] *data    - Pointer to the data from different resource
*************************************************************************/
int set_resource_data(const resourceType_t resource, const uint8_t * data)
{
    int status = 0;
    switch(resource)
    {
        case LED_AMBER:
        {
            status = set_LED_data(LED_AMBER,data);
        }
        break;
        case LED_RED:
        {
            status = set_LED_data(LED_RED,data);
        }
        break;
        default:
        {
            status = UNSUPPORTED_RESOURCE;
        }
    }
    return status;
}
/*********************************************************************//**
 \brief      Function to initialize different resources
*************************************************************************/
void resource_init(void)
{
    temp_sensor_init();
    //LED_init();
}
/*---------------------------------------------------------------------------*/
