使用pdu格式通过gsm调制解调器发送波斯短信 [英] use pdu format for send persian sms by gsm modem

查看:107
本文介绍了使用pdu格式通过gsm调制解调器发送波斯短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我

if (!comPort.IsOpen)
               comPort.Open();
           comPort.DiscardInBuffer();
           comPort.DiscardOutBuffer();





atCommandStr = "AT";
           comPort.WriteLine(atCommandStr + (char)13);
           messageTXT.Text = comPort.ReadExisting();
            //baraye moshakas kardan halate PDU
           atCommandStr = "AT+CMGF=0";
           comPort.WriteLine(atCommandStr + (char)13);
           messageTXT.Text = comPort.ReadExisting();
           atCommandStr = "AT+CMGS=20";
           comPort.WriteLine(atCommandStr + (char)13);
           messageTXT.Text = comPort.ReadExisting();


string path;
           //path = "0681398647575611000B819083660786F00008FF06062A0633062A" + Char.ConvertFromUtf32(26);
           path = "0681398647575611000B819083660786F00008FF06062A0633062A" + Char.ConvertFromUtf32(26);
           comPort.WriteLine(path + (char)13);
           //read immediately response
           messageTXT.Text = comPort.ReadExisting();
           comPort.Close();


运行此代码,但不发送短信
问题出在哪里?


run this code but do not send sms
where is problem ?

推荐答案

也许您在PDU消息中缺少时间戳.

0681398647575611000B819083660786F00008FF06062A0633062A转换为:


SMSC#9368747565
发件人:09386670680
TP_PID:00
TP_DCS:08
TP_DCS-popis:未压缩的文本
类别:"0"
字母:UCS2(16)bit
تست
长度:3


查看此链接:

在线PDU编码器和解码器 [用于解码/编码SMS PDU的库 [ http://www.dreamfabric.com/sms/ [
Perhaps you are missing a timestamp in the PDU message.

0681398647575611000B819083660786F00008FF06062A0633062A is converted to:


SMSC#9368747565
Sender:09386670680
TP_PID:00
TP_DCS:08
TP_DCS-popis:Uncompressed Text
class: "0"
Alphabet:UCS2(16)bit
تست
Length:3


Check out this links:

Online PDU Encoder and Decoder[^]

Library for Decode/Encode SMS PDU[^]

http://www.dreamfabric.com/sms/[^]


而不是:

Instead of:

path = "0681398647575611000B819083660786F00008FF06062A0633062A" + Char.ConvertFromUtf32(26);
comPort.WriteLine(path + (char)13);



做:



do:

path = "0681398647575611000B819083660786F00008FF06062A0633062A";
char eof = Convert.ToChar( 26 );
comPort.Write( path + eof );



最好的问候


编辑.
我刚刚检查了您的pdu长度.



best regards


edit.
i just checked your pdu length.

atCommandStr = "AT+CMGS=20";



应该是



should be

atCommandStr = "AT+CMGS=26";



一般而言:
AT + CMGS =(pduString.Length/2)-1



in general:
AT+CMGS = (pduString.Length / 2) - 1


感谢所有
我发现我的问题
当Pdu中的解码必须发送Sumber Be Whitout 0
例如

发送至:935421542
讯息:دلتاسافت

Pdu代码:00110009A139451245F20008AA12062F0644062A06270020063306270641062A

解码后:

Thanks From All
I Find My Problem
When Decode In Pdu Must Send Sumber Be Whitout 0
For Example

Send To:935421542
Message:دلتا سافت

Pdu Code:00110009A139451245F20008AA12062F0644062A06270020063306270641062A

After Decode:

Service center number:
Service center time stamp: 01/01/0001 12:00:00 ق.ظ
Message reference #: 0
Direction: Submited
Phone number: 935421542
Status report indication: False
Message:
دلتا سافت



此Pdu格式为真



This Pdu Format Is True


这篇关于使用pdu格式通过gsm调制解调器发送波斯短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