⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 response.cpp

📁 ril source code for Windows CE
💻 CPP
📖 第 1 页 / 共 5 页
字号:
            cchTextLen,
            cchUsed);
    }
    else
    {
        // Coding scheme is not GSM unpacked or UCS2
        goto Exit;
    }

    if (fConvertSucceeded)
    {
        if (cchUsed > dwSize)
        {
            // Overflow on text buffer! Truncating text.
            cchUsed = dwSize;
        }

        // null terminate
        wszText[cchUsed] = L'\0';

        // RIL driver only supports PSTR's for Operator Names.
        // Convert the Unicode text to an ANSI string as best possible.
        StringCchCopyA(szOut, dwSize, AnsiString(wszText));
        fRet = TRUE;
    }

Exit:
    if (NULL != wszText)
    {
        delete[] wszText;
    }

    return fRet;
}


static
void
SendRegStatusChangedNotif(
    void
)
/* send the registration status change notification */
{
      CNotificationData *pnd = new CNotificationData;
      if ( pnd != NULL && pnd->InitFromRealBlob( RIL_NOTIFY_REGSTATUSCHANGED, &g_dwRegStatus, sizeof(g_dwRegStatus) ) )
      {
         BOOL fOk = QueueCmdIgnoreRsp(APIID_NONE, NULL, CMDOPT_NOOP, g_TimeoutAPIDefault, NULL, pnd, 0, 0, 0);
         if ( fOk )
         {
            pnd = NULL;
         }
         else
         {
            DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : StartCPHSRead : failed to queue up notification\r\n")));
         }
      }
      else
      {
         DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : StartCPHSRead : failed to create notification\r\n")));
      }
      if ( pnd != NULL )
      {
         delete pnd;
         pnd = NULL;
      }
}


void StartPlmnNameRead()
{
    FUNCTION_TRACE( StartPlmnNameRead );

    DWORD dwPlmnNameFileId = 0x6FC5;    // Default to EF-PNN
    BOOL fReadCphsFile = TRUE;
    BOOL fReadPnnFile = TRUE;
    DWORD dwUseCphsPlmnName = 0;
    char *cptr = NULL;

    if (GetRegistryDWORD(
        HKEY_LOCAL_MACHINE,
        g_tszRegKeyRIL,
        TEXT("UseCphsPlmnName"),
        &dwUseCphsPlmnName))
    {
        if (0 == dwUseCphsPlmnName)
        {
            fReadCphsFile = FALSE;
        }
        else
        {
            fReadPnnFile = FALSE;
        }
    }

    if ( g_pcszCPHS != NULL )
    {
        delete[] g_pcszCPHS;
        g_pcszCPHS = NULL;
    }

    HRESULT hr = E_FAIL;
    DWORD dwSize = 0;
    if (fReadPnnFile)
    {
        CPHSStatus statusPnnFile(dwPlmnNameFileId);
        hr = statusPnnFile.Read();
        statusPnnFile.Dump();

        if (SUCCEEDED(hr))
        {
            RILSIMRECORDSTATUS rsrsPnn = statusPnnFile.GetStatus();

            if (RIL_PARAM_SRS_ALL == (RIL_PARAM_SRS_ALL & rsrsPnn.dwParams) &&
                RIL_SIMRECORDTYPE_LINEAR == rsrsPnn.dwRecordType &&
                0 < rsrsPnn.dwItemCount)
            {
                CPHSRecord recPnnFile(
                    dwPlmnNameFileId,
                    rsrsPnn.dwSize,
                    CPHSRecord::READ_RECORD,
                    1);
                hr = recPnnFile.Read();
                recPnnFile.Dump();

                if (SUCCEEDED(hr))
                {
                    dwSize = rsrsPnn.dwSize;
                    cptr = new char[dwSize+1];

                    if (ParsePnnNameRecord(recPnnFile, cptr, dwSize))
                    {
                        if (NULL != g_pcszCPHS)
                        {
                            delete[] g_pcszCPHS;
                        }
                        g_pcszCPHS   = cptr;
                        /* let upper layer know about CPHS */
                        SendRegStatusChangedNotif();
                        cptr         = NULL;
                    }
                    else
                    {
                        hr = E_FAIL;
                    }

                    if ( cptr != NULL )
                    {
                        delete[] cptr;
                        cptr = NULL;
                    }
                }
            }
        }
    }

    if (fReadCphsFile && FAILED(hr))
    {
        dwPlmnNameFileId = 0x6f14;  // CPHS Operator Name String
        CPHSStatus k( dwPlmnNameFileId );
        hr = k.Read();
        k.Dump();
        if ( SUCCEEDED( hr ) )
        {
            RILSIMRECORDSTATUS rsrs = k.GetStatus();
            if ( rsrs.dwParams & RIL_PARAM_SRS_SIZE )
            {
                CPHSRecord kk( dwPlmnNameFileId, rsrs.dwSize );
                hr = kk.Read();
                kk.Dump();
                if ( SUCCEEDED( hr ) )
                {
                    cptr = new char[ rsrs.dwSize+1 ];
                    if ( cptr != NULL )
                    {
                        dwSize = rsrs.dwSize;
                        BOOL fOk = kk.GetRecord( (BYTE*)cptr, dwSize );
                        if ( fOk )
                        {
                            cptr[dwSize] = NULL;

                            /* mark end-of-record */
                            char *x = strchr( cptr, (char)0xFF );
                            if ( x != NULL )
                            {
                                *x = NULL;
                            }
                            x = NULL;

                            if (NULL != g_pcszCPHS)
                            {
                                delete[] g_pcszCPHS;
                            }
                            g_pcszCPHS   = cptr;
                            /* let upper layer know about CPHS */
                            SendRegStatusChangedNotif();
                            cptr         = NULL;
                        }
                        if ( cptr != NULL )
                        {
                            delete[] cptr;
                            cptr = NULL;
                        }
                    }
                }
            }
        }
    }
}


