vb 与AT指令

ijianbo 架构师  2002-07-12 04:11:34
在vb里面如何使用AT指令来与gsm modern进行同信呢?比如短消息!
高手给点代码方面的提示!
...全文
102 点赞 收藏 13
写回复
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
houzx 2002-07-16
继续

AT+CMGR Read Message
Syntax: AT+CMGR=<index>
Returns a message with a location value <index> from a preferred message storage <mem1> to the TE.

AT+CMGR=<index>

+CMGR: <stat>, <length>, <CR><LF><pdu>

AT+CMGR=?

(No response)


<mem1>:
Memory from which messages are read and deleted.
<length>:
Integer type value indicating in the text mode, the length of the message body <data> in characters.
<pdu>:
GSM 03.40 SMS-DELIVER or SMS-STATUS-REPORT, or GSM 03.41 CBM in hexadecimal format.

AT+CMGS Send Message
Syntax: AT+CMGS=<length><CR>PDU<ctrl-Z/ESC>
Sends a message from a TE to the network (SMS-SUBMIT). Message reference value <mr> is returned to the TE on successful message delivery.
AT+CMGS=?

(No response)


<length>:
Integer type value indicating in the text mode, the length of the message body <data> in characters.

AT+CMGW Write Message to Memory
Syntax: AT+CMGW=<length>[,<stat>]<CR>PDU<ctrl-/ESC>
Stores a message (either SMS-DELIVER or SMS-SUBMIT) in preferred memory storage <mem2>. The memory location <index> of the stored message is returned. By default, the message status will be set to storedunsent, but parameter the <stat> also allows other status values to be given. The entering of text is done similarly as specified in the command Send Message +CMGS.
AT+CMGW=?

(No response)


<length>:
Integer type value indicating in the text mode, the length of the message body <data> in characters.
<stat>:
Integer type in PDU mode (default 0), or string type in text mode (default "REC UNREAD"); indicates the status of message in memory.
Defined values:
0 "REC UNREAD" received unread message (new message)
1 "REC READ" received read message
2 "STO UNSENT" stored unsent message (only SMs)
3 "STO SENT" stored sent message (only SMs)
4 "ALL" all messages (only applicable to +CMGL command)

回复
houzx 2002-07-16
接上篇


AT+CMGL List Messages
Syntax: AT+CMGL[=<stat>]
Returns messages with a status value <stat> from a preferred message storage <mem1> to the TE.

AT+CMGL[=<stat>]

+CMGL: <index>, <stat>, <oa/da>, [<alpha>], [<scts>][,<tooa/toda>, <length>]<CR><LF><data> [<CR><LF>
+CMGL: <index>, <stat>, <da/oa>, [<alpha>], [<scts>][,<tooa/toda>, <length>]<CR><LF><data> [...]]

AT+CMGL=?

