From ffe146c1e02d8a88798c39183e107645dcb96431 Mon Sep 17 00:00:00 2001 From: Wosser1sProductions Date: Fri, 17 Feb 2017 18:34:21 +0100 Subject: [PATCH] Test rebuild + Added message_socket_sink to lora_swig.i CMakeList config ~ [Python] Fixed typo/bug in lora_receiver.py + Added qa_BasicTest.py to CMakeList config ~ [Python] Reworked qa_BasicTest: simpler socket receiving, setting custom Spreading Factor when running test, check if files exist and log to file, simpler running of new test series ~ [Python] qa_BasicTest: Unit Tests are now grouped by sent data and Coding Rate: New test series for each coding rate and data pair. Same CR and data are run in 1 test serie, because the CR changes the HDR, a different CR with the same data requires a new test series. ~ [Python] Examplify now has SF and CR as ctor args + Added qa_basicTest.log: The output when running qa_BasicTest.py ~ Updated expected_results.log: The list of generated example files when running _examplify.py --- examples/_examplify.py | 43 +- examples/expected_results.txt | 127 +++-- examples/qa_BasicTest.log | 181 +++++++ python/CMakeLists.txt | 1 + python/lora_receiver.py | 8 +- python/qa_BasicTest.py | 878 ++++++++++++++++------------------ swig/lora_swig.i | 3 + 7 files changed, 701 insertions(+), 540 deletions(-) create mode 100644 examples/qa_BasicTest.log diff --git a/examples/_examplify.py b/examples/_examplify.py index d18d8e2..ade9bf5 100644 --- a/examples/_examplify.py +++ b/examples/_examplify.py @@ -3,6 +3,7 @@ import struct import time import collections +import os from loranode import RN2483Controller import lora, pmt, osmosdr @@ -12,12 +13,12 @@ FileData = collections.namedtuple('FileData', ['path', 'data', 'times']) class Examplify: - def __init__(self, output_dir = './lora-samples/', output_prefix = 'examplify_data'): + def __init__(self, spreadingFactor = 7, codingRate = "4/5", output_dir = './lora-samples/', output_prefix = 'examplify_data'): ################################################## # Variables # ################################################## self.target_freq = 868.1e6 - self.sf = 6 # 6 7 8 12 + self.sf = spreadingFactor # 6 7 8 12 self.samp_rate = 1e6 self.capture_freq = 868.0e6 self.bw = 125e3 @@ -26,7 +27,13 @@ class Examplify: #self.bitrate = self.sf * (1 / (2**self.sf / self.bw )) self.crc = True self.pwr = 1 - self.codingRate = "4/6" # 4/5 4/6 4/7 + self.codingRate = codingRate # 4/5 4/6 4/7 + + try: + if not os.path.exists(output_dir): + os.makedirs(output_dir) + except: + Exception("Error creating output directory.") self.output_dir = output_dir self.output_prefix = output_prefix @@ -40,12 +47,16 @@ class Examplify: ################################################## # LoRa transmitter # ################################################## - self.lc = RN2483Controller("/dev/lora") - self.lc.set_cr ( self.codingRate) - self.lc.set_bw ( self.bw / 1e3) - self.lc.set_sf ( self.sf ) - self.lc.set_crc( "on" if self.crc else "off") - self.lc.set_pwr( self.pwr ) + try: + self.lc = RN2483Controller("/dev/lora") + self.lc.set_cr ( self.codingRate) + self.lc.set_bw ( self.bw / 1e3) + self.lc.set_sf ( self.sf ) + self.lc.set_crc( "on" if self.crc else "off") + self.lc.set_pwr( self.pwr ) + except: + raise Exception("Error initialising LoRa transmitter: RN2483Controller") + ################################################## # Blocks # @@ -73,18 +84,18 @@ class Examplify: def setTransmitDelay(self, delay_s): self.trans_delay = delay_s - + def getOutput(self): return self.examples_output def transmitRawData(self, data_list): print ("Transmitting...") time.sleep(self.pre_delay) - + for x in data_list: self.lc.send_p2p(x) time.sleep(self.trans_delay) - + time.sleep(self.post_delay) def transmitToCapture(self, data_list): @@ -108,8 +119,8 @@ class Examplify: self.outputFile = output self.transmitToCapture(data_list) self.outputFile = prev - - def appendAndCaptureExample(data, times): + + def appendAndCaptureExample(self, data, times): name = (self.output_prefix + "_cr{0:s}_bw{1:d}_sf{2:d}_crc{3:d}_pwr{4:d}_{5:03d}" .format(self.codingRate.replace("/", "-"), int(self.bw / 1e3), @@ -123,7 +134,7 @@ class Examplify: self.outputFile = self.output_dir + name self.transmitToCapture([data] * times) - def appendResultsToFile(file_path): + def appendResultsToFile(self, file_path): f = open(file_path, 'a') stro = '\n' + (' ' * 20) + 'FILE' + (' ' * 23) + '|' + (' ' * 10) + 'HEX' f.write(stro + '\n') @@ -142,7 +153,7 @@ class Examplify: if __name__ == '__main__': - e = Examplify('./lora-samples/', 'hackrf') + e = Examplify(6, "4/7", './lora-samples/', 'hackrf') e.appendAndCaptureExample("0123456789abcdef", 10) diff --git a/examples/expected_results.txt b/examples/expected_results.txt index 2c5af98..0988a84 100644 --- a/examples/expected_results.txt +++ b/examples/expected_results.txt @@ -1,10 +1,3 @@ - FILE | HEX ---------------------------------------------+------------------------------------- -hackrf_cr4-5_bw125_sf7_crc1_pwr1_001.cfile | 40 0b 07 de ad be ef -hackrf_cr4-5_bw125_sf7_crc1_pwr1_002.cfile | (40 0b 07 de ad be ef) * 10 -hackrf_cr4-5_bw125_sf7_crc1_pwr1_003.cfile | 80 0b 01 a5 a5 a5 a5 a5 a5 a5 a5 -hackrf_cr4-5_bw125_sf7_crc1_pwr1_004.cfile | (80 0b 01 a5 a5 a5 a5 a5 a5 a5 a5) * 3 - FILE | HEX -----------------------------------------------+--------------------------- hackrf_cr4-5_bw125_sf7_crc1_pwr1_000.cfile | 80 0b 01 + ["0123456789abcdef"] * 10 @@ -19,58 +12,86 @@ hackrf_cr4-5_bw125_sf7_crc1_pwr1_004.cfile | (80 0b 01 a5 a5 a5 a5 a5 a5 a5 a5) hackrf_cr4-5_bw125_sf7_crc1_pwr1_009.cfile | 40 0b 07 + ["88888888"] * 5 hackrf_cr4-5_bw125_sf7_crc1_pwr1_010.cfile | 40 0b 07 + ["88888888"] * 10 - FILE | HEX ------------------------------------------------+--------------------------- - hackrf_cr4-5_bw125_sf12_crc1_pwr1_000.cfile | ["0123456789abcdef"] * 10 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_001.cfile | ["111111"] * 1 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_002.cfile | ["111111"] * 5 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_003.cfile | ["aaaaaaaa"] * 3 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_004.cfile | ["ffffffff"] * 1 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_005.cfile | ["ffffffff"] * 10 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_006.cfile | ["55555555"] * 3 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_007.cfile | ["55555555"] * 10 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_008.cfile | ["88888888"] * 1 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_009.cfile | ["88888888"] * 5 - hackrf_cr4-5_bw125_sf12_crc1_pwr1_010.cfile | ["88888888"] * 10 + FILE | HEX + -----------------------------------------------+--------------------------- + hackrf_cr4-5_bw125_sf8_crc1_pwr1_000.cfile | 80 0b 01 + ["0123456789abcdef"] * 10 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_001.cfile | 30 0b 02 + ["111111"] * 1 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_002.cfile | 30 0b 02 + ["111111"] * 5 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_003.cfile | 40 0b 07 + ["aaaaaaaa"] * 3 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_004.cfile | 40 0b 07 + ["ffffffff"] * 1 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_005.cfile | 40 0b 07 + ["ffffffff"] * 10 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_006.cfile | 40 0b 07 + ["55555555"] * 3 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_007.cfile | 40 0b 07 + ["55555555"] * 10 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_008.cfile | 40 0b 07 + ["88888888"] * 1 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_009.cfile | 40 0b 07 + ["88888888"] * 5 + hackrf_cr4-5_bw125_sf8_crc1_pwr1_010.cfile | 40 0b 07 + ["88888888"] * 10 FILE | HEX -----------------------------------------------+--------------------------- - hackrf_cr4-5_bw125_sf8_crc1_pwr1_000.cfile | ["0123456789abcdef"] * 10 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_001.cfile | ["111111"] * 1 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_002.cfile | ["111111"] * 5 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_003.cfile | ["aaaaaaaa"] * 3 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_004.cfile | ["ffffffff"] * 1 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_005.cfile | ["ffffffff"] * 10 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_006.cfile | ["55555555"] * 3 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_007.cfile | ["55555555"] * 10 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_008.cfile | ["88888888"] * 1 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_009.cfile | ["88888888"] * 5 - hackrf_cr4-5_bw125_sf8_crc1_pwr1_010.cfile | ["88888888"] * 10 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_000.cfile | 80 0b 01 + ["0123456789abcdef"] * 10 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_001.cfile | 30 0b 02 + ["111111"] * 1 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_002.cfile | 30 0b 02 + ["111111"] * 5 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_003.cfile | 40 0b 07 + ["aaaaaaaa"] * 3 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_004.cfile | 40 0b 07 + ["ffffffff"] * 1 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_005.cfile | 40 0b 07 + ["ffffffff"] * 10 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_006.cfile | 40 0b 07 + ["55555555"] * 3 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_007.cfile | 40 0b 07 + ["55555555"] * 10 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_008.cfile | 40 0b 07 + ["88888888"] * 1 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_009.cfile | 40 0b 07 + ["88888888"] * 5 + hackrf_cr4-5_bw125_sf12_crc1_pwr1_010.cfile | 40 0b 07 + ["88888888"] * 10 FILE | HEX -----------------------------------------------+--------------------------- - hackrf_cr4-7_bw125_sf7_crc1_pwr1_000.cfile | ["0123456789abcdef"] * 10 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_001.cfile | ["111111"] * 1 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_002.cfile | ["111111"] * 5 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_003.cfile | ["aaaaaaaa"] * 3 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_004.cfile | ["ffffffff"] * 1 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_005.cfile | ["ffffffff"] * 10 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_006.cfile | ["55555555"] * 3 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_007.cfile | ["55555555"] * 10 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_008.cfile | ["88888888"] * 1 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_009.cfile | ["88888888"] * 5 - hackrf_cr4-7_bw125_sf7_crc1_pwr1_010.cfile | ["88888888"] * 10 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_000.cfile | ["0123456789abcdef"] * 10 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_001.cfile | ["111111"] * 1 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_002.cfile | ["111111"] * 5 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_003.cfile | ["aaaaaaaa"] * 3 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_004.cfile | ["ffffffff"] * 1 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_005.cfile | ["ffffffff"] * 10 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_006.cfile | ["55555555"] * 3 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_007.cfile | ["55555555"] * 10 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_008.cfile | ["88888888"] * 1 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_009.cfile | ["88888888"] * 5 + hackrf_cr4-7_bw125_sf6_crc1_pwr1_010.cfile | ["88888888"] * 10 FILE | HEX -----------------------------------------------+--------------------------- - hackrf_cr4-6_bw125_sf6_crc1_pwr1_000.cfile | ["0123456789abcdef"] * 10 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_001.cfile | ["111111"] * 1 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_002.cfile | ["111111"] * 5 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_003.cfile | ["aaaaaaaa"] * 3 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_004.cfile | ["ffffffff"] * 1 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_005.cfile | ["ffffffff"] * 10 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_006.cfile | ["55555555"] * 3 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_007.cfile | ["55555555"] * 10 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_008.cfile | ["88888888"] * 1 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_009.cfile | ["88888888"] * 5 - hackrf_cr4-6_bw125_sf6_crc1_pwr1_010.cfile | ["88888888"] * 10 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_000.cfile | 80 0f 02 + ["0123456789abcdef"] * 10 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_001.cfile | 30 0f 01 + ["111111"] * 1 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_002.cfile | 30 0f 01 + ["111111"] * 5 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_003.cfile | 40 0f 04 + ["aaaaaaaa"] * 3 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_004.cfile | 40 0f 04 + ["ffffffff"] * 1 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_005.cfile | 40 0f 04 + ["ffffffff"] * 10 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_006.cfile | 40 0f 04 + ["55555555"] * 3 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_007.cfile | 40 0f 04 + ["55555555"] * 10 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_008.cfile | 40 0f 04 + ["88888888"] * 1 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_009.cfile | 40 0f 04 + ["88888888"] * 5 + hackrf_cr4-7_bw125_sf7_crc1_pwr1_010.cfile | 40 0f 04 + ["88888888"] * 10 + + FILE | HEX +-----------------------------------------------+--------------------------- + hackrf_cr4-6_bw125_sf6_crc1_pwr1_000.cfile | 80 0d 05 + ["0123456789abcdef"] * 10 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_001.cfile | 30 0d 06 + ["111111"] * 1 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_002.cfile | 30 0d 06 + ["111111"] * 5 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_003.cfile | 40 0d 03 + ["aaaaaaaa"] * 3 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_004.cfile | 40 0d 03 + ["ffffffff"] * 1 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_005.cfile | 40 0d 03 + ["ffffffff"] * 10 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_006.cfile | 40 0d 03 + ["55555555"] * 3 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_007.cfile | 40 0d 03 + ["55555555"] * 10 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_008.cfile | 40 0d 03 + ["88888888"] * 1 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_009.cfile | 40 0d 03 + ["88888888"] * 5 + hackrf_cr4-6_bw125_sf6_crc1_pwr1_010.cfile | 40 0d 03 + ["88888888"] * 10 + + FILE | HEX +-----------------------------------------------+--------------------------- + hackrf_cr4-6_bw125_sf7_crc1_pwr1_000.cfile | 80 0d 05 + ["0123456789abcdef"] * 10 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_001.cfile | 30 0d 06 + ["111111"] * 1 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_002.cfile | 30 0d 06 + ["111111"] * 5 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_003.cfile | 40 0d 03 + ["aaaaaaaa"] * 3 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_004.cfile | 40 0d 03 + ["ffffffff"] * 1 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_005.cfile | 40 0d 03 + ["ffffffff"] * 10 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_006.cfile | 40 0d 03 + ["55555555"] * 3 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_007.cfile | 40 0d 03 + ["55555555"] * 10 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_008.cfile | 40 0d 03 + ["88888888"] * 1 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_009.cfile | 40 0d 03 + ["88888888"] * 5 + hackrf_cr4-6_bw125_sf7_crc1_pwr1_010.cfile | 40 0d 03 + ["88888888"] * 10 diff --git a/examples/qa_BasicTest.log b/examples/qa_BasicTest.log new file mode 100644 index 0000000..fad1339 --- /dev/null +++ b/examples/qa_BasicTest.log @@ -0,0 +1,181 @@ + +-------- Test Results on 2017-02-17 15:37:32 --------- +Test serie 0: ['80 0b 01 01 23 45 67 89 ab cd ef'] * 10 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 5 out of 10 ( 50.00%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + => Total passed: 5 out of 30 (16.67%) + +Test serie 1: ['80 0f 02 01 23 45 67 89 ab cd ef'] * 10 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 4 out of 10 ( 40.00%) + => Total passed: 4 out of 20 (20.00%) + +Test serie 2: ['80 0d 05 01 23 45 67 89 ab cd ef'] * 10 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 2 out of 10 ( 20.00%) + => Total passed: 2 out of 20 (10.00%) + +Test serie 3: ['30 0b 02 11 11 11'] * 1 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + => Total passed: 1 out of 3 (33.33%) + +Test serie 4: ['30 0f 01 11 11 11'] * 1 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + => Total passed: 0 out of 2 (0.00%) + +Test serie 5: ['30 0d 06 11 11 11'] * 1 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + => Total passed: 0 out of 2 (0.00%) + +Test serie 6: ['30 0b 02 11 11 11'] * 5 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 3 out of 5 ( 60.00%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 5 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 5 ( 0.00%) + => Total passed: 3 out of 15 (20.00%) + +Test serie 7: ['30 0f 01 11 11 11'] * 5 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 5 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 2 out of 5 ( 40.00%) + => Total passed: 2 out of 10 (20.00%) + +Test serie 8: ['30 0d 06 11 11 11'] * 5 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 5 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 1 out of 5 ( 20.00%) + => Total passed: 1 out of 10 (10.00%) + +Test serie 9: ['40 0b 07 aa aa aa aa'] * 3 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 1 out of 3 ( 33.33%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + => Total passed: 1 out of 9 (11.11%) + +Test serie 10: ['40 0f 04 aa aa aa aa'] * 3 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + => Total passed: 0 out of 6 (0.00%) + +Test serie 11: ['40 0d 03 aa aa aa aa'] * 3 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 1 out of 3 ( 33.33%) + => Total passed: 1 out of 6 (16.67%) + +Test serie 12: ['40 0b 07 ff ff ff ff'] * 1 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + => Total passed: 0 out of 3 (0.00%) + +Test serie 13: ['40 0f 04 ff ff ff ff'] * 1 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + => Total passed: 0 out of 2 (0.00%) + +Test serie 14: ['40 0d 03 ff ff ff ff'] * 1 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%) + => Total passed: 1 out of 2 (50.00%) + +Test serie 15: ['40 0b 07 ff ff ff ff'] * 10 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 2 out of 10 ( 20.00%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + => Total passed: 2 out of 30 (6.67%) + +Test serie 16: ['40 0f 04 ff ff ff ff'] * 10 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + => Total passed: 0 out of 20 (0.00%) + +Test serie 17: ['40 0d 03 ff ff ff ff'] * 10 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 3 out of 10 ( 30.00%) + => Total passed: 3 out of 20 (15.00%) + +Test serie 18: ['40 0b 07 55 55 55 55'] * 3 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 1 out of 3 ( 33.33%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + => Total passed: 1 out of 9 (11.11%) + +Test serie 19: ['40 0f 04 55 55 55 55'] * 3 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 1 out of 3 ( 33.33%) + => Total passed: 1 out of 6 (16.67%) + +Test serie 20: ['40 0d 03 55 55 55 55'] * 3 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 0 out of 3 ( 0.00%) + => Total passed: 0 out of 6 (0.00%) + +Test serie 21: ['40 0b 07 55 55 55 55'] * 10 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 2 out of 10 ( 20.00%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + => Total passed: 2 out of 30 (6.67%) + +Test serie 22: ['40 0f 04 55 55 55 55'] * 10 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 5 out of 10 ( 50.00%) + => Total passed: 5 out of 20 (25.00%) + +Test serie 23: ['40 0d 03 55 55 55 55'] * 10 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 3 out of 10 ( 30.00%) + => Total passed: 3 out of 20 (15.00%) + +Test serie 24: ['40 0b 07 88 88 88 88'] * 1 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + => Total passed: 0 out of 3 (0.00%) + +Test serie 25: ['40 0f 04 88 88 88 88'] * 1 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + => Total passed: 0 out of 2 (0.00%) + +Test serie 26: ['40 0d 03 88 88 88 88'] * 1 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 1 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 1 out of 1 (100.00%) + => Total passed: 1 out of 2 (50.00%) + +Test serie 27: ['40 0b 07 88 88 88 88'] * 5 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 2 out of 5 ( 40.00%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 5 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 5 ( 0.00%) + => Total passed: 2 out of 15 (13.33%) + +Test serie 28: ['40 0f 04 88 88 88 88'] * 5 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 5 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 5 ( 0.00%) + => Total passed: 0 out of 10 (0.00%) + +Test serie 29: ['40 0d 03 88 88 88 88'] * 5 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 5 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 1 out of 5 ( 20.00%) + => Total passed: 1 out of 10 (10.00%) + +Test serie 30: ['40 0b 07 88 88 88 88'] * 10 + Test 0 :: cr4-5 bw125 sf7 crc1 pwr1 :: passed 5 out of 10 ( 50.00%) + Test 1 :: cr4-5 bw125 sf8 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 2 :: cr4-5 bw125 sf12 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + => Total passed: 5 out of 30 (16.67%) + +Test serie 31: ['40 0f 04 88 88 88 88'] * 10 + Test 0 :: cr4-7 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 1 :: cr4-7 bw125 sf7 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + => Total passed: 0 out of 20 (0.00%) + +Test serie 32: ['40 0d 03 88 88 88 88'] * 10 + Test 0 :: cr4-6 bw125 sf6 crc1 pwr1 :: passed 0 out of 10 ( 0.00%) + Test 1 :: cr4-6 bw125 sf7 crc1 pwr1 :: passed 4 out of 10 ( 40.00%) + => Total passed: 4 out of 20 (20.00%) + + + ====== Total passed: 51 out of 413 (12.35%) ====== + Ran 33 tests in 278.085s diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index a118e23..fce1485 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -51,3 +51,4 @@ include(GrTest) set(GR_TEST_TARGET_DEPS gnuradio-lora) set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig) GR_ADD_TEST(qa_receiver ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_receiver.py) +GR_ADD_TEST(qa_BasicTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_BasicTest.py) diff --git a/python/lora_receiver.py b/python/lora_receiver.py index d10c628..5df7a5b 100644 --- a/python/lora_receiver.py +++ b/python/lora_receiver.py @@ -69,13 +69,15 @@ class lora_receiver(gr.hier_block2): self.msg_connect((self.c_decoder, 'debug'), (self, 'debug')) self.msg_connect((self.c_decoder, 'frames'), (self, 'frames')) - def set_sf(self): + def get_sf(self): return self.sf def set_sf(self, sf): self.sf = sf - if self.realtime: - self.c_decoder.set_sf(self.sf) + ## hier_block2 does not have a realtime attribute: + ## http://gnuradio.org/doc/sphinx/runtime.html?highlight=hier_block2#gnuradio.gr.hier_block2 + # if self.realtime: + self.c_decoder.set_sf(self.sf) def get_offset(self): return self.offset diff --git a/python/qa_BasicTest.py b/python/qa_BasicTest.py index 39a6c71..8fe37d6 100644 --- a/python/qa_BasicTest.py +++ b/python/qa_BasicTest.py @@ -1,43 +1,27 @@ +#!/usr/bin/env python2 import lora, socket, pmt, time -import collections +import collections, datetime +import os.path from gnuradio import gr, gr_unittest, blocks -from gnuradio.blocks import socket_pdu -TestResultData = collections.namedtuple('TestResultData', ['passing', 'total', 'rate']) -TestSerieSettings = collections.namedtuple('TestSerieSettings', ['description', 'SpreadingFactor']) +TestResultData = collections.namedtuple('TestResultData', ['fromfile', 'passing', 'total', 'rate']) +TestSerieSettings = collections.namedtuple('TestSerieSettings', ['data', 'times']) class qa_BasicTest (gr_unittest.TestCase): # # Listen on socket for data, append to list if any and return list of captured data. # - def gatherFromSocket(self): - - ## or in self.server.settimeout(0.5) ? - # try: - # data = self.server.recv(8192) - # if data: - # total_data.append(data) - # except: - # pass - - timeout = 0.5 + def gatherFromSocket(self, amount): total_data = [] data = '' - begin = time.time() - while 1: - if total_data and time.time()-begin > timeout: - break - elif time.time()-begin > timeout*2: - break + + for i in range(amount): try: - data = self.server.recv(8192) + data = self.server.recv(4096) if data: total_data.append(data) - begin = time.time() - else: - time.sleep(0.1) except: pass @@ -48,8 +32,9 @@ class qa_BasicTest (gr_unittest.TestCase): # Print received data, expected data and if they match. # Also give feedback about successrate in the decoding (percentage correctly captured and decoded). # - def compareDataSets(self, total_data, expected_data): - total_passing = 0.0 + def compareDataSets(self, total_data, expected_data, fromfile): + global testResults + total_passing = 0 print '\nReceived:' @@ -70,25 +55,31 @@ class qa_BasicTest (gr_unittest.TestCase): print "{0: 3d} :: mismatch:\n {1:s}".format(idx, data_str) print "should be:\n {0:s}".format(expected_data[idx]) - results = TestResultData(total_passing, len(expected_data), float(total_passing) / len(expected_data) * 100.0) - testResults[nextSeriesSetting].append(results) + results = TestResultData(fromfile, total_passing, len(expected_data), float(total_passing) / len(expected_data) * 100.0) + testResults[len(testResults) - 1].append(results) print ("\nPassed rate: {0:d} out of {1:d} ({2:.2f}%)\n" - .format(results[0], results[1], results[2])) + .format(results[1], results[2], results[3])) # # Connect a filesource with the given file and run the flowgraph. # File is acquired from the file_sink block and saved as .cfile (complex IQ data). # - def runWithFileSourceAndData(self, file, expected_data): - print "Starting test from data in: %s\n" % (file) + def runWithFileSourceAndData(self, infile, SpreadingFactor): + print "Starting test from data in: {0:s}\n".format(infile) - file_source = blocks.file_source(gr.sizeof_gr_complex*1, file, False) # Repeat input: True/False - self.tb.connect((file_source, 0), (self.blocks_throttle_0, 0)) - self.tb.run () - self.tb.disconnect((file_source, 0), (self.blocks_throttle_0, 0)) + if os.path.isfile(infile): + self.file_source.close() + self.file_source.open(infile, False) + self.sf = SpreadingFactor + self.lora_lora_receiver_0.set_sf(self.sf) + self.tb.run () - total_data = self.gatherFromSocket() - self.compareDataSets(total_data, expected_data) + total_data = self.gatherFromSocket(test_series[len(test_series) - 1][1]) + self.compareDataSets(total_data, + test_series[len(test_series) - 1][0] * test_series[len(test_series) - 1][1], + os.path.splitext(os.path.basename(infile))[0]) + else: + raise Exception("Error file does not exists!") # # Set up flowgraph before Unit Test. (Gets threrefore called before EVERY test) @@ -102,7 +93,7 @@ class qa_BasicTest (gr_unittest.TestCase): # Variables # ################################################## self.target_freq = 868.1e6 - self.sf = test_series[nextSeriesSetting][1] # 7 + self.sf = 7 self.samp_rate = 1e6 self.capture_freq = 868.0e6 #self.bw = 125e3 @@ -121,17 +112,21 @@ class qa_BasicTest (gr_unittest.TestCase): self.lastTestComplete = False + self.logFile = './examples/qa_BasicTest.log' + ################################################## # Blocks # ################################################## self.tb = gr.top_block () + self.file_source = blocks.file_source(gr.sizeof_gr_complex*1, "./", False) # Repeat input: True/False self.lora_lora_receiver_0 = lora.lora_receiver(self.samp_rate, self.capture_freq, self.offset, self.sf, self.samp_rate) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, self.samp_rate, True) self.blocks_message_socket_sink_0 = lora.message_socket_sink() - self.tb.connect( (self.blocks_throttle_0, 0), (self.lora_lora_receiver_0, 0)) - self.tb.msg_connect( (self.lora_lora_receiver_0, 'frames'), (self.blocks_message_socket_sink_0, 'in')) + self.tb.connect( (self.file_source, 0), (self.blocks_throttle_0, 0)) + self.tb.connect( (self.blocks_throttle_0, 0), (self.lora_lora_receiver_0, 0)) + self.tb.msg_connect( (self.lora_lora_receiver_0, 'frames'), (self.blocks_message_socket_sink_0, 'in')) # # Clean-up flowgraph after Unit Test. (Gets threrefore called after EVERY test) @@ -143,488 +138,435 @@ class qa_BasicTest (gr_unittest.TestCase): self.server.close() if self.lastTestComplete: + flog = open(self.logFile, 'a') passed_t_a = 0 passed_t = 0 total_t_a = 0 total_t = 0 - print ("-" * 18) + " Test Results " + ("-" * 19) + stro = ("-" * 8) + " Test Results on " + str(datetime.datetime.now())[:19] + " " + ("-" * 9) + print(stro) + flog.write(stro + '\n') for j, serie in enumerate(testResults): total_t = passed_t = 0 - - print ("Test serie {0: 3d}: {1:5s} {2:5s} {3:5s} {4:5s} {5:5s}" - .format(j, *test_series[j][0].split("_"))) - + + stro = ("Test serie {0: 3d}: {1:s} * {2:d}" + .format(j, test_series[j][0], test_series[j][1])) + print(stro) + flog.write(stro + '\n') + for i, x in enumerate(serie): - passed_t += x[0] - total_t += x[1] - print (" Test {0: 4d} passing rate: {1: 3d} out of {2: 3d} ({3:6.2f}%)" - .format(i, x[0], x[1], x[2])) - + passed_t += x[1] + total_t += x[2] + stro = (" Test {0: 3d} :: {1:5s} {2:5s} {3:4s} {4:4s} {5:4s} :: passed {6: 3d} out of {7: 3d} ({8:6.2f}%)" + .format(i, *(x[0].split('_')[1:-1] + [x[1]] + [x[2]] + [x[3]]))) + print(stro) + flog.write(stro + '\n') + passed_t_a += passed_t total_t_a += total_t - print (" => Total passed: {0:d} out of {1:d} ({2:.2f}%)\n" - .format(passed_t, total_t, float(passed_t) / total_t * 100.0)) + stro = (" => Total passed: {0:d} out of {1:d} ({2:.2f}%)\n" + .format(passed_t, total_t, float(passed_t) / (total_t if total_t else 1.0) * 100.0)) + print(stro) + flog.write(stro + '\n') - print ("\n ====== Total passed: {0:d} out of {1:d} ({2:.2f}%) ======" - .format(passed_t_a, total_t_a, float(passed_t_a) / total_t_a * 100.0)) - + stro = ("\n ====== Total passed: {0:d} out of {1:d} ({2:.2f}%) ======" + .format(passed_t_a, total_t_a, float(passed_t_a) / (total_t_a if total_t_a else 1.0) * 100.0)) + print(stro) + flog.write(stro + '\n\n') + flog.close() + + print ("Log appended to: " + self.logFile) - ############################################################################################### - # Unit tests # - # These assume a directory "lora-samples" with the specified .cfiles existing. # - ############################################################################################### +################################################################################################### +# Unit tests # +# These assume a directory "./examples/lora-samples" # +# with the specified .cfiles existing. # +################################################################################################### ############################################################################################### # Unit tests series 0 # - # cr4-5_bw125_sf7_crc1_pwr1 # + # ["80 0b 01 01 23 45 67 89 ab cd ef"] * 10 with Coding Rate 4/5 # ############################################################################################### - # - # Unit test 1 - # - def test_001 (self): - expected_data = [ - '71 1b 09 12 12 12 12 12 12 12 10 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12', - '71 1b 09 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88', - '71 1b 09 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22' - ] - - self.runWithFileSourceAndData('../../examples/lora-samples/usrpcr5.cfile', expected_data) - nextSeriesSetting = 1 - testResults.append([]) + def test_000 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["80 0b 01 01 23 45 67 89 ab cd ef"], 10) ) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_000.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_000.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_000.cfile', 12) ############################################################################################### # Unit tests series 1 # - # cr4-5_bw125_sf7_crc1_pwr1 # + # ["80 0f 02 01 23 45 67 89 ab cd ef"] * 10 with Coding Rate 4/7 # ############################################################################################### - # - # Unit test 2 - # - def test_002 (self): - expected_data = ["80 0b 01 01 23 45 67 89 ab cd ef"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_000.cfile', expected_data) - - # self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_000.cfile', expected_data) - # ... - - # - # Unit test 3 - # - def test_003 (self): - expected_data = ["30 0b 02 11 11 11"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_001.cfile', expected_data) + def test_001 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["80 0f 02 01 23 45 67 89 ab cd ef"], 10) ) - # - # Unit test 4 - # - def test_004 (self): - expected_data = ["30 0b 02 11 11 11"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_002.cfile', expected_data) - - # - # Unit test 5 - # - def test_005 (self): - expected_data = ["40 0b 07 aa aa aa aa"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_003.cfile', expected_data) - - # - # Unit test 6 - # - def test_006 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_004.cfile', expected_data) - - # - # Unit test 7 - # - def test_007 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_005.cfile', expected_data) - - # - # Unit test 8 - # - def test_008 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_006.cfile', expected_data) - - # - # Unit test 9 - # - def test_009 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_007.cfile', expected_data) - - # - # Unit test 10 - # - def test_010 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_008.cfile', expected_data) - - # - # Unit test 11 - # - def test_011 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_009.cfile', expected_data) - - # - # Unit test 12 - # - def test_012 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_010.cfile', expected_data) - nextSeriesSetting = 2 - testResults.append([]) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_000.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_000.cfile', 7) ############################################################################################### # Unit tests series 2 # - # cr4-5_bw125_sf12_crc1_pwr1 # + # ["80 0? 0? 01 23 45 67 89 ab cd ef"] * 10 with Coding Rate 4/6 # ############################################################################################### - # - # Unit test 13 - # - def test_013 (self): - expected_data = ["80 0b 01 01 23 45 67 89 ab cd ef"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_000.cfile', expected_data) + def test_002 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["80 0d 05 01 23 45 67 89 ab cd ef"], 10) ) - # - # Unit test 14 - # - def test_014 (self): - expected_data = ["30 0b 02 11 11 11"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_001.cfile', expected_data) - - # - # Unit test 15 - # - def test_015 (self): - expected_data = ["30 0b 02 11 11 11"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_002.cfile', expected_data) - - # - # Unit test 16 - # - def test_016 (self): - expected_data = ["40 0b 07 aa aa aa aa"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_003.cfile', expected_data) - - # - # Unit test 17 - # - def test_017 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_004.cfile', expected_data) - - # - # Unit test 18 - # - def test_018 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_005.cfile', expected_data) - - # - # Unit test 19 - # - def test_019 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_006.cfile', expected_data) - - # - # Unit test 20 - # - def test_020 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_007.cfile', expected_data) - - # - # Unit test 21 - # - def test_021 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_008.cfile', expected_data) - - # - # Unit test 22 - # - def test_022 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_009.cfile', expected_data) - - # - # Unit test 23 - # - def test_023 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_010.cfile', expected_data) - nextSeriesSetting = 3 - testResults.append([]) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_000.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_000.cfile', 7) ############################################################################################### # Unit tests series 3 # - # cr4-5_bw125_sf8_crc1_pwr1 # + # ["30 0b 02 11 11 11"] * 1 with Coding Rate 4/5 # ############################################################################################### - # - # Unit test 24 - # - def test_024 (self): - expected_data = ["80 0b 01 01 23 45 67 89 ab cd ef"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_000.cfile', expected_data) + def test_003 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["30 0b 02 11 11 11"], 1) ) - # - # Unit test 25 - # - def test_025 (self): - expected_data = ["30 0b 02 11 11 11"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_001.cfile', expected_data) - - # - # Unit test 26 - # - def test_026 (self): - expected_data = ["30 0b 02 11 11 11"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_002.cfile', expected_data) - - # - # Unit test 27 - # - def test_027 (self): - expected_data = ["40 0b 07 aa aa aa aa"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_003.cfile', expected_data) - - # - # Unit test 28 - # - def test_028 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_004.cfile', expected_data) - - # - # Unit test 29 - # - def test_029 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_005.cfile', expected_data) - - # - # Unit test 30 - # - def test_030 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_006.cfile', expected_data) - - # - # Unit test 31 - # - def test_031 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_007.cfile', expected_data) - - # - # Unit test 32 - # - def test_032 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_008.cfile', expected_data) - - # - # Unit test 33 - # - def test_033 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_009.cfile', expected_data) - - # - # Unit test 34 - # - def test_034 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_010.cfile', expected_data) - nextSeriesSetting = 4 - testResults.append([]) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_001.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_001.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_001.cfile', 12) ############################################################################################### # Unit tests series 4 # - # cr4-7_bw125_sf7_crc1_pwr1 # + # ["30 0f 01 11 11 11"] * 1 with Coding Rate 4/7 # ############################################################################################### - # - # Unit test 35 - # - def test_035 (self): - expected_data = ["80 0b 01 01 23 45 67 89 ab cd ef"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_000.cfile', expected_data) + def test_004 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["30 0f 01 11 11 11"], 1) ) - # - # Unit test 36 - # - def test_036 (self): - expected_data = ["30 0b 02 11 11 11"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_001.cfile', expected_data) - - # - # Unit test 37 - # - def test_037 (self): - expected_data = ["30 0b 02 11 11 11"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_002.cfile', expected_data) - - # - # Unit test 38 - # - def test_038 (self): - expected_data = ["40 0b 07 aa aa aa aa"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_003.cfile', expected_data) - - # - # Unit test 39 - # - def test_039 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_004.cfile', expected_data) - - # - # Unit test 40 - # - def test_040 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_005.cfile', expected_data) - - # - # Unit test 41 - # - def test_041 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_006.cfile', expected_data) - - # - # Unit test 42 - # - def test_042 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_007.cfile', expected_data) - - # - # Unit test 43 - # - def test_043 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_008.cfile', expected_data) - - # - # Unit test 44 - # - def test_044 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_009.cfile', expected_data) - - # - # Unit test 45 - # - def test_045 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_010.cfile', expected_data) - nextSeriesSetting = 5 - testResults.append([]) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_001.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_001.cfile', 7) ############################################################################################### # Unit tests series 5 # - # cr4-6_bw125_sf6_crc1_pwr1 # + # ["30 0d 06 11 11 11"] * 1 with Coding Rate 4/6 # ############################################################################################### - # - # Unit test 46 - # - def test_046 (self): - expected_data = ["80 0b 01 01 23 45 67 89 ab cd ef"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_000.cfile', expected_data) + def test_005 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["30 0d 06 11 11 11"], 1) ) - # - # Unit test 47 - # - def test_047 (self): - expected_data = ["30 0b 02 11 11 11"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_001.cfile', expected_data) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_001.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_001.cfile', 7) - # - # Unit test 48 - # - def test_048 (self): - expected_data = ["30 0b 02 11 11 11"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_002.cfile', expected_data) + ############################################################################################### + # Unit tests series 6 # + # ["30 0b 02 11 11 11"] * 5 with Coding Rate 4/5 # + ############################################################################################### + def test_006 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["30 0b 02 11 11 11"], 5) ) - # - # Unit test 49 - # - def test_049 (self): - expected_data = ["40 0b 07 aa aa aa aa"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_003.cfile', expected_data) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_002.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_002.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_002.cfile', 12) - # - # Unit test 50 - # - def test_050 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_004.cfile', expected_data) + ############################################################################################### + # Unit tests series 7 # + # ["30 0f 01 11 11 11"] * 5 with Coding Rate 4/7 # + ############################################################################################### + def test_007 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["30 0f 01 11 11 11"], 5) ) - # - # Unit test 51 - # - def test_051 (self): - expected_data = ["40 0b 07 ff ff ff ff"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_005.cfile', expected_data) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_002.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_002.cfile', 7) - # - # Unit test 52 - # - def test_052 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 3 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_006.cfile', expected_data) + ############################################################################################### + # Unit tests series 8 # + # ["30 0d 06 11 11 11"] * 5 with Coding Rate 4/6 # + ############################################################################################### + def test_008 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["30 0d 06 11 11 11"], 5) ) - # - # Unit test 53 - # - def test_053 (self): - expected_data = ["40 0b 07 55 55 55 55"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_007.cfile', expected_data) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_002.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_002.cfile', 7) - # - # Unit test 54 - # - def test_054 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 1 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_008.cfile', expected_data) + ############################################################################################### + # Unit tests series 9 # + # ["40 0b 07 aa aa aa aa"] * 3 with Coding Rate 4/5 # + ############################################################################################### + def test_009 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0b 07 aa aa aa aa"], 3) ) - # - # Unit test 55 - # - def test_055 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 5 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_009.cfile', expected_data) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_003.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_003.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_003.cfile', 12) + + ############################################################################################### + # Unit tests series 10 # + # ["40 0f 04 aa aa aa aa"] * 3 with Coding Rate 4/7 # + ############################################################################################### + def test_010 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0f 04 aa aa aa aa"], 3) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_003.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_003.cfile', 7) + + ############################################################################################### + # Unit tests series 11 # + # ["40 0d 03 aa aa aa aa"] * 3 with Coding Rate 4/6 # + ############################################################################################### + def test_011 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0d 03 aa aa aa aa"], 3) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_003.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_003.cfile', 7) + + ############################################################################################### + # Unit tests series 12 # + # ["40 0b 07 ff ff ff ff"] * 1 with Coding Rate 4/5 # + ############################################################################################### + def test_012 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0b 07 ff ff ff ff"], 1) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_004.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_004.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_004.cfile', 12) + + ############################################################################################### + # Unit tests series 13 # + # ["40 0f 04 ff ff ff ff"] * 1 with Coding Rate 4/7 # + ############################################################################################### + def test_013 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0f 04 ff ff ff ff"], 1) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_004.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_004.cfile', 7) + + ############################################################################################### + # Unit tests series 14 # + # ["40 0d 03 aa aa aa aa"] * 3 with Coding Rate 4/6 # + ############################################################################################### + def test_014 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0d 03 ff ff ff ff"], 1) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_004.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_004.cfile', 7) + + ############################################################################################### + # Unit tests series 15 # + # ["40 0b 07 ff ff ff ff"] * 10 with Coding Rate 4/5 # + ############################################################################################### + def test_015 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0b 07 ff ff ff ff"], 10) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_005.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_005.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_005.cfile', 12) + + ############################################################################################### + # Unit tests series 16 # + # ["40 0f 04 ff ff ff ff"] * 10 with Coding Rate 4/7 # + ############################################################################################### + def test_016 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0f 04 ff ff ff ff"], 10) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_005.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_005.cfile', 7) + + ############################################################################################### + # Unit tests series 17 # + # ["40 0d 03 ff ff ff ff"] * 10 with Coding Rate 4/6 # + ############################################################################################### + def test_017 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0d 03 ff ff ff ff"], 10) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_005.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_005.cfile', 7) + + ############################################################################################### + # Unit tests series 18 # + # ["40 0b 07 55 55 55 55"] * 3 with Coding Rate 4/5 # + ############################################################################################### + def test_018 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0b 07 55 55 55 55"], 3) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_006.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_006.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_006.cfile', 12) + + ############################################################################################### + # Unit tests series 19 # + # ["40 0f 04 55 55 55 55"] * 3 with Coding Rate 4/7 # + ############################################################################################### + def test_019 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0f 04 55 55 55 55"] , 3) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_006.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_006.cfile', 7) + + ############################################################################################### + # Unit tests series 20 # + # ["40 0d 03 55 55 55 55"] * 3 with Coding Rate 4/6 # + ############################################################################################### + def test_020 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0d 03 55 55 55 55"] , 3) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_006.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_006.cfile', 7) + + ############################################################################################### + # Unit tests series 21 # + # ["40 0b 07 55 55 55 55"] * 10 with Coding Rate 4/5 # + ############################################################################################### + def test_021 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0b 07 55 55 55 55"], 10) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_007.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_007.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_007.cfile', 12) + + ############################################################################################### + # Unit tests series 22 # + # ["40 0f 04 55 55 55 55"] * 10 with Coding Rate 4/7 # + ############################################################################################### + def test_022 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0f 04 55 55 55 55"] , 10) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_007.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_007.cfile', 7) + + ############################################################################################### + # Unit tests series 23 # + # ["40 0d 03 55 55 55 55"] * 10 with Coding Rate 4/6 # + ############################################################################################### + def test_023 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0d 03 55 55 55 55"] , 10) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_007.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_007.cfile', 7) + + ############################################################################################### + # Unit tests series 24 # + # ["40 0b 07 88 88 88 88"] * 1 with Coding Rate 4/5 # + ############################################################################################### + def test_024 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0b 07 88 88 88 88"], 1) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_008.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_008.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_008.cfile', 12) + + ############################################################################################### + # Unit tests series 25 # + # ["40 0f 04 88 88 88 88"] * 1 with Coding Rate 4/7 # + ############################################################################################### + def test_025 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0f 04 88 88 88 88"] , 1) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_008.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_008.cfile', 7) + + ############################################################################################### + # Unit tests series 26 # + # ["40 0d 03 88 88 88 88"] * 1 with Coding Rate 4/6 # + ############################################################################################### + def test_026 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0d 03 88 88 88 88"] , 1) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_008.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_008.cfile', 7) + + ############################################################################################### + # Unit tests series 27 # + # ["40 0b 07 88 88 88 88"] * 5 with Coding Rate 4/5 # + ############################################################################################### + def test_027 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0b 07 88 88 88 88"], 5) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_009.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_009.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_009.cfile', 12) + + ############################################################################################### + # Unit tests series 28 # + # ["40 0f 04 88 88 88 88"] * 5 with Coding Rate 4/7 # + ############################################################################################### + def test_028 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0f 04 88 88 88 88"] , 5) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_009.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_009.cfile', 7) + + ############################################################################################### + # Unit tests series 29 # + # ["40 0d 03 88 88 88 88"] * 5 with Coding Rate 4/6 # + ############################################################################################### + def test_029 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0d 03 88 88 88 88"] , 5) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_009.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_009.cfile', 7) + + ############################################################################################### + # Unit tests series 30 # + # ["40 0b 07 88 88 88 88"] * 10 with Coding Rate 4/5 # + ############################################################################################### + def test_030 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0b 07 88 88 88 88"], 10) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf7_crc1_pwr1_010.cfile', 7) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf8_crc1_pwr1_010.cfile', 8) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-5_bw125_sf12_crc1_pwr1_010.cfile', 12) + + ############################################################################################### + # Unit tests series 31 # + # ["40 0f 04 88 88 88 88"] * 10 with Coding Rate 4/7 # + ############################################################################################### + def test_031(self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0f 04 88 88 88 88"] , 10) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf6_crc1_pwr1_010.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-7_bw125_sf7_crc1_pwr1_010.cfile', 7) + + ############################################################################################### + # Unit tests series 32 # + # ["40 0d 03 88 88 88 88"] * 10 with Coding Rate 4/6 # + ############################################################################################### + def test_032 (self): + testResults.append( [] ) + test_series.append( TestSerieSettings(["40 0d 03 88 88 88 88"] , 10) ) + + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_010.cfile', 6) + self.runWithFileSourceAndData('./examples/lora-samples/hackrf_cr4-6_bw125_sf7_crc1_pwr1_010.cfile', 7) - # - # Unit test 56 - # - def test_056 (self): - expected_data = ["40 0b 07 88 88 88 88"] * 10 - self.runWithFileSourceAndData('../../examples/lora-samples/hackrf_cr4-6_bw125_sf6_crc1_pwr1_010.cfile', expected_data) self.lastTestComplete = True - # nextSeriesSetting = 6 - # testResults.append([]) + if __name__ == '__main__': - testResults = [ [] ] - - nextSeriesSetting = 0 - test_series = [ TestSerieSettings("cr4-5_bw125_sf7_crc1_pwr1", 7), - TestSerieSettings("cr4-5_bw125_sf7_crc1_pwr1", 7), - TestSerieSettings("cr4-5_bw125_sf12_crc1_pwr1", 12), - TestSerieSettings("cr4-5_bw125_sf8_crc1_pwr1", 8), - TestSerieSettings("cr4-7_bw125_sf7_crc1_pwr1", 7), - TestSerieSettings("cr4-6_bw125_sf6_crc1_pwr1", 6) - ] + global testResults + testResults = [] + global test_series + test_series = [] # Remove second argument, otherwise this would cause each test to run twice # (once to console and once to xml, both outputs are printed in the console though) diff --git a/swig/lora_swig.i b/swig/lora_swig.i index a2e8bd0..5f01969 100644 --- a/swig/lora_swig.i +++ b/swig/lora_swig.i @@ -10,6 +10,7 @@ %{ #include "lora/decoder.h" #include "lora/message_file_sink.h" +#include "lora/message_socket_sink.h" %} @@ -17,3 +18,5 @@ GR_SWIG_BLOCK_MAGIC2(lora, decoder); %include "lora/message_file_sink.h" GR_SWIG_BLOCK_MAGIC2(lora, message_file_sink); +%include "lora/message_socket_sink.h" +GR_SWIG_BLOCK_MAGIC2(lora, message_socket_sink);