⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gsmmodem.cs

📁 [SMS SDK V1.7 测试说明] 1)“接口库”为SDK库包其中: Release —— 发布的稳定库 Debug —— 为调试库 2)“演示代码”为测试代码目录。
💻 CS
字号:
using System;
using System.Runtime.InteropServices;

namespace TestForCSharp
{
	/// <summary>
	/// GSMModem 的摘要说明。
	/// </summary>
	public class GSMModem
	{
		public GSMModem()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		//初始化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();

		//断开连接并释放内存空间		
		[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)] 
		public static extern string GSMModemSMSReadAll(int RD_opt);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -