SmartREST client reference implementation for the u-blox C027 mbed compatible device.

Dependencies:   C027 C027_Support mbed mbed-rtos MbedSmartRest LM75B MMA7660 C12832

Fork of MbedSmartRestTest by Vincent Wochnik

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers apndb.cpp Source File

apndb.cpp

00001 #include "apndb.h"
00002 #include "stdlib.h"
00003 #include "stdio.h"
00004 #include "string.h"
00005 
00006 #define APNDB_COUNT 5
00007 
00008 // Contains all tuples
00009 apndb_t apndb[] = {
00010     { .mcc = "204", .mnc = "04", .carrier = "Vodafone NL", .apn = "public4.m2minternet.com" }
00011 };
00012 
00013 apndb_t * apndb_get(const char * imsi)
00014 {
00015     char chr1[8], chr2[8];
00016     size_t len;
00017     
00018     for (size_t i = 0; i < APNDB_COUNT; i++) {
00019         strcpy(chr1, apndb[i].mcc);
00020         strcat(chr1, apndb[i].mnc);
00021         len = strlen(chr1);
00022         strncpy(chr2, imsi, len);
00023         chr2[len] = '\0';
00024         
00025         if (strcmp(chr1, chr2) == 0)
00026             return &apndb[i];
00027     }
00028     
00029     return NULL;
00030 }