feat: polling on by default and an effective-state toggle (v3.5.10)
- Background STATUS polling is enabled by default, per the spec's idle
polling rule (TS 102 221 14.6.2): `_POLL_ENABLED = True`, __main__ runs
`_poll_enable()` regardless of card presence (--poll-interval 0 still
disables) and `_do_status_poll` keeps ticking while enabled even without
a session, so a cardless start resumes as soon as a card appears.
- A new card session clears a POLLING OFF from the previous card in
`_apply_equipped_card` before re-enabling polling.
- The Phone-tab toggle now shows the *effective* state: OFF in amber
("card disabled polling (POLLING OFF)") while the card suspended
proactive polling, back to ON on the next POLL INTERVAL. The 5 s
background poll now passes `card_disabled` through (it was dropped, so
an autonomously received POLLING OFF never reached the UI).
- Tests: poll_ui updated (button OFF while suspended, warning path),
test_poll +2 (cardless ticking, module default via a subprocess check).
- Help EN/RU, docs/api.md, AGENTS; version 3.5.10; sw cache simple-v263.
573 frontend / 441 Python green.
This commit is contained in:
@@ -129,6 +129,26 @@ class TestCardDrivenPolling(unittest.TestCase):
|
||||
S._apply_poll_negotiation(S._decode_poll_negotiation('11010104020102'))
|
||||
self.assertEqual(S._POLL_INTERVAL, 30)
|
||||
|
||||
def test_poll_keeps_ticking_without_a_card(self):
|
||||
S._POLL_ENABLED = True
|
||||
S._POLL_DISABLED_BY_CARD = False
|
||||
S._set_poll_interval(30)
|
||||
saved_ref = S._server_ref
|
||||
S._server_ref = None
|
||||
try:
|
||||
with mock.patch.object(S.threading, 'Timer') as timer:
|
||||
S._do_status_poll()
|
||||
timer.assert_called_once_with(30, S._do_status_poll)
|
||||
finally:
|
||||
S._server_ref = saved_ref
|
||||
|
||||
def test_polling_is_enabled_by_default(self):
|
||||
import subprocess
|
||||
code = 'import pysim_simple_server.server as s; print(s._POLL_ENABLED)'
|
||||
rv = subprocess.run([sys.executable, '-c', code], capture_output=True, text=True,
|
||||
cwd=str(PROJECTS / 'simple'))
|
||||
self.assertEqual(rv.stdout.strip(), 'True', rv.stderr)
|
||||
|
||||
def test_poll_interval_decoded_in_the_proactive_log(self):
|
||||
fields = S._decode_cmd(0x03, bytes.fromhex(MIN_2_TLV), 0)
|
||||
self.assertEqual(fields[0]['value'], '2 min (120 s)')
|
||||
|
||||
Reference in New Issue
Block a user