zoukankan      html  css  js  c++  java
  • 二版手机读取SIM通讯录

    TInt GetSimContactCountL()
        {
        TInt SimCntCount = 0;   
        /*this code is just to get the TSY name*/
        CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeUnspecified);     
        CleanupStack::PushL(db);     
        CCommsDbTableView* table = db->OpenTableLC(TPtrC(MODEM));     
        table->GotoFirstRecord();   
        table->ReadTextL(TPtrC(MODEM_TSY_NAME),iTsyName);   
        // Cleanup - CommsDB no longer needed 
        CleanupStack::PopAndDestroy(2); // table,db     
        // Connect to the ETel server 
        RTelServer aTelServer;     
        User::LeaveIfError(aTelServer.Connect());     
        CleanupClosePushL(aTelServer);     
        User::LeaveIfError(aTelServer.LoadPhoneModule(iTsyName));     
        TInt numberOfPhones;     
        User::LeaveIfError(aTelServer.EnumeratePhones(numberOfPhones));     
        SimCntCount = 0;   
        for (TInt i=numberOfPhones; i>0; i--) { 
        // Get the phone name 
        RTelServer::TPhoneInfo phoneInfo; 
        User::LeaveIfError(aTelServer.GetPhoneInfo(i-1,phoneInfo)); 
        // Open the phone by name 
        RBasicGsmPhone phone; 
        User::LeaveIfError(phone.Open(aTelServer,phoneInfo.iName)); 
        TInt phoneBookCount;
        phone.EnumeratePhoneBooks(phoneBookCount);
        RBasicGsmPhone::TPhoneBookInfo aPbInfo;
        for(TInt j=0;j<phoneBookCount;j++){
        phone.GetPhoneBookInfo(j,aPbInfo);
        SimCntCount += aPbInfo.iUsed;
        }
        phone.Close();
        } 
        CleanupStack::PopAndDestroy(1); 
        return SimCntCount;
        }

  • 相关阅读:
    第一份随笔
    慢哈希算法
    彩虹表
    基于Wireshark验证网站口令认证传输方案
    electron学习笔记2
    基于原型的软件需求获取
    《小学四则运算练习软件》结对项目报告
    201571030109 小学四则运算练习软件项目报告
    201571030109 《构建之法》速读
    个人学期总结
  • 原文地址:https://www.cnblogs.com/yaoliang11/p/1928915.html
Copyright © 2011-2022 走看看