#ifdef RIL_ENABLE_EONS
void StartEONSRead()
{
    DEBUGMSG(ZONE_EONS, (TEXT("RILDrv : i :StartEONSRead Begin Ready Wait\r\n")));
    g_eons.Read();
    while( !g_eons.Ready() )
    {
        Sleep( 100 );
    }
    DEBUGMSG(ZONE_EONS, (TEXT("RILDrv : i :StartEONSRead End Ready Wait\r\n")));

    g_eons.Dump();

    /* send the EONS notification */
    {
        CNotificationData *pnd = new CNotificationData;
        if ( pnd != NULL && pnd->InitFromRealBlob( RIL_NOTIFY_EONS, NULL, 0 ) )
        {
            BOOL fOk = QueueCmdIgnoreRsp(APIID_NONE, NULL, CMDOPT_NOOP, g_TimeoutAPIDefault, NULL, pnd, 0, 0, 0);
            if ( fOk )
            {
                pnd = NULL;
            }
            else
            {
                DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : StartEONSRead : failed to queue up notification\r\n")));
            }
        }
        else
        {
            DEBUGMSG(ZONE_ERROR, (TEXT("RILDrv : E : StartEONSRead : failed to create notification\r\n")));
        }
        if ( pnd != NULL )
        {
            delete pnd;
            pnd = NULL;
        }
    }

    /* update cache */
    EONSCache cache( g_eons );
    cache.Write();

    /* sync the global cache object */
    g_eonscache.Invalidate();
    g_eonscache.Read();
}
#endif

