internal static LoRaDevice CreateFromSimulatedDevice(
            SimulatedDevice simulatedDevice,
            ILoRaDeviceClient loRaDeviceClient,
            DefaultLoRaDataRequestHandler requestHandler         = null,
            ILoRaDeviceClientConnectionManager connectionManager = null)
        {
            var result = new LoRaDevice(simulatedDevice.LoRaDevice.DevAddr, simulatedDevice.LoRaDevice.DeviceID, connectionManager ?? new SingleDeviceConnectionManager(loRaDeviceClient))
            {
                AppEUI        = simulatedDevice.LoRaDevice.AppEUI,
                AppKey        = simulatedDevice.LoRaDevice.AppKey,
                SensorDecoder = simulatedDevice.LoRaDevice.SensorDecoder,
                AppSKey       = simulatedDevice.LoRaDevice.AppSKey,
                NwkSKey       = simulatedDevice.LoRaDevice.NwkSKey,
                GatewayID     = simulatedDevice.LoRaDevice.GatewayID,
                IsOurDevice   = true,
                ClassType     = (simulatedDevice.ClassType == 'C' || simulatedDevice.ClassType == 'c') ? LoRaDeviceClassType.C : LoRaDeviceClassType.A,
            };

            result.SetFcntDown(simulatedDevice.FrmCntDown);
            result.SetFcntUp(simulatedDevice.FrmCntUp);
            result.AcceptFrameCountChanges();

            if (requestHandler != null)
            {
                result.SetRequestHandler(requestHandler);
            }

            return(result);
        }
 public TestLoRaDeviceFactory(ILoRaDeviceClient loRaDeviceClient, ILoRaDeviceClientConnectionManager connectionManager = null)
 {
     this.loRaDeviceClient  = loRaDeviceClient;
     this.connectionManager = connectionManager ?? new LoRaDeviceClientConnectionManager(new MemoryCache(new MemoryCacheOptions
     {
         ExpirationScanFrequency = TimeSpan.FromSeconds(5),
     }));
 }
Ejemplo n.º 3
0
 public MultiGatewayFrameCounterUpdateStrategyTest()
 {
     this.deviceClient      = new Mock <ILoRaDeviceClient>();
     this.deviceApi         = new Mock <LoRaDeviceAPIServiceBase>(MockBehavior.Strict);
     this.gatewayID         = "test-gateway";
     this.connectionManager = new SingleDeviceConnectionManager(this.deviceClient.Object);
     this.device            = new LoRaDevice(new DevAddr(1), new DevEui(2), connectionManager);
 }
Ejemplo n.º 4
0
 public TestLoRaDeviceFactory(
     NetworkServerConfiguration configuration,
     ILoRaDeviceClient loRaDeviceClient,
     ILoRaDeviceClientConnectionManager connectionManager,
     LoRaDeviceCache deviceCache,
     ILoRaDataRequestHandler requestHandler)
     : this(requestHandler, connectionManager, deviceCache, configuration, loRaDeviceClient)
 {
 }
 public TestDeviceFactory(NetworkServerConfiguration configuration             = null,
                          ILoRaDeviceClientConnectionManager connectionManager = null,
                          LoRaDeviceCache loRaDeviceCache         = null,
                          Action <Mock <LoRaDevice> > deviceSetup = null,
                          Meter meter = null)
     : base(configuration ?? new NetworkServerConfiguration(),
            new Mock <ILoRaDataRequestHandler>().Object,
            connectionManager ?? new Mock <ILoRaDeviceClientConnectionManager>().Object,
            loRaDeviceCache,
            NullLoggerFactory.Instance,
            NullLogger <LoRaDeviceFactory> .Instance,
            meter)
 {
     this.deviceSetup = deviceSetup;
 }
Ejemplo n.º 6
0
 public LoRaDeviceFactory(NetworkServerConfiguration configuration,
                          ILoRaDataRequestHandler dataRequestHandler,
                          ILoRaDeviceClientConnectionManager connectionManager,
                          LoRaDeviceCache loRaDeviceCache,
                          ILoggerFactory loggerFactory,
                          ILogger <LoRaDeviceFactory> logger,
                          Meter meter)
 {
     this.configuration      = configuration;
     this.dataRequestHandler = dataRequestHandler;
     this.connectionManager  = connectionManager;
     this.loggerFactory      = loggerFactory;
     this.logger             = logger;
     this.meter           = meter;
     this.loRaDeviceCache = loRaDeviceCache;
 }
Ejemplo n.º 7
0
 private TestLoRaDeviceFactory(ILoRaDataRequestHandler requestHandler,
                               ILoRaDeviceClientConnectionManager connectionManager,
                               LoRaDeviceCache deviceCache,
                               NetworkServerConfiguration configuration,
                               ILoRaDeviceClient loRaDeviceClient)
     : base(configuration ?? new NetworkServerConfiguration {
     GatewayID = MessageProcessorTestBase.ServerGatewayID
 },
            requestHandler,
            connectionManager,
            deviceCache,
            NullLoggerFactory.Instance,
            NullLogger <LoRaDeviceFactory> .Instance,
            meter: null)
 {
     this.loRaDeviceClient = loRaDeviceClient;
 }
 public TestLoRaDeviceFactory(
     NetworkServerConfiguration configuration,
     ILoRaDeviceFrameCounterUpdateStrategyProvider frameCounterUpdateStrategyProvider,
     ILoRaDeviceClient loRaDeviceClient,
     IDeduplicationStrategyFactory deduplicationFactory,
     ILoRaADRStrategyProvider adrStrategyProvider,
     ILoRAADRManagerFactory adrManagerFactory,
     IFunctionBundlerProvider functionBundlerProvider,
     ILoRaDeviceClientConnectionManager connectionManager)
     : this(loRaDeviceClient)
 {
     this.configuration = configuration;
     this.frameCounterUpdateStrategyProvider = frameCounterUpdateStrategyProvider;
     this.deduplicationFactory    = deduplicationFactory;
     this.adrStrategyProvider     = adrStrategyProvider;
     this.adrManagerFactory       = adrManagerFactory;
     this.functionBundlerProvider = functionBundlerProvider;
     this.connectionManager       = connectionManager;
 }
Ejemplo n.º 9
0
 public LoRaDeviceFactory(NetworkServerConfiguration configuration, DefaultLoRaDataRequestHandler dataRequestHandler, ILoRaDeviceClientConnectionManager connectionManager)
 {
     this.configuration      = configuration;
     this.dataRequestHandler = dataRequestHandler;
     this.connectionManager  = connectionManager;
 }
Ejemplo n.º 10
0
 public SingleGatewayFrameCounterUpdateStrategyTest()
 {
     this.deviceClient      = new Mock <ILoRaDeviceClient>();
     this.connectionManager = new SingleDeviceConnectionManager(this.deviceClient.Object);
     this.device            = new LoRaDevice(new DevAddr(1), new DevEui(2), connectionManager);
 }
Ejemplo n.º 11
0
 public TestLoRaDeviceFactory(ILoRaDeviceClient loRaDeviceClient, ILoRaDataRequestHandler requestHandler, LoRaDeviceCache deviceCache, ILoRaDeviceClientConnectionManager connectionManager = null)
     : this(requestHandler, connectionManager, deviceCache, null, loRaDeviceClient)
 {
 }
Ejemplo n.º 12
0
 public TestLoRaDeviceFactory(ILoRaDeviceClient loRaDeviceClient, LoRaDeviceCache deviceCache, ILoRaDeviceClientConnectionManager connectionManager = null)
     : this(null, connectionManager, deviceCache, null, loRaDeviceClient)
 {
 }