[Pocketbook] wifi: fallback to new API when old API is out of bounds

reviewable/pr8629/r1
Robert-Jan de Dreu 2 years ago committed by GitHub
parent 00b08d7b54
commit e2a5fd5c36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -358,7 +358,15 @@ function PocketBook:initNetworkManager(NetworkMgr)
end
function NetworkMgr:isWifiOn()
return band(inkview.QueryNetwork(), C.CONNECTED) ~= 0
local state = inkview.QueryNetwork()
-- Some devices (PB741) return state = 515 for connected and state = 3
-- when not connected. We guess the reason is deprecation of the old API
-- for this reason when state is higher than C.CONNECTED we try the new API
if state <= C.CONNECTED then
return band(state, C.CONNECTED) ~= 0
else
return band(inkview.GetNetState(), C.CONNECTED) ~= 0
end
end
end

Loading…
Cancel
Save