コード例 #1
0
        public void TestPhysicalMappingUSDR4(
            [CombinatorialValues("SF8BW500")] string datr,
            [CombinatorialValues(903, 904.6, 906.2, 907.8, 909.4, 911, 912.6, 914.2)] double freq)
        {
            List <Rxpk> rxpk = GenerateRxpk(datr, freq);

            // in EU in standard parameters the expectation is that the reply arrive at same place.
            double expFreq = 0;

            string expDatr = "SF7BW500";

            switch (freq)
            {
            case 903:
                expFreq = 923.3;
                break;

            case 904.6:
                expFreq = 923.9;
                break;

            case 906.2:
                expFreq = 924.5;
                break;

            case 907.8:
                expFreq = 925.1;
                break;

            case 909.4:
                expFreq = 925.7;
                break;

            case 911:
                expFreq = 926.3;
                break;

            case 912.6:
                expFreq = 926.9;
                break;

            case 914.2:
                expFreq = 927.5;
                break;

            default:
                break;
            }

            Assert.Equal(RegionFactory.CreateUS915Region().GetDownstreamChannelFrequency(rxpk[0]), expFreq);
            Assert.Equal(RegionFactory.CreateUS915Region().GetDownstreamDR(rxpk[0]), expDatr);
        }
コード例 #2
0
        public void EnsureRegionLimitTestAreWorking(double freq, string datarate, LoRaRegion region)
        {
            var rxpk = GenerateRxpk(datarate, freq);

            if (region == LoRaRegion.EU868)
            {
                Assert.Throws <RegionLimitException>(() =>
                {
                    RegionFactory.CreateEU868Region().GetDownstreamChannelFrequency(rxpk[0]);
                    RegionFactory.CreateEU868Region().GetDownstreamDR(rxpk[0]);
                });
            }

            if (region == LoRaRegion.US915)
            {
                Assert.Throws <RegionLimitException>(() =>
                {
                    RegionFactory.CreateUS915Region().GetDownstreamChannelFrequency(rxpk[0]);
                    RegionFactory.CreateUS915Region().GetDownstreamDR(rxpk[0]);
                });
            }
        }
コード例 #3
0
        public void TestPhysicalMappingUSDR1to3(
            [CombinatorialValues("SF10BW125", "SF9BW125", "SF8BW125", "SF7BW125")] string datr,
            [CombinatorialValues(902.3, 902.5, 902.7, 902.9, 903.1, 903.3, 903.5, 903.7, 903.9)] double freq)
        {
            List <Rxpk> rxpk = GenerateRxpk(datr, freq);

            // in EU in standard parameters the expectation is that the reply arrive at same place.
            double expFreq = 0;

            string expDatr = string.Empty;

            switch (datr)
            {
            case "SF10BW125":
                expDatr = "SF10BW500";
                break;

            case "SF9BW125":
                expDatr = "SF9BW500";
                break;

            case "SF8BW125":
                expDatr = "SF8BW500";
                break;

            case "SF7BW125":
                expDatr = "SF7BW500";
                break;

            default:
                break;
            }

            switch (freq)
            {
            case 902.3:
                expFreq = 923.3;
                break;

            case 902.5:
                expFreq = 923.9;
                break;

            case 902.7:
                expFreq = 924.5;
                break;

            case 902.9:
                expFreq = 925.1;
                break;

            case 903.1:
                expFreq = 925.7;
                break;

            case 903.3:
                expFreq = 926.3;
                break;

            case 903.5:
                expFreq = 926.9;
                break;

            case 903.7:
                expFreq = 927.5;
                break;

            case 903.9:
                expFreq = 923.3;
                break;

            case 904.1:
                expFreq = 923.9;
                break;

            case 904.3:
                expFreq = 924.5;
                break;

            default:
                break;
            }

            Assert.Equal(RegionFactory.CreateUS915Region().GetDownstreamChannelFrequency(rxpk[0]), expFreq);
            Assert.Equal(RegionFactory.CreateUS915Region().GetDownstreamDR(rxpk[0]), expDatr);
        }