min match by mcc mnc

来源:互联网 发布:宇信数据科技有限公司 编辑:程序博客网 时间:2024/05/01 21:19
#include <stdio.h>
#include <string.h>


static char match8[][24] = {"72406", "72410", "72411", "72423", "72402",
                            "72403", "72404", "72408", "72431", "72424",
                            "72416", "72432", "72433", "72434", "72439",
                            "73002", "73009", "73001", "73010", "73003",
                            "73008", "73004", "73005", "73007" };
static char match7[][8] = { "722310", "722341", "72234", "72207", "21407",
                           "71606", "71610", "71617" };


int getMatchCountByMccMnc() {
    int matchCount = 2;
    char *pMccMnc =(char *)malloc(40);
    memset(pMccMnc, 0, sizeof(char) * 40);
    property_get("gsm.sim.operator.numeric", pMccMnc,"0");


    int i = 0;
    while( i < sizeof(match7)/sizeof(match7[0])) {
        if(strcmp(pMccMnc, match7[i]) == 0) {
            printf("mcc mnc  %s  is 7 bit match!\n", match7[i]);
            matchCount = 7;
            goto exit;
        }
        i++;
    }


    i = 0;
    while( i < sizeof(match8)/sizeof(match8[0])) {
        if(strcmp(pMccMnc, match8[i]) == 0) {
            printf("mcc mnc  %s  is 8 bit match!\n", match8[i]);
            matchCount = 8;
            goto exit;
        }
        i++;
    }


    printf("No mcc mnc match, use default 7 bit\n");
exit:
    free(pMccMnc);
    return matchCount;
}


int main() {
    getMatchCountByMccMnc();
    return 0;
}
原创粉丝点击