Initialize modular ATM10 CC control system
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
local constants = require("core.constants")
|
||||
local M = {}
|
||||
function M.message(kind, source, target, payload)
|
||||
return {
|
||||
protocol = constants.PROTOCOL,
|
||||
version = constants.PROTOCOL_VERSION,
|
||||
type = kind,
|
||||
source = source,
|
||||
target = target,
|
||||
requestId = ("%s-%d-%d"):format(source, os.getComputerID(), os.epoch("utc")),
|
||||
timestamp = os.epoch("utc"),
|
||||
payload = payload or {},
|
||||
}
|
||||
end
|
||||
function M.valid(message)
|
||||
return type(message) == "table"
|
||||
and message.protocol == constants.PROTOCOL
|
||||
and message.version == constants.PROTOCOL_VERSION
|
||||
and type(message.type) == "string"
|
||||
end
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user