使用C#开发的基于华为SMEIDll.dll库的SMGP 2.0、SMGP 3.0协议的短信上行、短信下行的网关程序。
该程序代码在中国电信CDMA短信网关测试通过,实现了C网短信的上行和下行,下行分配采用SMGP 2.0和SMGP 3.0实现,程序直接与短信网关链接。
另外,基于电信C网短信网关的短信收发使用C++、Java、C#开发的接口程序都已全部完成。
核心申明代码如下,如果需要源代码,可以联系站长,附件有演示测试程序,同时附件提供了《中国电信集团公司企业标准(SMGP协议)(v2.0)(20041104).doc》、《中国电信集团公司技术标准_短信息网关协议(SMGP)规范(V3.1).pdf》、《华为提供的短信等开发文档08年12月\华为提供的短信等开发文档08年12月\31350093-infoX-SMS GW API参考-(V1.5D2_02)\31350093-infoX-SMS GW API参考-(V1.5D2_02)》的下载。
后来发现有一些朋友需要源代码,所以将系统的实现的核心源代码压缩了放在附件,需要的就下载看下。
#region “华为API声明”
[DllImport("SMEIDll.dll")]
public static extern bool SMGP_IFInitInterface(int dwCodeProtocol, int dwDriverProtocol, string pDriverParam);
[DllImport("SMEIDll.dll")]
public static extern bool SMGP_IFExitInterface();
[DllImport("SMEIDll.dll")]
public static extern bool SMGP_Login_R(string SystemID,string Password,int LoginMode);
[DllImport("SMEIDll.dll")]
public extern static bool SMGP_Logout();
[DllImport("SMEIDll.dll", EntryPoint = "SMGP30_SubmitSM",
SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]
public static extern int SMGP30_SubmitSM(byte byMsgType,
byte SRR,
byte PRI,
string ServiceSubType,
string sFeeType,
string sFeeCode,
string sFixedFee,
byte DCS,
string Expire,
string Schedule,
string OrgAddr,
string sFeeAddr,
byte byUserNum,
string sDestAddrs,
uint UDLen,
string UserData,
uint ulTLVlen,
string sTLVBlock,
string sReserved,
ref byte bySmgpMsgID,
ref int FCS);
[DllImport("SMEIDll.dll", EntryPoint = "SMGP20_SubmitSM",
SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]
public static extern int SMGP20_SubmitSM(byte byMsgType,
byte SRR,
byte PRI,
string ServiceSubType,
string sFeeType,
string sFeeCode,
string FixedFee,
byte DCS,
string Expire,
string Schedule,
string OrgAddr,
string sFeeAddr,
byte byUserNum,
string sDestAddrs,
uint UDLen,
string UserData,
ref byte bySmgpMsgID,
ref int FCS);
[DllImport("SMEIDLL.dll", CharSet = CharSet.Ansi)]
public static extern int SMGP20_GetDeliverSM(out byte sm_ID,
out byte StatusReport,
out byte DCS,
StringBuilder TimeStamp,
StringBuilder OrgAddr,
StringBuilder DestAddr,
out uint UDLen,
StringBuilder UserData);
[DllImport("SMEIDLL.dll", CharSet = CharSet.Ansi)]
public static extern int SMGP30_GetDeliverSM(int Ntimeout,
ref SMGP30_DeliverResp PdeliverResp
);
public class SMGP30_DeliverResp
{
}
[DllImport("SMEIDLL.dll", CharSet = CharSet.Ansi)]
public static extern int HasDeliverMessage(long dwTimeOut);
#endregion
本文相关资料下载地址:http://dl.dbank.com/c0ormwsl6a
