portable version of the cumulocity demo
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
apndb.cpp
- Committer:
- vwochnik
- Date:
- 2014-05-25
- Revision:
- 28:2004400abeec
- Parent:
- 23:0a48eebaaba8
- Child:
- 29:853741b9ea3b
File content as of revision 28:2004400abeec:
#include "apndb.h" #include "stdlib.h" #include "stdio.h" #include "string.h" #define APNDB_COUNT 5 // Contains all tuples apndb_t apndb[] = { { .mcc = "204", .mnc = "04", .apn = "public4.m2minternet.com", .user = "", .pass = "" } }; apndb_t * apndb_get(const char * imsi) { char chr1[8], chr2[8]; size_t len; for (size_t i = 0; i < APNDB_COUNT; i++) { strcpy(chr1, apndb[i].mcc); strcat(chr1, apndb[i].mnc); len = strlen(chr1); strncpy(chr2, imsi, len); chr2[len] = '\0'; if (strcmp(chr1, chr2) == 0) return &apndb[i]; } return NULL; }