//
// CME error mapping table must be in left hand sorted order
//
static const ERRORMAP g_rgemCMEErrors[] =
{
    { RIL_E_PHONEFAILURE,        0},
    { RIL_E_NOCONNECTION,        1},
    { RIL_E_LINKRESERVED,        2},
    { RIL_E_OPNOTALLOWED,        3},
    { RIL_E_OPNOTSUPPORTED,      4},
    { RIL_E_PHSIMPINREQUIRED,    5},
    { RIL_E_PHFSIMPINREQUIRED,   6},
    { RIL_E_PHFSIMPUKREQUIRED,   7},
    { RIL_E_SIMNOTINSERTED,     10},
    { RIL_E_SIMPINREQUIRED,     11},
    { RIL_E_SIMPUKREQUIRED,     12},
    { RIL_E_SIMFAILURE,         13},
    { RIL_E_SIMBUSY,            14},
    { RIL_E_SIMWRONG,           15},
    { RIL_E_INCORRECTPASSWORD,  16},
    { RIL_E_SIMPIN2REQUIRED,    17},
    { RIL_E_SIMPUK2REQUIRED,    18},
    { RIL_E_MEMORYFULL,         20},
    { RIL_E_INVALIDINDEX,       21},
    { RIL_E_NOTFOUND,           22},
    { RIL_E_MEMORYFAILURE,      23},
    { RIL_E_TEXTSTRINGTOOLONG,  24},
    { RIL_E_INVALIDTEXTSTRING,  25},
    { RIL_E_DIALSTRINGTOOLONG,  26},
    { RIL_E_INVALIDDIALSTRING,  27},
    { RIL_E_NONETWORKSVC,       30},
    { RIL_E_NETWORKTIMEOUT,     31},
    { RIL_E_EMERGENCYONLY,      32},
    { RIL_E_NETWKPINREQUIRED,   40},
    { RIL_E_NETWKPUKREQUIRED,   41},
    { RIL_E_SUBSETPINREQUIRED,  42},
    { RIL_E_SUBSETPUKREQUIRED,  43},
    { RIL_E_SVCPINREQUIRED,     44},
    { RIL_E_SVCPUKREQUIRED,     45},
    { RIL_E_CORPPINREQUIRED,    46},
    { RIL_E_CORPPUKREQUIRED,    47},
    { RIL_E_PHONEFAILURE,      100},
    { RIL_E_NOTREADY,          515},
};
#define NUM_CMEERRORS       (sizeof(g_rgemCMEErrors) / sizeof(ERRORMAP))

#ifdef RIL_RADIO_RESILIENCE
//
// CME GPRS error mapping table must be in left hand sorted order
//
static const ERRORMAP g_rgemGPRSCMEErrors[] =
{    
    { RIL_E_ILLEGALMS,                                                          103},
    { RIL_E_ILLEGALME,                                                          106},
    { RIL_E_GPRSSERVICENOTALLOWED,                                  107},
    { RIL_E_PLMNNOTALLOWED,                                         111},
    { RIL_E_LOCATIONAREANOTALLOWED,                                 112},
    { RIL_E_ROAMINGNOTALLOWEDINTHISLOCATIONAREA,                    113},
    { RIL_E_SERVICEOPTIONNOTSUPPORTED,                              132},
    { RIL_E_REQUESTEDSERVICEOPTIONNOTSUBSCRIBED,                    133},
    { RIL_E_SERVICEOPTIONTEMPORARILYOUTOFORDER,                     134},
    { RIL_E_UNSPECIFIEDGPRSERROR,                                   148},
    { RIL_E_PDPAUTHENTICATIONFAILURE,                               149},
    { RIL_E_INVALIDMOBILECLASS,                                     150},
};
#define NUM_GPRSCMEERRORS       (sizeof(g_rgemGPRSCMEErrors) / sizeof(ERRORMAP))
#endif // RIL_RADIO_RESILIENCE

