add : USB CDC虚拟串口通讯
This commit is contained in:
121
4G/tools/_temp/script/temp_script/socket.lua
Normal file
121
4G/tools/_temp/script/temp_script/socket.lua
Normal file
@@ -0,0 +1,121 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user