forked from public/pysim
MncLen: rather implement as EnumParam because it only has two possible values
Change-Id: I5036732f4350d64262dba90cda4a26a6db28bd8e
This commit is contained in:
@@ -669,24 +669,12 @@ class SmspTpScAddr(ConfigurableParameter):
|
|||||||
yield { cls.name: cls.tuple_to_str((international, digits)) }
|
yield { cls.name: cls.tuple_to_str((international, digits)) }
|
||||||
|
|
||||||
|
|
||||||
class MncLen(ConfigurableParameter):
|
class MncLen(EnumParam):
|
||||||
"""MNC length. Must be either 2 or 3. Sets only the MNC length field in EF-AD (Administrative Data)."""
|
"""MNC length. Must be either 2 or 3. Sets only the MNC length field in EF-AD (Administrative Data)."""
|
||||||
name = 'MNC-LEN'
|
name = 'MNC-LEN'
|
||||||
allow_chars = '23'
|
value_map = { '2': 2, '3': 3 }
|
||||||
strip_chars = ' \t\r\n'
|
|
||||||
numeric_base = 10
|
|
||||||
max_len = 1
|
|
||||||
min_len = 1
|
|
||||||
example_input = '2'
|
|
||||||
default_source = param_source.ConstantSource
|
default_source = param_source.ConstantSource
|
||||||
|
example_input = '2'
|
||||||
@classmethod
|
|
||||||
def validate_val(cls, val):
|
|
||||||
val = super().validate_val(val)
|
|
||||||
val = int(val)
|
|
||||||
if val not in (2, 3):
|
|
||||||
raise ValueError(f"MNC-LEN must be either 2 or 3, not {val!r}")
|
|
||||||
return val
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def apply_val(cls, pes: ProfileElementSequence, val):
|
def apply_val(cls, pes: ProfileElementSequence, val):
|
||||||
@@ -732,7 +720,7 @@ class MncLen(ConfigurableParameter):
|
|||||||
if mnc_len is None:
|
if mnc_len is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
yield { cls.name: str(mnc_len) }
|
yield { cls.name: cls.map_val_to_name(int(mnc_len)) }
|
||||||
|
|
||||||
|
|
||||||
class SdKey(BinaryParam):
|
class SdKey(BinaryParam):
|
||||||
|
|||||||
Reference in New Issue
Block a user