C027_Support library plus AT Comand for dialing.
Fork of C027_Support_New by
MDMAPN.h
00001 #pragma once 00002 00003 /* ---------------------------------------------------------------- 00004 APN stands for Access Point Name, a setting on your modem or phone 00005 that identifies an external network your phone can access for data 00006 (e.g. 3G or 4G Internet service on your phone). 00007 00008 The APN settings can be forced when calling the join function. 00009 Below is a list of known APNs that us used if no apn config 00010 is forced. This list could be extended by other settings. 00011 00012 For further reading: 00013 wiki apn: http://en.wikipedia.org/wiki/Access_Point_Name 00014 wiki mcc/mnc: http://en.wikipedia.org/wiki/Mobile_country_code 00015 google: https://www.google.de/search?q=APN+list 00016 ---------------------------------------------------------------- */ 00017 00018 //! helper to generate the APN string 00019 #define _APN(apn,username,password) apn "\0" username "\0" password "\0" 00020 00021 //! helper to extract a field from the config string 00022 #define _APN_GET(cfg) \ 00023 *cfg ? cfg : ""; \ 00024 cfg += strlen(cfg) + 1 00025 00026 //! APN lookup struct 00027 typedef struct { 00028 const char* mccmnc; //!< mobile country code (MCC) and mobile network code MNC 00029 const char* cfg; //!< APN configuartion string, use _APN macro to generate 00030 } APN_t; 00031 00032 //! default APN settings used by many networks 00033 static const char* apndef = _APN(,,) 00034 _APN("internet",,); 00035 00036 /*! this is a list of special APNs for different network operators 00037 There is no need to enter the default apn internet in the table; 00038 apndef will be used if no entry matches. 00039 00040 The APN without username/password have to be listed first. 00041 */ 00042 static const APN_t apnlut[] = { 00043 // MCC Country 00044 // { /* Operator */ "MCC-MNC[,MNC]" _APN(APN,USERNAME,PASSWORD) }, 00045 // MCC must be 3 digits 00046 // MNC must be either 2 or 3 digits 00047 // MCC must be separated by '-' from MNC, multiple MNC can be separated by ',' 00048 00049 // 232 Austria - AUT 00050 { /* T-Mobile */ "232-03", _APN("m2m.business",,) }, 00051 00052 // 460 China - CN 00053 { /* CN Mobile */"460-00", _APN("cmnet",,) 00054 _APN("cmwap",,) }, 00055 { /* Unicom */ "460-01", _APN("3gnet",,) 00056 _APN("uninet","uninet","uninet") }, 00057 00058 // 262 Germany - DE 00059 { /* T-Mobile */ "262-01", _APN("internet.t-mobile","t-mobile","tm") }, 00060 { /* T-Mobile */ "262-02,06", 00061 _APN("m2m.business",,) }, 00062 00063 // 222 Italy - IT 00064 { /* TIM */ "222-01", _APN("ibox.tim.it",,) }, 00065 { /* Vodafone */ "222-10", _APN("web.omnitel.it",,) }, 00066 { /* Wind */ "222-88", _APN("internet.wind.biz",,) }, 00067 00068 // 440 Japan - JP 00069 { /* Softbank */ "440-04,06,20,40,41,42,43,44,45,46,47,48,90,91,92,93,94,95" 00070 ",96,97,98" 00071 _APN("open.softbank.ne.jp","opensoftbank","ebMNuX1FIHg9d3DA") 00072 _APN("smile.world","dna1trop","so2t3k3m2a") }, 00073 { /* NTTDoCoMo */"440-09,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27," 00074 "28,29,30,31,32,33,34,35,36,37,38,39,58,59,60,61,62,63," 00075 "64,65,66,67,68,69,87,99", 00076 _APN("bmobilewap",,) /*BMobile*/ 00077 _APN("mpr2.bizho.net","Mopera U",) /* DoCoMo */ 00078 _APN("bmobile.ne.jp","bmobile@wifi2","bmobile") /*BMobile*/ }, 00079 00080 // 204 Netherlands - NL 00081 { /* Vodafone */ "204-04", _APN("public4.m2minternet.com",,) }, 00082 00083 // 293 Slovenia - SI 00084 { /* Si.mobil */ "293-40", _APN("internet.simobil.si",,) }, 00085 { /* Tusmobil */ "293-70", _APN("internet.tusmobil.si",,) }, 00086 00087 // 240 Sweden SE 00088 { /* Telia */ "240-01", _APN("online.telia.se",,) }, 00089 { /* Telenor */ "240-06,08", 00090 _APN("services.telenor.se",,) }, 00091 { /* Tele2 */ "240-07", _APN("mobileinternet.tele2.se",,) }, 00092 00093 // 228 Switzerland - CH 00094 { /* Swisscom */ "228-01", _APN("gprs.swisscom.ch",,) }, 00095 { /* Orange */ "228-03", _APN("internet",,) /* contract */ 00096 _APN("click",,) /* pre-pay */ }, 00097 00098 // 234 United Kingdom - GB 00099 { /* O2 */ "234-02,10,11", 00100 _APN("mobile.o2.co.uk","faster","web") /* contract */ 00101 _APN("mobile.o2.co.uk","bypass","web") /* pre-pay */ 00102 _APN("payandgo.o2.co.uk","payandgo","payandgo") }, 00103 { /* Vodafone */ "234-15", _APN("internet","web","web") /* contract */ 00104 _APN("pp.vodafone.co.uk","wap","wap") /* pre-pay */ }, 00105 { /* Three */ "234-20", _APN("three.co.uk",,) }, 00106 00107 // 310 United States of America - US 00108 { /* T-Mobile */ "310-026,260,490", 00109 _APN("epc.tmobile.com",,) 00110 _APN("fast.tmobile.com",,) /* LTE */ }, 00111 { /* AT&T */ "310-030,150,170,260,410,560,680", 00112 _APN("phone",,) 00113 _APN("wap.cingular","WAP@CINGULARGPRS.COM","CINGULAR1") 00114 _APN("isp.cingular","ISP@CINGULARGPRS.COM","CINGULAR1") }, 00115 00116 // 901 International - INT 00117 { /* Transatel */ "901-37", _APN("netgprs.com","tsl","tsl") }, 00118 }; 00119 00120 inline const char* apnconfig(const char* imsi) 00121 { 00122 const char* config = NULL; 00123 if (imsi && *imsi) { 00124 // many carriers use internet without username and password, os use this as default 00125 // now try to lookup the setting for our table 00126 for (int i = 0; i < sizeof(apnlut)/sizeof(*apnlut) && !config; i ++) { 00127 const char* p = apnlut[i].mccmnc; 00128 // check the MCC 00129 if ((0 == memcmp(imsi, p, 3))) { 00130 p += 3; 00131 // check all the MNC, MNC length can be 2 or 3 digits 00132 while (((p[0] == '-') || (p[0] == ',')) && 00133 (p[1] >= '0') && (p[1] <= '9') && 00134 (p[2] >= '0') && (p[2] <= '9') && !config) { 00135 int l = ((p[3] >= '0') && (p[3] <= '9')) ? 3 : 2; 00136 if (0 == memcmp(imsi+3,p+1,l)) 00137 config = apnlut[i].cfg; 00138 p += 1 + l; 00139 } 00140 } 00141 } 00142 } 00143 // use default if not found 00144 if (!config) 00145 config = apndef; 00146 return config; 00147 }
Generated on Sat Jul 23 2022 11:16:21 by 1.7.2