Add a bunch of APNs
Fork of C027_Support by
MDMAPN.h@136:af08db6d39ab, 2018-04-12 (annotated)
- Committer:
- ghuklev
- Date:
- Thu Apr 12 09:53:37 2018 +0000
- Revision:
- 136:af08db6d39ab
- Parent:
- 135:f1987d8ed556
added one more apn for ooredoo Qatar
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mazgch | 85:dd8f4f0d0ca9 | 1 | #pragma once |
mazgch | 85:dd8f4f0d0ca9 | 2 | |
mazgch | 85:dd8f4f0d0ca9 | 3 | /* ---------------------------------------------------------------- |
mazgch | 85:dd8f4f0d0ca9 | 4 | APN stands for Access Point Name, a setting on your modem or phone |
mazgch | 85:dd8f4f0d0ca9 | 5 | that identifies an external network your phone can access for data |
mazgch | 92:79b628d1da02 | 6 | (e.g. 3G or 4G Internet service on your phone). |
mazgch | 85:dd8f4f0d0ca9 | 7 | |
mazgch | 85:dd8f4f0d0ca9 | 8 | The APN settings can be forced when calling the join function. |
mazgch | 85:dd8f4f0d0ca9 | 9 | Below is a list of known APNs that us used if no apn config |
mazgch | 85:dd8f4f0d0ca9 | 10 | is forced. This list could be extended by other settings. |
mazgch | 85:dd8f4f0d0ca9 | 11 | |
mazgch | 85:dd8f4f0d0ca9 | 12 | For further reading: |
mazgch | 85:dd8f4f0d0ca9 | 13 | wiki apn: http://en.wikipedia.org/wiki/Access_Point_Name |
mazgch | 85:dd8f4f0d0ca9 | 14 | wiki mcc/mnc: http://en.wikipedia.org/wiki/Mobile_country_code |
mazgch | 85:dd8f4f0d0ca9 | 15 | google: https://www.google.de/search?q=APN+list |
mazgch | 85:dd8f4f0d0ca9 | 16 | ---------------------------------------------------------------- */ |
mazgch | 85:dd8f4f0d0ca9 | 17 | |
mazgch | 85:dd8f4f0d0ca9 | 18 | //! helper to generate the APN string |
mazgch | 85:dd8f4f0d0ca9 | 19 | #define _APN(apn,username,password) apn "\0" username "\0" password "\0" |
mazgch | 85:dd8f4f0d0ca9 | 20 | |
mazgch | 85:dd8f4f0d0ca9 | 21 | //! helper to extract a field from the config string |
mazgch | 85:dd8f4f0d0ca9 | 22 | #define _APN_GET(cfg) \ |
mazgch | 85:dd8f4f0d0ca9 | 23 | *cfg ? cfg : ""; \ |
mazgch | 85:dd8f4f0d0ca9 | 24 | cfg += strlen(cfg) + 1 |
mazgch | 85:dd8f4f0d0ca9 | 25 | |
mazgch | 85:dd8f4f0d0ca9 | 26 | //! APN lookup struct |
mazgch | 85:dd8f4f0d0ca9 | 27 | typedef struct { |
mazgch | 85:dd8f4f0d0ca9 | 28 | const char* mccmnc; //!< mobile country code (MCC) and mobile network code MNC |
mazgch | 85:dd8f4f0d0ca9 | 29 | const char* cfg; //!< APN configuartion string, use _APN macro to generate |
mazgch | 85:dd8f4f0d0ca9 | 30 | } APN_t; |
mazgch | 85:dd8f4f0d0ca9 | 31 | |
mazgch | 85:dd8f4f0d0ca9 | 32 | //! default APN settings used by many networks |
mazgch | 91:5af303e25287 | 33 | static const char* apndef = _APN(,,) |
mazgch | 91:5af303e25287 | 34 | _APN("internet",,); |
mazgch | 85:dd8f4f0d0ca9 | 35 | |
mazgch | 89:ea396f9f90a2 | 36 | /*! this is a list of special APNs for different network operators |
mazgch | 89:ea396f9f90a2 | 37 | There is no need to enter the default apn internet in the table; |
mazgch | 90:3915192f6d7e | 38 | apndef will be used if no entry matches. |
mazgch | 90:3915192f6d7e | 39 | |
mazgch | 90:3915192f6d7e | 40 | The APN without username/password have to be listed first. |
mazgch | 89:ea396f9f90a2 | 41 | */ |
mazgch | 85:dd8f4f0d0ca9 | 42 | static const APN_t apnlut[] = { |
mazgch | 88:135fb4bb7aac | 43 | // MCC Country |
mazgch | 88:135fb4bb7aac | 44 | // { /* Operator */ "MCC-MNC[,MNC]" _APN(APN,USERNAME,PASSWORD) }, |
mazgch | 88:135fb4bb7aac | 45 | // MCC must be 3 digits |
mazgch | 88:135fb4bb7aac | 46 | // MNC must be either 2 or 3 digits |
mazgch | 92:79b628d1da02 | 47 | // MCC must be separated by '-' from MNC, multiple MNC can be separated by ',' |
mazgch | 85:dd8f4f0d0ca9 | 48 | |
ghuklev | 135:f1987d8ed556 | 49 | // 427 Qatar - QA |
ghuklev | 136:af08db6d39ab | 50 | { /* ooredoo */ "427-01", _APN("data",,) |
ghuklev | 136:af08db6d39ab | 51 | _APN("internet.m2m.ooredoo.qa",,) }, |
ghuklev | 135:f1987d8ed556 | 52 | |
mazgch | 111:5f8807ca159a | 53 | // 232 Austria - AUT |
xinlei | 127:73d7bfcc1e3d | 54 | { /* T-Mobile */ "232-03", _APN("m2m.business",,) }, |
mazgch | 111:5f8807ca159a | 55 | |
mazgch | 97:b82539535365 | 56 | // 460 China - CN |
xinlei | 127:73d7bfcc1e3d | 57 | { /* CN Mobile */"460-00", _APN("cmnet",,) |
xinlei | 127:73d7bfcc1e3d | 58 | _APN("cmwap",,) }, |
xinlei | 127:73d7bfcc1e3d | 59 | { /* Unicom */ "460-01", _APN("3gnet",,) |
xinlei | 127:73d7bfcc1e3d | 60 | _APN("uninet","uninet","uninet") }, |
mazgch | 97:b82539535365 | 61 | |
mazgch | 89:ea396f9f90a2 | 62 | // 262 Germany - DE |
xinlei | 118:7d7ab5314caa | 63 | // { /* T-Mobile */ "262-01", _APN("internet.t-mobile","t-mobile","tm") }, |
xinlei | 122:98e685503727 | 64 | { /* T-Mobile */ "262-02,06", _APN("m2m.business",,) }, |
xinlei | 130:27043e7c9de3 | 65 | { /* T-Mobile */ "262-01", _APN("internet.m2mportal.de", "m2m", "sim") |
xinlei | 130:27043e7c9de3 | 66 | _APN("internet.telekom",,) }, |
mazgch | 89:ea396f9f90a2 | 67 | // 222 Italy - IT |
xinlei | 127:73d7bfcc1e3d | 68 | { /* TIM */ "222-01", _APN("ibox.tim.it",,) }, |
xinlei | 127:73d7bfcc1e3d | 69 | { /* Vodafone */ "222-10", _APN("web.omnitel.it",,) }, |
xinlei | 127:73d7bfcc1e3d | 70 | { /* Wind */ "222-88", _APN("internet.wind.biz",,) }, |
mazgch | 85:dd8f4f0d0ca9 | 71 | |
mazgch | 90:3915192f6d7e | 72 | // 440 Japan - JP |
mazgch | 90:3915192f6d7e | 73 | { /* Softbank */ "440-04,06,20,40,41,42,43,44,45,46,47,48,90,91,92,93,94,95" |
mazgch | 90:3915192f6d7e | 74 | ",96,97,98" |
xinlei | 127:73d7bfcc1e3d | 75 | _APN("open.softbank.ne.jp","opensoftbank","ebMNuX1FIHg9d3DA") |
xinlei | 127:73d7bfcc1e3d | 76 | _APN("smile.world","dna1trop","so2t3k3m2a") }, |
mazgch | 90:3915192f6d7e | 77 | { /* NTTDoCoMo */"440-09,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27," |
mazgch | 90:3915192f6d7e | 78 | "28,29,30,31,32,33,34,35,36,37,38,39,58,59,60,61,62,63," |
mazgch | 90:3915192f6d7e | 79 | "64,65,66,67,68,69,87,99", |
xinlei | 127:73d7bfcc1e3d | 80 | _APN("bmobilewap",,) /*BMobile*/ |
xinlei | 127:73d7bfcc1e3d | 81 | _APN("mpr2.bizho.net","Mopera U",) /* DoCoMo */ |
xinlei | 131:1f6b7f9b5805 | 82 | _APN("3g-uno.ntt.com",,) /* DoCoMo */ |
xinlei | 131:1f6b7f9b5805 | 83 | _APN("3gd-ocn.ntt.com",,) /* DoCoMo */ |
xinlei | 131:1f6b7f9b5805 | 84 | _APN("nttcom.fr",,) /* DoCoMo */ |
xinlei | 127:73d7bfcc1e3d | 85 | _APN("bmobile.ne.jp","bmobile@wifi2","bmobile") /*BMobile*/ }, |
mazgch | 90:3915192f6d7e | 86 | |
mazgch | 111:5f8807ca159a | 87 | // 204 Netherlands - NL |
xinlei | 132:1b04a376bfc3 | 88 | { /* Vodafone */ "204-04", _APN("public4.m2minternet.com",,) |
xinlei | 132:1b04a376bfc3 | 89 | _APN("test.teleena.com",,) }, |
xinlei | 132:1b04a376bfc3 | 90 | { /* Teleena */ "204-07", _APN("test.teleena.com",,) }, |
mazgch | 111:5f8807ca159a | 91 | |
mazgch | 89:ea396f9f90a2 | 92 | // 293 Slovenia - SI |
xinlei | 127:73d7bfcc1e3d | 93 | { /* Si.mobil */ "293-40", _APN("internet.simobil.si",,) }, |
xinlei | 127:73d7bfcc1e3d | 94 | { /* Tusmobil */ "293-70", _APN("internet.tusmobil.si",,) }, |
mazgch | 89:ea396f9f90a2 | 95 | |
xinlei | 127:73d7bfcc1e3d | 96 | // 240 Sweden SE |
xinlei | 127:73d7bfcc1e3d | 97 | { /* Telia */ "240-01", _APN("online.telia.se",,) }, |
xinlei | 127:73d7bfcc1e3d | 98 | { /* Telenor */ "240-06,08", _APN("services.telenor.se",,) }, |
xinlei | 127:73d7bfcc1e3d | 99 | { /* Tele2 */ "240-07", _APN("m2m.tele2.com",,) |
xinlei | 127:73d7bfcc1e3d | 100 | _APN("mobileinternet.tele2.se",,) }, |
mazgch | 89:ea396f9f90a2 | 101 | |
mazgch | 89:ea396f9f90a2 | 102 | // 228 Switzerland - CH |
xinlei | 128:0c2bef7cca88 | 103 | { /* Swisscom */ "228-01", _APN("swisscom-test.m2m.ch",,) |
xinlei | 128:0c2bef7cca88 | 104 | _APN("gprs.swisscom.ch",,) }, |
xinlei | 127:73d7bfcc1e3d | 105 | { /* Orange */ "228-03", _APN("internet",,) /* contract */ |
xinlei | 127:73d7bfcc1e3d | 106 | _APN("click",,) /* pre-pay */ }, |
xinlei | 131:1f6b7f9b5805 | 107 | |
xinlei | 131:1f6b7f9b5805 | 108 | // 270 Luxembourg |
xinlei | 131:1f6b7f9b5805 | 109 | { /* Post */ "270-01", _APN("postm2m.lu",,)}, |
mazgch | 88:135fb4bb7aac | 110 | |
mazgch | 88:135fb4bb7aac | 111 | // 234 United Kingdom - GB |
mazgch | 88:135fb4bb7aac | 112 | { /* O2 */ "234-02,10,11", |
xinlei | 127:73d7bfcc1e3d | 113 | _APN("mobile.o2.co.uk","faster","web") /* contract */ |
xinlei | 127:73d7bfcc1e3d | 114 | _APN("mobile.o2.co.uk","bypass","web") /* pre-pay */ |
xinlei | 127:73d7bfcc1e3d | 115 | _APN("payandgo.o2.co.uk","payandgo","payandgo") }, |
xinlei | 127:73d7bfcc1e3d | 116 | { /* Vodafone */ "234-15", _APN("internet","web","web") /* contract */ |
xinlei | 127:73d7bfcc1e3d | 117 | _APN("pp.vodafone.co.uk","wap","wap") /* pre-pay */ }, |
xinlei | 127:73d7bfcc1e3d | 118 | { /* Three */ "234-20", _APN("three.co.uk",,) }, |
ghuklev | 133:69700ba3fa72 | 119 | { /* EE */ "234-33,30", _APN("EEm2m",,) |
ghuklev | 133:69700ba3fa72 | 120 | _APN("m2mdata",,) }, |
mazgch | 88:135fb4bb7aac | 121 | |
mazgch | 89:ea396f9f90a2 | 122 | // 310 United States of America - US |
xinlei | 128:0c2bef7cca88 | 123 | { /* Kore Telematics */ "505-02", _APN("od1.korem2m.com",,) }, |
mazgch | 88:135fb4bb7aac | 124 | { /* T-Mobile */ "310-026,260,490", |
xinlei | 127:73d7bfcc1e3d | 125 | _APN("epc.tmobile.com",,) |
xinlei | 127:73d7bfcc1e3d | 126 | _APN("fast.tmobile.com",,) /* LTE */ }, |
mazgch | 88:135fb4bb7aac | 127 | { /* AT&T */ "310-030,150,170,260,410,560,680", |
xinlei | 127:73d7bfcc1e3d | 128 | _APN("phone",,) |
xinlei | 127:73d7bfcc1e3d | 129 | _APN("wap.cingular","WAP@CINGULARGPRS.COM","CINGULAR1") |
xinlei | 127:73d7bfcc1e3d | 130 | _APN("isp.cingular","ISP@CINGULARGPRS.COM","CINGULAR1") }, |
xinlei | 132:1b04a376bfc3 | 131 | |
xinlei | 132:1b04a376bfc3 | 132 | // 602 UAE |
xinlei | 132:1b04a376bfc3 | 133 | { /* Etisalat */ "602-602", _APN("internet.etisalat",,)}, |
mazgch | 124:db878a234544 | 134 | |
xinlei | 129:452a7234b1a1 | 135 | // 732 Colombia |
xinlei | 129:452a7234b1a1 | 136 | { /* Comcel */ "732-101", _APN("internet.comcel.com.co",,) |
xinlei | 129:452a7234b1a1 | 137 | _APN("internet.movistar.com.co",,) }, |
xinlei | 129:452a7234b1a1 | 138 | |
ghuklev | 133:69700ba3fa72 | 139 | // 405 India |
ghuklev | 133:69700ba3fa72 | 140 | { /* Reliance */ "405-21", _APN("unlimitiot",,) |
ghuklev | 133:69700ba3fa72 | 141 | _APN("IoTtest",,) }, |
ghuklev | 133:69700ba3fa72 | 142 | |
mazgch | 124:db878a234544 | 143 | // 901 International - INT |
xinlei | 127:73d7bfcc1e3d | 144 | { /* Transatel */ "901-37", _APN("netgprs.com","tsl","tsl") }, |
mazgch | 85:dd8f4f0d0ca9 | 145 | }; |
mazgch | 88:135fb4bb7aac | 146 | |
mazgch | 88:135fb4bb7aac | 147 | inline const char* apnconfig(const char* imsi) |
mazgch | 88:135fb4bb7aac | 148 | { |
mazgch | 88:135fb4bb7aac | 149 | const char* config = NULL; |
mazgch | 88:135fb4bb7aac | 150 | if (imsi && *imsi) { |
mazgch | 88:135fb4bb7aac | 151 | // many carriers use internet without username and password, os use this as default |
mazgch | 88:135fb4bb7aac | 152 | // now try to lookup the setting for our table |
mazgch | 88:135fb4bb7aac | 153 | for (int i = 0; i < sizeof(apnlut)/sizeof(*apnlut) && !config; i ++) { |
mazgch | 88:135fb4bb7aac | 154 | const char* p = apnlut[i].mccmnc; |
mazgch | 88:135fb4bb7aac | 155 | // check the MCC |
mazgch | 88:135fb4bb7aac | 156 | if ((0 == memcmp(imsi, p, 3))) { |
mazgch | 88:135fb4bb7aac | 157 | p += 3; |
mazgch | 88:135fb4bb7aac | 158 | // check all the MNC, MNC length can be 2 or 3 digits |
mazgch | 88:135fb4bb7aac | 159 | while (((p[0] == '-') || (p[0] == ',')) && |
mazgch | 88:135fb4bb7aac | 160 | (p[1] >= '0') && (p[1] <= '9') && |
mazgch | 88:135fb4bb7aac | 161 | (p[2] >= '0') && (p[2] <= '9') && !config) { |
mazgch | 88:135fb4bb7aac | 162 | int l = ((p[3] >= '0') && (p[3] <= '9')) ? 3 : 2; |
mazgch | 88:135fb4bb7aac | 163 | if (0 == memcmp(imsi+3,p+1,l)) |
mazgch | 88:135fb4bb7aac | 164 | config = apnlut[i].cfg; |
mazgch | 88:135fb4bb7aac | 165 | p += 1 + l; |
mazgch | 88:135fb4bb7aac | 166 | } |
mazgch | 88:135fb4bb7aac | 167 | } |
mazgch | 88:135fb4bb7aac | 168 | } |
mazgch | 88:135fb4bb7aac | 169 | } |
mazgch | 88:135fb4bb7aac | 170 | // use default if not found |
mazgch | 88:135fb4bb7aac | 171 | if (!config) |
mazgch | 88:135fb4bb7aac | 172 | config = apndef; |
mazgch | 88:135fb4bb7aac | 173 | return config; |
mazgch | 88:135fb4bb7aac | 174 | } |