/*****************************************************************************
 *
 * MODULE:             07/04/2021
 *
 * COMPONENT:          app_events.h
 *
 * DESCRIPTION:        Application Events
 *
 ****************************************************************************
 *
 * This software is owned by NXP B.V. and/or its supplier and is protected
 * under applicable copyright laws. All rights are reserved. We grant You,
 * and any third parties, a license to use this software solely and
 * exclusively on NXP products [NXP Microcontrollers such as JN5168, JN5179].
 * You, and any third parties must reproduce the copyright and warranty notice
 * and any other legend of ownership on each copy or partial copy of the
 * software.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright NXP B.V. 2016. All rights reserved
 *
 ***************************************************************************/

#ifndef APP_GENERIC_EVENTS_H_
#define APP_GENERIC_EVENTS_H_

/****************************************************************************/
/***        Macro Definitions                                             ***/
/****************************************************************************/

/****************************************************************************/
/***        Type Definitions                                              ***/
/****************************************************************************/
typedef enum
{
    APP_E_EVENT_NONE = 0,
    APP_E_EVENT_BUTTON_UP,
    APP_E_EVENT_BUTTON_DOWN,
    APP_E_EVENT_PERIODIC_REPORT,
    APP_E_EVENT_SEND_REPORT,
    APP_E_EVENT_WAKE_TIMER,
    APP_E_EVENT_KEEPALIVE_START,
    APP_E_EVENT_KEEPALIVE_STOP,
    APP_E_EVENT_FIND_BIND_START,
    APP_E_EVENT_FIND_BIND_STOP,
    APP_E_EVENT_MAX,


} APP_teEventType;

typedef struct
{
    uint8_t u8Button;
    uint32_t u32DIOState;
} APP_tsEventButton;

typedef struct
{
    APP_teEventType eType;
    union
    {
        APP_tsEventButton                   sButton;
    }uEvent;
} APP_tsEvent;
/****************************************************************************/
/*** UART  States für die UART Queue									  ***/
/****************************************************************************/
typedef enum
{
	APP_E_EVENT_UART_IDLE = 0,
	APP_E_EVENT_UART_ULP_WAS_TRIGGERED,
	APP_E_EVENT_UART_SEND_TEMPERATURE,
	APP_E_EVENT_UART_SEND_SYSTEM_MODE,
	APP_E_EVENT_UART_SEND_VALVE_POSITION,
	APP_E_EVENT_UART_SEND_FLAGS,
	APP_E_EVENT_UART_SEND_FLAGS_AUTO_MODE,
	APP_E_EVENT_UART_SEND_FLAGS_MANU_MODE,
	APP_E_EVENT_UART_SEND_DEVICE_CONFIG,
	APP_E_EVENT_UART_SEND_DEVICE_CONFIG_2,
	APP_E_EVENT_UART_SEND_FLAGS_JOINED,
	APP_E_EVENT_UART_SEND_FLAGS_LEAVE,
	APP_E_EVENT_UART_SEND_FLAGS_RF_COMMUNICATION_OK,
	APP_E_EVENT_UART_SEND_FLAGS_RF_COMMUNICATION_LOST,
	APP_E_EVENT_UART_SEND_RTC,
	APP_E_EVENT_UART_GET_RTC,
	APP_E_EVENT_UART_GET_TEMPERATURE,
	APP_E_EVENT_UART_GET_BATTERY,
	APP_E_EVENT_UART_GET_VALVE_POSITION,
	APP_E_EVENT_UART_GET_DEVICE_CONFIG,
	APP_E_EVENT_UART_GET_FIRMWARE_VERSION,
	APP_E_EVENT_UART_GET_RTC_FROM_COORDINATOR,
	APP_E_EVENT_UART_GET_COMPOSITE_DATA,
	APP_E_EVENT_UART_SEND_GET_PRODUCTION_MODE,
	APP_E_EVENT_UART_SEND_MASTER_RESET_REQUEST,
	APP_E_EVENT_UART_SEND_MASTER_RESET_SUCCESS,
	APP_E_EVENT_UART_SEND_SET_PRODUCTION_MODE_PASS,
	APP_E_EVENT_UART_SEND_START_PRODUCTION_MODE,
	APP_E_EVENT_UART_SEND_SWITCHPOINTS,
	APP_E_EVENT_UART_LEAVE_NETWORK,
	APP_E_EVENT_UART_IDENTIFY_MODE,

} APP_teEventUartType;

typedef struct {
	APP_teEventUartType eType_UartCurrentState;
	APP_teEventUartType eType_UartNextState;

} App_tsEventUart;
/****************************************************************************/
/*** Bootloader  States für die Bootloader Queue						  ***/
/****************************************************************************/
typedef enum
{
	APP_E_EVENT_BOOTLOADER_STATE = 40,
	APP_E_EVENT_UART_START_FIRMWARE_UPDATE,
	APP_E_EVENT_UART_TRANSFER_FRIMWARE_UPDATE,
	APP_E_EVENT_BOOTLOADER_STATE_IDLE,
}App_teEventBootloader;

typedef struct {
	App_teEventBootloader eType_BootloaderState;
} App_tsEventBootloader;

/****************************************************************************/
/*** Production  States für die Production Queue						  ***/
/****************************************************************************/
typedef enum
{
	APP_E_EVENT_PRODUCTION_STATE = 50,
	APP_E_EVENT_PRODUCTION_STATE_IDLE,
}App_teEventProduction;

typedef struct {
	App_teEventProduction eType_ProductionState;
} App_tsEventProduction;

/****************************************************************************/
/*** Link  States zwischen Coordiantor und ZED  						  ***/
/****************************************************************************/
/*typedef enum
{
	APP_NWK_E_EVENT_LINK_OK = 0,
	APP_NWK_E_EVENT_LINK_MISSING,
	APP_NWK_E_EVENT_LINK_LOST,

}App_teEventLinkType;

typedef struct {
	App_teEventLinkType eType_LinkStateCurrent;
	App_teEventLinkType eType_LinkStateBefore;
} App_tsEventLinkType;*/


/****************************************************************************/
/***        Exported Functions                                            ***/
/****************************************************************************/

/****************************************************************************/
/***        External Variables                                            ***/
/****************************************************************************/

/****************************************************************************/
/****************************************************************************/
/****************************************************************************/

#endif /*APP_GENERIC_EVENTS_H_*/
