public override bool ScanTo(int position, WIREMODE wire) { if (position < 0 || position >= 8) { throw new Exception("FLUKE 2560 做多只支持8个通道"); } channel = (position + 1).ToString(); return(true); }
//format is public override bool ScanTo(int position, WIREMODE wire) { if (wire != WIREMODE.MODE_4WIRE) { throw new Exception("扫描器SB148不支持3线测量"); } string spos = position.ToString(); char l = '0'; if (spos.Length >= 3) { l = spos[0]; spos = spos.Remove(0, spos.Length - 2); } char i = '0'; if (spos.Length >= 2) { i = spos[0]; spos = spos.Remove(0, 1); } char m = '0'; if (spos.Length >= 1) { m = spos[0]; spos = spos.Remove(0, 1); } while (true) { try { if (dev.IsConnected()) { dev.Send(String.Format("I{0}L{1}M{2}\r\n", i, l, m), true); Thread.Sleep(300); dev.Send(String.Format("I{0}L{1}M{2}\r\n", i, l, m), true); Thread.Sleep(300); return(true); } } catch { if (DialogResult.Cancel == MessageBox.Show("扫描开关切换失败,请检查连接和电源后按'确定'重试,按'取消'放弃", "错误提示", MessageBoxButtons.OKCancel)) { throw new Exception("扫描开关切换失败"); } } } return(false); }
//position is zero based public override bool ScanTo(int position, WIREMODE wire) { position++; if (position > 12) { return(false); } if (lastmode == wire && lastpos == position) { return(true); } Thread.Sleep(1000); if (wire == WIREMODE.MODE_2WIRE) { dev.Send(String.Format("LFST4012 {0} {1} 0\r", serial, position), true); } else if (wire == WIREMODE.MODE_3WIRE) { dev.Send(String.Format("LFST4012 {0} {1} 1\r", serial, position), true); } else if (wire == WIREMODE.MODE_4WIRE) { dev.Send(String.Format("LFST4012 {0} {1} 2\r", serial, position), true); } else { return(false); } Thread.Sleep(1000); if (lastpos == position)//send command again for the 4012 to enable channel { if (wire == WIREMODE.MODE_2WIRE) { dev.Send(String.Format("LFST4012 {0} {1} 0\r", serial, position), true); } else if (wire == WIREMODE.MODE_3WIRE) { dev.Send(String.Format("LFST4012 {0} {1} 1\r", serial, position), true); } else if (wire == WIREMODE.MODE_4WIRE) { dev.Send(String.Format("LFST4012 {0} {1} 2\r", serial, position), true); } } lastpos = position; lastmode = wire; Thread.Sleep(2000); return(true); }
//format is public override bool ScanTo(int position,WIREMODE wire) { if (wire != WIREMODE.MODE_4WIRE) throw new Exception("扫描器SB148不支持3线测量"); string spos = position.ToString(); char l = '0'; if(spos.Length >=3) { l = spos[0]; spos = spos.Remove(0, spos.Length-2); } char i = '0'; if (spos.Length >= 2) { i = spos[0]; spos = spos.Remove(0, 1); } char m = '0'; if (spos.Length >= 1) { m = spos[0]; spos = spos.Remove(0, 1); } while (true) { try { if (dev.IsConnected()) { dev.Send(String.Format("I{0}L{1}M{2}\r\n", i, l, m), true); Thread.Sleep(300); dev.Send(String.Format("I{0}L{1}M{2}\r\n", i, l, m), true); Thread.Sleep(300); return true; } } catch { if (DialogResult.Cancel == MessageBox.Show("扫描开关切换失败,请检查连接和电源后按'确定'重试,按'取消'放弃", "错误提示", MessageBoxButtons.OKCancel)) throw new Exception("扫描开关切换失败"); } } return false; }
//position is zero based public override bool ScanTo(int position, WIREMODE wire) { position++; if (position > 12) return false; if (lastmode == wire && lastpos == position) return true; Thread.Sleep(1000); if (wire == WIREMODE.MODE_2WIRE) dev.Send(String.Format("LFST4012 {0} {1} 0\r", serial, position), true); else if (wire == WIREMODE.MODE_3WIRE) dev.Send(String.Format("LFST4012 {0} {1} 1\r", serial, position), true); else if (wire == WIREMODE.MODE_4WIRE) dev.Send(String.Format("LFST4012 {0} {1} 2\r", serial, position), true); else return false; Thread.Sleep(1000); if (lastpos == position)//send command again for the 4012 to enable channel { if (wire == WIREMODE.MODE_2WIRE) dev.Send(String.Format("LFST4012 {0} {1} 0\r", serial, position), true); else if (wire == WIREMODE.MODE_3WIRE) dev.Send(String.Format("LFST4012 {0} {1} 1\r", serial, position), true); else if (wire == WIREMODE.MODE_4WIRE) dev.Send(String.Format("LFST4012 {0} {1} 2\r", serial, position), true); } lastpos = position; lastmode = wire; Thread.Sleep(2000); return true; }
public override bool ScanTo(int position, WIREMODE wire) { if (position < 0 || position >= 8) throw new Exception("FLUKE 2560 做多只支持8个通道"); channel = (position+1).ToString(); return true; }
public virtual bool ScanTo(int position, WIREMODE mode) { throw new Exception("Class Scanner cannot be called directly."); }