日期:2014-05-17 浏览次数:21401 次
//---------------------------------------
// <copyright file="RILHelper.cs" company="Yaping Xin">
// Copyright (c) Yaping Xin. All rights reserved.
// </copyright>
// <Description>Helper class for Radio Interface Layer.</Description>
//---------------------------------------
namespace MobileAutomation.Projects.VDFStressTesting
{
using System;
using System.Runtime.InteropServices;
using System.Threading;
/// <summary>
/// Helper class for Radio Interface Layer.
/// </summary>
public class RILHelper
{
/// <summary>
/// Delegation definition of Log event handler
/// </summary>
/// <param name="message">Message to transfer</param>
public delegate void LogHandler(string message);
/// <summary>Event handler to record log</summary>
public static event LogHandler Log;
/// <summary>AutoResetEvent object</summary>
private static AutoResetEvent waithandle = new AutoResetEvent(false);
/// <summary>HRESULT to RIL object</summary>
private static IntPtr hRil = IntPtr.Zero;
/// <summary>HRESULT to result</summary>
private static IntPtr hRes = IntPtr.Zero;
/// <summary>
/// RILRESULTCALLBACK delegation
/// http://msdn.microsoft.com/en-us/library/aa920069.aspx
/// </summary>
/// <param name="dwCode">Specifies the result code.</param>
/// <param name="hrCmdID">ID returned by the command that originated this response.</param>
/// <param name="lpData">Data associated with the notification.</param>
/// <param name="cbData">Size of the structure pointed to by lpData.</param>
/// <param name="dwParam">Specifies the parameter passed to RIL_Initialize or RIL_InitializeEmergency.</param>
public delegate void RILRESULTCALLBACK(
uint dwCode,
IntPtr hrCmdID,
IntPtr lpData,
uint cbData,
uint dwParam);
/// <summary>
/// RILNOTIFYCALLBACK delegation
/// http://msdn.microsoft.com/en-us/library/aa922465.aspx
/// </summary>
/// <param name="dwCode">Specifies the