Basic usage of GSM MODEM - Send and receive text messages

Step 5: Edit and send the text message by drawing and painting :
Edit template text message :
Click "New Message" in "Toolbar "----"Text Message----" to confirm , after entering the content of the text message, click OK.
Add a phone number :
Right-click in the blank space on the right and select "Insert Recipient Number" , or click "Import Number" in the menu bar, or click the triangle next to "Menu Bar" and select "Insert Recipient Number", and then click "Insert Recipient Number". Enter the phone number in the pop-up dialog box and confirm, a short message queue will appear on the right side, and the newly added text message is displayed as being sent.
As for others, like importing phone numbers, editing MMS, etc., you can study it yourself when you have time.

 

Step 6 : Send SMS by reading the database SMS information
: The database used for sending SMS is mbssendmsg (the case of the table name does not matter), the structure and field information are in the help document, I will not list them one by one here, just say A few useful ones:
SQL for inserting data , let me post a local example here:

insert into MBSSendMsg(Sender,Recipient,MsgLevel,MsgType,Subject,URLs,MMSInfo,MsgStatus,MsgSize,RequestTime,SendStyle,SendTime,SendOutTime,DeliverTime,ScreenHeight,ScreenWidth,ComPort,MsgID,RefID,ExtendInfo,Comments,SMSSendID)values('1','10086',0,1,'测试数据','','',0,8,now(),0,'','','',200,140,1,NULL,'','','','80'),('1','10010',0,1,'测试数据','','',0,8,now(),0,'','','',200,140,1,NULL,'','','','80')

There are many fields, and it seems a bit laborious (it also takes a lot of effort when writing). This SQL adds two pieces of data at one time. Let's break it down so that we know which field corresponds to which value.

insert into MBSSendMsg(Sender,Recipient,MsgLevel,MsgType,Subject,URLs,MMSInfo,MsgStatus,MsgSize,RequestTime,SendStyle,SendTime,SendOutTime,DeliverTime,ScreenHeight,ScreenWidth,ComPort,MsgID,RefID,ExtendInfo,Comments,SMSSendID)values('Sender:1','Recipient:10086', MsgLevel :0, MsgType :1,' Subject:测试数据',' URLs :空',' MMSInfo :空', MsgStatus :0, MsgSize :8, RequestTime :now(),SendStyle :0,' SendTime :空',' SendOutTime :空',' DeliverTime :', ScreenHeight :200, ScreenWidth :140, ComPort :1, MsgID :NULL,' RefID :空',' ExtendInfo :空',' Comments :空',' SMSSendID :80')

Let's talk about some of the useful fields first :
Sender: The sender's number, you can leave it blank, or it can be used to record some useful information. I will use it here to store useful information.
Recipient: Recipient number, required.
MsgLevel: SMS level, 0: Normal sending, 1: Priority sending
MsgType: SMS type, 1-SMS
Subject: SMS content or MMS title
MsgStatus : Sending status, - 3: Non-compliant; -2: No delivery receipt received Information; -1: Failed to send; 0: Request to send; 1: Sending processing; 2: Sending successfully; 3: Message has been delivered. I am 0 here, request to send.
MsgSize: Information size (Bytes)
RequestTime: Request time, here is the current time
SendStyle: Sending type, 0: Instant sending 1: Timing sending. Im sending it here.
SendOutTime : Help document explanation: server submission time, personal understanding: the time when the SMS is successfully sent. No need for our maintenance. After the SMS is sent successfully, the GSM MODEM will automatically modify this field, so that we know when the SMS is sent successfully .
RefID : Help documentation explains: Reference ID. This field does not need to be maintained by us. After successful transmission, it will automatically return a numeric type of data. It is said that GSM MODEM will use Access when sending short messages. Maybe this RefID is the primary key serial number in a certain table of Access. (Purely personal speculation, have time to verify)

 

A few more key or misleading fields :
Misleading :

