rewrite function ExportScript.Tools.ProcessInput()....

This commit is contained in:
mcmicha 2016-09-09 00:22:10 +02:00
parent 560f107f65
commit 2e5f545d4a

View File

@ -27,53 +27,32 @@ function ExportScript.Tools.ProcessInput()
-- lCommandArgs[1] = 1 => lDevice -- lCommandArgs[1] = 1 => lDevice
-- lCommandArgs[2] = 3001 => ButtonID -- lCommandArgs[2] = 3001 => ButtonID
-- lCommandArgs[3] = 4 => Value -- lCommandArgs[3] = 4 => Value
if ExportScript.Config.Listener then
if ExportScript.Config.IkarusExport then local lInput,from,port = ExportScript.UDPListener:receivefrom()
local lInput,from,port = ExportScript.UDPsender:receivefrom() if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("lInput: "..ExportScript.Tools.dump(lInput)..", from: "..ExportScript.Tools.dump(from)..", port: "..ExportScript.Tools.dump(port))
end
if lInput then if lInput then
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("lInput: "..lInput..", from: "..from..", port: "..port)
end
lCommand = string.sub(lInput,1,1) lCommand = string.sub(lInput,1,1)
if lCommand == "R" then if lCommand == "R" then -- R == Reset
ExportScript.Tools.ResetChangeValues() if ExportScript.Config.IkarusExport then
ExportScript.Tools.ResetChangeValues()
end
if ExportScript.Config.DACExport then
ExportScript.Tools.ResetChangeValuesDAC()
end
end end
if (lCommand == "C") then if (lCommand == "C") then
lCommandArgs = ExportScript.Tools.StrSplit(string.sub(lInput,2),",") lCommandArgs = ExportScript.Tools.StrSplit(string.sub(lInput,2),",")
lDevice = GetDevice(lCommandArgs[1]) lDevice = GetDevice(lCommandArgs[1])
if type(lDevice) == "table" then
lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3])
end
end
end
end
if ExportScript.Config.DACExport then
local lInput2,from2,port2 = ExportScript.UDPListener:receivefrom() -- Hardware
if lInput2 then
if ExportScript.Config.Debug then
ExportScript.Tools.WriteToLog("lInput2: "..lInput2..", from2: "..from2..", port2: "..port2)
end
lCommand = string.sub(lInput2,1,1)
if lCommand == "C" then
ExportScript.Tools.ResetChangeValuesDAC()
end
if (lCommand == "C") then
lCommandArgs = ExportScript.Tools.StrSplit(string.sub(lInput2,2),",")
lDevice = GetDevice(lCommandArgs[1])
if lDevice ~= "1000" then if lDevice ~= "1000" then
if type(lDevice) == "table" then if type(lDevice) == "table" then
lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3]) lDevice:performClickableAction(lCommandArgs[2],lCommandArgs[3])
end end
elseif lDevice == "1000" then elseif lDevice == "1000" then
--ExportScript.genericRadio(key, value, hardware) --ExportScript.genericRadio(key, value)
--ExportScript.genericRadio(lCommandArgs[2],lCommandArgs[3], ExportScript.Config.genericRadioHardwareID)
ExportScript.genericRadio(lCommandArgs[2],lCommandArgs[3]) ExportScript.genericRadio(lCommandArgs[2],lCommandArgs[3])
end end
end end