--[[
---------------------------------------------------------------------------
Remote Train Control Program for Windows

© Copyright 2019 by Mark DiVecchio

	This file is part of Remote Train Control.

	Remote Train Control 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.

	Remote Train Control 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 Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

 Home Page : http://www.silogic.com/trains/RTC_Running.html
---------------------------------------------------------------------------]]
-- Semicolons are not required in Lua code
-- Do Nothing Tag Test
title = "Do Nothing Tag Test"
--
-- This test runs a simple "do nothing" script with tag detection enabled
--
require("defines");
require("functions");

local MyEngineNo, MyTIUNo;

-- Counter Labels
Counter01Label = "Do Nothing";

--[[---------------------------------------------------------------------------------------]]
function setup(Engine)
	-- the setup() function is called once at the beginning of the run
	MyEngineNo = Engine;	-- Engine number selected on the RTC Main window
	MyTIUNo = GetTIUNo(MyEngineNo);	-- TIU associated with MyEngineNo
	
	print("setup(): Engine Number " .. MyEngineNo .. " TIU Number " .. MyTIUNo .. " Debug " .. Debug());
	-- Do nothing	
	return true;		-- false=setup failed, true=setup succeeded
	end
--[[---------------------------------------------------------------------------------------]]
function tag(Detector, Reader, EngineNo, TagLocation, CarModel, Railroad, CarNumber, TagPacket)
	-- this function is called each time a tag is detected
	-- this function always waits until loop() finishes
	if (EngineNo > 0) then	-- its an engine
		print(string.format([[tag(%.2f) : Detector %d Reader %d EngineNo %d TagLocation %d EngineModel %d]],
			RunTime(), Detector, Reader, EngineNo, TagLocation, CarModel));
		else	-- it's a car
		print(string.format([[tag(%.2f) : Detector %d Reader %d CarModel %d]], RunTime(),
			Detector, Reader, CarModel));
		end
	-- Do nothing
	return true;
	end
--[[---------------------------------------------------------------------------------------]]
function cleanup()
	-- the cleanup() function is called once when the [STOP] button is pressed
	print(string.format("cleanup %.2f", RunTime()));
	-- Do nothing
	return true;		-- false=cleanup failed, true=cleanup succeeded
	end
--[[---------------------------------------------------------------------------------------]]
function tick()
	-- the tick() function is called once per second
	-- do not call Sleep() from this function
	print(string.format("tick --> %.2f", RunTime()));
	-- Do nothing;
	return true;	-- false=stop calling tick(), true=continue to tick
	end
--[[---------------------------------------------------------------------------------------]]
function DL()
	-- the DL() function is called when the Function 1 button is pressed
	print("Do Nothing : PCNo = " .. PCNo() .. " Debug " .. Debug());
	-- Do almost nothing	
	BumpCounter(COUNTER01);
	return true;
	end
Function01Name, Function01Label = DL, 'Print("Do Nothing")';
--[[---------------------------------------------------------------------------------------]]
