A C# Class to work with AT commands?

旧时模样 提交于 2020-01-01 14:29:11

问题


Is there a class for AT communication with devices? Like a class which encapsulates AT commands into a .NET interface?

It needs to be also able to parse AT responses such as Network Lists.

Example : +COPS=? returns a list of carriers and it would take some pretty complex regex to actually parse it. Instead of writing my own lib I want to use a premade one.

AT Commands I am refereeing to are these : http://en.wikipedia.org/wiki/Hayes_command_set


回答1:


Try this one: GSM Communication Library. Apart from built in commands it allows you to send any command you need.




回答2:


I hope this also help you. This is c# code to send AT commands to your com port device (mobile phone, etc) This can be used to send sms, etc

//Send SMS
SerialPort serialPort = new SerialPort();
serialPort.BaudRate = 56700;
serialPort.PortName = "COM3";
serialPort.Open();
serialPort.WriteLine("AT+CMGF=1" + Environment.NewLine);//Set Message Format
serialPort.WriteLine("AT+CMGS=" + PhoneNumber + (char)(26));
serialPort.WriteLine(MyMessage + System.Environment.NewLine);
serialPort.Close();


来源:https://stackoverflow.com/questions/2758618/a-c-sharp-class-to-work-with-at-commands

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!