예제 #1
0
 public SerialPipe(
     IConfiguration config,
     ILogger <SerialPipe> log,
     IParseScoreMachineFactory factory,
     IHubContext <ScoreMachineHub> hub
     )
 {
     _portName = config["ScoringMachine:Port"];
     _baud     = config.GetValue <int>("ScoringMachine:Baud");
     _type     = config.GetValue <ScoreMachineType>("ScoringMachine:MachineType");
     _parser   = factory.Create(_type);
     _log      = log;
     _hub      = hub;
 }
        public IParseScoreMachineState Create(ScoreMachineType type)
        {
            switch (type)
            {
            case ScoreMachineType.SaintGeorge:
                return(new SgStateParser());

            case ScoreMachineType.Favero:
                return(new FaveroStateParser());

            default:
                throw new NotSupportedException();
            }
        }