TC35短信发送程序设计

Similar documents
EC51/52 GSM /GPRS MODEN

Microsoft Word - 小心翼翼的二十一點N.doc

27 :OPC 45 [4] (Automation Interface Standard), (Costom Interface Standard), OPC 2,,, VB Delphi OPC, OPC C++, OPC OPC OPC, [1] 1 OPC 1.1 OPC OPC(OLE f

untitled

前言

穨文件1

Visual Basic D 3D

TwinCAT 1. TwinCAT TwinCAT PLC PLC IEC TwinCAT TwinCAT Masc

ThreeDtunnel.doc

<4D F736F F D D342DA57CA7DEA447B14D2DA475B57BBB50BADEB27AC3FEB14DA447B8D5C344>

游戏厅捕鱼技巧_天天酷跑游戏技巧 2048游戏技巧,游戏厅打鱼技巧_

投稿類別:電子工程類

untitled

养鸭实用技术(三)

Microsoft PowerPoint - OPVB1基本VB.ppt

USSD DTMF 14,400 bits/s group3 class 1&2 GPRS for 900/1800/1900 AT 44pin - - 3V SIM SIM RS-232 : - AT (GSM and 07.05) ,20

Microsoft PowerPoint - VB14.ppt

宏电文档

(Methods) Client Server Microsoft Winsock Control VB 1 VB Microsoft Winsock Control 6.0 Microsoft Winsock Control 6.0 1(a). 2

19. 具 有 标 准 有 线 防 区 接 口 有 线 紧 急 按 钮 接 口 外 接 警 号 接 口 20. 电 源 交 直 流 自 动 切 换 : 配 高 效 长 寿 可 充 电 池 组, 平 常 涓 流 充 电, 交 流 停 电 自 动 转 换 三 GSM 联 网 报 警 编 程 操 作 GS

3.1 num = 3 ch = 'C' 2

Excel VBA Excel Visual Basic for Application

VB程序设计教程

3 Driver do Microsoft Access (*.mdb) hisdata IFIX 1.4

2

吳元康

4. 投 资 者 : 指 满 足 证 券 投 资 基 金 合 法 投 资 者 要 求 且 持 有 南 京 银 行 个 人 活 期 存 款 账 户 的 自 然 人 5. 基 金 账 户 : 指 为 提 供 基 金 份 额 登 记 服 务 的 登 记 机 构 为 投 资 者 开 立 的 记 录 其 持

2010年3月计算机等级考试四级网络工程师笔试

四川省普通高等学校


_InfraSuite datacenter_B5_SC_ _print.pdf

CC213

MVB-1001.DOC


Ps22Pdf

VB控件教程大全

2009年3月二级VB语言笔试真题

2 response personnel to speed up the rescue operations after various natural or man-made disasters. Keywords: SMS, Database, Disaster

新 闻 学 46 7 新 闻 传 播 学 院 广 告 学 28 4 广 播 电 视 学 23 3 新 闻 学 广 告 学 ). 级 学 生 申 请 准 入 需 修 完 或 正 在 修 2 门 专 业 准 入 课 程 并 取 得 相 应 学 分 ;2). 级 学 生 申 请 准 入 需

ActiveX Control

新时期共青团工作实务全书(三十九)

串口、网口猫池使用说明书

PowerPoint Presentation

1 Framework.NET Framework Microsoft Windows.NET Framework.NET Framework NOTE.NET NET Framework.NET Framework 2.0 ( 3 ).NET Framework 2.0.NET F

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor

目 录

Visual Basic AD/DA Visual Basic 2

DaoCiDi2003TC ct-P293L02-R

壹:教育文化公益慈善機關或團體免納所得稅適用標準

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

RS-232C [11-13] 1 1 (PLC) (HMI) Visual Basic (PLC) 402

untitled

今天 年春季号 总 92 期

*

( ) / / / / / / /

(Microsoft Word - 8\244T\244\362\277\337\272]\244W\265L\246W.doc)

Microsoft Word - 專家本色 doc


