Esempio n. 1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Supply connection string");
                return;
            }

            connectionString = ConnectionString.Parse(args[0]);
            if (!connectionString.IsValid(out var errors))
            {
                Console.WriteLine(errors);
                return;
            }

            factory.UseSerialProtocol();
            factory.UseAlienProtocol();
            using var stream = factory.CreateStream(connectionString);
            stream.Errors.Subscribe(e =>
            {
                errors += e.Message + "\r\n";
                Console.WriteLine(e.Message);
            });
            SubscribeToPollingResults(stream.Tags, 500);
            stream.Start().Wait();
            Console.WriteLine("Polling for tags...");
            Console.ReadLine();
        }
Esempio n. 2
0
 public RfidService(StorageService storageService, IMessageHub messageHub,
                    ISystemClock systemClock, IMapper mapper)
 {
     this.storageService = storageService;
     this.messageHub     = messageHub;
     this.systemClock    = systemClock;
     this.mapper         = mapper;
     messageHub.Subscribe <RfidOptions>(RfidOptionsChanged);
     factory = new UniversalTagStreamFactory();
     factory.UseAlienProtocol();
     factory.UseSerialProtocol();
     RfidOptionsChanged(storageService.GetRfidOptions());
 }
Esempio n. 3
0
        public void Should_create_instance_from_connection_string()
        {
            var factory = new UniversalTagStreamFactory();

            factory.UseAlienProtocol();
            var stream = factory.CreateStream("protocol=alien; network=localhost");

            stream.Should().BeOfType <ReconnectingAlienReaderProtocol>();

            factory = new UniversalTagStreamFactory();
            factory.UseSerialProtocol();
            stream = factory.CreateStream("protocol=serial; serial=COM4");
            stream.Should().BeOfType <SerialUnifiedTagStream>();
        }