Share via


RIL_Initialize (Compact 2013)

3/26/2014

This function initializes RIL for use by a client.

Syntax

HRESULT RIL_Initialize(
  DWORD dwIndex,
  RILRESULTCALLBACK pfnResult,
  RILNOTIFYCALLBACK pfnNotify,
  DWORD dwNotificationClasses,
  DWORD dwParam,
  HRIL* lphRil
);

Parameters

  • dwIndex
    [in] Specifies the index of the RIL port to use, for example, 1 for RIL1.
  • pfnResult
    [in] Function result callback.
  • pfnNotify
    [in] Notification callback.
  • dwNotificationClasses
    [in] Specifies the classes of notifications to be enabled for a client.
  • dwParam
    [in] Specifies the custom parameter passed to result and notification callbacks.
  • lphRil
    [in] A storage area to place the pointer.

    [out] Pointer to a handle to the RIL instance.

Return Value

The function returns the following values:

Value

Description

S_OK

The driver is up and radio is present.

S_FALSE

The driver is still waiting for radio presence.

E_XXX

The call to initialize the driver has failed.

Remarks

This function is synchronous. An asynchronous result callback is not returned.

RIL only supports single-threaded RIL handles. RIL validates the application's RIL handle before using it. An application cannot use a RIL handle that it does not own.

Call RIL_Deinitialize to release the handle. If the RIL client generates an exception or exits without calling RIL_Deinitialize, the RIL library will release the handle when the DLL is unloaded.

Note

You should not use CloseHandle to release this handle.

When a client calls this function, it can also register for notifications. If it registers for notifications, the driver will send a RIL_NOTIFY_RADIOPRESENCECHANGED indicating if the radio is present or not present. The proxy returns S_FALSE as an indication that the driver has not detected the radio presence yet. The pending notification is used by the client to determine when the radio is present. For more information about RIL_NOTIFY_RADIOPRESENCECHANGED, see Notification Radio State Change Constants.

If the client does not register for notifications when this function is called, it has two options:

  1. The client can periodically call RIL_Deinitialize and then call this function again until the proxy returns S_OK.
  2. The client can periodically call the desired RIL API until the API no longer returns RIL_E_RADIONOTPRESENT.

Requirements

Header

ril.h

Library

Ril.lib

See Also

Reference

RIL Functions
RIL_EnumRadios
RIL_Deinitialize
Error Constants