122 lines
1.1 KiB
Lua
122 lines
1.1 KiB
Lua
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
require "socket4G"
|
||
|
|
module(..., package.seeall)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
socket.isReady = link.isReady
|
||
|
|
local tSocketModule = nil
|
||
|
|
local function init()
|
||
|
|
tSocketModule = tSocketModule or {
|
||
|
|
[link.CELLULAR] = socket4G,
|
||
|
|
[link.CH395] = socketCh395,
|
||
|
|
[link.W5500] = socketW5500,
|
||
|
|
[link.ESP8266] = socketESP8266
|
||
|
|
}
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function tcp(ssl, cert, tCoreExtPara, ipv6)
|
||
|
|
init()
|
||
|
|
return tSocketModule[link.getNetwork()].tcp(ssl, cert, tCoreExtPara, ipv6)
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function udp(ipv6)
|
||
|
|
init()
|
||
|
|
return tSocketModule[link.getNetwork()].udp(ipv6)
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function setTcpResendPara(retryCnt, retryMaxTimeout)
|
||
|
|
init()
|
||
|
|
return tSocketModule[link.getNetwork()].setTcpResendPara(retryCnt, retryMaxTimeout)
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function setDnsParsePara(retryCnt, retryTimeoutMulti)
|
||
|
|
init()
|
||
|
|
return tSocketModule[link.getNetwork()].setDnsParsePara(retryCnt, retryTimeoutMulti)
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function printStatus()
|
||
|
|
init()
|
||
|
|
return tSocketModule[link.getNetwork()].printStatus()
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function setLowPower(tm)
|
||
|
|
init()
|
||
|
|
return tSocketModule[link.getNetwork()].setLowPower(tm)
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function setIpStatis(interval)
|
||
|
|
init()
|
||
|
|
return tSocketModule[link.getNetwork()].setIpStatis(interval or 0)
|
||
|
|
end
|