<?php require_once "atp.header.php" ?>

<section class="content-wrapper" data-heading="home" id="mob">

	<!--Heading-->
	<div class="page-title">
		<h1>
			MOB Settings
		</h1>
		<p>
			The ATP provides a versatile MOB (Man OverBoard) function that meets the needs of both
			safety and race regulations.
		</p>
	</div>
	
	<!--MOB Event-->
	<div class="box box-top">
		<div class="flex-row">
			<div class="flex-heading">
					<h2>MOB Event</h2>
			</div>
			<div>
				<p>The MOB Event can be triggered by:-</p>
				<ul id="mob-trigger-list">
					<li>Pressing the Menu button three times on a connected A+T MFD.</li>
					<li>An external button connected to any A+T MFD, see A+T MFD manual.</li>
					<li>Contact closure on a configured analogue input or the dedicated MOB input.</li>
					<li>Expedition MOB being activated, provided it is correctly configured <a href="dataOutput.php">here</a>.<br></li>
					<li>The MOB Test button below.</li>
				</ul>
			</div>
		</div>
	</div>
	
	<!--MOB Action-->
	<div class="box box-stack">
		<div class="flex-row">
			<div class="flex-heading">
				<h2>MOB Action</h2>
			</div>
			<div>
				<p>
					Determines contact closure response to MOB event. If left unchecked below, contact closure will close and remain
					closed until manually silenced or MOB cleared. If checked below then contact closure will close for the specified length of time.
				</p>
			</div>
		</div>
		<div class="flex-row">
			<div class="flex-heading">
				<a class="button button-gray button-medium" id="mob-reset">Silence MOB</a>
			</div>
			<input type="checkbox" id="mob-closure-active">
			<label for="mob-closure-time">
				Activate closure for
				<div class="input-unit">
					<input type="number" id="mob-closure-time" step=1 min=0>
					<span>s</span>
				</div>
			</label>
		</div>
	</div>
	
	<!--MOB Display-->
	<div class="box box-stack">
		<div class="flex-row">
			<div class="flex-heading">
				<h2>MOB Display</h2>
			</div>
			<div>
				<p>
					Range and bearing to MOB position is output to connected displays as a waypoint,
					calculated either as:-
				</p>
				<!--Range/Bearing Grid-->
				<div id="mob-range-bearing-grid">
					<div></div>
					<div>Range</div>
					<div>Bearing</div>
					<div class="tooltip-wrapper">
						<input type="radio" id="mob-dr" value="dr" name="mob-mode">
						Dead Reckoning
						<div class="tooltip">
							<p>
								Use if in tidal waters with good speed and heading calibration. Cannot be used with Boat Speed set to SoG.
							</p>
						</div>
					</div>
					<div class="flex-field">
						<div class="field-container" id="MOB_DR_Range" 
							data-field="<?php echo fieldEnum::MOB_Ship_Range_m;?>"
							data-sender="<?php echo PROCESSOR_ID;?>" 
							data-instance="<?php echo PROCESSOR_INSTANCE;?>">
							&nbsp;
						</div>
					</div>
					<div class="flex-field">
						<div class="field-container" id="MOB_DR_BearingT"
							data-field="<?php echo fieldEnum::MOB_Ship_Bearing_T;?>"
							data-sender="<?php echo PROCESSOR_ID;?>" 
							data-instance="<?php echo PROCESSOR_INSTANCE;?>">
							&nbsp;
						</div>
						<div class="field-container" id="MOB_DR_BearingM"
							data-field="<?php echo fieldEnum::MOB_Ship_Bearing_M;?>"
							data-sender="<?php echo PROCESSOR_ID;?>" 
							data-instance="<?php echo PROCESSOR_INSTANCE;?>">
							&nbsp;
						</div>
					</div>
					<div class="tooltip-wrapper">
						<input type="radio" id="mob-gnss" value="gps" name="mob-mode">
						GNSS to MOB
						<div class="tooltip">
							<p>
								Use if in non-tidal waters or if speed/<wbr>heading data is in doubt.
							</p>
						</div>
					</div>
					<div class="flex-field">
						<div class="field-container" id="MOB_GPS_Range" 
							data-field="<?php echo fieldEnum::MOB_GPS_Range_m;?>"
							data-sender="<?php echo PROCESSOR_ID;?>" 
							data-instance="<?php echo PROCESSOR_INSTANCE;?>">
							&nbsp;
						</div>
					</div>
					<div class="flex-field">
						<div class="field-container" id="MOB_GPS_BearingT"
							data-field="<?php echo fieldEnum::MOB_GPS_Bearing_T;?>"
							data-sender="<?php echo PROCESSOR_ID;?>" 
							data-instance="<?php echo PROCESSOR_INSTANCE;?>">
							&nbsp;
						</div>
						<div class="field-container" id="MOB_GPS_BearingM"
							data-field="<?php echo fieldEnum::MOB_GPS_Bearing_M;?>"
							data-sender="<?php echo PROCESSOR_ID;?>" 
							data-instance="<?php echo PROCESSOR_INSTANCE;?>">
							&nbsp;
						</div>
					</div>
				</div>
				<p>
					Note: If preferred option cannot be calculated, the other will be used.
				</p>
			</div>
		</div>
	</div>
	
	<!--MOB History-->
	<div class="box box-bottom">
		<div class="flex-row">
			<div class="flex-heading">
				<h2>MOB History</h2>
			</div>
			<div>
				<table id="mob-history"></table>
			</div>
		</div>
	</div>
	
	<!--Buttons-->
	<div class="button-box" id="button-container">
		<div class="box">
			<a id="ok-button" class="button button-gray button-medium">OK</a>
			<a id="cancel-button" class="button button-gray button-medium">Cancel</a>
			<a id="apply-button" class="button button-gray button-medium">Apply</a>
		</div>
	</div>
	
	<!--MOB Test-->
	<div class="box bottom-wrapper">
		<div class="flex-row">
			<div class="flex-heading">
				<a class="button button-gray" id="mob-test">Test MOB</a>
			</div>
			<div id="mob-warning-container">
				<div id="mob-warning-large">
					IT IS VERY IMPORTANT TO REGULARLY TEST THE WHOLE YACHT MOB FUNCTION.
				</div><br>
				<div id="mob-warning-small">
					Including checking all modes of activation and ensuring that displays
					operate as expected.
				</div>
			</div>
		</div>
	</div>

</section>

<script type="text/javascript" src="js/utils.lat-long.js" defer></script>
<script type="text/javascript" src="js/atp.mob.js" defer></script>
<script>
$(document).ready(function() {
	var model = new MOBModel();
	var controller = new MOBController(model);
	var view = new MOBView(controller);	
});
</script>

<?php require_once "footer.php";?>