但, 你 应 该 听 过 我 们 走 在 大 路 上 这 首 歌, 或 许 还 知 道 革 命 人 永 远 是 年 轻 那 支 歌 ; 并 且, 几 乎 可 以 肯 定, 你 在 戴 红 领 巾 的 那 阵, 必 然 唱 过 牛 儿 还 在 山 坡 吃 草, 放 牛 的 却 不 知 道 哪 儿 去

2 临 终 助 念 答 问 序 临 终 关 怀, 由 佛 门 净 宗 古 来 祖 师 大 德 提 倡 助 念 往 生, 现 今 已 渐 为 社 会 大 众 所 重 视, 在 台 湾, 台 大 长 庚 等 各 大 医 院, 也 都 设 有 助 念 室 ; 大 陆 上 许 多 道 场, 也 有 专 为

校园之星

<4D F736F F F696E74202D FA8BEA861B8EAB7BDBEE3A658BB50C0B3A5CE28B773A6CBA5AB29>


之 原 則 及 國 防 部 訂 頒 國 軍 列 管 國 有 不 動 產 提 供 非 軍 方 單 位 使 用 處 理 原 則 規 定 不 符, 仍 應 以 出 租 方 式 辦 理 惟 可 就 偏 遠 地 區 提 供 官 兵 金 融 水 電 服 務 使 用 部 分, 研 議 降 低 租 金 標 準, 報

chineseall

釋禪波羅蜜次第法門

证券代码: 证券简称:锦江股份 公告编号:【】

1700 装 卸 搬 运 7645 装 卸 搬 运 服 务 2100 建 筑 7410 工 程 服 务 11% 装 卸 搬 运 服 务, 是 指 使 用 装 卸 搬 运 工 具 或 者 人 力 畜 力 将 货 物 在 运 输 工 具 之 间 装 卸 现 场 之 间 或 者 运 输 工 具 与 装 卸

前 言 教 育 无 小 事, 它 成 就 着 学 生 的 未 来 作 为 教 师, 他 们 无 时 无 刻 不 在 关 注 着 学 生 的 成 长 学 生 的 未 来 学 生 就 像 一 朵 含 苞 待 放 的 花 朵, 需 要 老 师 们 的 细 心 呵 护, 给 学 生 需 要 的 东 西, 而

《盗墓笔记》 南派三叔/著

<CFFBB7D1D5DFD0D0CEAAD1A72E6D7073>

独立学院建设与发展


Microsoft Word - 澎湖田調報告-宏達組9804.doc

平 凡 足 迹 李 本 川 作 者 为 中 国 科 学 院 海 洋 研 究 所 研 究 员,1935 年 生, 山 东 荣 成 人 我 今 年 63 岁 了 大 前 年 丈 夫 和 儿 子 在 一 个 月 内 先 后 离 开 了 人 世, 女 儿 又 已 出 嫁, 现 在 是 孑 然 一 身 我 是

第一章

