bip: report a location in PROVIDE LOCAL INFORMATION

TS 102 223 6.8.7: TERMINAL RESPONSE shall contain the data object the
command qualifier (6.6.15) asked for.
The card always asks for location information, so at least answer 00,
with the GERAN form of TS 131.111 8.19.1, PLMN 262-01.

Do not answer "terminal currently unable to process - no service"...

Change-Id: I53547da2ea9f0a4ea7a4dd032985a546f2d4277f
This commit is contained in:
Eric Wild
2026-09-23 17:51:04 +02:00
parent 7e8f711ec2
commit 632d585cfc
3 changed files with 57 additions and 4 deletions
+29 -1
View File
@@ -28,7 +28,7 @@ from pySim.sms import SMS_SUBMIT, AddressField
from pySim.cat import (ProactiveCommand, CommandDetails, DeviceIdentities,
BearerDescription, BufferSize, UiccTransportLevel,
OtherAddress, ChannelData, ChannelDataLength, ChannelStatus,
Result)
Result, LocationInformation)
from pySim.bip import Proact, ProactChannels, terminal_profile
@@ -329,6 +329,34 @@ class OpenChannelRefusalTest(unittest.TestCase):
self.assertEqual(self.proact.channels.channels, {}) # channel given back
class ProvideLocalInformationTest(unittest.TestCase):
"""TS 102 223 6.8.7: only 00 gets a data object; the rest keeps the empty result."""
def _cmd(self, qualifier):
return _pcmd([
CommandDetails(decoded={'command_number': 1, 'type_of_command': 'provide_local_info',
'command_qualifier': qualifier}).to_tlv(),
DeviceIdentities(decoded={'source_dev_id': 'uicc', 'dest_dev_id': 'terminal'}).to_tlv()])
def test_location(self):
til = Proact().handle_ProvideLocalInformation(self._cmd(0x00))
b''.join(x.to_tlv() for x in til)
self.assertEqual(_first(til, Result).decoded['general_result'], 'performed_successfully')
self.assertEqual(b2h(_first(til, LocationInformation).to_tlv()), '930762f21000010001')
self.assertEqual(b2h(_first(til, DeviceIdentities).to_tlv()), '82028281') # 6.8.2
def test_other_qualifiers_get_no_data_object(self):
for qualifier in (0x01, 0x03, 0x04, 0x1a):
with self.subTest(command_qualifier=qualifier):
til = Proact().handle_ProvideLocalInformation(self._cmd(qualifier))
b''.join(x.to_tlv() for x in til)
self.assertIsNone(_first(til, LocationInformation))
def test_location_is_configurable(self):
til = Proact(location=h2b('26f8100539')).handle_ProvideLocalInformation(self._cmd(0x00))
self.assertEqual(b2h(_first(til, LocationInformation).to_tlv()), '930526f8100539')
class TerminalProfileTest(unittest.TestCase):
"""TS 102 223 5.2, one bit per CAT facility"""