/* 
 * File:   LoraWatchdog.h
 * Author: JF
 *
 * 
 */

#ifndef LORAWATCHDOG_H
#define	LORAWATCHDOG_H
#include "define.h"

#define LORA_WATCHDOG_MODULE_RESET_TIMEOUT 900000 // 15 minutes //3600000    //1h Time without comm. before we reset the LoRa module
#define LORA_WATCHDOG_REBOOT_TIMEOUT    1200000  //20 minutes     Time to reboot after we reset the LoRa module
#define LORA_WATCHDOG_MODULE_OFF_TIMEOUT 4000   //Keep the LoRa module off for 2 seconds when reseting it.

enum eLoraWDSMStates
{
    LORA_WATCHDOG_OK_STATE,
    LORA_WATCHDOG_RESET_LORA_MODULE_STATE,
    LORA_WATCHDOG_WAIT_FOR_RECONNECT_STATE
};

enum eLoraWDEvents
{
    LORA_SM_TICK_EVENT,
    LORA_SM_KICK_EVENT
};


void InitLoraWatchdog();
void TickLoraWatchdog();
void LoraWatchdogStateMachine(int Event);
void KickLoraWatchdog();



#endif	/* HARAKIRIRELAY_H */

