/****************************************************************************/
/* Copyright 2012-2018 MBARI												*/
/****************************************************************************/
/* Summary	: Definitions for Watch Cycle for BEDS2 on PIC32MX470			*/
/* Filename : watch.h														*/
/* Author	: Robert Herlien (rah)											*/
/* Project	: BEDS (Benthic Event Detection System)							*/	
/* Revision : 1.0															*/
/* Created	: 10/15/2012													*/
/*																			*/
/* MBARI provides this documentation and code "as is", with no warranty,	*/
/* express or implied, of its quality or consistency. It is provided without*/
/* support and without obligation on the part of the Monterey Bay Aquarium	*/
/* Research Institute to assist in its use, correction, modification, or	*/
/* enhancement. This information should not be published or distributed to	*/
/* third parties without specific written permission from MBARI.			*/
/*																			*/
/****************************************************************************/
/* Modification History:													*/
/* 15oct2012 rah - created													*/
/* 23feb2018 rah - Ported to BEDS2 on PIC32MX470							*/
/****************************************************************************/

#ifndef INCwatchh
#define INCwatchh		1

#include <file.h>				/* BEDS file I/O definitions			*/
#include <fatFs/ff.h>			/* FatFs definitions					*/

typedef enum
	{ OffState=0, Warmup, OnState, WaitOff } DeviceState;

typedef enum
	{ COMMAND_MODE=0, WATCH_MODE, EVENT_MODE } RunMode;

/* Who's using the sensors power		*/
#define SENSORS_SAMPLING		1
#define MODEM_SAMPLING			2
#define SENSOR_USERS_ALL		3


/****************************************/
/* Function Declarations				*/
/****************************************/

Errno	watchInit(void);
MBool	getDeploymentMode(void);
void	setDeploymentMode(MBool onoff);
RunMode getRunMode(void);
Errno	recordDataPoint(DataFileStruct *dfp);
MBool	newSecond(void);
void	watchCycle(void);
void	sensorsOn(Nat16 who);
void	sensorsOff(Nat16 who);
Errno	writeSysRec(DataFileStruct *dfp);
void	forceModemCycle(void);

#endif	/* INCwatchh */
