mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-07-30 16:59:15 +02:00
add parse ascii
This commit is contained in:
+1
-2
@@ -291,8 +291,7 @@ mec_handlers[0x2D] = function (data)
|
|||||||
local mel = string.byte(data, 2)
|
local mel = string.byte(data, 2)
|
||||||
local designation = string.sub(data, 3, 4)
|
local designation = string.sub(data, 3, 4)
|
||||||
if string.byte(designation, 1) == 0x39 and string.byte(designation, 2) == 0x35 and mel > 2 then
|
if string.byte(designation, 1) == 0x39 and string.byte(designation, 2) == 0x35 and mel > 2 then
|
||||||
local data = string.sub(data, 5, 4+mel)
|
pcall(hooks.parse_ascii, string.sub(data, 5, 4+mel))
|
||||||
pcall(hooks.data_handle, data)
|
|
||||||
end
|
end
|
||||||
return 2+mel
|
return 2+mel
|
||||||
end
|
end
|
||||||
|
|||||||
+8
-7
@@ -1,8 +1,5 @@
|
|||||||
---@param data string
|
---@param data string
|
||||||
function hooks.data_handle(data)
|
function hooks.parse_ascii(data)
|
||||||
-- UECP
|
|
||||||
if uecp.parse_uecp and string.byte(data, 1) == 0xfe then return uecp.parse_uecp(data) end
|
|
||||||
|
|
||||||
if string.sub(data, 1, 4):lower() == "lua=" then
|
if string.sub(data, 1, 4):lower() == "lua=" then
|
||||||
local chunk, err = load("return " .. string.sub(data, 5), "udp_chunk") -- skip "lua="
|
local chunk, err = load("return " .. string.sub(data, 5), "udp_chunk") -- skip "lua="
|
||||||
if not chunk then return string.format("-\r\n%s\r\n", err) end
|
if not chunk then return string.format("-\r\n%s\r\n", err) end
|
||||||
@@ -324,7 +321,11 @@ function hooks.data_handle(data)
|
|||||||
|
|
||||||
rds.ext.set_af_oda(af_table)
|
rds.ext.set_af_oda(af_table)
|
||||||
return "+\r\n"
|
return "+\r\n"
|
||||||
else
|
else return "?\r\n" end
|
||||||
return "?\r\n"
|
end
|
||||||
end
|
|
||||||
|
---@param data string
|
||||||
|
function hooks.data_handle(data)
|
||||||
|
if uecp.parse_uecp and string.byte(data, 1) == 0xfe then return uecp.parse_uecp(data)
|
||||||
|
else return hooks.parse_ascii(data) end
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user