mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[Pocketbook] wifi: fallback to new API when old API is out of bounds
This commit is contained in:
committed by
GitHub
parent
00b08d7b54
commit
e2a5fd5c36
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user