ComPort : The help document says that the port number is sent. My first impression is: this port number is the port number used when sending text messages. If COM1 is used, write 1 here. If COM3 is used, write 3 here. If the number does not correspond to the actual port number sent, it will fail to send. In fact , this port number does not need to be maintained by us. The channel is set in the image, and which port is used to send this text message. The data is the port number . For example, this field will be automatically modified to 3 after the COM3 used for the channel sends the SMS successfully, and the field used will be modified to 8 after the COM8 used successfully. Nothing to do with the 1/2/3/4 that we wrote ourselves.

 

Criticality :
MsgID : Help document explanation: Message ID. I don't know what it means, but this field must be present. If not, MsgStatus will directly become -3, which means that it does not meet the specification, and the text message will not be sent . My setting here is to set this value to be the same as the primary key serial number, and it must be set before sending a short message (there is a certain time difference between when the data is written into the mbssendmsg table and when the GSM MODEM sends a short message) . After that, you can send normally.
Immediately assigning a primary key sequence number to another value, the first thing that often comes to mind is a trigger.
Here is the trigger method for the SQL Server version:
update MBSSendMsg set MsgID=inserted.IdxNo from inserted where MBSSendMsg.IdxNo=inserted.IdxNo;

mySQL:
update mbssendmsg set MsgID=NEW.IdxNo where mbssendmsg.IdxNo=NEW.IdxNo;
but MySQL This is not allowed . Once defined like this, an error will be reported:
Can't update table 'mbssendmsg' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
The reason is: the trigger in a table You cannot directly perform addition, deletion, and modification operations on the same table to prevent an infinite loop..
Because I used java code to insert directly, so after insert, I updated it again :
update MBSSendMsg set MsgID=IdxNo,MsgStatus=0 where MsgID is null;
(setting MsgStatus to 0 is to avoid the previous MsgID without data MsgStatus becomes -3 and no longer send, becomes 0 request to send).

 

SMSSendID : This field does not exist in the system table of GSM MODEM, and I added it here as needed. Naturally, only one message is edited in a group message, and then the message is split into multiple pieces to be sent separately. After the sending is completed, the sending status and sending time of the message need to be updated. At this time, SMSSendID is very necessary.
For example:
I edited a mass message, recorded it in table1, the primary key serial number is 111, it was split into 3 short messages and stored in the mbssendmsg table, their SMSSendIDs are all 111. When one of the three short messages is successfully sent, it will find the message in table1 through SMSSendID, and then update the status and sending time. (Considering the situation that "three text messages are sent the same except for different recipients, there will be no big trouble", other messy considerations are automatically ignored). This function can be done with triggers. Whether it's SQL Server or MySQL, it's OK (it's the other table being updated not the mbssendmsg table itself, so it can be modified).

The above is to add the correct data to the mbssendmsg table, but the GSM MODEM can't send text messages here, and you need to click "Operation" in the menu bar of the audio-visual interface, "On/Off the transfer service" , However , this function is not available in the trial version, and can only be used after registration .

 

以下说说注册
安装绘声绘彩之后,进入菜单栏的“帮助”----》注册,然后就会弹出如下的框:

把硬件码拷贝出来,发给厂商。
厂商名称:北京人大金仓信息技术有限公司
厂商连接:http://www.smsalert.cn/DOCC/product_dxw.htm
厂商联系方式链接:www.smsalert.cn/DOCC/yd_tech.htm
(大家也可以去网上搜这个厂商)
之后厂商会发回一个dat文件,将这个文件拷贝到绘声绘彩的安装目录下(与VividMMS.exe同级),重启绘声绘彩就注册完成了。


之后,再点击“开/关中转服务”,就能发送mbssendmsg表中的数据啦

 

第七步、收件箱
用的表:mbsrecmsg
其实这个表也不需要我们维护,只要我们数据库里边的表名(大小写无所谓)和字段与要求的一致即可。这样子当GSM MODEM收到短信时它会自动往mbsrecmsg表中写,我们只需要查看就成啦。(这个还是挺不错的)
注意点:表名和字段信息必须高度一致,一旦有些微不一致都收不到消息

基本功能就写到这里啦,其他的功能大家去碰吧,祝好运!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326446828&siteId=291194637