C # Write mobile phone software

Source: Internet
Author: User

The first time I spent writing something, I used to read it all the time.

Recently, I have come into contact with Short Message programming. I believe many of my brothers have already achieved this. I just want to write my own experiences.

First, I checked the post on csdn. There were a lot of advertisements, but I didn't believe them :)
I read the classic program written by the silkworm cocoon on the Tianji recommended by everyone, and gained a lot.
Start with the program as the core. I am grateful for the enthusiastic reply from egpscar.

This is an easy-to-learn tutorial.
Http://soft.yesky.com/SoftChannel/72342380468109312/20040523/1800310.shtml

There is also a http://0926.net/archive/sms.htm provided by popcorn (rice flower)
Is there an AT command http://www.cetinet.com/download/list.asp? Id = 179

On the basis of the sample program, I added some control while debugging, which can basically reach 800 entries per hour.
I am using win form and haven't used windowns service for the moment.

Source code
Http://bbs.gzeasy.com/index.php? Showtopic = 275782 if there is no place to upload, the BBS of GZ will be used.

I added
1. multi-threaded processing to ensure that the content read by the COM port can be returned at the same time, instead of waiting until the end of reading an AT command returns to display the result.
2. added a retry operation on the read COM port. One read operation was performed within 50 ms.
3. added a buffer for reading the comport,
After sending a command to the COM port, read the COM port to obtain the returned information. Note that the data read from the COM port is not saved on the COM port. the next read is new. A 50 ms read is performed once, and a protocol-compliant string is formed only when the next read or N reads are put into the buffer, it took me some time to figure it out and make the experts laugh. In this case, OK.

I used my Siemens 3518i mobile phone and bought 30 data lines for selling mobile phone accessories. Then I started debugging.

Here, we will explain that this program has a log record. We can see two data boxes on the interface. The black text and the green text are the sending log, and the white text is the bufferlog. What should I record? This indicates whether the sending failed or succeeded. If it fails, it will be resending. the content to be sent is in the database and the SQL statement is used. The table can be found in the database directory to create a file with the SQL extension.

I sent 200 logs, read several logs, and accept two more logs. It is not ideal, and it is estimated that there are only 400 to logs per hour ~ 600.

Later, I plan to buy a GSM Modem, mainly because of the charging problem, because the interface between my data cable and the charging line is one and I cannot change the battery. episode (I was told later that my cell phone can charge and connect data lines at the same time, but I thought I might need hardware support. I didn't try again after I bought the device)

I don't know where to sell the GSM Modem in Shanghai. I didn't find it anyway. I then made an inquiry on some forums selling such DD, mainly in Beijing and Guangdong, Fujian, that is, we often receive messages from you that you have won the prize. Now we all know that they are sent by the swindlers of Fujian and Guangdong. I guess they are using this type of equipment, but there are more modules, this does not mean that people in a region are ill-spoken. haha

One of them gave me a quote and I didn't dare to buy it right away. I worried that the program could not be used. I asked him to test it for me. The result was not answered for several days, wait for a guy from www.sendsms.com to send me a letter saying they are selling too. I said, you can try it for me. This guy is not installed. net, even Windows Update has never used: (I had to pass him a framework, he tried it for me for one afternoon, and the result was useful. this guy is very enthusiastic, so here is a place for anyone who wants to buy professional equipment. it's an encouragement to his professionalism.

After receiving the device, I immediately tested 100 messages, and it took less than 7 minutes. In this way, it is okay to check that 800 messages are sent in one hour, and the sending end log does not fail or resend, all received mobile phones are also received, with no duplicates.

The difference between the device and the mobile phone is analyzed.
The connection speed of my mobile phone is 19200bps, And the GSM Modem (Wavecom) is only 9600
However, it is mainly stable and fast to respond. For example, my mobile phone may have to wait a little longer to read OK or error. This modem is very fast. I read the log again and print a point. The average number of mobile phones is 7 or 8, and the modem is about 4 or 5. In addition, the phone appears prone to error due to continuous sending, then resend the message. Although the message can be successfully sent at the end, the time is wasted.

Well, this is basically the case. It took less than two weeks before and after. I don't know how to start without the code, therefore, I also provide my code for your reference (after obtaining the consent of the silkworm cocoon), hoping to save the time required by the brothers, without comments, if you have any questions and discussion, you can write to me guanfei@hotmail.com, to Chinese theme, otherwise too many spam I easy to ignore. The next step is to read the message. It is estimated that it will not be too difficult.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.