📄 gsm.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace SMS.BaseClass
{
class GSM
{
[DllImport("dllforvc.dll", //初始化GSM MODEM,并连接GSM MODEM
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();
[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();
[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);
//接收短信息返回字符串格式为:手机号码|短信内容||手机号码|短信内容||
[DllImport("dllforvc.dll",
EntryPoint = "GSMModemSMSReadAll",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
//RD_opt为1接收短信息后不做任何处理,0为接收后删除信息
public static extern string GSMModemSMSReadAll(int RD_opt);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -