• PDU短信发送编码程序(C#)

    程序中的sp是SerialPort类型的对象,在System.IO.Ports命名空间下 //手机号码转换为pdu模式 private string telc(string MobileNum) { int tl; string ltem, rtem, ttem; int ti; ttem = ""; tl = MobileNum.Trim().Length; if (tl != 11 && tl != 13) { MessageBox.Show("wrong number:" + MobileNum); return ""; } if (tl == 11) // 11位转换为13位 { tl += 2; MobileNum = "86" + MobileNum; } for (ti = 0; ti < tl; ti += 2) { ltem = MobileNum.Substring(ti, 1); if (ti == tl - 1) { rtem = "F"; } else { rtem = MobileNum.Substring(ti + 1, 1); } ttem += rtem + ltem; //每两位颠倒 } return ttem; } //Unicode解码函数 private string ascg(string smsg) { string res=""; string ls; string rs; byte[] resByte = System.Text.UnicodeEncoding.Unicode.GetBytes(smsg); for (int i = 0; i < resByte.Length ; i+=2) { ls = resByte[i].ToString("X2"); rs = resByte[i + 1].ToString("X2"); res = res + rs + ls; //注意这里高低位颠倒 } return res.Trim(); }

    4
    201
    3KB
    2010-06-19
    33
  • 诺基亚C#利用SerialPort收发信息

    Created by Noah Coad See blog post: http://msmvps.com/blogs/coad/archive/2005/03/23/39466.aspx ====== Ports Added/Removed Scenarios (on timer tick) ====== Assumptions: If a port is opened, it is the currently selected port 1. No Change Do nothing. 2. Port is Open, New Ports Added Refresh port list, but keep the currently selected port selected 3. Port is Open, Existing Ports Removed, One removed was currently selected Refresh port list, but keep the currently selected port selected 4. Port is Open, Existing Ports Removed, None of removed ones were currently selected Close current port, refresh port list, select a new default port 5. Port is Closed, New Ports Added Refresh port list, new selected default is the highest of the most recently added ports 6. Port is Closed, Existing Ports Removed, One removed was currently selected Refresh port list, selected default is the highest of the current list of ports 7. Port is Closed, Existing Ports Removed, None of removed ones were currently selected Refresh port list, selected default is the highest of the current list of ports

    4
    41
    23KB
    2010-06-19
    9
  • 手机通讯,短信PUD编码/解码开发

    SMS with the SMS PDU-mode ...................................................................................................... 1 编者序................................................................................................................................ 3 版本变动历史 ...................................................................................................................... 4 1、绪论............................................................................................................................... 5 2、缩写词............................................................................................................................ 6 3、设置指令........................................................................................................................ 7 3.1 服务中心号码 (+CSCA) ...................................................................................... 7 3.2 选择消息服务 (+CSMS)...................................................................................... 7 3.3 选择消息格式 (+CMGF)...................................................................................... 8 4、SMS 文本模式................................................................................................................ 9 5、SMS PDU 模式............................................................................................................... 9 5.1 发送方SMS-Submit (Mobile Originated) ................................................................... 9 5.1.1 向SIM 卡存储区写入一条SMS (+CMGW) ................................................ 10 5.1.2 发送SIM 卡存储区中的一条SMS (+CMSS)............................................... 10 5.1.3 直接从终端设置发送SMS (+CMGS) ..........................................................11 5.2 接收方 SMS-DELIVER (Mobile Terminated)........................................................... 12 5.2.1 列取消息(+CMGL)................................................................................... 12 5.2.2 读取消息(+CMGR)................................................................................... 12 5.2.3 删除消息(+CMGD) .................................................................................. 13 6、SMS PDU 基本组成元素.............................................................................................. 13 6.1 发送方PDU 格式SMS-SUBMIT-PDU (Mobile Originated)....................................... 14 6.2 接受方PDU 格式 SMS-DELIVER-PDU (Mobile Terminated) ................................... 14 6.3 SCA 短消息服务中心地址格式.............................................................................. 15 6.4 PDU Type(第一个八位位组)............................................................................... 16 6.5 MR 信息参考 (Message Reference)......................................................................... 17 6.6 DA/OA 接收方地址与发送方地址.......................................................................... 17 6.7 PID 协议标识 (Protocol-Identifier).......................................................................... 18 6.8 DCS 数据编码方案 (DataCoding-Scheme) .............................................................. 18 6.9 VP 信息有效期(Validity Period) ......................................................................... 19 6.10 SCTS 服务中心时间戳(Service Center TimeStamp)............................................ 20 6.11 UDL 用户数据长度 (User-Data-Length (Amount of Characters)).............................. 20 7、常用 AT 指令.............................................................................................................. 20 8、PDU 操作实例.............................................................................................................. 21 8.1 准备工作.............................................................................................................. 21 8.2 连接手机.............................................................................................................. 22 8.3 发送PDU SMS ..................................................................................................... 22 9、SMS 编码方案与编程实现............................................................................................ 25 附..................................................................................................................................... 27 Message service error.................................................................................................... 27 error codes:.................................................................................................................. 27 默认的字符表 ............................................................................................................. 29

    3
    131
    617KB
    2010-06-07
    3
关注 私信
上传资源赚积分or赚钱