You've already forked rdsspy-lua-host
mirror of
https://github.com/KubaPro010/rdsspy-lua-host.git
synced 2026-02-26 18:35:01 +01:00
add af
This commit is contained in:
@@ -501,6 +501,10 @@ local rtp_types = {
|
|||||||
"Identifier", "Purchase", "GET_DATA"
|
"Identifier", "Purchase", "GET_DATA"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local expected_afs = 0
|
||||||
|
local afs = {}
|
||||||
|
local state_af_am_follows = false
|
||||||
|
|
||||||
local last_render_hash = 0
|
local last_render_hash = 0
|
||||||
local function crc(data)
|
local function crc(data)
|
||||||
local sum = 0xFF
|
local sum = 0xFF
|
||||||
@@ -520,10 +524,15 @@ end
|
|||||||
local function render_menu()
|
local function render_menu()
|
||||||
local out = string.format("Menu %d%s\r\n------\r\n", current_menu, menu_extended and " (extended)" or "")
|
local out = string.format("Menu %d%s\r\n------\r\n", current_menu, menu_extended and " (extended)" or "")
|
||||||
set_font_size(26)
|
set_font_size(26)
|
||||||
if current_menu == 1 then
|
if current_menu == 1 and not menu_extended then
|
||||||
set_font_size(72) -- largest as i can do, this is directly from the public's wants (https://pira.cz/forum/index.php?topic=1124.0)
|
set_font_size(72) -- largest as i can do, this is directly from the public's wants (https://pira.cz/forum/index.php?topic=1124.0)
|
||||||
out = out .. string.format("PI: %s\r\n", db.read_value("PI") or "----")
|
out = out .. string.format("PI: %s\r\n", db.read_value("PI") or "----")
|
||||||
out = out .. string.format("PS: %s", db.read_value("PS") or "--------")
|
out = out .. string.format("PS: %s", db.read_value("PS") or "--------")
|
||||||
|
elseif current_menu == 1 and menu_extended then
|
||||||
|
out = out .. string.format("AF: (%d)\r\n\t", expected_afs)
|
||||||
|
for _, freq in ipairs(afs) do
|
||||||
|
out = out .. string.format("%.1f\r\n\t", freq)
|
||||||
|
end
|
||||||
elseif current_menu == 2 and not menu_extended then
|
elseif current_menu == 2 and not menu_extended then
|
||||||
out = out .. string.format("PTY: %d (%s / %s)\r\n", pty, pty_rds[pty+1], pty_rbds[pty+1])
|
out = out .. string.format("PTY: %d (%s / %s)\r\n", pty, pty_rds[pty+1], pty_rbds[pty+1])
|
||||||
out = out .. string.format("TP %s | TA %s | DPTY %s\r\n", tp and "+" or "-", ta and "+" or "-", dpty and "+" or "-")
|
out = out .. string.format("TP %s | TA %s | DPTY %s\r\n", tp and "+" or "-", ta and "+" or "-", dpty and "+" or "-")
|
||||||
@@ -630,13 +639,16 @@ function command(cmd, param)
|
|||||||
time_display_local = "-"
|
time_display_local = "-"
|
||||||
time_display_offset = 0
|
time_display_offset = 0
|
||||||
rtp_running = false
|
rtp_running = false
|
||||||
rtp_running = false
|
rtp_toggle = false
|
||||||
rtp_type1 = 0
|
rtp_type1 = 0
|
||||||
rtp_start1 = 0
|
rtp_start1 = 0
|
||||||
rtp_len1 = 0
|
rtp_len1 = 0
|
||||||
rtp_type2 = 0
|
rtp_type2 = 0
|
||||||
rtp_start2 = 0
|
rtp_start2 = 0
|
||||||
rtp_len2 = 0
|
rtp_len2 = 0
|
||||||
|
expected_afs = 0
|
||||||
|
afs = {}
|
||||||
|
state_af_am_follows = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -776,6 +788,45 @@ function group(stream, b_corr, a, b, c, d, time)
|
|||||||
local segment = b & 0x3
|
local segment = b & 0x3
|
||||||
if di_bit and segment == 0 then dpty = true
|
if di_bit and segment == 0 then dpty = true
|
||||||
elseif segment == 0 then dpty = false end
|
elseif segment == 0 then dpty = false end
|
||||||
|
if c < 0 or group_version == 1 then return end
|
||||||
|
local af_high = c >> 8
|
||||||
|
local af_low = c & 0xff
|
||||||
|
if af_high >= 224 and af_high <= (224+25) then
|
||||||
|
local run_new = false
|
||||||
|
expected_afs = af_high - 224
|
||||||
|
if af_low ~= 205 and af_low ~= 250 and #afs ~= 0 and afs[1] ~= (af_low+875)/10 then run_new = true end
|
||||||
|
if #afs ~= expected_afs or run_new then
|
||||||
|
afs = {}
|
||||||
|
state_af_am_follows = false
|
||||||
|
if af_low ~= 205 and af_low ~= 250 then table.insert(afs, (af_low+875)/10)
|
||||||
|
elseif af_low == 250 then state_af_am_follows = true end
|
||||||
|
end
|
||||||
|
elseif #afs ~= expected_afs then
|
||||||
|
if not (af_high == 250 or state_af_am_follows) then
|
||||||
|
local freq = (af_high+875)/10
|
||||||
|
local found
|
||||||
|
for _, value in ipairs(afs) do
|
||||||
|
if value == freq then
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not found then table.insert(afs, freq) end
|
||||||
|
end
|
||||||
|
if state_af_am_follows then state_af_am_follows = false end
|
||||||
|
if not (af_high == 250 or af_low == 205 or af_low == 250) then
|
||||||
|
local freq = (af_low+875)/10
|
||||||
|
local found
|
||||||
|
for _, value in ipairs(afs) do
|
||||||
|
if value == freq then
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not found then table.insert(afs, freq) end
|
||||||
|
end
|
||||||
|
if af_low == 250 then state_af_am_follows = true end
|
||||||
|
end
|
||||||
elseif group_type == 1 and group_version == 0 then
|
elseif group_type == 1 and group_version == 0 then
|
||||||
if d < 0 then return end
|
if d < 0 then return end
|
||||||
local variant = (c & 0x7000) >> 12
|
local variant = (c & 0x7000) >> 12
|
||||||
|
|||||||
8
plugin.c
8
plugin.c
@@ -534,14 +534,14 @@ void lua_event(int event) {
|
|||||||
} else lua_pop(L, 1);
|
} else lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) void __stdcall RDSGroup(TRDSGroup* PRDSGroup) {
|
__declspec(dllexport) void WINAPI RDSGroup(TRDSGroup* PRDSGroup) {
|
||||||
if (PRDSGroup == NULL) return;
|
if (PRDSGroup == NULL) return;
|
||||||
|
|
||||||
Group = *PRDSGroup;
|
Group = *PRDSGroup;
|
||||||
lua_call_group();
|
lua_call_group();
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) void __stdcall Command(const char* Cmd, const char* Param) {
|
__declspec(dllexport) void WINAPI Command(const char* Cmd, const char* Param) {
|
||||||
if (Cmd == NULL) return;
|
if (Cmd == NULL) return;
|
||||||
if (_stricmp(Cmd, "EXIT") == 0) {
|
if (_stricmp(Cmd, "EXIT") == 0) {
|
||||||
if (hWnd != NULL) {
|
if (hWnd != NULL) {
|
||||||
@@ -592,7 +592,7 @@ __declspec(dllexport) void __stdcall Command(const char* Cmd, const char* Param)
|
|||||||
} else lua_call_command(Cmd, Param);
|
} else lua_call_command(Cmd, Param);
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) const char* __stdcall PluginName(void) { return "Lua Host"; }
|
__declspec(dllexport) const char* WINAPI PluginName(void) { return "Lua Host"; }
|
||||||
|
|
||||||
void InitLua() {
|
void InitLua() {
|
||||||
if(L != NULL) {
|
if(L != NULL) {
|
||||||
@@ -679,7 +679,7 @@ void InitLua() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) int __stdcall Initialize(HANDLE hHandle, TDB* DBPointer) {
|
__declspec(dllexport) int WINAPI Initialize(HANDLE hHandle, TDB* DBPointer) {
|
||||||
CreatePluginWindow(hHandle);
|
CreatePluginWindow(hHandle);
|
||||||
AppendText(LUA_COPYRIGHT);
|
AppendText(LUA_COPYRIGHT);
|
||||||
AppendText("\r\n");
|
AppendText("\r\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user