!"# $% & $%%% ( ")*+,-./00-(11.-. $%! $ " # $ % & ( - ) +%23!"# $%%% %,.%,!" $%.! 1.% & /$ 3(,. ( /0% $%%% ( $%%% ( 3 5 /6%%%! ")*+,-./00-(11

!! "!! "! "!! "! "! "!!#$% & ()*+, -./!000$ 1-2$##0! 3

KPCI KPCI-815 TEL: Fax:

一量动…

<4D F736F F D20D5FDB7A8D2ABD1DB20BAE7B9E2CEDECFDE20C7B0D1D4D0DEB8C4342E31332E646F63>

bnb.PDF

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1

计算机网络与经济(二).doc

教 务 信 息 教 学 日 常 运 行 工 作 4 月 6 日, 教 务 部 高 丽 琴 老 师 参 加 南 昌 市 教 育 局 2016 年 中 小 学 教 师 资 格 认 定 工 作 培 训 会 2016 年 教 师 资 格 认 定 工 作 是 从 省 考 向 国 考 过 渡 后 的 第 一 次

Microsoft PowerPoint ?????????3 [Compatibility Mode]

派遣公司人力資源管理措施對派遣人員離職傾向之影響:

中北大学常规事项财务报销操作指南

Outline USB Application Requirements Variable Definition Communications Code for VB Code for Keil C Practice

<4D F736F F D20D1A7C9FACAD6B2E1B8C4D7EED6D5A3A8B4F8B1EDB8F1BCD3D2B3C2EBB0E6A3A9372E3239>

桂林市劳动和社会保障局关于

第三章 維修及管理

Microsoft Word 年度选拔硕博连读研究生的通知.doc

奥运风云榜(上).doc

(i) (ii) (iii) (i) (ii) (iii) (iv) 1. 2

Bus Hound 5

untitled

1.5招募说明书(草案)

0SQL SQL SQL SQL SQL 3 SQL DBMS Oracle DBMS DBMS DBMS DBMS RDBMS R DBMS 2 DBMS RDBMS R SQL SQL SQL SQL SELECT au_fname,au_ lname FROM authors ORDER BY

(HMI) IO A

Transcription:

http://www.dragonsoft.net.cn/down/project/tc35_sms.rar TC35 AT /down/book/tc35_at.pdf TC35/TC35i GSM Modem TC35 GSM POS COM SIM DOWN COM E, vbcr AT VB6.0 1)C# http://www.yesky.com/softchannel/72342380468109312/20040523/1800310.shtml, 2) PC http://www.knowsky.com/2944.html 3) VB6.0 http://www.pcbookcn.com/article/3061.htm OUTPUT SM( TC35) TC35 AT 1) OK: OK 2) ERROR 3) ( ) 4) 1 12

TC35 Response AT / AT+CMGF=0<vbCr> : AT+CMGF=0<vbCr><vbCrLf>OK<vbCrLf> SM COM TC35 ATE0<vbCr> OK ERROR ( ATE1<vbCr> ) TC35 4 ' MSCOMM ' ' MSCOMM ' msg ' errmsg ' ischeckresult (True,False ) ' ntimeout ( ischeckresult=true ) ' okretmsg "OK" ' errretmsg "ERROR" ' True \ FALSE ' fasle,errmsg Public Function TC35_OutMsg(MSComm As MSComm, _ ByVal Msg As String, _ errmsg As String, _ Optional ByVal ischeckresult As Boolean = True, _ Optional ByVal ntimeout As Long = 6000, _ Optional ByVal okretmsg As String = "OK", _ Optional ByVal errretmsg As String = "ERROR") As Boolean Dim i As Integer, n As Integer Dim rs As String, StartTime As Long With MSComm ' While.InBufferCount > 0 DoEvents rs =.Input Wend ' Buffer.InBufferCount = 0.OutBufferCount = 0.Output = Msg While.OutBufferCount > 0 ', DoEvents Wend If ischeckresult = True Then ' rs = "" 2 12

StartTime = timegettime Do DoEvents rs = rs &.Input If InStr(1, rs, okretmsg) > 0 Then ' errmsg = " [" & Msg & "], " & rs TC35_OutMsg = True ' If InStr(1, rs, errretmsg) > 0 Then ' errmsg = " [" & Msg & "] " & rs TC35_OutMsg = False ' Loop Until StartTime + ntimeout < timegettime ' errmsg = " [" & Msg & "] " ' TC35_OutMsg = False errmsg = " [" & Msg & "] " TC35_OutMsg = True End With SM 2 OK SM, TC35 AT+CMGF=[0 1]+vbCr PDU Mode text Mode text Mode PDU PDU SMS Block Mode 3 12

SMS Etsi GSM 03.40 GSM 03.38 7-bits 160 ; 8-bit 140 ; 16-bit 70 ( ) Unicode(UCS2) 1 86 2 86+ F 3) BCD 2 138 1234 5678 86 8613812345678 F 8613812345678F 2 86 13 81 23 45 67 8F 68 31 18 32 54 76 F8( ) 68 31 18 32 54 76 F8 ( ) ' Private Function TC35_ChangeTelCode(ByVal Mobile As String) As String Dim l As String Dim r As String Dim rs As String Dim i As Integer Dim n As Integer rs = "" n = Len(Mobile) FOr i = 1 To n Step 2 l = Mid(Mobile, i, 1) If i = n Then ', F r = "F" r = Mid(Mobile, i + 1, 1) rs = rs & r & l ' Next i TC35_ChangeTelCode = rs USC2 VB AscW() Hex() USC2. Private Function TC35_ChangeToUSC2 (ByVal s As String) As String Dim i As Integer 4 12

