Esempio n. 1
0
        public static IUnityContainer AddCommunicationServices(this IUnityContainer services)
        {
            var listenOptions = MulticastConnectionOptions.Create(ipAddress: "225.0.0.0",
                                                                  multicastLoopback: false,
                                                                  exclusiveAddressUse: false);

            var senderOptions = MulticastConnectionOptions.Create(ipAddress: "225.0.0.0",
                                                                  exclusiveAddressUse: false,
                                                                  useBind: false);

            var listenConnection = new UdpMulticastConnection(listenOptions);
            var senderConnection = new UdpMulticastConnection(senderOptions);


            services.AddLocalConnectionTable();
            var table       = services.Resolve <IRedistributableLocalConnectionTable>();
            var settings    = services.Resolve <RadioSettings>();
            var netService  = new NetService(33100, table, settings);
            var taskService = new NetworkTaskService(netService);

            services.RegisterInstance <ITaskService>(taskService, new SingletonLifetimeManager());

            services.RegisterInstance <IDataReceiver>(listenConnection);
            services.RegisterInstance <IDataTransmitter>(senderConnection);
            IDataProvider <byte[]> miner = new DataEngineMiner(services.Resolve <IDataReceiver>());

            services.RegisterInstance(miner, new SingletonLifetimeManager());
            services.RegisterInstance <IDataAsByteConverter <DataModel> >(new Converter <DataModel>());
            services.RegisterType <IDataProcessingBuilder, DataModelProcessingBuilder>();
            return(services);
        }
Esempio n. 2
0
        public Player()
        {
            var options = MulticastConnectionOptions.Create();

            _guid        = Guid.NewGuid();
            _converter   = new Converter <DataModel>();
            _transmitter = new UdpMulticastConnection(options);

            _waveIn = new WaveIn {
                WaveFormat = WaveFormat.CreateIeeeFloatWaveFormat(44100, 2)
            };
            _compressor = new DataCompressor();
        }