PM.BLL/PMPollingService.cs
/// <summary>
/// Gets the current workout state for a specified location
/// </summary>
/// <param name="serialNumber">The serial number</param>
/// <returns>The current workout state</returns>
Gets the current workout state for a specified location
Gets the current workout state for a specified location
private WorkoutState? GetWorkoutState(string serialNumber)
        {
            ICommandList commands = _commandListFactory.Create();
            commands.Add(new GetWorkoutStateCommand());
            commands.Prepare();
            try
            {
                _pmCommunicator.Send(serialNumber, commands);
            }
            catch (Exception e)
            {
                _logger.LogWarning(e, "Error occurred while checking workout state prior to polling");
                return WorkoutState.WaitingToBegin;
            }
            return commands.FirstOrDefault()?.Value;
        }
private WorkoutState ? GetWorkoutState ( string serialNumber ) { ICommandList commands = _commandListFactory . Create ( ) ; commands . Add ( new GetWorkoutStateCommand ( ) ) ; commands . Prepare ( ) ; try { _pmCommunicator . Send ( serialNumber , commands ) ; } catch ( Exception e ) { _logger . LogWarning ( e , " " ) ; return WorkoutState . WaitingToBegin ; } return commands . FirstOrDefault ( ) ? . Value ; }
Gets the current workout state for a specified location
Gets the current workout state for a specified location
The current workout state
The current workout state
serialNumber
string
The serial number
The serial number