require("xap")
-- set gpio 2 as output
gpio.mode(4, gpio.OUTPUT)
f = Filter:new()
f:callback(function(frame)
			 state = frame:getValue("gpio.2","state")
			 if state == nil then 
			   return 
			 end
			 if state == "on" then
			    gpio.write(4, gpio.HIGH)
			 else
			    gpio.write(4, gpio.LOW)
			 end
		    end
			)
xap.addFilter(f)
xap.start{host="192.168.1.8",source="dbzoo.eap.demo"}
-- Now send this xAP packet and it will be printed on the ESP
--[[
xap-header
{
v=12
hop=1
uid=FFE11E00
class=control
target=dbzoo.eap.demo
source=dbzoo.acme.test
}
gpio.2
{
state=on
}
--]]