?? gsmmodem.cs
字號:
using System;
using System.Runtime.InteropServices;
namespace TestForCSharp
{
/// <summary>
/// GSMModem 的摘要說明。
/// </summary>
public class GSMModem
{
public GSMModem()
{
//
// TODO: 在此處添加構造函數(shù)邏輯
//
}
//初始化gsm modem,并連接gsm modem
[DllImport("dllforvc.dll",
EntryPoint="GSMModemInitNew",
CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.StdCall)]
public static extern bool GSMModemInitNew(
string device,
string baudrate,
string initstring,
string charset,
bool swHandshake,
string sn);
//獲取短信貓新的標識號碼
[DllImport("dllforvc.dll",
EntryPoint="GSMModemGetSnInfoNew",
CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.StdCall)]
public static extern string GSMModemGetSnInfoNew(string device, string baudrate);
//獲取當前通訊端口
[DllImport("dllforvc.dll",
EntryPoint="GSMModemGetDevice",
CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.StdCall)]
public static extern string GSMModemGetDevice();
//獲取當前通訊波特率
[DllImport("dllforvc.dll",
EntryPoint="GSMModemGetBaudrate",
CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.StdCall)]
public static extern string GSMModemGetBaudrate();
//斷開連接并釋放內(nèi)存空間
[DllImport("dllforvc.dll",
EntryPoint="GSMModemRelease",
CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.StdCall)]
public static extern void GSMModemRelease();
//取得錯誤信息
[DllImport("dllforvc.dll",
EntryPoint="GSMModemGetErrorMsg",
CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.StdCall)]
public static extern string GSMModemGetErrorMsg();
//發(fā)送短信息
[DllImport("dllforvc.dll",
EntryPoint="GSMModemSMSsend",
CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.StdCall)]
public static extern bool GSMModemSMSsend(
string serviceCenterAddress,
int encodeval,
string text,
int textlen,
string phonenumber,
bool requestStatusReport);
//接收短信息返回字符串格式為:手機號碼|短信內(nèi)容||手機號碼|短信內(nèi)容||
[DllImport("dllforvc.dll",
EntryPoint="GSMModemSMSReadAll",
CharSet=CharSet.Ansi,
CallingConvention=CallingConvention.StdCall)]
public static extern string GSMModemSMSReadAll(int RD_opt);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -