/// <summary> /// Constructor of class DataStandardJet : Initalizes values and connects /// the eventhandler from Connection to the interal update method /// </summary> public DataStandardJet(INetConnection Connection) { _connection = Connection; _connection.UpdateData += UpdateData; _connection.UpdateData += UpdateDataIO; _connection.UpdateData += UpdateDataLimitSwitch; WeightMemory = new WeightMemory(); Input1 = false; Input2 = false; Input3 = false; Input4 = false; _output1 = false; _output2 = false; _output3 = false; _output4 = false; LimitStatus1 = false; LimitStatus2 = false; LimitStatus3 = false; LimitStatus4 = false; _limitSwitch1Source = 0; _limitSwitch1Mode = 0; _limitSwitch1LevelAndLowerBandValue = 0; _limitSwitch1HysteresisAndBandHeight = 0; _limitSwitch2Source = 0; _limitSwitch2Mode = 0; _limitSwitch2LevelAndLowerBandValue = 0; _limitSwitch2HysteresisAndBandHeight = 0; _limitSwitch3Source = 0; _limitSwitch3Mode = 0; _limitSwitch3LevelAndLowerBandValue = 0; _limitSwitch3HysteresisAndBandHeight = 0; _limitSwitch4Source = 0; _limitSwitch4Mode = 0; _limitSwitch4LevelAndLowerBandValue = 0; _limitSwitch4HysteresisAndBandHeight = 0; }
private WeightMemory ExtractWeightMemory() { WeightMemory _wm = new WeightMemory(); string _currentweight = _connection.ReadFromBuffer(JetBusCommands.WRSWeightMemoryEntry); if (_currentweight.Length > 61) { try { int _year = Convert.ToInt32(_currentweight.Substring(10, 2)) + 2000; int _month = Convert.ToInt32(_currentweight.Substring(7, 2)); int _day = Convert.ToInt32(_currentweight.Substring(4, 2)); int _id = Convert.ToInt32(_currentweight.Substring(17, 4).Trim()); int _gross = Convert.ToInt32(_currentweight.Substring(22, 8).Trim()); int _net = Convert.ToInt32(_currentweight.Substring(38, 8).Trim()); _wm.Update(_year, _month, _day, _net, _gross, _id); } catch { _wm.Update(0, 0, 0, 0, 0, -1); } } return(_wm); }