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

📄 gsmmodem.cs

📁 GSM MODEM开发实例
💻 CS
字号:
using System;
using System.Runtime.InteropServices;

namespace TestForCSharp
{
	/// <summary>
	/// GSMModem 的摘要说明。
	/// </summary>
	public class GSMModem
	{
		public GSMModem()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}

		//初始化gsm modem,并连接gsm modem
		[DllImport("GSMMultiPort.dll",
			 EntryPoint="GSMModemInit",
			 CharSet=CharSet.Ansi,
			 CallingConvention=CallingConvention.StdCall)] 
		public static extern bool  GSMModemInit(
			string device, 
			string baudrate,
			string initstring, 
			string charset,
			bool swHandshake,
			string sn);

		//获取短信猫标识号码
		[DllImport("GSMMultiPort.dll",
			 EntryPoint="GSMModemGetSnInfo",
			 CharSet=CharSet.Ansi,
			 CallingConvention=CallingConvention.StdCall)] 
		public static extern string GSMModemGetSnInfo(string device, string baudrate);

		//获取设备的连接状态		
		[DllImport("GSMMultiPort.dll",
			 EntryPoint="GSMModemIsConn",
			 CharSet=CharSet.Ansi,
			 CallingConvention=CallingConvention.StdCall)] 
		public static extern bool GSMModemIsConn(string device);

		//断开连接并释放内存空间		
		[DllImport("GSMMultiPort.dll",
			 EntryPoint="GSMModemRelease",
			 CharSet=CharSet.Ansi,
			 CallingConvention=CallingConvention.StdCall)] 
		public static extern void GSMModemRelease(string device);

		//取得错误信息	
		[DllImport("GSMMultiPort.dll",
			 EntryPoint="GSMModemGetErrorMsg",
			 CharSet=CharSet.Ansi,
			 CallingConvention=CallingConvention.StdCall)] 
		public static extern string GSMModemGetErrorMsg(string device);

		//发送短信息
		[DllImport("GSMMultiPort.dll",
			 EntryPoint="GSMModemSMSsend",
			 CharSet=CharSet.Ansi,
			 CallingConvention=CallingConvention.StdCall)] 
		public static extern bool GSMModemSMSsend(
			string device,
			string serviceCenterAddress, 
			int	encodeval,
			string text, 
			int textlen,
			string phonenumber,
			bool requestStatusReport);

		//接收短信息
		[DllImport("GSMMultiPort.dll",
			 EntryPoint="GSMModemSMSReadAll",
			 CharSet=CharSet.Ansi,
			 CallingConvention=CallingConvention.StdCall)] 
		public static extern string GSMModemSMSReadAll(string device,int RD_opt);
	}
}

⌨️ 快捷键说明

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