コード例 #1
0
        // Creates a new instance of UdpServer
        public static UdpServer Create()
        {
            var configuration = NetworkServerConfiguration.CreateFromEnviromentVariables();

            var loRaDeviceAPIService         = new LoRaDeviceAPIService(configuration, new ServiceFacadeHttpClientProvider(configuration, ApiVersion.LatestVersion));
            var frameCounterStrategyProvider = new LoRaDeviceFrameCounterUpdateStrategyProvider(configuration.GatewayID, loRaDeviceAPIService);
            var deduplicationStrategyFactory = new DeduplicationStrategyFactory(loRaDeviceAPIService);
            var adrStrategyProvider          = new LoRaADRStrategyProvider();
            var cache = new MemoryCache(new MemoryCacheOptions());
            var dataHandlerImplementation = new DefaultLoRaDataRequestHandler(configuration, frameCounterStrategyProvider, new LoRaPayloadDecoder(), deduplicationStrategyFactory, adrStrategyProvider, new LoRAADRManagerFactory(loRaDeviceAPIService), new FunctionBundlerProvider(loRaDeviceAPIService));
            var connectionManager         = new LoRaDeviceClientConnectionManager(cache);
            var loRaDeviceFactory         = new LoRaDeviceFactory(configuration, dataHandlerImplementation, connectionManager);
            var loRaDeviceRegistry        = new LoRaDeviceRegistry(configuration, cache, loRaDeviceAPIService, loRaDeviceFactory);

            var messageDispatcher = new MessageDispatcher(configuration, loRaDeviceRegistry, frameCounterStrategyProvider);
            var udpServer         = new UdpServer(configuration, messageDispatcher, loRaDeviceAPIService, loRaDeviceRegistry);

            // TODO: review dependencies
            var classCMessageSender = new DefaultClassCDevicesMessageSender(configuration, loRaDeviceRegistry, udpServer, frameCounterStrategyProvider);

            dataHandlerImplementation.SetClassCMessageSender(classCMessageSender);

            udpServer.SetClassCMessageSender(classCMessageSender);
            return(udpServer);
        }
コード例 #2
0
 public LoRaDeviceFactory(NetworkServerConfiguration configuration, DefaultLoRaDataRequestHandler dataRequestHandler, ILoRaDeviceClientConnectionManager connectionManager)
 {
     this.configuration      = configuration;
     this.dataRequestHandler = dataRequestHandler;
     this.connectionManager  = connectionManager;
 }