copy of gsmlib.cs
来自「c# 基于windows mobile 访问基站信息源程序」· CS 代码 · 共 61 行
CS
61 行
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace NiceTracker.Libraries
{
/// <summary>
/// Summary description for GSMLib.
/// </summary>
public class GSMLib
{
[DllImport("NiceRIL.dll")]
private static extern IntPtr GetCREG( IntPtr comPort );
[DllImport("NiceRIL.dll")]
private static extern IntPtr GetCSQ( IntPtr comPort );
[DllImport("NiceRIL.dll")]
private static extern IntPtr GetCCED( IntPtr comPort );
public GSMLib()
{}
public static string PerformCREG( )
{
IntPtr creg = GetCREG( IntPtr.Zero );
return IntPtrToString( creg );
}
public static string PerformCCED( )
{
IntPtr cced = GetCCED( IntPtr.Zero );
return IntPtrToString( cced );
}
public static string PerformCSQ( )
{
IntPtr csq = GetCSQ( IntPtr.Zero );
return IntPtrToString( csq );
}
private static string IntPtrToString( IntPtr ptr )
{
string output = "";
char c = (char)Marshal.ReadByte( ptr );
while ( c != '\r' )
{
output += c;
ptr = (IntPtr)((int)ptr + 1);
c = (char)Marshal.ReadByte( ptr );
}
return output;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?