Hand to create an enterprise SMS platform (on)

xiaoxiao2021-03-06  55

Author: dever (For reference, please indicate the source!)

Preface: This article is just to explore the idea of ​​constructed SMS platforms, do not focus on discussing some technologies, if there is any questions mentioned in the article, please read the relevant information. Today, in today's communication, SMS has become an important means of communicating, compared to traditional communication methods such as e-mail, telephone, and the advantage of being unplanned. More and more companies have begun to choose to use SMS platforms to conduct corporate promotion, industry applications, system integration, and more.

When you decide to construct a company's SMS platform, you face the following options: First, access the mobile operator SMS center or SMS gateway via the Internet or special line; Center (such as Sina, Netease SP service provider); three is to send short messages connected to the phone; fourth is to send short messages through multi-channel SMS dedicated devices (GSM MODEM pool). In general, the first way has the advantage of high delivery speed, success rate and reliability. For the first choice, followed by the fourth way. However, it is apparent that these two methods are not what our ordinary people can get into contact, let alone DIY, so today I want to introduce the third, using the mobile phone built-in GSM-Modem build SMS platform.

Let me introduce my development environment:

Hardware: Siemens M55 mobile phone, mobile phone data cable (USB interface, virtual COM port), Benq Joybook5000 notebook. Software System: Windows XP Operating System, .NET FRAMWORK 1.1 Development Tool: vs.net2003

If you are the first time you contact serial programming, then it is best to make some basic knowledge: serial port programming, usually using the AT command. The mobile phone is best to use the famous brand of Siemens, Nokia, Ericsson and other famous brands. The data cable is minimized as possible to ensure its stability. Even the data line, after installing the mobile phone driver, remember to see which port of your phone is connected, set it for a while.

(Figure 1: My mobile port is com3) OK, until all preparations have been completed, before the official start, we also need to test it, see if you can communicate with your computer, or you have finished the program. I can't communicate, I can't cry, I can't cry. I use the test tool is "super terminal" comes with Windows. Create a new connection, set the port number and port parameters, and the port parameters are determined according to the parameters of your phone. Basically select the default parameter. There is a window similar to the following picture after connection: (Figure 2: Super terminal debug window) Try a AT instruction, return OK, you can represent your phone and PC. This tool is still very useful, most of you need to test the AT command here.

Everything is available, Dongfeng is also available. We now began to build a SMS platform, the first step is to make a small program that can make a short message. First finish the ideas, you need to send a short message, you need to send a message to the serial port. If you want to send a message, you must be able to communicate with serial communication. The problem seems to be very clear, first find a class package that can be communicated with serial communication. (Unfortunately, there is no such class in C #, I saw a Blog written to VB.Net 2005, I didn't know if C # 2005 would not join such a class.) The network is Very much, but most of them have no source code and charge, this obviously there is a spirit of diy, no need.

Finally, I found two serial port operations on GotdotNet. The source and information in China are really too few: (. In the way, thank these original creators, if they are not their hard work, we can have hard work. Found Two serial operations are Justinio and SerialStreamReader.justinio are simple and easy to use classes, quite good. SERIALSTREAMReader is a serial debugging tool, so it can basically replace Windows "Super Terminal". As the core of it - SeriesTream Directly inherited from the Stream class, which brings a lot of convenience to our operations, but I found that using remoting to call this class, it will cause the service process deadlock, how many regrets. (These two classes The package is provided below) With these two classes, we can communicate with the serial port in the program written by itself, but can communicate not to send text messages, because any communication will have an agreement, but The communication protocol here is the three modes that I want to introduce short messages to you. These three modes are Block mode, Text mode, and PDU mode. Block mode: The mobile phone manufacturer is required to provide driver support, has been eliminated .Text mode: Simple and easy, do not need to be encoded, but only ASCII code, support less mobile phone, more common in the Nokia phone.pdu: Support this mode mobile phone, good compatibility, but you need to encode conversion .

After reading the introduction above, there is no doubt that our choice is only PDU. There are many examples of PDU coding on the Internet. I refer to a piece of silkworm mice written in the article "C # development of terminal SMS principle and method", there is still behind the article The author writes Demo, I believe that people who will bring a big friend who have been programmed to serial port (including me, thank you silkworm cocoon). The serial communication class with his Demo is Justinio.

It seems that there is no big problem, do our procedure, open vs.net, new project, guide the you need to use, you can start ~~

This is a Demo I did, and it is simple, but as a test, the function is enough, and the source code of this DEMO is available next time.

So fast, a program that can send a short message is coming, is it very accomplishment ~~ Oh, I will be intoxicated for a while. We continue next time.

Code download:

Serial communication component: Justinio.rar SerialStream.rar

转载请注明原文地址:https://www.9cbs.com/read-114681.html

New Post(0)