1 Star 1 Fork 1

小青子衿/lua与protobuf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
getData.lua 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
小青子衿 提交于 2021-01-28 11:18 +08:00 . add library
local protoc = require "protoc"
-- load schema from text
assert(protoc:loadfile("../proto/zmqmsg.proto"))
--数据采集数据包模拟
--接收到数据包接口
function recvTask(self, uuid, pri, typeName, bytes)
local data = assert(pb.decode(typeName, bytes))
print("数据采集任务:", uuid)
print(require "serpent".block(data))
local execDir
if string.find(uuid, 'CPRIPORT1') ~= nil then
execDir = 'F:\\ISON_Linux\\TestData\\HW\\CDD\\first'
elseif string.find(uuid, 'CPRIPORT2') ~= nil then
execDir = 'F:\\ISON_Linux\\TestData\\HW\\CDD\\second'
else
execDir = 'F:\\ISON_Linux\\TestData\\HW\\CDD\\data'
end
local decoderData = {
collReq = data.cllReq,
execRsltDir = execDir
}
decoderData.collReq.ossName = data.ossNames[1]
print("Decoder:")
print(require "serpent".block(decoderData))
--生成解码任务
local decoderBytes = assert(pb.encode("zmqmsg.DataDecodeReq", decoderData))
self:sendRequest( "HW_DECODER", uuid..".Decoder", pri, "zmqmsg.DataDecodeReq", decoderBytes)
local repData = {taskName = data.taskName, code = pb.enum("zmqmsg.taskReply.type", "SUCCESS")}
local bytes = assert(pb.encode("zmqmsg.taskReply", repData))
return bytes
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/little_gitee/lua-and-protobuf.git
git@gitee.com:little_gitee/lua-and-protobuf.git
little_gitee
lua-and-protobuf
lua与protobuf
master

搜索帮助