<?xml version="1.0" encoding="UTF-8"?>
<component name="WritePinTask" extends="Task" >

    <script type="text/brightscript" uri="pkg:/source/utils/nodeUtils.brs" />
    <script type="text/brightscript" uri="pkg:/source/utils/generalUtils.brs" />
    <script type="text/brightscript" uri="pkg:/source/utils/urlUtils.brs" />
	
	<script type="text/brightscript">
		<![CDATA[
		sub init()
		    m.top.functionName = "go"
		end sub
		
		sub go()
		    read = regread("lock", m.top.section)
		    if m.top.pin = read and m.top.tipo = "1" then
		        m.top.result = "run"
		    else if m.top.pin <> read and m.top.tipo = "1" then
		    	m.top.result = "fault"
			else	
				regWrite("lock", m.top.pin.toStr(), m.top.section)
				m.top.result = "change"
		    end if
		end sub
		]]>
	</script>
	<interface>
		<field id="pin" type="string"/>
		<field id="tipo" type="string" value="1"/>
		<field id="section" type="string"/>
		<field id="result" type="string"/>
	</interface>
</component>