Dim rs As String Dim n As Integer Dim tn As Integer rs = "" FOr i = 1 To Len(s) n = AscW(Mid(s, i, 1)) tn = Abs(n) If tn >= 16 And tn <= 127 Then rs = rs &"00" If tn > 1 And tn < 16 Then rs = rs & "000" rs = rs & Hex(n) ' Mid(s, i, 1) &"="& Hex(n) &"," Next i TC35_ChangeToUSC2 = rs AT+CMGS= 2 AT / 1 AT+CMGS=<datan> + vbcrlf datan TP-Destination-Address + \2 TC35 >, SM 2 <msg>+ FileEof TC35 MSG+ Ctrl+z +CMGS:<n> OK +CMs ERROR <datan> Hex, ( )/2, MSG Address of the SMSC + TP-Destination-Address + Address of the SMSC TC35 SM ( 2 WORD ) 1 1 08(WORD) 2 1 91 TON/NPI 5 12

3 International/E.164 '+' 91 TC35_ChangeTelCode 7. 13800755500( 86), 8613800755500,( 13 BYTE 86 31 08 70 55 05 F0 7 WORD 08 + 91 + 86 31 08 70 55 05 F0 TP-Destination-Address 1, 11 1 TP-Message-Reference, 00 1 13 ( 86 ), 0D 1 11000D91 ( ) TC35_ChangeTelCode 14 1 TP-PID, 00 1 TP-Data-Coding-Scheme, USC2(16bit), 08 1 TP-VP TP-Valid-Period, 00 1 TP-UDL TP-User-Data-Length /2( Hex ) UC2 TC35_ChangeToUSC2 6 12

AT Const PREX = "0891" Const SUFX = "000800" Const CharTimeDelay = 4 Public Declare Function timegettime Lib "winmm.dll" () As Long ' SM ' ' mscomm ' mobile / ( ) ' errmsg, ' CenterNo ' TRUR false ' False, errmsg Public Function TC35_SendSM(MSComm As MSComm, _ ByVal Mobile As String, _ ByVal Msg As String, _ errmsg As String, _ Optional ByVal CenterNo As String = "13800755500" _ ) As Boolean Dim pmsg As String, length As Integer Dim at As String, pdu As String Dim CenterPart As String, TPPart As String, SMPart As String TC35_SendSM = False length = Len(Msg) * 2 If length > 140 Then errmsg = " 70 " CenterNo = TC35_ToServerMobile(CenterNo, errmsg) ' If CenterNo = "" Then ', Mobile = TC35_ToMobile(Mobile, errmsg) ' If Mobile = "" Then pmsg = TC35_ChangeToUSC2(Msg) ' SM USC2 CenterPart = PREX & TC35_ChangeTelCode(CenterNo) ' ' TPPart = "1100" & TC35_ToHex(Len(Mobile), 2) & "91" & TC35_ChangeTelCode(Mobile) ' SMPart = SUFX & IIf(length < 16, "0", "") & Hex(length) & pmsg ' AT SM "> " 1 at = "AT+CMGS=" & ((Len(TPPart) + Len(SMPart)) \ 2) & vbcr If TC35_OutMsg(MSComm, at, errmsg, True, 1000, "> ") = True Then 7 12

' > ", at = CenterPart & TPPart & SMPart & Chr$(26) TC35_SendSM = TC35_OutMsg(MSComm, at, errmsg) ' n Hex,nbits Private Function TC35_ToHex(ByVal n As Integer, Optional ByVal nbits As Integer = 2) As String Dim s As String Dim i As Integer s = Hex(n) FOr i = Len(s) + 1 To nbits s = "0"& s Next i TC35_ToHex = s ',, errmsg Public Function TC35_ToMobile(ByVal Mobile As String, errmsg As String) As String Dim c As String Dim n As Integer Dim i As Integer TC35_ToMobile = "" n = Len(Mobile) If n <> 11 And n <> 12 Then errmsg = " / [" & Mobile & "] 11, ( ) 11 12 ( )" If Left(Mobile, 2) = "13" Then If n <> 11 Then errmsg = " [" & Mobile & "] 11." FOr i = 1 To 11 c = Mid(Mobile, i, 1) If c < "0" Or c > "9" Then errmsg = " [" & Mobile & "] 11." 8 12

Next i errmsg = "" TC35_ToMobile = "86" & Mobile FOr i = 1 To n c = Mid(Mobile, i, 1) If c < "0" Or c > "9" Then errmsg = " ( ) [" & Mobile & "] 11 12." Next i If Left(Mobile, 1) <> "0" Then errmsg = " ( ) 0 ( )" errmsg = "" TC35_ToMobile = "106" & Mobile Public Function TC35_ToServerMobile(ByVal Mobile As String, errmsg As String) As String Dim c As String Dim n As Integer Dim i As Integer TC35_ToServerMobile = "" n = Len(Mobile) If n <> 11 Then errmsg = " [" & Mobile & "] 11 " If Left(Mobile, 2) <> "13" Then errmsg = " [" & Mobile & "] 11, 13." FOr i = 1 To 11 c = Mid(Mobile, i, 1) If c < "0" Or c > "9" Then errmsg = " [" & Mobile & "] 11." Next i 9 12

errmsg = "" TC35_ToServerMobile = "86" & Mobile ' ' ' mscomm ' errmsg ' commport COM ' TRUR false ' false,errmsg Public Function TC35_Init(MSComm As MSComm, errmsg As String, _ Optional ByVal CommPort As Integer = 1) As Boolean On ErrOr GoTo laberr TC35_Init = False With MSComm If.PortOpen = True Then.PortOpen = False '.CommPort = CommPort ' If.PortOpen = False Then.PortOpen = True '.Settings = "9600,n,8,1" ' If TC35_OutMsg(MSComm, "ATE0" & vbcr, errmsg, True, 1000) = True Then ' T35 TC35_Init = TC35_OutMsg(MSComm, "AT+CMGF=0" & vbcr, errmsg, True, 1000) ' PDU End With laberr: errmsg = ", " & Err.Description ' MSCOMM Public Sub TC35_Destory(MSComm As MSComm) With MSComm If.PortOpen = True Then.PortOpen = False End With 10 12

, If TC35_Init(MSComm, errmsg, Port) = True Then b = TC35_SendSM(MSComm, _ txtmobile.text, _ txtmsg.text, _ errmsg, _ txtcenterno.text) s = " " & IIf(b, " ", " ") msgbox s Option Explicit Dim Port As Integer Private Sub bntcancel_click() Unload Me Private Sub bntsend_click() Dim b As Boolean Dim errmsg As String Dim s As String bntsend.enabled = False If TC35_Init(MSComm, errmsg, Port) = True Then StatusBar.Panels(2).Text = " [" & Port & "]..." & vbcrlf b = TC35_SendSM(MSComm, txtmobile.text, txtmsg.text, errmsg, txtcenterno.text) s = " " & IIf(b, " ", " ") txtrs.text = errmsg 11 12

StatusBar.Panels(2).Text = s s = " [" & Port & "] " StatusBar.Panels(2).Text = s txtrs.text = errmsg MsgBox s, vbokonly Or vbinformation, " " bntsend.enabled = True Private Sub Form_Load() txtmsg.text = " AT PC " Port = 1 txtmsg_change Private Sub Form_Unload(Cancel As Integer) Call TC35_Destory(MSComm) // Private Sub optport_click(index As Integer) Port = Index + 1 // Private Sub txtmsg_change() lablen.caption = " " & Len(txtMsg.Text) i. Siemens Technical Product Information TC35 ii. C# 12 12