public void StartListening() { if (string.IsNullOrEmpty(_controlLogix.IPAddress)) { throw new PlcCommunicationException( "IngearTagListener cannot start listening to ControlLogix because the IpAddress was not set!", string.Empty, string.Empty); } var result = _controlLogix.Connect(); if (result != ResultCode.E_SUCCESS) { throw new PlcCommunicationException("Can't connect to ControlLogix.", _controlLogix.IPAddress, _controlLogix.Path, result.ToString()); } _tagGroup.ScanStart(); // TODO: port is already in use very often. Fix it! // TODO: do we need CIP messages? because we go to beckhoff PLC systems... //try //{ // _peerMessage.Listen(); //} //catch (Exception e) //{ // throw new PlcCommunicationException( // "IngearTagListener cannot start listening peerMessage listener (CIP messages). Maybe the port is already used by another process!", // _controlLogix.IPAddress, e); //} }
public TagViewController() { this.State = new VmTagView() { PlcIP = "192.168.10.1", Notification = "Ready", CmdLoadTags = new DelegateCommand(() => LoadTags()), CmdStartMonitoring = new DelegateCommand(() => tagGroup.ScanStart(SCAN_INTERVAL)), CmdStopMonitoring = new DelegateCommand(() => tagGroup.ScanStop()), MonitoredTags = new BindingList <VmMonitoredTag>(), }; }