Most Mobile Phone API's provide a way to extract the MCC and/or MNC from the SIM with highlevel calls. For instance, the blackberry platform I've used allows for the following method calls:
import net.rim.device.api.system.RadioInfo;
int networkIndex = RadioInfo.getCurrentNetworkIndex();
_mnc = RadioInfo.getMNC(networkIndex);
_mcc = RadioInfo.getMCC(networkIndex);
_mnc = FWCellInfo.fromDecimalToHex(_mnc);
_mcc = FWCellInfo.fromDecimalToHex(_mcc);
(the fromDecimalToHex method is a simple method to convert the decimal number the api delivers to me into the hexadecimal network code and country code. Other platforms, such as Symbian/Android/Windows Mobile provide the hexadecimal value out of the box.)
These values can then be matched against the XML file, with Holland as an example snippet from the converted xml-file (see xml-attachment). I've also included the java code to (SAX-)parse through the XML based on country code and mobile provider code, and if that fails, gather all access points for that country (see java-attachment, GetApnStringsFromXml method).
I've not sent the full xml-file, because I don’t know newsgroup/mailgroup etiquette that well, and might flood someone's inbox with the full 100+ KB xml file (?).
One final note: Whenever the original MBPI-entry could not be matched to a MCC and/or MNC (based on the list provided @ http://en.wikipedia.org/wiki/Mobile_Network_Code), I've added the marker value '123456789'. Also, we didn't fully process the list, as time is money..
Hope this is helpful.
-----Original Message-----
From: Dan Williams [mailto:dcbw redhat com]
Sent: woensdag 15 april 2009 17:56
To: Martijn Cox (LiveContacts)
Cc: networkmanager-list gnome org; stuart ward bcs org; wader-devel lists warp es
Subject: Re: APN list: adding mcc & mnc
On Tue, 2009-04-14 at 15:05 +0200, Martijn Cox (LiveContacts) wrote:
> Hello all,
>
>
>
> I’ve sent the following email to Wellark, the maintainer of the Mobile
> Broadband Provider Info project, a few weeks ago, outlining a way to
> include mobile country codes and mobile network codes in the MBPI
> project. In the meantime, we’ve already implemented this scheme in our
> company, and have successfully used it to extract the APN’s for two
> providers in one country. Would you be interested in using this
> scheme?
Yeah, that would be pretty cool. IIRC, we can then extract bits from
the IMSI and figure out which provider the SIM is for too, right?
Can you provide a sample of how this would look in the XML config too?
We need to ensure that we can store multiple MCC/MNC codes for each
provider in the table.
Dan
>
>
> As Wellark has been very busy, he has asked me to forward this message
> to both the NetworkManager and the Wader Development mailing list, as
> he suspects there is additional interest these development groups in
> adding country code and network codes to the MBPI project. Note that I
> currently have no idea what the NetworkManager and Wader development
> groups are, as this is not within the scope of my current
> job-assignment.
>
>
>
> Regards, Martijn.
>
>
>
> From: Martijn Cox
> Sent: woensdag 1 april 2009 13:00
> To: 'antti kaijanmaki net'
> Subject: apn list, adding mcc & mnc
>
>
>
>
> Hi Wellark,
>
>
>
> I’m a developer for (amongst others), the blackberry platform. I’ve
> come across your project, and wish to contribute by adding the mobile
> country code and mobile network code to the xml file, based on the
> Wikipedia list @ http://en.wikipedia.org/wiki/Mobile_Network_Code. Do
> you regard such an endeavor as ok?
>
>
>
> I would like to add them, according to the following
> DTD, which is based on your supplied DTD, with additions in yellow:
>
>
>
> <!ELEMENT serviceproviders (country*)>
>
> <!ATTLIST serviceproviders format CDATA #REQUIRED>
>
>
>
> <!ELEMENT country (provider* ,mcc+)>
>
> <!ATTLIST country code CDATA #REQUIRED>
>
>
>
> <!ELEMENT provider ( mnc+,
>
> name+,
>
> (gsm|cdma),
>
> username?,
>
> password?,
>
> dns*,
>
> gateway?)>
>
>
>
> <!ELEMENT name (#PCDATA)>
>
> <!ATTLIST name xml:lang CDATA #IMPLIED>
>
>
>
> <!ELEMENT gsm (apn)>
>
> <!ELEMENT apn (#PCDATA)>
>
>
>
> <!ELEMENT cdma EMPTY>
>
>
>
> <!ELEMENT username (#PCDATA)>
>
> <!ELEMENT password (#PCDATA)>
>
> <!ELEMENT dns (#PCDATA)>
>
> <!ELEMENT gateway (#PCDATA)>
>
>
>
> <!ELEMENT mcc (#PCDATA)>
>
> <!ELEMENT mnc (#PCDATA)>
>
>
>
> Do you think that would be ok? The reason for these additions is that
> it’s easier to search this way when you have access to a provider id
> (mobile network code), and mobile country code (i.s.o. the country
> identifier you use, which is currently not available for me).
>
>
>
> Regards,
>
>
>
> Martijn Cox
>
> Livecontacts B.V.
>
>
>
>
> _______________________________________________
> NetworkManager-list mailing list
> NetworkManager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list
Attachment:
APNInfo.java
Description: APNInfo.java
<country code="nl"> <mcc>204</mcc> <provider> <mnc>16</mnc> <name>ben</name> <gsm> <apn>internet.ben</apn> </gsm> </provider> <provider> <mnc>20</mnc> <name>Orange</name> <gsm> <apn>internet</apn> </gsm> </provider> <provider> <mnc>123456789</mnc> <name>Hi</name> <gsm> <apn>portalmmm.nl</apn> </gsm> </provider> <provider> <mnc>08</mnc> <name>KPN Mobile</name> <gsm> <apn>internet</apn> </gsm> <username>KPN</username> <password>gprs</password> <dns>62.133.126.28</dns> <dns>62.133.126.29</dns> </provider> <provider> <mnc>123456789</mnc> <name>o2</name> <gsm> <apn>internet</apn> </gsm> <dns>195.99.65.220</dns> <dns>195.99.66.220</dns> </provider> <provider> <mnc>16</mnc> <name>T-Mobile</name> <gsm> <apn>internet</apn> </gsm> <username>tmobile</username> <password>tmobile</password> </provider> <provider> <mnc>16</mnc> <name>T-Mobile</name> <gsm> <apn>internet</apn> </gsm> <dns>193.78.240.12</dns> <dns>193.79.242.39</dns> </provider> <provider> <mnc>12</mnc> <name>Telfort</name> <gsm> <apn>internet</apn> </gsm> <username>telfort</username> <password>telfort</password> </provider> <provider> <mnc>12</mnc> <name>Telfort</name> <gsm> <apn>internet</apn> </gsm> <username>telfortnl</username> </provider> <provider> <mnc>04</mnc> <name>Vodafone Live!</name> <gsm> <apn>live.vodafone.com</apn> </gsm> <username>vodafone</username> <password>vodafone</password> </provider> <provider> <mnc>04</mnc> <name>Vodafone</name> <gsm> <apn>blackberry.vodafone.nl</apn> </gsm> <username>vodafone</username> <password>vodafone</password> </provider> <provider> <mnc>04</mnc> <name>Vodafone (business)</name> <gsm> <apn>office.vodafone.nl</apn> </gsm> <username>vodafone</username> <password>vodafone</password> </provider> <provider> <mnc>123456789</mnc> <name>XS4ALL Mobiel Internet</name> <gsm> <apn>umts.xs4all.nl</apn> </gsm> </provider> </country>