问题描述
我一直在尝试在 C# 应用程序中使用 gsmcomm 库,以便使用 GSM 调制解调器(wavecom)发送 SMS 消息(接收交付报告)。我已经阅读了 SO 中的所有类似线程,但没有帮助。 错误:“消息类型 SmsDeliverReport 已识别,但 SMS 解码器不支持。”
public bool SendSMS()
{
try
{
string strMsg = "Hello";
string strSendPhoneNum = "phone num";
string strSimPhoneNum = "phone num";
if (comm.IsConnected() == false) comm.open();
var dcs = (byte)DataCodingScheme.GeneralCoding.Alpha16Bit;
gsmcomm.PduConverter.SmsSubmitPdu pdu = new gsmcomm.PduConverter.SmsSubmitPdu(strMsg,strSendPhoneNum,strSimPhoneNum,dcs);
pdu.RequestStatusReport = true;
comm.SendMessage(pdu);
SmsDeliverMessageFlags sdmf = new SmsDeliverMessageFlags();
string DeliverRpt = sdmf.MessageType.ToString();
return true;
}
catch (Exception ex)
{
return false;
}
}
private void comm_MessageReceived(object sender,gsmcomm.gsmcommunication.MessageReceivedEventArgs e)
{
try
{
IMessageIndicationObject obj = e.IndicationObject;
//Get status report for this condition
if (obj is MemoryLocation)
{
MemoryLocation loc = (MemoryLocation)obj;
string stTemp = string.Format("New message received in storage \"{0}\",index {1}.",loc.Storage,loc.Index);
var msg = comm.ReadMessage(loc.Index,loc.Storage);
if (((SmsPdu)msg.Data) is SmsstatusReportPdu)
{
SmsstatusReportPdu data = (SmsstatusReportPdu)msg.Data;
string strTemp2 = "rec msg ref #: " + data.MessageReference;
}
string strTemp3 = msg.Status.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message); //Error:"Message type SmsDeliverReport recognized,but not supported by the SMS decoder."
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)