![](/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
Diff: apndb.cpp
- Revision:
- 42:104746744af8
- Parent:
- 29:853741b9ea3b
- Child:
- 44:e34e48130533
diff -r 804f6a0bda26 -r 104746744af8 apndb.cpp --- a/apndb.cpp Tue Jul 15 12:44:34 2014 +0000 +++ b/apndb.cpp Thu Jul 24 14:17:07 2014 +0000 @@ -3,19 +3,22 @@ #include "stdio.h" #include "string.h" -#define APNDB_COUNT 5 - // Contains all tuples apndb_t apndb[] = { - { .mcc = "204", .mnc = "04", .carrier = "Vodafone NL", .apn = "public4.m2minternet.com" } + { .mcc = "262", .mnc = "02", .carrier = "Telekom", .apn = "m2m.business" }, + { .mcc = "262", .mnc = "06", .carrier = "Telekom", .apn = "m2m.business" }, + { .mcc = "204", .mnc = "04", .carrier = "Vodafone NL", .apn = "public4.m2minternet.com" }, + { .mcc = NULL, .mnc = NULL, .carrier = NULL, .apn = NULL } // ending terminator }; apndb_t * apndb_get(const char * imsi) { char chr1[8], chr2[8]; size_t len; + size_t i; - for (size_t i = 0; i < APNDB_COUNT; i++) { + i = 0; + while (apndb[i].mcc != NULL) { strcpy(chr1, apndb[i].mcc); strcat(chr1, apndb[i].mnc); len = strlen(chr1); @@ -24,6 +27,7 @@ if (strcmp(chr1, chr2) == 0) return &apndb[i]; + i++; } return NULL;