summaryrefslogtreecommitdiff
path: root/scripts/create-mcc-mnc-table.py
diff options
context:
space:
mode:
authorSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2021-05-24 22:28:35 +0300
committerSerhii Kostiuk <serhii.o.kostiuk@globallogic.com>2021-05-24 22:28:35 +0300
commitd3766835ac77eb2f7eb4530e9aa4cc0d437f27e5 (patch)
tree5f1df1db2dc2d7fe96e500c0a4c6b6e0afcac8d8 /scripts/create-mcc-mnc-table.py
parent479925f3645106ff130537943f40e3948a8c9b16 (diff)
downloadlibmts-io-d3766835ac77eb2f7eb4530e9aa4cc0d437f27e5.tar.gz
libmts-io-d3766835ac77eb2f7eb4530e9aa4cc0d437f27e5.tar.bz2
libmts-io-d3766835ac77eb2f7eb4530e9aa4cc0d437f27e5.zip
[GP-1111] mPower R. Apr 2021: +CEMODE shall be set to CEMODE=2
Added the 'Carrier Code' field to the MCC/MNC table. The new field is supposed to be a constant Multitech-specific indentifier that is constant between the firmware versions and does not necessarily depends on a carrier name. In particular the new field is needed to detect when there is an AT&T SIM card inserted and 'UE mode of operation' shall be set to CS/PS mode 2.
Diffstat (limited to 'scripts/create-mcc-mnc-table.py')
-rw-r--r--scripts/create-mcc-mnc-table.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/create-mcc-mnc-table.py b/scripts/create-mcc-mnc-table.py
index c2aee14..c7afb56 100644
--- a/scripts/create-mcc-mnc-table.py
+++ b/scripts/create-mcc-mnc-table.py
@@ -95,6 +95,7 @@ Json::Value MccMncTable::lookup(const std::string& sMcc, const std::string& sMnc
j["country"] = vJson[1];
j["code"] = vJson[2];
j["carrier"] = vJson[3];
+ j["carrierCode"] = vJson[4];
return j;
}
}
@@ -107,7 +108,7 @@ Json::Value MccMncTable::lookup(const std::string& sMcc, const std::string& sMnc
MccMncElement = namedtuple(
'MccMncData',
- field_names=('mcc', 'mcc_int', 'mnc', 'mnc_int', 'iso', 'country', 'country_code', 'carrier')
+ field_names=('mcc', 'mcc_int', 'mnc', 'mnc_int', 'iso', 'country', 'country_code', 'carrier', 'carrier_code')
)
@@ -131,23 +132,25 @@ def print_cpp_general_code(*, target: Optional[TextIO] = None) -> None:
def format_mcc_mnc_line(el: MccMncElement) -> str:
if el.mnc.upper() != "N/A":
- return ' m_mTable[{mcc_int}][{mnc_int}] = "{iso},{country},{country_code},{carrier}";'.format(
+ return ' m_mTable[{mcc_int}][{mnc_int}] = "{iso},{country},{country_code},{carrier},{carrier_code}";'.format(
mcc_int=el.mcc_int,
mnc_int=el.mnc_int,
iso=el.iso,
country=el.country,
country_code=el.country_code,
- carrier=el.carrier
+ carrier=el.carrier,
+ carrier_code=el.carrier_code
)
else:
# TODO: The Country and Country Code values were swapped in the original implementation due to a bug.
# Left as is for compatibility reasons.
- return ' //MCC({mcc}) MNC(N/A) ISO({iso}) Country Code({country}) Country({country_code}) Carrier({carrier})'.format(
+ return ' //MCC({mcc}) MNC(N/A) ISO({iso}) Country Code({country}) Country({country_code}) Carrier({carrier}) Carrier Code({carrier_code})'.format(
mcc=el.mcc,
iso=el.iso,
country=el.country,
country_code=el.country_code,
- carrier=el.carrier
+ carrier=el.carrier,
+ carrier_code=el.carrier_code
)
@@ -220,7 +223,8 @@ def mcc_mnc_from_website(url: str) -> Generator[MccMncElement, None, None]:
iso=iso,
country=country,
country_code=country_code,
- carrier=carrier
+ carrier=carrier,
+ carrier_code="" # Multitech-specific, not populated from this source
)
@@ -234,6 +238,7 @@ def mcc_mnc_from_csv(path: str) -> Generator[MccMncElement, None, None]:
country = row['Country']
country_code = row['Country Code']
carrier = row['Carrier']
+ carrier_code = row['Carrier Code']
mcc_int = mcc_to_mcc_int(mcc)
mnc_int = mnc_to_mnc_int(mnc)
@@ -246,7 +251,8 @@ def mcc_mnc_from_csv(path: str) -> Generator[MccMncElement, None, None]:
iso=iso,
country=country,
country_code=country_code,
- carrier=carrier
+ carrier=carrier,
+ carrier_code=carrier_code
)