/// <summary> /// Инициализация устройства /// </summary> public bool Initialize(string[] ComPorts) { bool res = false; try { for (int i = 0; i < ComPorts.Length; i++) { int s = prim21k.OpenDLL(Encoding.GetEncoding(866).GetBytes(" "), Encoding.GetEncoding(866).GetBytes(""), Encoding.GetEncoding(866).GetBytes(ComPorts[i]), 0); s = prim21k.GetStatus(); prim21k.CloseDLL(); LastAnswer = GetError(s); LastErrorCode = s; if (s == 0) { res = true; Model = KKMModel.Prim21K; ComPort = ComPorts[i]; break; } } } catch (Exception ex) { throw ex; } return(res); }
/// <summary> /// Инициализация устройства /// </summary> public bool Initialize(string ComPort) { bool res = false; try { int s = PRIM21K.OpenDLL(Encoding.GetEncoding(866).GetBytes(" "), Encoding.GetEncoding(866).GetBytes(""), Encoding.GetEncoding(866).GetBytes(ComPort), 0); s = PRIM21K.GetStatus(); PRIM21K.CloseDLL(); LastAnswer = GetError(s); LastErrorCode = s; if (s == 0) { res = true; Model = KKMModel.PRIM21K; } } catch (Exception ex) { throw ex; } return(res); }