mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-26 20:33:53 +01:00
turn away bad groups
This commit is contained in:
@@ -263,6 +263,7 @@ function set_rds_udg(xy, groups) end
|
||||
function set_rds_udg2(xy, groups) end
|
||||
|
||||
---Registers an ODA to be used in the O of the group sequence. ODAs are stored as state data, thus running reset_rds will clear it
|
||||
---Groups 14, 15, 2, 0 cannot be registered either version, groups 10, 4, 3, 1 can be only registered as B
|
||||
---@param group integer
|
||||
---@param group_version boolean
|
||||
---@param id integer
|
||||
@@ -276,6 +277,7 @@ function register_oda(group, group_version, id, id_data) end
|
||||
---Sets a function to handle the ODA data generation.
|
||||
---The handler is called when the group sequence 'K' slot is processed.
|
||||
---The function must return 3 integers representing RDS Blocks B, C, and D.
|
||||
---Please note that you do not need to compute the block A to indentify the group and group version, that will be done for you and EVERY SINGLE group has PTY and TP inserted (and also PI if its a B)
|
||||
---@param oda_id integer The ID returned by register_oda
|
||||
---@param fun ODAHandler
|
||||
function set_oda_handler(oda_id, fun) end
|
||||
@@ -421,7 +421,19 @@ int lua_register_oda(lua_State *localL) {
|
||||
if(mod->enc->state[mod->enc->program].user_oda.oda_len >= 32) return luaL_error(localL, "There can't be more than 32 registered ODAs");
|
||||
if(mod->enc->state[mod->enc->program].user_oda.odas[id].group != 0) return luaL_error(localL, "internal error");
|
||||
mod->enc->state[mod->enc->program].user_oda.odas[id].group = luaL_checkinteger(localL, 1);
|
||||
if(mod->enc->state[mod->enc->program].user_oda.odas[id].group == 0) return luaL_error(localL, "Invalid group");
|
||||
switch (mod->enc->state[mod->enc->program].user_oda.odas[id].group) {
|
||||
case 14:
|
||||
case 15:
|
||||
case 2:
|
||||
case 0: return luaL_error(localL, "Invalid group");
|
||||
case 10:
|
||||
case 4:
|
||||
case 3:
|
||||
case 1:
|
||||
default:
|
||||
if(mod->enc->state[mod->enc->program].user_oda.odas[id].group_version == 0) return luaL_error(localL, "Invalid group");
|
||||
break;
|
||||
}
|
||||
mod->enc->state[mod->enc->program].user_oda.odas[id].group_version = lua_toboolean(localL, 2);
|
||||
mod->enc->state[mod->enc->program].user_oda.odas[id].id = luaL_checkinteger(localL, 3);
|
||||
mod->enc->state[mod->enc->program].user_oda.odas[id].id_data = luaL_checkinteger(localL, 4);
|
||||
|
||||
Reference in New Issue
Block a user