public MasterSyncStruct() { var loggerconf = new XmlLoggingConfiguration("NLog.config"); logger = LogManager.GetCurrentClassLogger(); propertiesSetting = new PropertiesSetting(); serialPort = new SerialPort(propertiesSetting.PortName); //Create a new SerialPort object. serialPort.PortName = propertiesSetting.PortName; serialPort.BaudRate = propertiesSetting.BaudRate; serialPort.DataBits = propertiesSetting.DataBits; serialPort.Parity = Parity.None; serialPort.StopBits = StopBits.One; }
public MasterSyncStruct(string text) { var loggerconf = new XmlLoggingConfiguration("NLog.config"); logger = LogManager.GetCurrentClassLogger(); try { propertiesSetting = new PropertiesSetting(); serialPort = new SerialPort(); serialPort.PortName = text; serialPort.BaudRate = propertiesSetting.BaudRate; serialPort.DataBits = propertiesSetting.DataBits; } catch (Exception ex) { logger.Error(ex); Console.WriteLine(ex); } }
public SlaveSyncSruct() { var loggerconf = new XmlLoggingConfiguration("NLog.config"); logger = LogManager.GetCurrentClassLogger(); PropertiesSetting propertiesSetting = new PropertiesSetting(); slaveID = 1; serialPort = new SerialPort(propertiesSetting.PortName); serialPort.PortName = propertiesSetting.PortName; serialPort.BaudRate = propertiesSetting.BaudRate; serialPort.DataBits = propertiesSetting.DataBits; serialPort.Parity = Parity.None; serialPort.StopBits = StopBits.One; receivedpacket = new byte[count_send_packet * 2]; receive_packet_data = new ushort[count_send_packet]; //data_byte= new byte[count_send_packet*2]; metaClass = new MetaClassForStructandtherdata(); }