#region 扫描枪初始化
private void Init_Scanner()
{
try
{
ShowLog("扫描枪初始化...");
m_ScanSerial.PortName = Potting_ini.IniReadValue("system", "ScannerCom");
m_ScanSerial.BaudRate = 9600;
m_ScanSerial.StopBits = StopBits.One;
m_ScanSerial.DataBits = 8;
m_ScanSerial.Parity = Parity.None;
m_ScanSerial.NewLine = "\r";
m_ScanSerial.DtrEnable = true;
MySleep(100);
if (!m_ScanSerial.IsOpen) { m_ScanSerial.Open(); }
m_ScanSerial.Close();
ShowLog("扫描枪初始化完成");
}
catch (Exception)
{
ShowLog("扫描枪初始化失败,请检查串口连接!");
}
}
#endregion
#region 扫描枪读取
private string ReadScanner()
{
string lon = "\x02lon\x03"; // <STX&