+CMGL: (list of supported <stat>'s)


<stat>:
Integer type in PDU mode (default 0), or string type in text mode (default "REC UNREAD"); indicates the status of message in memory.
Defined values:
0 "REC UNREAD" received unread message (new message)
1 "REC READ" received read message
2 "STO UNSENT" stored unsent message (only SMs)
3 "STO SENT" stored sent message (only SMs)
4 "ALL" all messages (only applicable to +CMGL command)
<index>:
Integer type; value in the range of location numbers supported by the associated memory.
<mem1>:
Memory from which messages are read and deleted.
<oa>:
TP-Originating-Address Address-Value field in a string format.
<da>:
TP-Destination-Address Address-Value field in a string format.
<alpha>:
String type alphanumeric representation of <da> or <oa> corresponding to the entry found in MT. (Not supported).
<scts>:
TP-Service-Centre-Time-Stamp in a time-string format.
<tooa>:
TP-Originating-Address Type-of-Address octet in an integer format (default refer <toda>).
<toda>:
TP-Destination-Address Type-of-Address octet in an integer format.
<length>:
Integer type value indicating in the text mode, the length of the message body <data> in characters.
<data>:
TP-User-Data in text mode responses.

AT+CMGR Read Message
Syntax: AT+CMGR=<index>
Returns a message with the location value <index> from a preferred message storage <mem1> to the TE.

AT+CMGR=<index>
SMS SUBMIT:

+CMGR: <stat>, <oa>, [<alpha>], [<scts>],[,<tooa>, <fo>, <pid>, <dcs>, <sca>, <tosca>, <length>]<CR><LF><data>

SMS DELIVER:

+CMGR: <stat>, <da>, [<alpha>] [,<toda>, <fo>, <pid>, <dcs>, [<vp>], <sca>, <tosca>, <length>]<CR><LF><data>

AT+CMGR=?

(No response)


<mem1>:
Memory from which messages are read and deleted.
<oa>:
TP-Originating-Address Address-Value field in a string format.
<da>:
TP-Destination-Address Address-Value field in a string format.
<alpha>:
String type alphanumeric representation of <da> or <oa> corresponding to the entry found in MT. (Not supported).
<scts>:
TP-Service-Centre-Time-Stamp in a time-string format.
<tooa>:
TP-Originating-Address Type-of-Address octet in an integer format (default refer <toda>).
<toda>:
TP-Destination-Address Type-of-Address octet in an integer format.
<fo>:
Depending on the command or result code: first octet of SMS-DELIVER, SMS-SUBMIT (default 17), SMS-STATUS- REPORT in an integer format.
<pid>:
TP-Protocol-Identifier in an integer format (default 0).
<dcs>:
SMS Data Coding Scheme (default 0).
<vp>:
Depending on the SMS-SUBMIT <fo> setting: TP-Validity-Period either in an integer format (default 167), or in a time-string format.
<sca>:
RP SC address Address-Value field in a string format.
<tosca>:
RP SC address Type-of-Address octet in an integer format (default refer <toda>)
<length>:
Integer type value indicating in the text mode, the length of the message body <data> in characters.
<data>:
TP-User-Data in text mode responses.

AT+CMGS Send Message
Syntax: AT+CMGS=<da>[,<toda>]<CR>text<ctrl-Z/ESC>
Sends a message from a TE to the network (SMS-SUBMIT). Message reference value <mr> is returned to the TE on successful message delivery. Sending can be cancelled by using the <ESC> character. <ctrl-Z> must be used to indicate the ending of the message body.
AT+CMGS=?

(No response)


<da>:
TP-Destination-Address Address-Value field in a string format.
<toda>:
TP-Destination-Address Type-of-Address octet in the integer format.

AT+CMSS Send Message from Storage
Syntax: AT+CMSS=<index>[,<da>[,<toda>]]
Sends a message with the location value <index> from a preferred message storage <mem2> to the network (SMS- SUBMIT). If a new recipient address <da> is given, it shall be used instead of the one stored with message. Reference value <mr> is returned to TE on successful message delivery.
AT+CMSS=?

(No response)


<da>:
TP-Destination-Address Address-Value field in a string format.
<toda>:
TP-Destination-Address Type-of-Address octet in an integer format.
<mem2>:
Memory in which writing and sending operations are executed.

AT+CMGW Write Message to Memory
Syntax: AT+CMGW=<oa/da>[,<tooa/toda>[,<stat>]]<CR>text<ctrl-Z/ESC>
Stores a message (either SMS-DELIVER or SMS-SUBMIT) in a preferred memory storage <mem2>. Memory location <index> of stored message is returned. By default, message status will be set to "stored unsent", but parameter <stat> also allows other status values to be given. Entering of text is done similarly as specified in command Send Message AT+CMGS.
AT+CMGW=?

(No response)


<stat>:
Integer type in PDU mode (default 0), or string type in text mode (default "REC UNREAD"); indicates the status of message in memory.
Defined values:
0 "REC UNREAD" received unread message (new message)
1 "REC READ" received read message
2 "STO UNSENT" stored unsent message (only SMs)
3 "STO SENT" stored sent message (only SMs)
4 "ALL" all messages (only applicable to +CMGL command)
<mem2>:
Memory in which writing and sending operations are executed.
<oa>:
TP-Originating-Address Address-Value field in a string format.
<da>:
TP-Destination-Address Address-Value field in a string format.
<tooa>:
TP-Originating-Address Type-of-Address octet in an integer format (default refer <toda>)
<toda>:
TP-Destination-Address Type-of-Address octet in an integer format.


AT+CMGD Delete Message
Syntax: AT+CMGD=<index>
Deletes a message from preferred message storage <mem1> location <index>.
AT+CMGD=?

(No response)


<mem1>:
Memory from which messages are read and deleted.

SMS PDU Mode

AT+CMGL List Messages
Syntax: AT+CMGL[=<stat>]
Returns messages with a status value <stat> from a preferred message storage <mem1> to the TE.

AT+CMGL[=<stat>]

+CMGL: <index>, <stat>, <length><CR><LF><pdu> [<CR><LF>+CMGL: <index>, <stat>, <length>]<CR><LF><pdu> [...]]

AT+CMGL=?

