次の方法で共有


RIL_EnumRadios (Compact 2013)

3/26/2014

This function retrieves the count of radios. It optionally retrieves a list of RADIOINFO structures for the radios.

The RADIOINFO structures are filled with data from the registry.

The RADIOINFO structure member dwRadioIndex is a unique identifier for the radio which is used to initialize a RIL instance using RIL_Initialize.

Syntax

HRESULT RIL_EnumRadios(
    LPRADIOINFO lpRadioInfo,
    DWORD *lpdwNumRadio
);

Parameters

  • [in, out] lpRadioInfo
    [in] A pointer to a storage area for the output.

    NULL if no structure output is desired.

    [out] A pointer to an array of RADIOINFO structures.

  • [in, out] lpdwNumRadio
    [in] If lpRadioInfo is not NULL, the array size of lpRadioInfo.

    [out] A pointer to the number of radios.

    [out] The required buffer array size when ERROR_INSUFFICIENT_BUFFER is returned.

Return Value

HRESULT is S_OK for success, or a standard error value.

ERROR_INSUFFICIENT_BUFFER if lpRadioInfo buffer is not NULL and the buffer is not big enough for the output.

Example

// assumption: the device has 2 radios.
HRESULT    hr;
DWORD      dwRadioCount = 0;
RADIOINFO *lpRadioInfo  = NULL;

// get the number of radios
hr = RIL_EnumRadios( NULL, &dwRadioCount );

// dwRadioCount now = 2

if ( dwRadioCount > 0 ){
    // allocate buffers for the RADIOINFO
    lpRadioInfo = new RADIOINFO[ dwRadioCount ];    
    if ( NULL == lpRadioInfo ){
        // we could not allocate memory
        break;
    }                
    hr = RIL_EnumRadios( lpRadioInfo, &dwRadioCount);
    if ( FAILED( hr ) ){
        // we could not get the RADIOINFO
    }
}

Remarks

This function returns 1 radio with Radio ID 1, Radio Type 0, and Radio Name empty when the "HKEY_LOCAL_MACHINE\Comm\Cellular\RADIO\RadioNumber" registry entry does not exist. This provides backward compatibility.

Requirements

Library

Ril.lib

See Also

Reference

RIL Functions
RIL Radio Type Constants
RADIOINFO