big lua api changes

This commit is contained in:
2026-06-20 13:45:17 +02:00
parent a4b968c457
commit e647870238
14 changed files with 625 additions and 651 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ end
---@param designator string
---@param handler function
function rds.ext.register_group(designator, handler)
function RDS.ext.register_group(designator, handler)
for i = 1, #designator do
local char = designator:sub(i, i)
hooks.registered_groups[char] = handler
+1 -1
View File
@@ -119,7 +119,7 @@ local function group_handler(group_type)
elseif group_type == "\xff" then return get_data()
else return false, 0, 0, 0 end
end
rds.ext.register_group("\x06\xff", group_handler)
RDS.ext.register_group("\x06\xff", group_handler)
table.insert(hooks.on_state, function ()
_RDS_ODAs = {}
+2 -2
View File
@@ -138,7 +138,7 @@ function RftInstance:sendFile(aid, path, id, crc, once)
local f_size = #self.file_data
if crc == 0 then
self.crc_mode = 0
self.crc_full_file = dp.crc16(self.file_data)
self.crc_full_file = Data.crc16(self.file_data)
elseif crc == true or crc == 7 then
if f_size <= 40960 then self.crc_mode = 1
elseif f_size > 40960 and f_size <= 81920 then self.crc_mode = 2
@@ -153,7 +153,7 @@ function RftInstance:sendFile(aid, path, id, crc, once)
local chunk_size = 5 * multiplier
for i = 1, f_size, chunk_size do
local chunk = string.sub(self.file_data, i, i + chunk_size - 1)
local v = dp.crc16(chunk)
local v = Data.crc16(chunk)
self.crc_data = self.crc_data .. string.char(v >> 8, v & 0xff)
end
end
+1 -1
View File
@@ -106,7 +106,7 @@ end
---Sets the AFs included in the ODA and saves them
---@param afs table List of numbers (e.g., {98.1, 102.5})
function rds.ext.set_af_oda(afs)
function RDS.ext.set_af_oda(afs)
_process_af_list(afs)
save_af_to_userdata(afs)
end
+2 -2
View File
@@ -41,7 +41,7 @@ function unregister_ert()
end
end
function rds.ext.set_ert(ert)
function RDS.ext.set_ert(ert)
if #ert == 0 then
userdata.set_offset(USERDATA_ERT_OFFSET, 128, "")
userdata.set_offset(USERDATA_ERT_OFFSET+128, 1, string.char(0))
@@ -72,7 +72,7 @@ function rds.ext.set_ert(ert)
if _Ert_oda_id == nil then init_ert() end
end
function rds.ext.get_ert()
function RDS.ext.get_ert()
local segments = string.byte(userdata.get_offset(USERDATA_ERT_OFFSET+128, 1))
if segments == 0 then return "" end
+9 -9
View File
@@ -52,7 +52,7 @@ local function init_ertp()
end
end
function rds.ext.set_rtp_meta(ertp, running)
function RDS.ext.set_rtp_meta(ertp, running)
if ertp then
if running and _Ertp_oda_id == nil then init_ertp() end
userdata.set_offset(USERDATA_RTP_OFFSET+7, 1, string.char(running and 1 or 0))
@@ -61,21 +61,21 @@ function rds.ext.set_rtp_meta(ertp, running)
userdata.set_offset(USERDATA_RTP_OFFSET, 1, string.char(running and 1 or 0))
end
end
function rds.ext.get_rtp_meta(ertp)
function RDS.ext.get_rtp_meta(ertp)
local offset = ertp and (USERDATA_RTP_OFFSET+7) or USERDATA_RTP_OFFSET
return string.byte(userdata.get_offset(offset, 1)) ~= 0
end
function rds.ext.toggle_rtp(ertp)
function RDS.ext.toggle_rtp(ertp)
if ertp then _Ertp_toggle = not _Ertp_toggle
else _Rtp_toggle = not _Rtp_toggle end
end
function rds.ext.set_rtplus_tags(ertp, t1, s1, l1, t2, s2, l2)
rds.ext.set_rtp_meta(ertp, true)
rds.ext.toggle_rtp(ertp)
function RDS.ext.set_rtplus_tags(ertp, t1, s1, l1, t2, s2, l2)
RDS.ext.set_rtp_meta(ertp, true)
RDS.ext.toggle_rtp(ertp)
userdata.set_offset(ertp and (USERDATA_RTP_OFFSET+8) or (USERDATA_RTP_OFFSET+1), 6, string.char(t1, s1, l1, t2, s2, l2))
end
function rds.ext.get_rtplus_tags(ertp)
function RDS.ext.get_rtplus_tags(ertp)
return string.byte(userdata.get_offset(ertp and (USERDATA_RTP_OFFSET+8) or (USERDATA_RTP_OFFSET+1), 6), 1, 6)
end
@@ -90,6 +90,6 @@ function unregister_rtp(ertp)
end
table.insert(hooks.on_state, function ()
if rds.ext.get_rtp_meta(false) then init_rtp() end
if rds.ext.get_rtp_meta(true) then init_ertp() end
if RDS.ext.get_rtp_meta(false) then init_rtp() end
if RDS.ext.get_rtp_meta(true) then init_ertp() end
end)
+29 -29
View File
@@ -19,29 +19,29 @@ hooks.rt_transmission[#hooks.rt_transmission + 1] = function ()
local entry = uecp.rt_buffer[uecp.rt_buffer_index]
uecp.rt_tx_remaining = entry.number_tx
rds.set_rt_raw(entry.text)
if entry.toggle_ab then rds.toggle_rt_ab() end
RDS.set_rt_raw(entry.text)
if entry.toggle_ab then RDS.toggle_rt_ab() end
end
local function dsn_helper(dsn, write)
if dsn == 0 then write()
elseif dsn == 254 then
local start = dp.get_writing_program()
for i = 1, dp.max_programs do
local start = Data.get_writing_program()
for i = 1, Data.max_programs do
local p = i - 1
if p ~= start then
dp.set_writing_program(p)
Data.set_writing_program(p)
write()
end
end
elseif dsn == 255 then
for i = 1, dp.max_programs do
dp.set_writing_program(i - 1)
for i = 1, Data.max_programs do
Data.set_writing_program(i - 1)
write()
end
else
dp.set_writing_program(dsn - 1)
Data.set_writing_program(dsn - 1)
write()
end
end
@@ -55,7 +55,7 @@ mec_handlers[1] = function(data)
local pi_lsb = string.byte(data, 5)
dsn_helper(dsn, function()
rds.set_pi((pi_msb << 8) | pi_lsb)
RDS.pi = (pi_msb << 8) | pi_lsb
end)
return 5
end
@@ -65,7 +65,7 @@ mec_handlers[2] = function(data)
local psn = string.byte(data, 3)
local ps = string.sub(data, 4, 11) -- Static len
dsn_helper(dsn, function()
rds.set_ps(ps)
RDS.set_ps(ps)
end)
return 11
end
@@ -80,7 +80,7 @@ mec_handlers[0x21] = function(data)
if cut then lps = string.sub(lps, 1, cut - 1) end
dsn_helper(dsn, function()
rds.set_lps(lps)
RDS.set_lps(lps)
end)
return 4 + mel
end
@@ -90,7 +90,7 @@ mec_handlers[4] = function(data)
local psn = string.byte(data, 3)
local data = string.byte(data, 4)
dsn_helper(dsn, function ()
rds.set_dpty((data & 8) ~= 0)
RDS.dpty = (data & 8) ~= 0
end)
return 4
end
@@ -100,8 +100,8 @@ mec_handlers[3] = function(data)
local psn = string.byte(data, 3)
local data = string.byte(data, 4)
dsn_helper(dsn, function ()
rds.set_ta((data & 1) ~= 0)
rds.set_tp((data & 2) ~= 0)
RDS.ta = (data & 1) ~= 0
RDS.tp = (data & 2) ~= 0
end)
return 4
end
@@ -111,7 +111,7 @@ mec_handlers[7] = function(data)
local psn = string.byte(data, 3)
local data = string.byte(data, 4)
dsn_helper(dsn, function ()
rds.set_pty(data)
RDS.pty = data
end)
return 4
end
@@ -121,7 +121,7 @@ mec_handlers[0x3E] = function(data)
local psn = string.byte(data, 3)
local ptyn = string.sub(data, 4, 11) -- Static
dsn_helper(dsn, function ()
rds.set_ptyn(ptyn)
RDS.set_ptyn(ptyn)
end)
return 11
end
@@ -136,7 +136,7 @@ mec_handlers[0x0A] = function(data)
uecp.rt_buffer_index = 1
uecp.rt_tx_remaining = 0
dsn_helper(dsn, function ()
rds.set_rt_enabled(false)
RDS.rt_enabled = false
end)
return 4
end
@@ -151,7 +151,7 @@ mec_handlers[0x0A] = function(data)
uecp.rt_buffer_index = 1
uecp.rt_tx_remaining = 0
dsn_helper(dsn, function ()
rds.set_rt_enabled(false)
RDS.rt_enabled = false
end)
return 5
end
@@ -167,9 +167,9 @@ mec_handlers[0x0A] = function(data)
uecp.rt_tx_remaining = number_tx
-- Seed the encoder immediately with the first entry
dsn_helper(dsn, function ()
rds.set_rt_raw(rt_text)
if toggle_ab then rds.toggle_rt_ab() end
rds.set_rt_enabled(true)
RDS.set_rt_raw(rt_text)
if toggle_ab then RDS.toggle_rt_ab() end
RDS.rt_enabled = true
end)
elseif buffer_config == 2 then
uecp.rt_buffer[#uecp.rt_buffer + 1] = { text = rt_text, number_tx = number_tx, toggle_ab = toggle_ab }
@@ -209,7 +209,7 @@ mec_handlers[0x1A] = function (data)
if variant == 0 then
-- TODO: maybe make it more than just ecc? idk why but would be cool
dsn_helper(dsn, function ()
rds.set_ecc(full_data)
RDS.ecc = full_data
end)
end
@@ -230,7 +230,7 @@ mec_handlers[0x24] = function (data)
local blockc_lsb = string.byte(data, 5)
local blockd_msb = string.byte(data, 6)
local blockd_lsb = string.byte(data, 7)
rds.put_custom_group((group << 11) | blockb, (blockc_msb << 8) | blockc_lsb, (blockd_msb << 8) | blockd_lsb)
RDS.put_custom_group((group << 11) | blockb, (blockc_msb << 8) | blockc_lsb, (blockd_msb << 8) | blockd_lsb)
return 7
end
-- Fuck you mean, i have to implement some fucking "spinning wHELLs"? may the lord have mercy
@@ -239,7 +239,7 @@ mec_handlers[0x19] = function (data)
-- CT
local data = string.byte(data, 2)
dsn_helper(255, function ()
rds.set_ct(data ~= 0)
RDS.ct = data ~= 0
end)
return 2
end
@@ -249,7 +249,7 @@ mec_handlers[0x16] = function (data)
local mel = string.byte(data, 3)
local group_sequence = string.sub(data, 4, 3+mel)
dsn_helper(dsn, function ()
rds.set_grpseq(group_sequence)
RDS.set_grpseq(group_sequence)
end)
return 4 + mel
end
@@ -282,8 +282,8 @@ end
mec_handlers[0x1C] = function (data)
-- DS select
local dsn = string.byte(data, 2)
dp.set_output_program(dsn)
dp.set_writing_program(dsn)
Data.set_output_program(dsn)
Data.set_writing_program(dsn)
return 2
end
mec_handlers[0x2D] = function (data)
@@ -367,7 +367,7 @@ function uecp.parse_uecp(packet)
return
end
local crc_calculated = dp.crc16(string.sub(unstuffed, 1, 4 + mfl))
local crc_calculated = Data.crc16(string.sub(unstuffed, 1, 4 + mfl))
local crc_hi = string.byte(unstuffed, 4 + mfl + 1)
local crc_stored = (crc_hi << 8) | string.byte(unstuffed, 4 + mfl + 2)
@@ -386,6 +386,6 @@ function uecp.parse_uecp(packet)
end
local advance = handler(string.sub(data, consumed))
consumed = consumed + advance
dp.set_writing_program(dp.get_output_program())
Data.set_writing_program(Data.get_output_program())
end
end
+67 -67
View File
@@ -39,48 +39,48 @@ function hooks.parse_ascii(data)
end
if cmd == nil then
data = data:lower()
if data == "ver" then return string.format("rds95 core v. %s - (C) 2025 radio95 - lua parser\r\n", dp.core_version)
if data == "ver" then return string.format("rds95 core v. %s - (C) 2026 radio95 - lua parser\r\n", Data.core_version)
elseif data == "init" then
dp.set_program_defaults()
Data.set_program_defaults()
return "+\r\n"
elseif data == "reset" then
dp.reset_rds()
Data.reset_rds()
return "+\r\n"
elseif data == "pi" then return string.format("PI=%s\r\n", string.format("%x", rds.get_pi()))
elseif data == "pty" then return string.format("PTY=%s\r\n", string.format("%d", rds.get_pty()))
elseif data == "ecc" then return string.format("ECC=%s\r\n", string.format("%x", rds.get_ecc()))
elseif data == "slcd" then return string.format("SLCD=%s\r\n", string.format("%x", rds.get_slc_data()))
elseif data == "ct" then return string.format("CT=%s\r\n", string.format("%d", (rds.get_ct() and 1 or 0)))
elseif data == "dpty" then return string.format("DPTY=%s\r\n", string.format("%d", (rds.get_dpty() and 1 or 0)))
elseif data == "tp" then return string.format("TP=%s\r\n", string.format("%d", (rds.get_tp() and 1 or 0)))
elseif data == "ta" then return string.format("TA=%s\r\n", string.format("%d", (rds.get_ta() and 1 or 0)))
elseif data == "rt1en" then return string.format("RT1EN=%s\r\n", string.format("%d", (rds.get_rt_enabled() and 1 or 0)))
elseif data == "ptynen" then return string.format("PTYNEN=%s\r\n", string.format("%d", (rds.get_ptyn_enabled() and 1 or 0)))
elseif data == "rdsgen" then return string.format("RDSGEN=%s\r\n", string.format("%d", rds.get_streams()))
elseif data == "link" then return string.format("LINK=%s\r\n", string.format("%d", (rds.get_link() and 1 or 0)))
elseif data == "pi" then return string.format("PI=%s\r\n", string.format("%x", RDS.pi))
elseif data == "pty" then return string.format("PTY=%s\r\n", string.format("%d", RDS.pty))
elseif data == "ecc" then return string.format("ECC=%s\r\n", string.format("%x", RDS.ecc))
elseif data == "slcd" then return string.format("SLCD=%s\r\n", string.format("%x", RDS.slc_data))
elseif data == "ct" then return string.format("CT=%s\r\n", string.format("%d", (RDS.ct and 1 or 0)))
elseif data == "dpty" then return string.format("DPTY=%s\r\n", string.format("%d", (RDS.dpty and 1 or 0)))
elseif data == "tp" then return string.format("TP=%s\r\n", string.format("%d", (RDS.tp and 1 or 0)))
elseif data == "ta" then return string.format("TA=%s\r\n", string.format("%d", (RDS.ta and 1 or 0)))
elseif data == "rt1en" then return string.format("RT1EN=%s\r\n", string.format("%d", (RDS.rt_enabled and 1 or 0)))
elseif data == "ptynen" then return string.format("PTYNEN=%s\r\n", string.format("%d", (RDS.ptyn_enabled and 1 or 0)))
elseif data == "rdsgen" then return string.format("RDSGEN=%s\r\n", string.format("%d", RDS.get_streams()))
elseif data == "link" then return string.format("LINK=%s\r\n", string.format("%d", (RDS.get_link() and 1 or 0)))
elseif data == "rtp" then
local t1, s1, l1, t2, s2, l2 = rds.ext.get_rtplus_tags(false)
local t1, s1, l1, t2, s2, l2 = RDS.ext.get_rtplus_tags(false)
return string.format("RTP=%d,%d,%d,%d,%d,%d\r\n", t1, s1, l1, t2, s2, l2)
elseif data == "ertp" then
local t1, s1, l1, t2, s2, l2 = rds.ext.get_rtplus_tags(true)
local t1, s1, l1, t2, s2, l2 = RDS.ext.get_rtplus_tags(true)
return string.format("ERTP=%d,%d,%d,%d,%d,%d\r\n", t1, s1, l1, t2, s2, l2)
elseif data == "rtprun" then
local running = rds.ext.get_rtp_meta(false)
local running = RDS.ext.get_rtp_meta(false)
local f1 = 2 or (running and 1 or 0)
return string.format("RTPRUN=%d\r\n", f1)
elseif data == "ertprun" then
local running = rds.ext.get_rtp_meta(true)
local running = RDS.ext.get_rtp_meta(true)
local f1 = 2 or (running and 1 or 0)
return string.format("ERTPRUN=%d\r\n", f1)
elseif data == "lps" then return string.format("LPS=%s\r\n", rds.get_lps())
elseif data == "ert" then return string.format("ERT=%s\r\n", rds.ext.get_ert())
elseif data == "lps" then return string.format("LPS=%s\r\n", RDS.get_lps())
elseif data == "ert" then return string.format("ERT=%s\r\n", RDS.ext.get_ert())
else
local eon_cmd, eon_num = data:match("^eon(%d+)([a-z]+)$")
if eon_cmd then
local eon_idx = tonumber(eon_cmd)
if not eon_idx or eon_idx < 1 or eon_idx > rds.eon_count then return "?\r\n" end
if not eon_idx or eon_idx < 1 or eon_idx > RDS.eon_count then return "?\r\n" end
eon_idx = eon_idx - 1
local eon_data = rds.get_eon(eon_idx)
local eon_data = RDS.get_eon(eon_idx)
if eon_num == "en" then return string.format("EON%dEN=%d\r\n", eon_idx + 1, eon_data.enabled and 1 or 0)
elseif eon_num == "pi" then return string.format("EON%dPI=%x\r\n", eon_idx + 1, eon_data.pi)
@@ -101,46 +101,46 @@ function hooks.parse_ascii(data)
local eon_num, eon_type = cmd:match("^eon(%d+)([a-z]+)$")
if eon_num then
local eon_idx = tonumber(eon_num)
if not eon_idx or eon_idx < 1 or eon_idx > rds.eon_count then return "?\r\n" end
if not eon_idx or eon_idx < 1 or eon_idx > RDS.eon_count then return "?\r\n" end
eon_idx = eon_idx - 1
if eon_type == "en" then
local en_val = tonumber(value)
if not en_val then return "-\r\n" end
local enabled = (en_val ~= 0)
rds.set_eon(eon_idx, { enabled = enabled })
RDS.set_eon(eon_idx, { enabled = enabled })
return "+\r\n"
elseif eon_type == "pi" then
local pi_val = tonumber(value, 16)
if not pi_val then return "-\r\n" end
rds.set_eon(eon_idx, { pi = pi_val })
RDS.set_eon(eon_idx, { pi = pi_val })
return "+\r\n"
elseif eon_type == "ps" then
local ps_val = value:sub(1, 24)
rds.set_eon(eon_idx, { ps = ps_val })
RDS.set_eon(eon_idx, { ps = ps_val })
return "+\r\n"
elseif eon_type == "pty" then
local pty_val = tonumber(value)
if not pty_val then return "-\r\n" end
rds.set_eon(eon_idx, { pty = pty_val })
RDS.set_eon(eon_idx, { pty = pty_val })
return "+\r\n"
elseif eon_type == "ta" then
local ta_val = tonumber(value)
if not ta_val then return "-\r\n" end
local ta = (ta_val ~= 0)
rds.set_eon(eon_idx, { ta = ta })
if ta then rds.set_ta(true) end
RDS.set_eon(eon_idx, { ta = ta })
if ta then RDS.ta = true end
return "+\r\n"
elseif eon_type == "tp" then
local tp_val = tonumber(value)
if not tp_val then return "-\r\n" end
local tp = (tp_val ~= 0)
rds.set_eon(eon_idx, { tp = tp })
RDS.set_eon(eon_idx, { tp = tp })
return "+\r\n"
elseif eon_type == "af" then
local af_table = {}
if value == "" or value == "0" then
rds.set_eon(eon_idx, { afs = {} })
RDS.set_eon(eon_idx, { afs = {} })
return "+\r\n"
end
for freq_str in value:gmatch("([^,]+)") do
@@ -149,12 +149,12 @@ function hooks.parse_ascii(data)
else return "-\r\n" end
end
if #af_table > 25 then return "-\r\n" end
rds.set_eon(eon_idx, { afs = af_table })
RDS.set_eon(eon_idx, { afs = af_table })
return "+\r\n"
elseif eon_type == "dt" then
local dt_val = tonumber(value, 16)
if not dt_val then return "-\r\n" end
rds.set_eon(eon_idx, { data = dt_val })
RDS.set_eon(eon_idx, { data = dt_val })
return "+\r\n"
else return "?\r\n" end
end
@@ -163,96 +163,96 @@ function hooks.parse_ascii(data)
local pi = tonumber(value, 16)
if not pi then return "-\r\n" end
if (pi & 0xF000) == 0 then return "-\r\n" end
rds.set_pi(pi)
RDS.pi = pi
return "+\r\n"
elseif cmd == "ecc" then
local ecc = tonumber(value, 16)
if not ecc then return "-\r\n" end
rds.set_ecc(ecc)
RDS.ecc = ecc
return "+\r\n"
elseif cmd == "pty" then
local pty = tonumber(value)
if not pty then return "-\r\n" end
rds.set_pty(pty)
RDS.pty = pty
return "+\r\n"
elseif cmd == "ct" then
local ct = tonumber(value)
if not ct then return "-\r\n" end
rds.set_ct(ct ~= 0)
RDS.ct = ct ~= 0
return "+\r\n"
elseif cmd == "dpty" then
local dpty = tonumber(value)
if not dpty then return "-\r\n" end
rds.set_dpty(dpty ~= 0)
RDS.dpty = dpty ~= 0
return "+\r\n"
elseif cmd == "tp" then
local tp = tonumber(value)
if not tp then return "-\r\n" end
rds.set_tp(tp ~= 0)
RDS.tp = tp ~= 0
return "+\r\n"
elseif cmd == "ta" then
local ta = tonumber(value)
if not ta then return "-\r\n" end
rds.set_ta(ta ~= 0)
RDS.ta = ta ~= 0
return "+\r\n"
elseif cmd == "rt1en" then
local en = tonumber(value)
if not en then return "-\r\n" end
rds.set_rt_enabled(en ~= 0)
RDS.rt_enabled = en ~= 0
return "+\r\n"
elseif cmd == "ptynen" then
local en = tonumber(value)
if not en then return "-\r\n" end
rds.set_ptyn_enabled(en ~= 0)
RDS.ptyn_enabled = en ~= 0
return "+\r\n"
elseif cmd == "rdsgen" then
local type = tonumber(value)
if not type then return "-\r\n" end
rds.set_streams(type)
RDS.set_streams(type)
return "+\r\n"
elseif cmd == "ptyn" then
rds.set_ptyn(value)
RDS.set_ptyn(value)
return "+\r\n"
elseif cmd == "ps" then
rds.set_ps(value)
RDS.set_ps(value)
return "+\r\n"
elseif cmd == "tps" then
rds.set_tps(value)
RDS.set_tps(value)
return "+\r\n"
elseif cmd == "rt1" or cmd == "text" then
uecp.rt_buffer = {}
uecp.rt_buffer_index = 1
uecp.rt_buffer[1] = { text = dp.encode_charset(value), number_tx = 0, toggle_ab = true }
uecp.rt_buffer[1] = { text = Data.encode_charset(value), number_tx = 0, toggle_ab = true }
uecp.rt_tx_remaining = 0
rds.set_rt_enabled(true)
rds.set_rt(value)
rds.toggle_rt_ab()
RDS.rt_enabled = true
RDS.set_rt(value)
RDS.toggle_rt_ab()
return "+\r\n"
elseif cmd == "lps" then
rds.set_lps(value)
RDS.set_lps(value)
return "+\r\n"
elseif cmd == "ert" then
rds.ext.set_ert(value)
RDS.ext.set_ert(value)
return "+\r\n"
elseif cmd == "link" then
local link = tonumber(value)
if not link then return "-\r\n" end
rds.set_link(link ~= 0)
RDS.set_link(link ~= 0)
return "+\r\n"
elseif cmd == "program" then
local program = tonumber(value)
if not program then return "-\r\n" end
if program < 1 or program > dp.max_programs then return "-\r\n" end
dp.set_output_program(program-1)
dp.set_writing_program(program-1)
rds.set_ta(false)
if program < 1 or program > Data.max_programs then return "-\r\n" end
Data.set_output_program(program-1)
Data.set_writing_program(program-1)
RDS.ta = false
return "+\r\n"
elseif cmd == "rtp" or cmd == "ertp" then
local is_ertp = (cmd == "ertp")
local t1, s1, l1, t2, s2, l2 = value:match("(%d+),(%d+),(%d+),(%d+),(%d+),(%d+)")
if not l2 then return "-\r\n" end
rds.ext.set_rtplus_tags(
RDS.ext.set_rtplus_tags(
is_ertp,
---@diagnostic disable-next-line: param-type-mismatch
tonumber(t1), tonumber(s1), tonumber(l1), tonumber(t2), tonumber(s2), tonumber(l2)
@@ -261,13 +261,13 @@ function hooks.parse_ascii(data)
elseif cmd == "g" then
local a, b, c, d = value:match("^(%x%x%x%x)(%x%x%x%x)(%x%x%x%x)(%x%x%x%x)$")
if a and b and c and d then
rds.put_rds2_custom_group(tonumber(a, 16), tonumber(b, 16), tonumber(c, 16), tonumber(d, 16))
RDS.put_rds2_custom_group(tonumber(a, 16), tonumber(b, 16), tonumber(c, 16), tonumber(d, 16))
return "+\r\n"
end
local b1, c1, d1 = value:match("^(%x%x%x%x)(%x%x%x%x)(%x%x%x%x)$")
if b1 and c1 and d1 then
rds.put_custom_group(tonumber(b1, 16), tonumber(c1, 16), tonumber(d1, 16))
RDS.put_custom_group(tonumber(b1, 16), tonumber(c1, 16), tonumber(d1, 16))
return "+\r\n"
end
@@ -282,14 +282,14 @@ function hooks.parse_ascii(data)
local f2 = tonumber(f2_str) or 0
local running = (f1 & 1) ~= 0
rds.ext.set_rtp_meta(is_ertp, running)
if f2 ~= 0 then rds.ext.toggle_rtp(is_ertp) end
RDS.ext.set_rtp_meta(is_ertp, running)
if f2 ~= 0 then RDS.ext.toggle_rtp(is_ertp) end
return "+\r\n"
elseif cmd == "af" then
local af_table = {}
if value == "" or value == "0" then
rds.set_af({})
RDS.set_af({})
return "+\r\n"
end
@@ -301,13 +301,13 @@ function hooks.parse_ascii(data)
if #af_table > 25 then return "-\r\n" end
rds.set_af(af_table)
RDS.set_af(af_table)
return "+\r\n"
elseif cmd == "afo" then
local af_table = {}
if value == "" or value == "0" then
rds.ext.set_af_oda({})
RDS.ext.set_af_oda({})
return "+\r\n"
end
@@ -319,7 +319,7 @@ function hooks.parse_ascii(data)
if #af_table > 25 then return "-\r\n" end
rds.ext.set_af_oda(af_table)
RDS.ext.set_af_oda(af_table)
return "+\r\n"
else return "?\r\n" end
end