public IRegSEDeviceInfo GetDeviceInfo() { if (_deviceInfo == null) { if (!IsConnected) { return(null); } using (var session = new SerialPortSession(_commport)) { var deviceNameCommand = new DeviceNameCommand(); deviceNameCommand.Execute(session.Port); var deviceName = deviceNameCommand.GetDeviceName(); var nameCommand = new NameCommand(); nameCommand.Execute(session.Port); var name = nameCommand.GetName(); var numberOfPointsCommand = new NumOfPointsCommand();; numberOfPointsCommand.Execute(session.Port); var numberOfPoints = numberOfPointsCommand.GetNumOfPoints(); var softwareVersionCommand = new SoftwareVersionCommand();; softwareVersionCommand.Execute(session.Port); var softwareVersion = softwareVersionCommand.GetVersion(); var hardwareVersionCommand = new HardwareVersionCommand();; hardwareVersionCommand.Execute(session.Port); var hardwareVersion = hardwareVersionCommand.GetVersion(); _deviceInfo = new RegSEDeviceInfo(deviceName, name, softwareVersion, hardwareVersion, numberOfPoints); } } return(_deviceInfo); }
private void ClearCache() { _tracks = null; _trackInfos = null; _deviceInfo = null; }
public IRegSEDeviceInfo GetDeviceInfo() { if (_deviceInfo == null) { if (!IsConnected) { return null; } using (var session = new SerialPortSession(_commport)) { var deviceNameCommand = new DeviceNameCommand(); deviceNameCommand.Execute(session.Port); var deviceName = deviceNameCommand.GetDeviceName(); var nameCommand = new NameCommand(); nameCommand.Execute(session.Port); var name = nameCommand.GetName(); var numberOfPointsCommand = new NumOfPointsCommand(); ; numberOfPointsCommand.Execute(session.Port); var numberOfPoints = numberOfPointsCommand.GetNumOfPoints(); var softwareVersionCommand = new SoftwareVersionCommand(); ; softwareVersionCommand.Execute(session.Port); var softwareVersion = softwareVersionCommand.GetVersion(); var hardwareVersionCommand = new HardwareVersionCommand(); ; hardwareVersionCommand.Execute(session.Port); var hardwareVersion = hardwareVersionCommand.GetVersion(); _deviceInfo = new RegSEDeviceInfo(deviceName, name, softwareVersion, hardwareVersion, numberOfPoints); } } return _deviceInfo; }