通过移动设备发送消息的一些基本理论问题 [英] Some basic theory questions for sending msgs through mobile

查看:68
本文介绍了通过移动设备发送消息的一些基本理论问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法正确理解的一些理论问题,如果有任何机构在这里帮助我,谢谢



some theory question that i could not understand correctly if any body here to help me here thanks

class SmsClass
   {
       SerialPort serialPort;
       public SmsClass(string comPort)
       {
           this.serialPort = new SerialPort();
           this.serialPort.PortName = comPort;
           this.serialPort.BaudRate = 9600; //what is BaudRate and why we use 9600 not other?
           this.serialPort.Parity = Parity.None;//if parity is for error checking then why we set Parity.None? 
           this.serialPort.DataBits = 8;// what is Databits?
           this.serialPort.StopBits = StopBits.One;
           this.serialPort.Handshake = Handshake.RequestToSend;// what is Handshake do?
           this.serialPort.DtrEnable = true;
           this.serialPort.RtsEnable = true;
           this.serialPort.NewLine = System.Environment.NewLine;
       }
       public bool sendSms(string cellNo, string sms)
       {
           string messages = null;
           messages = sms;
           if (this.serialPort.IsOpen == true)
           {
               try
               {
                   this.serialPort.WriteLine("AT" + (char)(13));// why we set char 13?
                   Thread.Sleep(4);
                   this.serialPort.WriteLine("AT+CMGF=1" + (char)(13));//also here char 13?
                   Thread.Sleep(5);
                   this.serialPort.WriteLine("AT+CMGS=\"" + cellNo + "\"");
                   Thread.Sleep(10);
                   this.serialPort.WriteLine(">" + messages + (char)(26));//why we set char 26 here? 
               }
               catch (Exception ex)
               {
                   MessageBox.Show(ex.Source);
               }
               return true;
           }
           else
               return false;
       }







问题

1)什么是BaudRate为什么我们使用9600而不是其他?

2)如果奇偶校验用于错误检查那么为什么我们设置Parity.None?

3)什么是Databits?

4)什么是握手呢?

5)




Questions
1)What is BaudRate and why we use 9600 not other?
2)If parity is for error checking then why we set Parity.None?
3)What is Databits?
4)What is Handshake do?
5)

this.serialPort.WriteLine("AT" + (char)(13));// why we set char 13?





6)this.serialPort.WriteLine(AT + CMGF = 1+(char)(13)); //也在这里char 13?

7)this.serialPort.WriteLine(>+ messages +(char)(26)); //为什么我们在这里设置char 26?



6)this.serialPort.WriteLine("AT+CMGF=1" + (char)(13));//also here char 13?
7)this.serialPort.WriteLine(">" + messages + (char)(26));//why we set char 26 here?

推荐答案

一些答案​​..

1. http://msdn.microsoft。 com / en-us / library / system.io.ports.serialport.baudrate.aspx [ ^ ](检查9600是默认值)

2. http://msdn.microsoft.com/en-us/library/system.io.ports.parity.aspx [ ^ ]

3. http: //msdn.microsoft.com/en-us/library/system.io.ports.serialport.databits.aspx [ ^ ]

4. http://msdn.microsoft.com/en-us/library/system.io.ports.seria lport.handshake.aspx [ ^ ]
Some answers for you..
1.http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.baudrate.aspx[^](Check 9600 is the default value)
2.http://msdn.microsoft.com/en-us/library/system.io.ports.parity.aspx[^]
3.http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.databits.aspx[^]
4.http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.handshake.aspx[^]


1)波特率是com端口的数据传输速率9600位/秒这是大多数设备正常工作的默认值(你可以增加它但你可能会得到错误。)



2)奇偶校验用于错误检查数据,对于大多数通过数据发送较少数据的设备,默认值为none wirre。



3)数据位是流中的位数,二进制传输可以是8位,文本传输可以是7位。



4)握手是发送方和接收方之间用于确定数据传输正确性的协议。



5,6)char 13 =返回键代码相当于按下回车键。



7)char 26 = ctrl + z键终止连接。
1) Baud rate is the data transfer rate for the com port 9600 bits/sec this is the default for most devices which works correctly (you can increase it but you might get errors).

2) Parity is for error checking the data and the default is none for most devices which sends less data over the wirre.

3) Databits are the number of bits in the stream which can be 8 for binary transfer or 7 for text transfer.

4) Handshake is a protocol between the sender and receiver for determining the data transfer correctness.

5,6) char 13 = the return key code equivalent to pressing the enter key.

7) char 26 = ctrl+z key which terminates the connection.


这篇关于通过移动设备发送消息的一些基本理论问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