/// <summary> /// TCP/IP 연결용 객체 생성 /// </summary> /// <param name="strIP"></param> /// <param name="intPort"></param> public clsBarcodePrinter(string strIP, int intPort) { clsTcp = new Function.Comm.SocketClient(strIP, intPort); clsTcp.evtReceived = new Function.Comm.SocketClient.delReceive(ReceiveAck); clsSn = null; Init(); }
/// <summary> /// Serial 연결용 객체 생성 /// </summary> /// <param name="portName"></param> /// <param name="baudRate"></param> /// <param name="parity"></param> /// <param name="dataBits"></param> /// <param name="stopBits"></param> public clsBarcodePrinter(string portName, int baudRate, string parity, int dataBits, string stopBits) { strCom = portName; clsSn = new Function.Comm.Serial(portName, baudRate, parity, dataBits, stopBits); clsSn.OnDataReceived += new Function.Comm.Serial.delReceive(ReceiveAck); clsTcp = null; Init(); }
public void Dispose() { this.Close(); if (clsSn == null) { clsTcp = null; } else { clsSn = null; } }
private void InitXml(string strNode, XML xml) { Init(); xml.chNode2Root(); xml.chSingleNode(strNode); LoadFormatFromXml(xml.GetSingleNodeValue("FORMAT")); if (xml.GetSingleNodeValue("TYPE") == "TCP") { xml.chSingleNode(@"TCP"); string strIP = xml.GetSingleNodeValue("IP"); int intPort = int.Parse(xml.GetSingleNodeValue("PORT")); clsTcp = new Function.Comm.SocketClient(strIP, intPort); clsTcp.evtReceived += new Function.Comm.SocketClient.delReceive(ReceiveAck); clsSn = null; } else { xml.chSingleNode(@"SERIAL"); strCom = xml.GetSingleNodeValue("COMPORT"); string strBaudrate = xml.GetSingleNodeValue("BAUDRATE"); string strPARITY = xml.GetSingleNodeValue("PARITY"); string strDATABITS = xml.GetSingleNodeValue("DATABITS"); string strSTOPBITS = xml.GetSingleNodeValue("STOPBITS"); clsSn = new Function.Comm.Serial(strCom, int.Parse(strBaudrate), strPARITY, int.Parse(strDATABITS), strSTOPBITS); clsSn.OnDataReceived += new Function.Comm.Serial.delReceive(ReceiveAck); clsTcp = null; Open(); } }