public AndonManager(Queue <int> stationList, Queue <int> departmentList, MODE mode) { try { responseTimeout = int.Parse(ConfigurationSettings.AppSettings["ResponseTimeout"]); this.mode = mode; transactionTimer = new System.Timers.Timer(responseTimeout); transactionTimer.Elapsed += new ElapsedEventHandler(transactionTimer_Elapsed); transactionTimer.AutoReset = false; simulation = ConfigurationSettings.AppSettings["SIMULATION"]; if (simulation != "Yes") { spDriver = new SerialPortDriver(57600, 8, StopBits.One, Parity.None, Handshake.None); communicationPort = ConfigurationSettings.AppSettings["PORT"]; rs485Driver = new RS485Driver(); xbeeDriver = new XbeeDriver(XbeeDriver.COMMUNICATION_MODE.API_ESC); xbeeIdentifier = ConfigurationSettings.AppSettings["XBeeIdentifier"]; //communicationPort = findXbeePort(xbeeIdentifier); //find the port of xbee //if (communicationPort == String.Empty) //{ // throw new AndonManagerException(" Error : Xbee Device Not Found "); //} stations = stationList; departments = departmentList; transactionQ = new Queue <TransactionInfo>(); } else { simulationTimer = new System.Timers.Timer(2 * 1000); simulationTimer.Elapsed += new ElapsedEventHandler(simulationTimer_Elapsed); simulationTimer.AutoReset = false; } } catch (Exception e) { throw new AndonManagerException("Andon Manager Initialization Error:" + e.Message); } }
public AndonManager(Queue <int> stationList, Queue <int> departmentList, MODE mode) { try { responseTimeout = int.Parse(ConfigurationSettings.AppSettings["ResponseTimeout"]); this.mode = mode; transactionTimer = new System.Timers.Timer(responseTimeout); transactionTimer.Elapsed += new ElapsedEventHandler(transactionTimer_Elapsed); transactionTimer.AutoReset = false; simulation = ConfigurationSettings.AppSettings["SIMULATION"]; if (simulation != "Yes") { //spDriver = new SerialPortDriver(57600, 8, StopBits.One, Parity.None, Handshake.None); //communicationPort = ConfigurationSettings.AppSettings["PORT"]; //Code added on 11 Nov BCPORT bcScannerDriver = new SerialPortDriver(9600, 8, StopBits.One, Parity.None, Handshake.None); bccommunicationPort = ConfigurationSettings.AppSettings["BCPORT"]; csScannerDriver = new SerialPortDriver(9600, 8, StopBits.One, Parity.None, Handshake.None); cscommunicationPort = ConfigurationSettings.AppSettings["CSPORT"]; actQtyScannerDriver = new SerialPortDriver(9600, 8, StopBits.One, Parity.None, Handshake.None);; actQtycommunicationPort = ConfigurationSettings.AppSettings["ACTQTYPORT"]; comLayers = ConfigurationSettings.AppSettings["COM_LAYERS"].Split(','); responsePacketFields = ConfigurationSettings.AppSettings["RESPONSE_PACKET_FIELDS"].Split(','); if (comLayers.Contains <String>("RS485")) { rs485Driver = new RS485Driver(); } if (comLayers.Contains <String>("XBee")) { xbeeDriver = new XbeeDriver(XbeeDriver.COMMUNICATION_MODE.API_ESC); xbeeIdentifier = ConfigurationSettings.AppSettings["XBeeIdentifier"]; //communicationPort = findXbeePort(xbeeIdentifier); //find the port of xbee //if (communicationPort == String.Empty) //{ // throw new AndonManagerException(" Error : Xbee Device Not Found "); //} } stations = stationList; //departments = departmentList; } else { simulationTimer = new System.Timers.Timer(2 * 1000); simulationTimer.Elapsed += new ElapsedEventHandler(simulationTimer_Elapsed); simulationTimer.AutoReset = false; } transactionQ = new Queue <TransactionInfo>(); } catch (Exception e) { throw new AndonManagerException("Andon Manager Initialization Error:" + e.Message); } }
public AndonManager(MODE mode) { try { responseTimeout = int.Parse(ConfigurationSettings.AppSettings["ResponseTimeout"]); this.mode = mode; transactionTimer = new System.Timers.Timer(responseTimeout); transactionTimer.Elapsed += new ElapsedEventHandler(transactionTimer_Elapsed); transactionTimer.AutoReset = false; simulation = ConfigurationSettings.AppSettings["SIMULATION"]; if (simulation != "Yes") { spDriver = new SerialPortDriver(19200, 8, StopBits.One, Parity.None, Handshake.None); communicationPort = ConfigurationSettings.AppSettings["PORT"]; rs485Driver = new RS485Driver(); xbeeDriver = new XbeeDriver(XbeeDriver.COMMUNICATION_MODE.API_ESC); xbeeIdentifier = ConfigurationSettings.AppSettings["XBeeIdentifier"]; //communicationPort = findXbeePort(xbeeIdentifier); //find the port of xbee //if (communicationPort == String.Empty) //{ // throw new AndonManagerException(" Error : Xbee Device Not Found "); //} //stations = stationList; //departments = departmentList; transactionQ = new Queue <TransactionInfo>(); } else { simulationTimer = new System.Timers.Timer(2 * 1000); simulationTimer.Elapsed += new ElapsedEventHandler(simulationTimer_Elapsed); simulationTimer.AutoReset = false; } _andonTrace = new TraceSource("andonTrace"); _andonTrace.Switch = new SourceSwitch("andonTraceSwitch"); String xbeeTraceFile = ConfigurationSettings.AppSettings["AndonTraceFile"]; if (xbeeTraceFile != String.Empty) { _andonTraceListener = new TextWriterTraceListener(xbeeTraceFile); _andonTrace.Listeners.Add(_andonTraceListener); _andonTrace.Switch.Level = SourceLevels.Information; } else { _andonTrace.Switch.Level = SourceLevels.Off; } } catch (Exception e) { throw new AndonManagerException("Andon Manager Initialization Error:" + e.Message); } }