//
// CMS error mapping table must be in left hand sorted order
//
static const ERRORMAP g_rgemCMSErrors[] =
{
    { RIL_E_UNASSIGNEDNUMBER,         1},
    { RIL_E_MSGBARREDBYOPERATOR,      8},
    { RIL_E_MSGCALLBARRED,           10},
    { RIL_E_MSGXFERREJECTED,         21},
    { RIL_E_DESTINATIONOUTOFSVC,     27},
    { RIL_E_UNIDENTIFIEDSUBCRIBER,   28},
    { RIL_E_SVCUNSUPPORTED,          29},
    { RIL_E_UNKNOWNSUBSCRIBER,       30},
    { RIL_E_NETWKOUTOFORDER,         38},
    { RIL_E_NETWKTEMPFAILURE,        41},
    { RIL_E_CONGESTION,              42},
    { RIL_E_RESOURCESUNAVAILABLE,    43},
    { RIL_E_SVCNOTSUBSCRIBED,        50},
    { RIL_E_SVCNOTIMPLEMENTED,       69},
    { RIL_E_INVALIDMSGREFERENCE,     81},
    { RIL_E_INVALIDMSG,              95},
    { RIL_E_INVALIDMANDATORYINFO,    96},
    { RIL_E_MSGTYPEUNSUPPORTED,      97},
    { RIL_E_ICOMPATIBLEMSG,          98},
    { RIL_E_INFOELEMENTUNSUPPORTED,  99},
    { RIL_E_PROTOCOLERROR,          111},
    { RIL_E_NETWORKERROR,           127},
    { RIL_E_TELEMATICIWUNSUPPORTED, 128},
    { RIL_E_SMTYPE0UNSUPPORTED,     129},
    { RIL_E_CANTREPLACEMSG,         130},
    { RIL_E_PROTOCOLIDERROR,        143},
    { RIL_E_DCSUNSUPPORTED,         144},
    { RIL_E_MSGCLASSUNSUPPORTED,    145},
    { RIL_E_DCSERROR,               159},
    { RIL_E_CMDCANTBEACTIONED,      160},
    { RIL_E_CMDUNSUPPORTED,         161},
    { RIL_E_CMDERROR,               175},
    { RIL_E_MSGBODYHEADERERROR,     176},
    { RIL_E_SCBUSY,                 192},
    { RIL_E_NOSCSUBSCRIPTION,       193},
    { RIL_E_SCSYSTEMFAILURE,        194},
    { RIL_E_INVALIDADDRESS,         195},
    { RIL_E_DESTINATIONBARRED,      196},
    { RIL_E_REJECTEDDUPLICATE,      197},
    { RIL_E_VPFUNSUPPORTED,         198},
    { RIL_E_VPUNSUPPORTED,          199},
    { RIL_E_SIMMSGSTORAGEFULL,      208},
    { RIL_E_NOSIMMSGSTORAGE,        209},
    { RIL_E_PHONEFAILURE,           210},
    { RIL_E_MEMORYFULL,             211},
    { RIL_E_SIMTOOLKITBUSY,         212},
    { RIL_E_SIMDOWNLOADERROR,       213},
    { RIL_E_PHONEFAILURE,           300},
    { RIL_E_MSGSVCRESERVED,         301},
    { RIL_E_OPNOTALLOWED,           302},
    { RIL_E_OPNOTSUPPORTED,         303},
    { RIL_E_INVALIDMSGPARAM,        304},
    { RIL_E_INVALIDMSGPARAM,        305},
    { RIL_E_SIMNOTINSERTED,         310},
    { RIL_E_SIMPINREQUIRED,         311},
    { RIL_E_PHSIMPINREQUIRED,       312},
    { RIL_E_SIMFAILURE,             313},
    { RIL_E_SIMBUSY,                314},
    { RIL_E_SIMWRONG,               315},
    { RIL_E_SIMPUKREQUIRED,         316},
    { RIL_E_SIMPIN2REQUIRED,        317},
    { RIL_E_SIMPUK2REQUIRED,        318},
    { RIL_E_MEMORYFAILURE,          320},
    { RIL_E_INVALIDINDEX,           321},
    { RIL_E_MEMORYFULL,             322},
    { RIL_E_UNKNOWNSCADDRESS,       330},
    { RIL_E_NONETWORKSVC,           331},
    { RIL_E_NETWORKTIMEOUT,         332},
    { RIL_E_MESSAGINGERROR,         512},
    { RIL_E_MESSAGINGERROR,         513},
    { RIL_E_MESSAGINGERROR,         514},
    { RIL_E_NOTREADY,               515},
};
#define NUM_CMSERRORS       (sizeof(g_rgemCMSErrors) / sizeof(ERRORMAP))

//
// CallerID validities 
//
static const DWORD g_rgdwValidities[] =

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -