diff --git a/index.html b/index.html index aa96ab1..76e3aa8 100644 --- a/index.html +++ b/index.html @@ -928,6 +928,8 @@ @@ -3065,7 +3067,7 @@ function pysimSwitchSubtab(name) { document.getElementById('pysim-sub-' + s).classList.toggle('hidden', s !== name); }); if (name === 'custom') pysimCustomRender(); - if (name === 'proactive') pysimEventsRender(); + if (name === 'proactive') { pysimEventsRender(); pysimProactiveLogRender(); } } function pysimCmdKeydown(e) { @@ -3573,6 +3575,40 @@ async function pysimEventsRender() { } } +// ===== proactive command log ===== +const CMD_NAMES = { + '03': 'POLL INTERVAL', '05': 'SET UP EVENT LIST', + '13': 'SEND SHORT MESSAGE', '20': 'PLAY TONE', + '21': 'DISPLAY TEXT', '22': 'GET INKEY', '23': 'GET INPUT', + '24': 'SELECT ITEM', '25': 'SET UP MENU', + '26': 'PROVIDE LOCAL INFORMATION', + '15': 'LAUNCH BROWSER', '70': 'ACTIVATE', +}; + +async function pysimProactiveLogRender() { + const el = document.getElementById('pysim-proactive-log'); + el.innerHTML = '' + t('Loading...') + ''; + try { + const log = await pysimFetch('/api/proactive-log'); + if (!log || !log.length) { + el.innerHTML = '' + t('No commands logged yet.') + ''; + return; + } + let html = ''; + log.forEach(e => { + const name = CMD_NAMES[e.type_hex] || ('Cmd 0x' + e.type_hex.toUpperCase()); + html += '
' + + '0x' + e.type_hex.toUpperCase() + '' + + '' + esc(name) + '' + + '— ' + e.elapsed + 's (' + e.bytes + ' bytes)' + + '
'; + }); + el.innerHTML = html; + } catch (err) { + el.innerHTML = 'Error: ' + esc(err.message) + ''; + } +} + // ===== custom files ===== let pysimCustomFiles = []; @@ -3798,6 +3834,8 @@ const LANG_RU = { 'Proactive UICC': 'Проактивный UICC', 'Events that the card monitors (SET UP EVENT LIST):': 'События, отслеживаемые картой (SET UP EVENT LIST):', 'No events configured.': 'Нет настроенных событий.', + 'Fetched proactive commands:': 'Извлечённые проактивные команды:', + 'No commands logged yet.': 'Команды пока не регистрировались.', }; let currentLang = 'en';