S社NB30機種向ATCmd
开机splash上有彩条的时候使用
需要等到设备完全进系统后再执行
C#写的首个练手项目
/* NB30 AtCmdXSoftUpdate v0.1
(C)Yuu 2020
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.IO.Ports;
namespace AtCmdXSoftUpdate {
class Program {
static void Main(string[] args) {
Console.WriteLine("Nb30 AtCmdXSoftUpdate v0.1");
SerialPort serialPort = new SerialPort();
serialPort.PortName = "COM30";
serialPort.BaudRate = 115200;
serialPort.DataBits = 8;
serialPort.Parity = Parity.None;
serialPort.StopBits = StopBits.One;
serialPort.Handshake = Handshake.None;
serialPort.ReadTimeout = 500;
serialPort.WriteTimeout = 500;
serialPort.Open();
serialPort.WriteLine("AT+XSOFTUPDATE");
Thread.Sleep(1000);
string response = serialPort.ReadExisting();
if (true == response.Contains("OK")) {
Console.WriteLine("OK.Please wait device reboot!");
} else {
Console.WriteLine("ERROR");
}
serialPort.Close();
}
}
}