![](/media/cache/group/u-blox_logo_trans.png.50x50_q85.png)
portable version of the cumulocity demo
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
apndb.cpp@44:e34e48130533, 2014-07-24 (annotated)
- Committer:
- Cumulocity
- Date:
- Thu Jul 24 14:47:24 2014 +0000
- Revision:
- 44:e34e48130533
- Parent:
- 42:104746744af8
- Child:
- 53:76de473cf5a7
added apn
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vwochnik | 23:0a48eebaaba8 | 1 | #include "apndb.h" |
vwochnik | 23:0a48eebaaba8 | 2 | #include "stdlib.h" |
vwochnik | 23:0a48eebaaba8 | 3 | #include "stdio.h" |
vwochnik | 23:0a48eebaaba8 | 4 | #include "string.h" |
vwochnik | 23:0a48eebaaba8 | 5 | |
vwochnik | 23:0a48eebaaba8 | 6 | // Contains all tuples |
vwochnik | 23:0a48eebaaba8 | 7 | apndb_t apndb[] = { |
Cumulocity | 44:e34e48130533 | 8 | { .mcc = "232", .mnc = "03", .carrier = "Telekom", .apn = "m2m.business" }, |
Cumulocity | 42:104746744af8 | 9 | { .mcc = "262", .mnc = "02", .carrier = "Telekom", .apn = "m2m.business" }, |
Cumulocity | 42:104746744af8 | 10 | { .mcc = "262", .mnc = "06", .carrier = "Telekom", .apn = "m2m.business" }, |
Cumulocity | 42:104746744af8 | 11 | { .mcc = "204", .mnc = "04", .carrier = "Vodafone NL", .apn = "public4.m2minternet.com" }, |
Cumulocity | 42:104746744af8 | 12 | { .mcc = NULL, .mnc = NULL, .carrier = NULL, .apn = NULL } // ending terminator |
vwochnik | 23:0a48eebaaba8 | 13 | }; |
vwochnik | 23:0a48eebaaba8 | 14 | |
vwochnik | 23:0a48eebaaba8 | 15 | apndb_t * apndb_get(const char * imsi) |
vwochnik | 23:0a48eebaaba8 | 16 | { |
vwochnik | 23:0a48eebaaba8 | 17 | char chr1[8], chr2[8]; |
vwochnik | 23:0a48eebaaba8 | 18 | size_t len; |
Cumulocity | 42:104746744af8 | 19 | size_t i; |
vwochnik | 23:0a48eebaaba8 | 20 | |
Cumulocity | 42:104746744af8 | 21 | i = 0; |
Cumulocity | 42:104746744af8 | 22 | while (apndb[i].mcc != NULL) { |
vwochnik | 23:0a48eebaaba8 | 23 | strcpy(chr1, apndb[i].mcc); |
vwochnik | 23:0a48eebaaba8 | 24 | strcat(chr1, apndb[i].mnc); |
vwochnik | 23:0a48eebaaba8 | 25 | len = strlen(chr1); |
vwochnik | 23:0a48eebaaba8 | 26 | strncpy(chr2, imsi, len); |
vwochnik | 23:0a48eebaaba8 | 27 | chr2[len] = '\0'; |
vwochnik | 23:0a48eebaaba8 | 28 | |
vwochnik | 23:0a48eebaaba8 | 29 | if (strcmp(chr1, chr2) == 0) |
vwochnik | 23:0a48eebaaba8 | 30 | return &apndb[i]; |
Cumulocity | 42:104746744af8 | 31 | i++; |
vwochnik | 23:0a48eebaaba8 | 32 | } |
vwochnik | 23:0a48eebaaba8 | 33 | |
vwochnik | 23:0a48eebaaba8 | 34 | return NULL; |
vwochnik | 23:0a48eebaaba8 | 35 | } |