+CMGL: (list of supported <stat>'s)


<stat>:
Integer type in PDU mode (default 0), or string type in text mode (default "REC UNREAD"); indicates the status of message in memory.
Defined values:
0 "REC UNREAD" received unread message (new message)
1 "REC READ" received read message
2 "STO UNSENT" stored unsent message (only SMs)
3 "STO SENT" stored sent message (only SMs)
4 "ALL" all messages (only applicable to +CMGL command)
<index>:
Integer type; value in the range of location numbers supported by the associated memory.
<mem1>:
Memory from which messages are read and deleted.
<length>:
Integer type value indicating in the text mode, the length of the message body <data> in characters.
<pdu>:
GSM 03.40 SMS-DELIVER or SMS-STATUS-REPORT, or GSM 03.41 CBM in hexadecimal format.

回复
houzx 2002-07-16
你想要什么呢?
只要会串口编程即可,和手机连接可用数据线或红外接口,红外接口可模拟成虚拟串口,直接编程也行,不过我不会,AT命令给你一份Nokia的吧(只包括SMS的):
AT+CSMS Select Message Service
Syntax: AT+CSMS=<service>
Selects the messaging service <service>. It returns the types of messages supported by the ME.

AT+CSMS?

+CSMS: <mt,mo,bm>

AT+CSMS=?

+CSMS: (list of <service>'s supported by the data card).

<service>:
0 GSM 03.40 and 03.41

<mt>, <mo>, <bm>:
0 type not supported
1 type supported

<mt>: mobile terminated messages
<mo>: mobile originated messages
<bm>: broadcast type messages

AT+CPMS Preferred Message Storage
Syntax: AT+CPMS=[<mem1>[,<mem2>[,<mem3>]]]
Selects memory storages <mem1>, <mem2>, and <mem3> to be used for reading, writing, etc.

AT+CPMS=<mem1>[,<mem2>[,<mem3>]]

+CPMS: <used1>, <total1>, <used2>, <total2>, <used3>, <total3>

AT+CPMS?

+CPMS: <mem1>, <used1>, <total1>, <mem2>, <used2>, <total2>, <mem3>, <used3>, <total3>

AT+CPMS=?

+CPMS: (list of supported <mem1>'s), (list of supported <mem2>'s), (list of supported <mem3>'s)


<mem1>: Memory from which messages are read and deleted.

"ME" ME message storage
"SM" SIM message storage

<mem2>: Memory in which writing and sending operations are executed.

"ME" ME message storage
"SM" SIM message storage

<mem3>: Memory in which received SMS messages are preferably to be stored.

"MT" Any of the storages associated with the ME.

AT+CMGF Message Format
Syntax: AT+CMGF=[<mode>]
Tells the data card, which input and output format of messages to use. <mode> indicates the format of messages used with send, list, read and write commands.

AT+CMGF=[<mode>]

(No response)

AT+CMGF?

+CMGF: <mode>

AT+CMGF=?

+CMGF: (list of supported <mode>'s)


<mode>:
0 PDU mode
1 text mode

AT+CSCA Service Centre Address
Syntax: AT+CSCA=<sca>[,<tosca>]
Updates the SMSC address, through which mobile originated SMS messages are transmitted. Used both in the PDU and text mode.

AT+CSCA=<sca>[,<tosca>]

(No response)

AT+CSCA?

+CSCA: <sca>, <tosca>

AT+CSCA=?

(No response)

<sca>:
RP SC address Address-Value field in string format.
<tosca>:
RP SC address Type-of-Address octet in integer format (default refer <toda>).

AT+CSMP Set Text Mode Parameters
Syntax: AT+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]]
Used to select values for additional parameters needed when SMS messages are sent to the network, or placed in a storage when the text format message mode is selected.

AT+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]

(No response)

AT+CSMP?

+CSMP: <fo>,<vp>,<pid>,<dcs>

AT+CSMP=?

(No response)


<fo>:
Depending on the command or result code: first octet of SMS-DELIVER, SMS-SUBMIT (default 17), SMS-STATUS- REPORT in integer format.
<vp>:
Depending on SMS-SUBMIT <fo> setting: TP-Validity- Period either in integer format (default 167) or in time-string format.
<pid>:
TP-Protocol-Identifier in integer format (default 0).
<dcs>:
SMS Data Coding Scheme (default 0).

AT+CSDH Show Text Mode Parameters
Syntax: AT+CSDH=[<show>]
Controls whether detailed header information is shown in text mode result codes.

AT+CSDH=[<show>]

(No response)

AT+CSDH?

+CSDH: <show>

AT+CSDH=?

+CSDH: (list of supported <show>'s)

<show>:
0

do not show header values defined in commands +CSCA and +CSMP (<sca>, <tosca>, <fo>, <vp>, <pid> and <dcs>) nor <length>, <toda> or <tooa> in +CMT, +CMGL, +CMGR result codes for SMSPP text mode

1

show all the values in result codes

AT+CSCB Select Cell Broadcast Message Types
Syntax: AT+CSCB=[<mode>[,<mids>[,<dcss>]]]
Selects which types of CBM's are to be received by the ME.

AT+CSCB=[<mode>[,<mids>[,<dcss>]]]

(No response)

AT+CSCB?

+CSCB: <mode>, <mids>, <dcss>

AT+CSCB=?

+CSCB: (list of supported <mode>'s)


<mode>:
0 message types specified in <mids> and <dcss> are accepted
1 message types specified in <mids> and <dcss> are not accepted

<mids>:
string type; all different possible combinations of CBM message identifiers; default is an empty string. E.g.: 0,1,5,10-20,22"
<dcss>:
string type; all different possible combinations of CBM data coding schemes; default is an empty string. E.g.: 0-3,5"

AT+CSAS Save Settings
Syntax: AT+CSAS[=<profile>]
Saves active message service settings to a non-volatile memory.

AT+CSAS[=<profile>]

(No response)

AT+CSAS=?

+CSAS: (list of supported <profiles>'s)

<profile>:
0

profile number where settings are to be stored

AT+CRES Restore Settings
Syntax: AT+CRES[=<profile>]
Restores message service settings from a non-volatile memory to active memory.

AT+CRES[=<profile>]

(No response)

AT+CRES=?

+CRES: (list of supported <profile>'s)

<profile>:
0

profile number from where settings are to be restored.

AT+CNMI New Message Indications to TE
Syntax: AT+CNMI=[<mode>[,<mt>[,<bm>[,<ds>[,<bfr>]]]]]
Selects the procedure, for how the receiving of new messages from the network is indicated to the TE when the TE is active.

AT+CNMI=[<mode>[,<mt>[,<bm>[,<ds>[,<bfr>]]]]]

(No response)

AT+CNMI?

+CNMI: <mode>, <mt>, <bm>, <ds>, <bfr>

AT+CNMI=?

+CNMI: (lists of supported (<mode>'s), (<mt>'s), (<bm>'s), (<ds>'s), (<bfr>'s))

<mode>:
1

Discard indication and reject new received message unsolicited result codes, when the TA-TE link is reserved.

<mt>:
0

No SMS-DELIVER indications are routed to the TE.

1

Indication of SMS-DELIVER is routed to the TE using an unsolicited result code:+CMTI: <mem>,<index>

2

SMS-DELIVERs (except class 2 messages) are routed directly to the TE using an unsolicited result code:+CMT:[<alpha>],<length> <CR><LF><pdu> (PDU mode enabled), or +CMT: <oa>, [<alpha>],<scts>[,<tooa>,<fo>,<pid>,<dcs>,<sca>,<tosca>, <length>]<CR><LF><data> (text mode enabled; refer to the command Show Text Mode Parameters +CSDH).Class 2 messages result in an indication as defined in <mt>=1.

3

Class 3 SMS-DELIVERs are routed directly to the TE using an unsolicited result codes defined in <mt>=2. Messages of other classes result in an indication as defined in <mt>=1.

<bm>:
0

No CBM indications are routed to the TE.

2

New CBMs are routed directly to the TE using an unsolicited result code: +CBM:<length><CR><LF><pdu> (PDU mode enabled) or +CBM:<sn>,<mid>,<dcs>, <page>,<pages><CR><LF><data> (text mode enabled)

<ds>:
0

No SMS-STATUS-REPORTs are routed to the TE.

1

SMS-STATUS-REPORTs are routed to the TE using an unsolicited result code:+CDS:<length><CR><LF><pdu> (PDU mode enabled) or +CDS: <fo>,<mr>,[<ra>], [<tora>], <scts>,<dt>,<st> (text mode enabled)

<bfr>:
0

TA buffer of an unsolicited result codes defined within this command is flushed to the TE when <mode> 1...3 is entered. TA buffer is not implemented.

1

TA buffer of unsolicited result codes defined within this command is cleared when <mode> 1...3 is entered.
回复
smilejiangjun 2002-07-16
我只有一般modern通讯的东东
不知道对你是否有用
回复
ijianbo 2002-07-16
to smilejiangjun:

呵呵,我需要对 gsm moderm进行通讯方面的编程,gsm moderm与计算机的串口连接,通过开发的软件控制 gsm moderm 发送短消息.

类似下面的帖子的内容:
http://www.csdn.net/expert/topic/544/544517.xml?temp=.2882654
回复
ijianbo 2002-07-16
看来只有我自己研究了!;-)
回复
smilejiangjun 2002-07-16
不知道你要做什么东西
我做过用mscomm控件进行moderm通信传输数据的东西
回复
houzx 2002-07-16
串口通信,可用MsComm控件
回复
hnpeter 2002-07-15
再帮你顶一下
回复
ijianbo 2002-07-15
呵呵,没人可以帮我么?
回复
hnpeter 2002-07-12
关注.............
回复
heruzhi 2002-07-12
up
gz
回复
FranklinBHU 2002-07-12
帮你up一下
回复
发动态
发帖子
VB基础类
创建于2007-09-28

7453

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告