maybe I fixed it
This commit is contained in:
95
startup.lua
95
startup.lua
@ -253,9 +253,7 @@ local function GetGDOTransmission()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function HandlePasswordEntry()
|
local function HandlePasswordEntry()
|
||||||
utils.debug("HandlePasswordEntry: Calling handlers.handlePasswordInput()")
|
|
||||||
local result = handlers.handlePasswordInput()
|
local result = handlers.handlePasswordInput()
|
||||||
utils.debug("HandlePasswordEntry: handlers.handlePasswordInput() returned: " .. tostring(result))
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -265,18 +263,17 @@ local function HandleIncomingPasswordRequest(password)
|
|||||||
utils.log("Correct password received, opening iris")
|
utils.log("Correct password received, opening iris")
|
||||||
utils.openIris()
|
utils.openIris()
|
||||||
utils.sendPasswordResponse(true)
|
utils.sendPasswordResponse(true)
|
||||||
utils.debug("Sent: IRIS_OPEN")
|
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
utils.log("Incorrect password received")
|
utils.log("Incorrect password received")
|
||||||
utils.sendPasswordResponse(false)
|
utils.sendPasswordResponse(false)
|
||||||
utils.debug("Sent: IRIS_DENIED")
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function MonitorRemoteIris()
|
local function MonitorRemoteIris()
|
||||||
-- Continuously monitor remote iris state while connected
|
-- Continuously monitor remote iris state while connected
|
||||||
|
-- Password handling is done during initial connection only
|
||||||
local lastIrisState = nil
|
local lastIrisState = nil
|
||||||
local state = getState()
|
local state = getState()
|
||||||
|
|
||||||
@ -289,90 +286,14 @@ local function MonitorRemoteIris()
|
|||||||
-- Only update display if state changed
|
-- Only update display if state changed
|
||||||
if remoteIrisState ~= lastIrisState then
|
if remoteIrisState ~= lastIrisState then
|
||||||
if remoteIrisState and remoteIrisState > 0 then
|
if remoteIrisState and remoteIrisState > 0 then
|
||||||
-- Remote iris closed or closing
|
-- Remote iris closed or closing during active connection
|
||||||
if remoteIrisState == 100 then
|
if remoteIrisState == 100 then
|
||||||
utils.log("ALERT: Remote iris fully closed during connection!")
|
utils.log("ALERT: Remote iris fully closed during connection!")
|
||||||
else
|
else
|
||||||
utils.log("ALERT: Remote iris moving: " .. remoteIrisState .. "%")
|
utils.log("ALERT: Remote iris moving: " .. remoteIrisState .. "%")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If remote has computer and iris just became fully closed, check for password request
|
-- Show warning screen
|
||||||
if state.remoteHasComputer and remoteIrisState == 100 and (not lastIrisState or lastIrisState < 100) then
|
|
||||||
utils.log("Remote iris closed and computer detected - checking for password request")
|
|
||||||
|
|
||||||
-- Check if password was already requested during initial connection
|
|
||||||
if state.remotePasswordRequired then
|
|
||||||
utils.log("Password already requested - showing password prompt")
|
|
||||||
|
|
||||||
local password = HandlePasswordEntry()
|
|
||||||
|
|
||||||
-- Wait for response
|
|
||||||
local function WaitForResponse()
|
|
||||||
sleep(3) -- Wait up to 3 seconds for response
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local result = parallel.waitForAny(GetMessage, WaitForResponse)
|
|
||||||
if result == 1 then
|
|
||||||
local response = state.lastReceivedMessage
|
|
||||||
state.lastReceivedMessage = nil
|
|
||||||
if response == "IRIS_OPEN" then
|
|
||||||
display.showPasswordResult(true)
|
|
||||||
utils.log("Password accepted - iris opened")
|
|
||||||
-- Continue monitoring, iris state will update
|
|
||||||
elseif response == "IRIS_DENIED" then
|
|
||||||
display.showPasswordResult(false)
|
|
||||||
utils.log("Password rejected")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- Wait briefly for password request message if not already received
|
|
||||||
utils.log("Waiting for password request message")
|
|
||||||
local function WaitForPasswordRequest()
|
|
||||||
sleep(2) -- Wait up to 2 seconds for password request
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local result = parallel.waitForAny(GetMessage, WaitForPasswordRequest)
|
|
||||||
if result == 1 then
|
|
||||||
local message = state.lastReceivedMessage
|
|
||||||
state.lastReceivedMessage = nil
|
|
||||||
|
|
||||||
-- Only show password panel if explicitly requested
|
|
||||||
if message == "IRIS_PASSWORD_REQUIRED" then
|
|
||||||
utils.log("Password requested by remote gate - showing password prompt")
|
|
||||||
|
|
||||||
local password = HandlePasswordEntry()
|
|
||||||
|
|
||||||
-- Wait for response
|
|
||||||
local function WaitForResponse()
|
|
||||||
sleep(3) -- Wait up to 3 seconds for response
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
result = parallel.waitForAny(GetMessage, WaitForResponse)
|
|
||||||
if result == 1 then
|
|
||||||
local response = state.lastReceivedMessage
|
|
||||||
state.lastReceivedMessage = nil
|
|
||||||
if response == "IRIS_OPEN" then
|
|
||||||
display.showPasswordResult(true)
|
|
||||||
utils.log("Password accepted - iris opened")
|
|
||||||
-- Continue monitoring, iris state will update
|
|
||||||
elseif response == "IRIS_DENIED" then
|
|
||||||
display.showPasswordResult(false)
|
|
||||||
utils.log("Password rejected")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Re-check iris state after password attempt
|
|
||||||
remoteIrisState = transceiver.checkConnectedShielding()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Show warning screen if iris still closed
|
|
||||||
if remoteIrisState and remoteIrisState > 0 then
|
|
||||||
mon.setBackgroundColor(colors.red)
|
mon.setBackgroundColor(colors.red)
|
||||||
mon.clear()
|
mon.clear()
|
||||||
mon.setTextScale(1)
|
mon.setTextScale(1)
|
||||||
@ -388,9 +309,6 @@ local function MonitorRemoteIris()
|
|||||||
mon.write("Connection unsafe")
|
mon.write("Connection unsafe")
|
||||||
display.drawIrisStatus()
|
display.drawIrisStatus()
|
||||||
display.drawDisconnectButton()
|
display.drawDisconnectButton()
|
||||||
else
|
|
||||||
display.showConnected(state.destAddressname, state.destAddress)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
-- Remote iris is open (0 or nil)
|
-- Remote iris is open (0 or nil)
|
||||||
if lastIrisState and lastIrisState > 0 then
|
if lastIrisState and lastIrisState > 0 then
|
||||||
@ -806,19 +724,12 @@ local function handleOutgoingDial()
|
|||||||
|
|
||||||
local result = HandlePasswordEntry()
|
local result = HandlePasswordEntry()
|
||||||
|
|
||||||
utils.debug("HandlePasswordEntry returned: " .. tostring(result))
|
|
||||||
utils.debug("Type of result: " .. type(result))
|
|
||||||
utils.debug("result == 'IRIS_OPENED': " .. tostring(result == "IRIS_OPENED"))
|
|
||||||
|
|
||||||
-- Check if iris opened during password entry (via GDO)
|
-- Check if iris opened during password entry (via GDO)
|
||||||
if result == "IRIS_OPENED" then
|
if result == "IRIS_OPENED" then
|
||||||
utils.debug("Setting connectionSafe=true after IRIS_OPENED")
|
|
||||||
utils.log("Iris opened during password entry (via GDO or message)")
|
|
||||||
connectionSafe = true
|
connectionSafe = true
|
||||||
-- Show success message briefly
|
-- Show success message briefly
|
||||||
display.showPasswordResult(true)
|
display.showPasswordResult(true)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
utils.debug("After success display, connectionSafe=" .. tostring(connectionSafe))
|
|
||||||
elseif result then
|
elseif result then
|
||||||
-- Password was entered, send it
|
-- Password was entered, send it
|
||||||
utils.debug("Sent: IRIS_PASSWORD:" .. result)
|
utils.debug("Sent: IRIS_PASSWORD:" .. result)
|
||||||
|
|||||||
Reference in New Issue
Block a user