├── .ci_support ├── README ├── linux_64_numpy1.22python3.10.____cpython.yaml ├── linux_64_numpy1.22python3.9.____cpython.yaml ├── linux_64_numpy1.23python3.11.____cpython.yaml ├── linux_64_numpy1.26python3.12.____cpython.yaml ├── linux_aarch64_numpy1.22python3.10.____cpython.yaml ├── linux_aarch64_numpy1.22python3.9.____cpython.yaml ├── linux_aarch64_numpy1.23python3.11.____cpython.yaml ├── linux_aarch64_numpy1.26python3.12.____cpython.yaml ├── linux_ppc64le_numpy1.22python3.10.____cpython.yaml ├── linux_ppc64le_numpy1.22python3.9.____cpython.yaml ├── linux_ppc64le_numpy1.23python3.11.____cpython.yaml ├── linux_ppc64le_numpy1.26python3.12.____cpython.yaml ├── osx_64_numpy1.22python3.10.____cpython.yaml ├── osx_64_numpy1.22python3.9.____cpython.yaml ├── osx_64_numpy1.23python3.11.____cpython.yaml ├── osx_64_numpy1.26python3.12.____cpython.yaml ├── osx_arm64_numpy1.22python3.10.____cpython.yaml ├── osx_arm64_numpy1.22python3.9.____cpython.yaml ├── osx_arm64_numpy1.23python3.11.____cpython.yaml ├── osx_arm64_numpy1.26python3.12.____cpython.yaml ├── win_64_numpy1.22python3.10.____cpython.yaml ├── win_64_numpy1.22python3.9.____cpython.yaml ├── win_64_numpy1.23python3.11.____cpython.yaml └── win_64_numpy1.26python3.12.____cpython.yaml ├── .circleci └── config.yml ├── .conda ├── README.md ├── conda-forge.yml └── recipe │ ├── bld.bat │ ├── build.sh │ ├── conda_build_config.yaml │ └── meta.yaml ├── .gitattributes ├── .github └── workflows │ └── conda-build.yml ├── .gitignore ├── .scripts ├── build_steps.sh ├── create_conda_build_artifacts.sh ├── logging_utils.sh ├── run_docker_build.sh ├── run_osx_build.sh └── run_win_build.bat ├── CITATION.cff ├── CMakeLists.txt ├── Changelog.md ├── LICENSE ├── MANIFEST.md ├── MANIFEST.yml ├── README.md ├── apps ├── CMakeLists.txt └── simulation │ ├── .gitignore │ ├── README.md │ ├── data │ └── .gitkeep │ ├── flowgraph │ └── tx_rx_simulation.py │ ├── load_results.py │ ├── mc_simulator.py │ └── results │ └── .gitkeep ├── bindall.sh ├── cmake ├── Modules │ ├── CMakeParseArgumentsCopy.cmake │ ├── gnuradio-lora_sdrConfig.cmake │ └── targetConfig.cmake.in └── cmake_uninstall.cmake.in ├── data └── GRC_default │ ├── example_tx_source.txt │ ├── example_tx_source_for_tagged_stream.txt │ └── example_tx_source_ishex.txt ├── docs ├── CMakeLists.txt ├── README.lora_sdr └── doxygen │ ├── CMakeLists.txt │ ├── Doxyfile.in │ ├── doxyxml │ ├── __init__.py │ ├── base.py │ ├── doxyindex.py │ ├── generated │ │ ├── __init__.py │ │ ├── compound.py │ │ ├── compoundsuper.py │ │ ├── index.py │ │ └── indexsuper.py │ └── text.py │ ├── other │ ├── doxypy.py │ ├── group_defs.dox │ └── main_page.dox │ ├── pydoc_macros.h │ └── update_pydoc.py ├── environment.yml ├── examples ├── CMakeLists.txt ├── lora_RX.grc ├── lora_RX.py ├── lora_TX.grc ├── lora_TX.py ├── tx_rx_functionality_check.grc ├── tx_rx_functionality_check.py ├── tx_rx_hier_functionality_check.grc ├── tx_rx_hier_functionality_check.py ├── tx_rx_simulation.grc ├── tx_rx_simulation.py ├── tx_rx_usrp.grc └── tx_rx_usrp.py ├── grc ├── CMakeLists.txt ├── lora_sdr_RH_RF95_header.block.yml ├── lora_sdr_add_crc.block.yml ├── lora_sdr_crc_verif.block.yml ├── lora_sdr_data_source.block.yml ├── lora_sdr_deinterleaver.block.yml ├── lora_sdr_dewhitening.block.yml ├── lora_sdr_fft_demod.block.yml ├── lora_sdr_frame_sync.block.yml ├── lora_sdr_gray_demap.block.yml ├── lora_sdr_gray_mapping.block.yml ├── lora_sdr_hamming_dec.block.yml ├── lora_sdr_hamming_enc.block.yml ├── lora_sdr_header.block.yml ├── lora_sdr_header_decoder.block.yml ├── lora_sdr_interleaver.block.yml ├── lora_sdr_lora_rx.block.yml ├── lora_sdr_lora_tx.block.yml ├── lora_sdr_modulate.block.yml ├── lora_sdr_payload_id_inc.block.yml └── lora_sdr_whitening.block.yml ├── include └── gnuradio │ └── lora_sdr │ ├── CMakeLists.txt │ ├── RH_RF95_header.h │ ├── add_crc.h │ ├── api.h │ ├── crc_verif.h │ ├── data_source.h │ ├── deinterleaver.h │ ├── dewhitening.h │ ├── fft_demod.h │ ├── frame_sync.h │ ├── gray_demap.h │ ├── gray_mapping.h │ ├── hamming_dec.h │ ├── hamming_enc.h │ ├── header.h │ ├── header_decoder.h │ ├── interleaver.h │ ├── modulate.h │ ├── no_sfo_frame_sync.h │ ├── payload_id_inc.h │ ├── utilities.h │ └── whitening.h ├── lib ├── CMakeLists.txt ├── RH_RF95_header_impl.cc ├── RH_RF95_header_impl.h ├── _kiss_fft_guts.h ├── add_crc_impl.cc ├── add_crc_impl.h ├── crc_verif_impl.cc ├── crc_verif_impl.h ├── data_source_impl.cc ├── data_source_impl.h ├── deinterleaver_impl.cc ├── deinterleaver_impl.h ├── dewhitening_impl.cc ├── dewhitening_impl.h ├── fft_demod_impl.cc ├── fft_demod_impl.h ├── frame_sync_impl.cc ├── frame_sync_impl.h ├── gray_demap_impl.cc ├── gray_demap_impl.h ├── gray_mapping_impl.cc ├── gray_mapping_impl.h ├── hamming_dec_impl.cc ├── hamming_dec_impl.h ├── hamming_enc_impl.cc ├── hamming_enc_impl.h ├── header_decoder_impl.cc ├── header_decoder_impl.h ├── header_impl.cc ├── header_impl.h ├── interleaver_impl.cc ├── interleaver_impl.h ├── kiss_fft.c ├── kiss_fft.h ├── modulate_impl.cc ├── modulate_impl.h ├── payload_id_inc_impl.cc ├── payload_id_inc_impl.h ├── tables.h ├── whitening_impl.cc └── whitening_impl.h └── python └── lora_sdr ├── .gitignore ├── CMakeLists.txt ├── __init__.py ├── bindings ├── CMakeLists.txt ├── README.md ├── RH_RF95_header_python.cc ├── _utilities_python.cc ├── add_crc_python.cc ├── bind_oot_file.py ├── crc_verif_python.cc ├── data_source_python.cc ├── deinterleaver_python.cc ├── dewhitening_python.cc ├── docstrings │ ├── README.md │ ├── RH_RF95_header_pydoc_template.h │ ├── add_crc_pydoc_template.h │ ├── crc_verif_pydoc_template.h │ ├── data_source_pydoc_template.h │ ├── deinterleaver_pydoc_template.h │ ├── dewhitening_pydoc_template.h │ ├── fft_demod_pydoc_template.h │ ├── frame_sync_pydoc_template.h │ ├── gray_demap_pydoc_template.h │ ├── gray_mapping_pydoc_template.h │ ├── hamming_dec_pydoc_template.h │ ├── hamming_enc_pydoc_template.h │ ├── header_decoder_pydoc_template.h │ ├── header_pydoc_template.h │ ├── interleaver_pydoc_template.h │ ├── modulate_pydoc_template.h │ ├── payload_id_inc_pydoc_template.h │ ├── utilities_pydoc_template.h │ └── whitening_pydoc_template.h ├── failed_conversions.txt ├── fft_demod_python.cc ├── frame_sync_python.cc ├── gray_demap_python.cc ├── gray_mapping_python.cc ├── hamming_dec_python.cc ├── hamming_enc_python.cc ├── header_decoder_python.cc ├── header_python.cc ├── header_utils.py ├── interleaver_python.cc ├── modulate_python.cc ├── payload_id_inc_python.cc ├── python_bindings.cc └── whitening_python.cc ├── lora.py ├── lora_sdr_lora_rx.py ├── lora_sdr_lora_tx.py └── utils.py /.ci_support/README: -------------------------------------------------------------------------------- 1 | This file is automatically generated by conda-smithy. If any 2 | particular build configuration is expected, but it is not found, 3 | please make sure all dependencies are satisfiable. To add/modify any 4 | matrix elements, you should create/change conda-smithy's input 5 | recipe/conda_build_config.yaml and re-render the recipe, rather than 6 | editing these files directly. 7 | -------------------------------------------------------------------------------- /.ci_support/linux_64_numpy1.22python3.10.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc 3 | c_compiler_version: 4 | - '13' 5 | cdt_name: 6 | - cos7 7 | channel_sources: 8 | - conda-forge 9 | channel_targets: 10 | - tapparelj main 11 | cxx_compiler: 12 | - gxx 13 | cxx_compiler_version: 14 | - '13' 15 | docker_image: 16 | - quay.io/condaforge/linux-anvil-cos7-x86_64 17 | gmp: 18 | - '6' 19 | gnuradio_core: 20 | - 3.10.11 21 | gnuradio_extra_pin: 22 | - '' 23 | numpy: 24 | - '1.22' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.10.* *_cpython 31 | target_platform: 32 | - linux-64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/linux_64_numpy1.22python3.9.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc 3 | c_compiler_version: 4 | - '13' 5 | cdt_name: 6 | - cos7 7 | channel_sources: 8 | - conda-forge 9 | channel_targets: 10 | - tapparelj main 11 | cxx_compiler: 12 | - gxx 13 | cxx_compiler_version: 14 | - '13' 15 | docker_image: 16 | - quay.io/condaforge/linux-anvil-cos7-x86_64 17 | gmp: 18 | - '6' 19 | gnuradio_core: 20 | - 3.10.11 21 | gnuradio_extra_pin: 22 | - '' 23 | numpy: 24 | - '1.22' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.9.* *_cpython 31 | target_platform: 32 | - linux-64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/linux_64_numpy1.23python3.11.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc 3 | c_compiler_version: 4 | - '13' 5 | cdt_name: 6 | - cos7 7 | channel_sources: 8 | - conda-forge 9 | channel_targets: 10 | - tapparelj main 11 | cxx_compiler: 12 | - gxx 13 | cxx_compiler_version: 14 | - '13' 15 | docker_image: 16 | - quay.io/condaforge/linux-anvil-cos7-x86_64 17 | gmp: 18 | - '6' 19 | gnuradio_core: 20 | - 3.10.11 21 | gnuradio_extra_pin: 22 | - '' 23 | numpy: 24 | - '1.23' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.11.* *_cpython 31 | target_platform: 32 | - linux-64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/linux_64_numpy1.26python3.12.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc 3 | c_compiler_version: 4 | - '13' 5 | cdt_name: 6 | - cos7 7 | channel_sources: 8 | - conda-forge 9 | channel_targets: 10 | - tapparelj main 11 | cxx_compiler: 12 | - gxx 13 | cxx_compiler_version: 14 | - '13' 15 | docker_image: 16 | - quay.io/condaforge/linux-anvil-cos7-x86_64 17 | gmp: 18 | - '6' 19 | gnuradio_core: 20 | - 3.10.11 21 | gnuradio_extra_pin: 22 | - '' 23 | numpy: 24 | - '1.26' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.12.* *_cpython 31 | target_platform: 32 | - linux-64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/linux_aarch64_numpy1.22python3.10.____cpython.yaml: -------------------------------------------------------------------------------- 1 | BUILD: 2 | - aarch64-conda_cos7-linux-gnu 3 | c_compiler: 4 | - gcc 5 | c_compiler_version: 6 | - '13' 7 | cdt_arch: 8 | - aarch64 9 | cdt_name: 10 | - cos7 11 | channel_sources: 12 | - conda-forge 13 | channel_targets: 14 | - tapparelj main 15 | cxx_compiler: 16 | - gxx 17 | cxx_compiler_version: 18 | - '13' 19 | docker_image: 20 | - quay.io/condaforge/linux-anvil-cos7-x86_64 21 | gmp: 22 | - '6' 23 | gnuradio_core: 24 | - 3.10.11 25 | gnuradio_extra_pin: 26 | - '' 27 | numpy: 28 | - '1.22' 29 | pin_run_as_build: 30 | python: 31 | min_pin: x.x 32 | max_pin: x.x 33 | python: 34 | - 3.10.* *_cpython 35 | target_platform: 36 | - linux-aarch64 37 | zip_keys: 38 | - - c_compiler_version 39 | - cxx_compiler_version 40 | - - python 41 | - numpy 42 | -------------------------------------------------------------------------------- /.ci_support/linux_aarch64_numpy1.22python3.9.____cpython.yaml: -------------------------------------------------------------------------------- 1 | BUILD: 2 | - aarch64-conda_cos7-linux-gnu 3 | c_compiler: 4 | - gcc 5 | c_compiler_version: 6 | - '13' 7 | cdt_arch: 8 | - aarch64 9 | cdt_name: 10 | - cos7 11 | channel_sources: 12 | - conda-forge 13 | channel_targets: 14 | - tapparelj main 15 | cxx_compiler: 16 | - gxx 17 | cxx_compiler_version: 18 | - '13' 19 | docker_image: 20 | - quay.io/condaforge/linux-anvil-cos7-x86_64 21 | gmp: 22 | - '6' 23 | gnuradio_core: 24 | - 3.10.11 25 | gnuradio_extra_pin: 26 | - '' 27 | numpy: 28 | - '1.22' 29 | pin_run_as_build: 30 | python: 31 | min_pin: x.x 32 | max_pin: x.x 33 | python: 34 | - 3.9.* *_cpython 35 | target_platform: 36 | - linux-aarch64 37 | zip_keys: 38 | - - c_compiler_version 39 | - cxx_compiler_version 40 | - - python 41 | - numpy 42 | -------------------------------------------------------------------------------- /.ci_support/linux_aarch64_numpy1.23python3.11.____cpython.yaml: -------------------------------------------------------------------------------- 1 | BUILD: 2 | - aarch64-conda_cos7-linux-gnu 3 | c_compiler: 4 | - gcc 5 | c_compiler_version: 6 | - '13' 7 | cdt_arch: 8 | - aarch64 9 | cdt_name: 10 | - cos7 11 | channel_sources: 12 | - conda-forge 13 | channel_targets: 14 | - tapparelj main 15 | cxx_compiler: 16 | - gxx 17 | cxx_compiler_version: 18 | - '13' 19 | docker_image: 20 | - quay.io/condaforge/linux-anvil-cos7-x86_64 21 | gmp: 22 | - '6' 23 | gnuradio_core: 24 | - 3.10.11 25 | gnuradio_extra_pin: 26 | - '' 27 | numpy: 28 | - '1.23' 29 | pin_run_as_build: 30 | python: 31 | min_pin: x.x 32 | max_pin: x.x 33 | python: 34 | - 3.11.* *_cpython 35 | target_platform: 36 | - linux-aarch64 37 | zip_keys: 38 | - - c_compiler_version 39 | - cxx_compiler_version 40 | - - python 41 | - numpy 42 | -------------------------------------------------------------------------------- /.ci_support/linux_aarch64_numpy1.26python3.12.____cpython.yaml: -------------------------------------------------------------------------------- 1 | BUILD: 2 | - aarch64-conda_cos7-linux-gnu 3 | c_compiler: 4 | - gcc 5 | c_compiler_version: 6 | - '13' 7 | cdt_arch: 8 | - aarch64 9 | cdt_name: 10 | - cos7 11 | channel_sources: 12 | - conda-forge 13 | channel_targets: 14 | - tapparelj main 15 | cxx_compiler: 16 | - gxx 17 | cxx_compiler_version: 18 | - '13' 19 | docker_image: 20 | - quay.io/condaforge/linux-anvil-cos7-x86_64 21 | gmp: 22 | - '6' 23 | gnuradio_core: 24 | - 3.10.11 25 | gnuradio_extra_pin: 26 | - '' 27 | numpy: 28 | - '1.26' 29 | pin_run_as_build: 30 | python: 31 | min_pin: x.x 32 | max_pin: x.x 33 | python: 34 | - 3.12.* *_cpython 35 | target_platform: 36 | - linux-aarch64 37 | zip_keys: 38 | - - c_compiler_version 39 | - cxx_compiler_version 40 | - - python 41 | - numpy 42 | -------------------------------------------------------------------------------- /.ci_support/linux_ppc64le_numpy1.22python3.10.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc 3 | c_compiler_version: 4 | - '13' 5 | cdt_name: 6 | - cos7 7 | channel_sources: 8 | - conda-forge 9 | channel_targets: 10 | - tapparelj main 11 | cxx_compiler: 12 | - gxx 13 | cxx_compiler_version: 14 | - '13' 15 | docker_image: 16 | - quay.io/condaforge/linux-anvil-cos7-x86_64 17 | gmp: 18 | - '6' 19 | gnuradio_core: 20 | - 3.10.11 21 | gnuradio_extra_pin: 22 | - '' 23 | numpy: 24 | - '1.22' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.10.* *_cpython 31 | target_platform: 32 | - linux-ppc64le 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/linux_ppc64le_numpy1.22python3.9.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc 3 | c_compiler_version: 4 | - '13' 5 | cdt_name: 6 | - cos7 7 | channel_sources: 8 | - conda-forge 9 | channel_targets: 10 | - tapparelj main 11 | cxx_compiler: 12 | - gxx 13 | cxx_compiler_version: 14 | - '13' 15 | docker_image: 16 | - quay.io/condaforge/linux-anvil-cos7-x86_64 17 | gmp: 18 | - '6' 19 | gnuradio_core: 20 | - 3.10.11 21 | gnuradio_extra_pin: 22 | - '' 23 | numpy: 24 | - '1.22' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.9.* *_cpython 31 | target_platform: 32 | - linux-ppc64le 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/linux_ppc64le_numpy1.23python3.11.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc 3 | c_compiler_version: 4 | - '13' 5 | cdt_name: 6 | - cos7 7 | channel_sources: 8 | - conda-forge 9 | channel_targets: 10 | - tapparelj main 11 | cxx_compiler: 12 | - gxx 13 | cxx_compiler_version: 14 | - '13' 15 | docker_image: 16 | - quay.io/condaforge/linux-anvil-cos7-x86_64 17 | gmp: 18 | - '6' 19 | gnuradio_core: 20 | - 3.10.11 21 | gnuradio_extra_pin: 22 | - '' 23 | numpy: 24 | - '1.23' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.11.* *_cpython 31 | target_platform: 32 | - linux-ppc64le 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/linux_ppc64le_numpy1.26python3.12.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc 3 | c_compiler_version: 4 | - '13' 5 | cdt_name: 6 | - cos7 7 | channel_sources: 8 | - conda-forge 9 | channel_targets: 10 | - tapparelj main 11 | cxx_compiler: 12 | - gxx 13 | cxx_compiler_version: 14 | - '13' 15 | docker_image: 16 | - quay.io/condaforge/linux-anvil-cos7-x86_64 17 | gmp: 18 | - '6' 19 | gnuradio_core: 20 | - 3.10.11 21 | gnuradio_extra_pin: 22 | - '' 23 | numpy: 24 | - '1.26' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.12.* *_cpython 31 | target_platform: 32 | - linux-ppc64le 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/osx_64_numpy1.22python3.10.____cpython.yaml: -------------------------------------------------------------------------------- 1 | MACOSX_DEPLOYMENT_TARGET: 2 | - '10.13' 3 | MACOSX_SDK_VERSION: 4 | - '10.13' 5 | c_compiler: 6 | - clang 7 | c_compiler_version: 8 | - '18' 9 | channel_sources: 10 | - conda-forge 11 | channel_targets: 12 | - tapparelj main 13 | cxx_compiler: 14 | - clangxx 15 | cxx_compiler_version: 16 | - '18' 17 | gnuradio_core: 18 | - 3.10.11 19 | gnuradio_extra_pin: 20 | - '' 21 | macos_machine: 22 | - x86_64-apple-darwin13.4.0 23 | numpy: 24 | - '1.22' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.10.* *_cpython 31 | target_platform: 32 | - osx-64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/osx_64_numpy1.22python3.9.____cpython.yaml: -------------------------------------------------------------------------------- 1 | MACOSX_DEPLOYMENT_TARGET: 2 | - '10.13' 3 | MACOSX_SDK_VERSION: 4 | - '10.13' 5 | c_compiler: 6 | - clang 7 | c_compiler_version: 8 | - '18' 9 | channel_sources: 10 | - conda-forge 11 | channel_targets: 12 | - tapparelj main 13 | cxx_compiler: 14 | - clangxx 15 | cxx_compiler_version: 16 | - '18' 17 | gnuradio_core: 18 | - 3.10.11 19 | gnuradio_extra_pin: 20 | - '' 21 | macos_machine: 22 | - x86_64-apple-darwin13.4.0 23 | numpy: 24 | - '1.22' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.9.* *_cpython 31 | target_platform: 32 | - osx-64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/osx_64_numpy1.23python3.11.____cpython.yaml: -------------------------------------------------------------------------------- 1 | MACOSX_DEPLOYMENT_TARGET: 2 | - '10.13' 3 | MACOSX_SDK_VERSION: 4 | - '10.13' 5 | c_compiler: 6 | - clang 7 | c_compiler_version: 8 | - '18' 9 | channel_sources: 10 | - conda-forge 11 | channel_targets: 12 | - tapparelj main 13 | cxx_compiler: 14 | - clangxx 15 | cxx_compiler_version: 16 | - '18' 17 | gnuradio_core: 18 | - 3.10.11 19 | gnuradio_extra_pin: 20 | - '' 21 | macos_machine: 22 | - x86_64-apple-darwin13.4.0 23 | numpy: 24 | - '1.23' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.11.* *_cpython 31 | target_platform: 32 | - osx-64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/osx_64_numpy1.26python3.12.____cpython.yaml: -------------------------------------------------------------------------------- 1 | MACOSX_DEPLOYMENT_TARGET: 2 | - '10.13' 3 | MACOSX_SDK_VERSION: 4 | - '10.13' 5 | c_compiler: 6 | - clang 7 | c_compiler_version: 8 | - '18' 9 | channel_sources: 10 | - conda-forge 11 | channel_targets: 12 | - tapparelj main 13 | cxx_compiler: 14 | - clangxx 15 | cxx_compiler_version: 16 | - '18' 17 | gnuradio_core: 18 | - 3.10.11 19 | gnuradio_extra_pin: 20 | - '' 21 | macos_machine: 22 | - x86_64-apple-darwin13.4.0 23 | numpy: 24 | - '1.26' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.12.* *_cpython 31 | target_platform: 32 | - osx-64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/osx_arm64_numpy1.22python3.10.____cpython.yaml: -------------------------------------------------------------------------------- 1 | MACOSX_DEPLOYMENT_TARGET: 2 | - '11.0' 3 | MACOSX_SDK_VERSION: 4 | - '11.0' 5 | c_compiler: 6 | - clang 7 | c_compiler_version: 8 | - '18' 9 | channel_sources: 10 | - conda-forge 11 | channel_targets: 12 | - tapparelj main 13 | cxx_compiler: 14 | - clangxx 15 | cxx_compiler_version: 16 | - '18' 17 | gnuradio_core: 18 | - 3.10.11 19 | gnuradio_extra_pin: 20 | - '' 21 | macos_machine: 22 | - arm64-apple-darwin20.0.0 23 | numpy: 24 | - '1.22' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.10.* *_cpython 31 | target_platform: 32 | - osx-arm64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/osx_arm64_numpy1.22python3.9.____cpython.yaml: -------------------------------------------------------------------------------- 1 | MACOSX_DEPLOYMENT_TARGET: 2 | - '11.0' 3 | MACOSX_SDK_VERSION: 4 | - '11.0' 5 | c_compiler: 6 | - clang 7 | c_compiler_version: 8 | - '18' 9 | channel_sources: 10 | - conda-forge 11 | channel_targets: 12 | - tapparelj main 13 | cxx_compiler: 14 | - clangxx 15 | cxx_compiler_version: 16 | - '18' 17 | gnuradio_core: 18 | - 3.10.11 19 | gnuradio_extra_pin: 20 | - '' 21 | macos_machine: 22 | - arm64-apple-darwin20.0.0 23 | numpy: 24 | - '1.22' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.9.* *_cpython 31 | target_platform: 32 | - osx-arm64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/osx_arm64_numpy1.23python3.11.____cpython.yaml: -------------------------------------------------------------------------------- 1 | MACOSX_DEPLOYMENT_TARGET: 2 | - '11.0' 3 | MACOSX_SDK_VERSION: 4 | - '11.0' 5 | c_compiler: 6 | - clang 7 | c_compiler_version: 8 | - '18' 9 | channel_sources: 10 | - conda-forge 11 | channel_targets: 12 | - tapparelj main 13 | cxx_compiler: 14 | - clangxx 15 | cxx_compiler_version: 16 | - '18' 17 | gnuradio_core: 18 | - 3.10.11 19 | gnuradio_extra_pin: 20 | - '' 21 | macos_machine: 22 | - arm64-apple-darwin20.0.0 23 | numpy: 24 | - '1.23' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.11.* *_cpython 31 | target_platform: 32 | - osx-arm64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/osx_arm64_numpy1.26python3.12.____cpython.yaml: -------------------------------------------------------------------------------- 1 | MACOSX_DEPLOYMENT_TARGET: 2 | - '11.0' 3 | MACOSX_SDK_VERSION: 4 | - '11.0' 5 | c_compiler: 6 | - clang 7 | c_compiler_version: 8 | - '18' 9 | channel_sources: 10 | - conda-forge 11 | channel_targets: 12 | - tapparelj main 13 | cxx_compiler: 14 | - clangxx 15 | cxx_compiler_version: 16 | - '18' 17 | gnuradio_core: 18 | - 3.10.11 19 | gnuradio_extra_pin: 20 | - '' 21 | macos_machine: 22 | - arm64-apple-darwin20.0.0 23 | numpy: 24 | - '1.26' 25 | pin_run_as_build: 26 | python: 27 | min_pin: x.x 28 | max_pin: x.x 29 | python: 30 | - 3.12.* *_cpython 31 | target_platform: 32 | - osx-arm64 33 | zip_keys: 34 | - - c_compiler_version 35 | - cxx_compiler_version 36 | - - python 37 | - numpy 38 | -------------------------------------------------------------------------------- /.ci_support/win_64_numpy1.22python3.10.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - vs2019 3 | channel_sources: 4 | - conda-forge 5 | channel_targets: 6 | - tapparelj main 7 | cxx_compiler: 8 | - vs2019 9 | gnuradio_core: 10 | - 3.10.11 11 | gnuradio_extra_pin: 12 | - '' 13 | numpy: 14 | - '1.22' 15 | pin_run_as_build: 16 | python: 17 | min_pin: x.x 18 | max_pin: x.x 19 | python: 20 | - 3.10.* *_cpython 21 | target_platform: 22 | - win-64 23 | zip_keys: 24 | - - python 25 | - numpy 26 | -------------------------------------------------------------------------------- /.ci_support/win_64_numpy1.22python3.9.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - vs2019 3 | channel_sources: 4 | - conda-forge 5 | channel_targets: 6 | - tapparelj main 7 | cxx_compiler: 8 | - vs2019 9 | gnuradio_core: 10 | - 3.10.11 11 | gnuradio_extra_pin: 12 | - '' 13 | numpy: 14 | - '1.22' 15 | pin_run_as_build: 16 | python: 17 | min_pin: x.x 18 | max_pin: x.x 19 | python: 20 | - 3.9.* *_cpython 21 | target_platform: 22 | - win-64 23 | zip_keys: 24 | - - python 25 | - numpy 26 | -------------------------------------------------------------------------------- /.ci_support/win_64_numpy1.23python3.11.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - vs2019 3 | channel_sources: 4 | - conda-forge 5 | channel_targets: 6 | - tapparelj main 7 | cxx_compiler: 8 | - vs2019 9 | gnuradio_core: 10 | - 3.10.11 11 | gnuradio_extra_pin: 12 | - '' 13 | numpy: 14 | - '1.23' 15 | pin_run_as_build: 16 | python: 17 | min_pin: x.x 18 | max_pin: x.x 19 | python: 20 | - 3.11.* *_cpython 21 | target_platform: 22 | - win-64 23 | zip_keys: 24 | - - python 25 | - numpy 26 | -------------------------------------------------------------------------------- /.ci_support/win_64_numpy1.26python3.12.____cpython.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - vs2019 3 | channel_sources: 4 | - conda-forge 5 | channel_targets: 6 | - tapparelj main 7 | cxx_compiler: 8 | - vs2019 9 | gnuradio_core: 10 | - 3.10.11 11 | gnuradio_extra_pin: 12 | - '' 13 | numpy: 14 | - '1.26' 15 | pin_run_as_build: 16 | python: 17 | min_pin: x.x 18 | max_pin: x.x 19 | python: 20 | - 3.12.* *_cpython 21 | target_platform: 22 | - win-64 23 | zip_keys: 24 | - - python 25 | - numpy 26 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # This file was generated automatically from conda-smithy. To update this configuration, 2 | # update the conda-forge.yml and/or the recipe/meta.yaml. 3 | # -*- mode: jinja-yaml -*- 4 | 5 | version: 2 6 | 7 | jobs: 8 | build: 9 | working_directory: ~/test 10 | machine: 11 | image: ubuntu-2004:current 12 | steps: 13 | - run: 14 | # The Circle-CI build should not be active, but if this is not true for some reason, do a fast finish. 15 | command: exit 0 16 | 17 | workflows: 18 | version: 2 19 | build_and_test: 20 | jobs: 21 | - build: 22 | filters: 23 | branches: 24 | ignore: 25 | - /.*/ 26 | -------------------------------------------------------------------------------- /.conda/conda-forge.yml: -------------------------------------------------------------------------------- 1 | # See https://conda-forge.org/docs/maintainer/conda_forge_yml.html for 2 | # documentation on possible keys and values. 3 | 4 | # uncomment to enable cross-compiled osx-arm64 builds 5 | build_platform: 6 | linux_aarch64: linux_64 7 | linux_ppc64le: linux_64 8 | osx_arm64: osx_64 9 | clone_depth: 0 10 | github_actions: 11 | store_build_artifacts: true 12 | os_version: 13 | linux_64: cos7 14 | provider: 15 | linux: github_actions 16 | osx: github_actions 17 | win: github_actions 18 | # uncomment to enable additional linux platforms 19 | #linux_aarch64: github_actions 20 | #linux_ppc64le: github_actions 21 | 22 | recipe_dir: .conda/recipe 23 | # skip unnecessary files since this is not a full-fledged conda-forge feedstock 24 | skip_render: 25 | - README.md 26 | - LICENSE.txt 27 | - .gitattributes 28 | - .gitignore 29 | - build-locally.py 30 | - LICENSE 31 | test: native_and_emulated 32 | # enable uploads to Anaconda Cloud from specified branches only 33 | upload_on_branch: master 34 | -------------------------------------------------------------------------------- /.conda/recipe/bld.bat: -------------------------------------------------------------------------------- 1 | setlocal EnableDelayedExpansion 2 | @echo on 3 | 4 | :: Make a build folder and change to it 5 | cmake -E make_directory buildconda 6 | cd buildconda 7 | 8 | :: configure 9 | cmake -G "Ninja" ^ 10 | -DCMAKE_BUILD_TYPE:STRING=Release ^ 11 | -DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%" ^ 12 | -DCMAKE_PREFIX_PATH:PATH="%LIBRARY_PREFIX%" ^ 13 | -DGR_PYTHON_DIR:PATH="%SP_DIR%" ^ 14 | -DENABLE_DOXYGEN=OFF ^ 15 | -DENABLE_TESTING=ON ^ 16 | .. 17 | if errorlevel 1 exit 1 18 | 19 | :: build 20 | cmake --build . --config Release -- -j%CPU_COUNT% 21 | if errorlevel 1 exit 1 22 | 23 | :: install 24 | cmake --build . --config Release --target install 25 | if errorlevel 1 exit 1 26 | 27 | :: test 28 | ctest --build-config Release --output-on-failure --timeout 120 -j%CPU_COUNT% 29 | if errorlevel 1 exit 1 30 | -------------------------------------------------------------------------------- /.conda/recipe/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | cmake -E make_directory buildconda 6 | cd buildconda 7 | 8 | cmake_config_args=( 9 | -DCMAKE_BUILD_TYPE=Release 10 | -DCMAKE_INSTALL_PREFIX=$PREFIX 11 | -DLIB_SUFFIX="" 12 | -DENABLE_DOXYGEN=OFF 13 | -DENABLE_TESTING=ON 14 | ) 15 | 16 | cmake ${CMAKE_ARGS} -G "Ninja" .. "${cmake_config_args[@]}" 17 | cmake --build . --config Release -- -j${CPU_COUNT} 18 | cmake --build . --config Release --target install 19 | 20 | if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" || "${CROSSCOMPILING_EMULATOR}" != "" ]]; then 21 | ctest --build-config Release --output-on-failure --timeout 120 -j${CPU_COUNT} 22 | fi 23 | -------------------------------------------------------------------------------- /.conda/recipe/conda_build_config.yaml: -------------------------------------------------------------------------------- 1 | # this is the channel and label where packages will be uploaded to if enabled 2 | # (see ../README.md) 3 | channel_targets: 4 | - tapparelj main 5 | # override the conda-forge pin for gnuradio-core by uncommenting 6 | # and specifying a different version here 7 | gnuradio_core: 8 | - "3.10.11" 9 | gnuradio_extra_pin: 10 | # always leave one entry with the empty string 11 | - "" 12 | # add version strings here like to get builds for versions other than 13 | # the conda-forge-wide default or version specified above for gnuradio_core 14 | #- "3.9.5" 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # In GNU Radio 3.9+, pybind11 compares hash values of headers and source 2 | # files against knowns values. Conversion of values to CRLF on checkout 3 | # break those checks so keep LF values when files are subject to said checks 4 | # 5 | *.h text eol=lf 6 | *.c text eol=lf 7 | *.cc text eol=lf 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build*/ 2 | *.pyc 3 | *.pyo 4 | .vscode/ 5 | */__pycache__/* 6 | -------------------------------------------------------------------------------- /.scripts/logging_utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Provide a unified interface for the different logging 4 | # utilities CI providers offer. If unavailable, provide 5 | # a compatible fallback (e.g. bare `echo xxxxxx`). 6 | 7 | function startgroup { 8 | # Start a foldable group of log lines 9 | # Pass a single argument, quoted 10 | case ${CI:-} in 11 | azure ) 12 | echo "##[group]$1";; 13 | travis ) 14 | echo "$1" 15 | echo -en 'travis_fold:start:'"${1// /}"'\r';; 16 | github_actions ) 17 | echo "::group::$1";; 18 | * ) 19 | echo "$1";; 20 | esac 21 | } 2> /dev/null 22 | 23 | function endgroup { 24 | # End a foldable group of log lines 25 | # Pass a single argument, quoted 26 | 27 | case ${CI:-} in 28 | azure ) 29 | echo "##[endgroup]";; 30 | travis ) 31 | echo -en 'travis_fold:end:'"${1// /}"'\r';; 32 | github_actions ) 33 | echo "::endgroup::";; 34 | esac 35 | } 2> /dev/null 36 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | title: >- 3 | A fully-functional GNU Radio software-defined radio 4 | implementation of a LoRa transceiver 5 | message: >- 6 | If you use this software, please cite it using the 7 | metadata from this file. 8 | type: software 9 | authors: 10 | - given-names: Joachim 11 | family-names: Tapparel 12 | orcid: 'https://orcid.org/0000-0002-0154-9738' 13 | affiliation: École Polytechnique Fédérale de Lausanne 14 | repository-code: 'https://github.com/tapparelj/gr-lora_sdr' 15 | abstract: >- 16 | This is the fully-functional GNU Radio software-defined 17 | radio (SDR) implementation of a LoRa transceiver with all 18 | the necessary receiver components to operate correctly 19 | even at very low SNRs. This work has been conducted at the 20 | Telecommunication Circuits Laboratory, EPFL. 21 | license: GPL-3.0+ 22 | preferred-citation: 23 | type: conference-paper 24 | authors: 25 | - family-names: "Joachim" 26 | given-names: "Tapparel" 27 | orcid: "https://orcid.org/0000-0002-0154-9738" 28 | - family-names: "Afisiadis" 29 | given-names: "Orion" 30 | orcid: "https://orcid.org/0000-0002-5287-9681" 31 | - family-names: "Mayoraz" 32 | given-names: "Paul" 33 | - family-names: "Balatsoukas-Stimming" 34 | given-names: "Alexios" 35 | orcid: "https://orcid.org/0000-0002-6721-4666" 36 | - family-names: "Burg" 37 | given-names: "Andreas" 38 | orcid: "https://orcid.org/0000-0002-7270-5558" 39 | doi: "10.1109/SPAWC48557.2020.9154273" 40 | journal: "2020 IEEE 21st International Workshop on Signal Processing Advances in Wireless Communications (SPAWC)" 41 | month: 5 42 | start: 1 43 | end: 5 44 | title: "An Open-Source LoRa Physical Layer Prototype on GNU Radio" 45 | year: 2020 46 | -------------------------------------------------------------------------------- /Changelog.md: -------------------------------------------------------------------------------- 1 | # v0.5.8 2 | - Add option to ignore sync words checks and print the received values 3 | # v0.5.7 4 | - Add optional print of received payload as hex values 5 | - Update conda-smithy configuration 6 | # v0.5.6 7 | - Added tagged stream input support (for frame definition of frame length) 8 | - Fixed LLR stream format between _fft\_demod_ and _deinterleaver_ 9 | # v0.5.5 10 | - added tags to crc verification output stream indication frame start, length and CRC result. 11 | # v0.5.4 12 | - added separator option for file input 13 | # v0.5.3 14 | - added parameter for preamble length 15 | # v0.5.2 16 | - added parameter for frame zero-padding 17 | 18 | # v0.5.1 19 | - Fixed an issue when running simulations on multiple threads while using soft-decision decoding 20 | 21 | # v0.5.0 22 | - add low datarate optimisation support 23 | - Can be enabled, disabled or used automatically for configuration using symbols longer than 16ms 24 | - Compatible with semtech transceiver (verified with semtech sx1276) 25 | - add support of spreading factors smaller than 7 26 | - Compatible with semtech transceiver (verified with semtech sx1276) 27 | - add sampling frequency offset estimation and compensation 28 | - Estimation leverages the relation between CFO and SFO, both caused by the same reference clock 29 | - The compensation method consists in a two step refinement of the estimates in the preamble and a puncturing/insertion of samples during the payload 30 | - Add PRR simulation script in apps/ 31 | - Simplify spreading factor setup in receiver 32 | 33 | # v0.4.0 34 | - Port to GNU Radio 3.10 35 | - Added hierarchical blocks for easy Tx and Rx utilisation 36 | - fixed issue with buffer sizes for spreading factor 12 37 | - move sample flowgraphs from apps to examples 38 | 39 | # v0.3.0 40 | - Added soft-decision decoding as an option 41 | - Added choice of different sampling rate and bandwidth for both transmitter and receiver 42 | - Added callback to set coding rate and spreading factor of the transmitter during flowgraph runtime 43 | - Updated documentation of each block 44 | - Cleaned legacy unused blocks 45 | 46 | # v0.2.0 47 | - Update to GNU Radio 3.8.2 48 | - Supports custom network identifiers/sync words 49 | - Improved message passing between blocks 50 | - Fixed bug for negative CFO 51 | 52 | # v0.1.0 53 | - Initial transceiver supporting 54 | - Spreading factors: 7-12 (without reduce rate mode) 55 | - Coding rates: 0-4 56 | - Implicit and explicit header mode 57 | - Payload length: 1-255 bytes 58 | - Verification of payload CRC 59 | - Verification of explicit header checksum 60 | 61 | -------------------------------------------------------------------------------- /MANIFEST.md: -------------------------------------------------------------------------------- 1 | title: The LORA_SDR OOT Module 2 | brief: OOT Module containing all blocks requiring for a functional LoRa transceiver. 3 | tags: 4 | - SDR 5 | - LoRa 6 | author: 7 | - Tapparel Joachim 8 | copyright_owner: 9 | - Tapparel Joachim 10 | license: 11 | gr_supported_version: 3.10.3 12 | #repo: # Put the URL of the repository here, or leave blank for default 13 | #website: # If you have a separate project website, put it here 14 | #icon: # Put a URL to a square image here that will be used as an icon on CGRAN 15 | --- 16 | -------------------------------------------------------------------------------- /MANIFEST.yml: -------------------------------------------------------------------------------- 1 | title: The LORA_SDR OOT Module 2 | version: 1.0 3 | brief: OOT Module containing all blocks requiring for a functional LoRa transceiver 4 | tags: # Tags are arbitrary, but look at CGRAN what other authors are using 5 | - SDR 6 | - LoRa 7 | author: 8 | - Tapparel Joachim 9 | copyright_owner: 10 | - Tapparel Joachim 11 | license: GPL-3.0-or-later 12 | gr_supported_version: 13 | - 3.10 14 | repo: https://github.com/tapparelj/gr-lora_sdr 15 | website: https://github.com/tapparelj/gr-lora_sdr 16 | #icon: # Put a URL to a square image here that will be used as an icon 17 | description: |- 18 | This is the fully-functional GNU Radio software-defined radio (SDR) implementation of a LoRa transceiver with all the necessary receiver components to operate correctly even at very low SNRs. The transceiver is available as a module for GNU Radio 3.10. This work has been conducted at the Telecommunication Circuits Laboratory, EPFL. 19 | file_format: 1 20 | -------------------------------------------------------------------------------- /apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-lora_sdr 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | include(GrPython) 10 | 11 | GR_PYTHON_INSTALL( 12 | PROGRAMS 13 | DESTINATION bin 14 | ) 15 | -------------------------------------------------------------------------------- /apps/simulation/.gitignore: -------------------------------------------------------------------------------- 1 | data/* 2 | results/* 3 | !*/.gitkeep 4 | -------------------------------------------------------------------------------- /apps/simulation/README.md: -------------------------------------------------------------------------------- 1 | # LoRa FER Simulator 2 | ## Description 3 | A simple script measuring the frame error rate of a flowgraph. The error rate is based on the payload CRC present in each LoRa frame. 4 | ## Structure 5 | - mc_simulator.py: the main script to execute. 6 | - data: temporary files containing the transmitted payloads, received payloads, and CRC validity for each SNR. 7 | - flowgraph: A sample flowgraph class 8 | - results: A figure of the obtained FER as well as the values of the data. Can be loaded in ```load_results.py``` to compare different simulations. 9 | - load_results.py: Open previously obtained curves and plot them alongside each others. 10 | ## Usage 11 | - Open ```mc_simulator.py``` and set the parameters you want to evaluate 12 | - ```cd``` to this directory 13 | - Execute ```python mc_simulator.py``` in a terminal 14 | - You can load and plot previous simulation results by adding their name inside ```load_results.py``` -------------------------------------------------------------------------------- /apps/simulation/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapparelj/gr-lora_sdr/a8143cb6162e0ee0677531aec36ca5f05fd678e0/apps/simulation/data/.gitkeep -------------------------------------------------------------------------------- /apps/simulation/load_results.py: -------------------------------------------------------------------------------- 1 | from os import fork 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | import pickle 5 | 6 | plt.figure() 7 | 8 | # results folder path 9 | folder = "results/" 10 | 11 | #----------------------------------------- 12 | # Results to load and plot 13 | #----------------------------------------- 14 | file_list=[""] 15 | 16 | colors = plt.cm.rainbow(np.linspace(0,1,len(file_list))) 17 | for idx,file in enumerate(file_list): 18 | 19 | snrs, FER, Glob_FER = pickle.load(open(folder+file+".pkl","rb")) 20 | # Plot FER of frame which preamble has been detected 21 | plt.semilogy(snrs,FER,'-d',label=file_list[idx], color=colors[idx]) 22 | # Plot FER over all transmitted frames 23 | plt.semilogy(snrs,Glob_FER,'--d',label=file_list[idx], color=colors[idx]) 24 | 25 | plt.grid() 26 | plt.xlabel('SNR [dB]') 27 | plt.ylabel('Frame Error rate') 28 | plt.ylim([1e-4,1.05]) 29 | plt.legend(loc='upper right') 30 | plt.title("") 31 | plt.show() 32 | 33 | -------------------------------------------------------------------------------- /apps/simulation/results/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapparelj/gr-lora_sdr/a8143cb6162e0ee0677531aec36ca5f05fd678e0/apps/simulation/results/.gitkeep -------------------------------------------------------------------------------- /bindall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Script to redo all python bindings in case there is a version mismatch 3 | 4 | gr_modtool bind add_crc 5 | gr_modtool bind crc_verif 6 | gr_modtool bind data_source 7 | gr_modtool bind deinterleaver 8 | gr_modtool bind dewhitening 9 | gr_modtool bind fft_demod 10 | gr_modtool bind frame_sync 11 | gr_modtool bind gray_demap 12 | gr_modtool bind gray_mapping 13 | gr_modtool bind hamming_dec 14 | gr_modtool bind hamming_enc 15 | gr_modtool bind header_decoder 16 | gr_modtool bind header 17 | gr_modtool bind interleaver 18 | gr_modtool bind modulate 19 | gr_modtool bind payload_id_inc 20 | gr_modtool bind RH_RF95_header 21 | gr_modtool bind utilities 22 | gr_modtool bind whitening 23 | 24 | -------------------------------------------------------------------------------- /cmake/Modules/gnuradio-lora_sdrConfig.cmake: -------------------------------------------------------------------------------- 1 | find_package(PkgConfig) 2 | 3 | PKG_CHECK_MODULES(PC_GR_LORA_SDR gnuradio-lora_sdr) 4 | 5 | FIND_PATH( 6 | GR_LORA_SDR_INCLUDE_DIRS 7 | NAMES gnuradio/lora_sdr/api.h 8 | HINTS $ENV{LORA_SDR_DIR}/include 9 | ${PC_LORA_SDR_INCLUDEDIR} 10 | PATHS ${CMAKE_INSTALL_PREFIX}/include 11 | /usr/local/include 12 | /usr/include 13 | ) 14 | 15 | FIND_LIBRARY( 16 | GR_LORA_SDR_LIBRARIES 17 | NAMES gnuradio-lora_sdr 18 | HINTS $ENV{LORA_SDR_DIR}/lib 19 | ${PC_LORA_SDR_LIBDIR} 20 | PATHS ${CMAKE_INSTALL_PREFIX}/lib 21 | ${CMAKE_INSTALL_PREFIX}/lib64 22 | /usr/local/lib 23 | /usr/local/lib64 24 | /usr/lib 25 | /usr/lib64 26 | ) 27 | 28 | include("${CMAKE_CURRENT_LIST_DIR}/gnuradio-lora_sdrTarget.cmake") 29 | 30 | INCLUDE(FindPackageHandleStandardArgs) 31 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GR_LORA_SDR DEFAULT_MSG GR_LORA_SDR_LIBRARIES GR_LORA_SDR_INCLUDE_DIRS) 32 | MARK_AS_ADVANCED(GR_LORA_SDR_LIBRARIES GR_LORA_SDR_INCLUDE_DIRS) 33 | -------------------------------------------------------------------------------- /cmake/Modules/targetConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # SPDX-License-Identifier: GPL-3.0-or-later 6 | # 7 | 8 | include(CMakeFindDependencyMacro) 9 | 10 | set(target_deps "@TARGET_DEPENDENCIES@") 11 | foreach(dep IN LISTS target_deps) 12 | find_dependency(${dep}) 13 | endforeach() 14 | include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake") 15 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /data/GRC_default/example_tx_source.txt: -------------------------------------------------------------------------------- 1 | HztlXcpsegzpnbkq,rkvpzpbd,mnxxhoch,lkcaxkyajmntudouhfzumtbgtavjfwsp,mzebvqousvhrsanl,ingkzvddatxfgjzh,rbhibtwkfyuvecbb,vvzdjzflvgaevyzd,rfvhcmuqskiqlpag,zfpgxcjzhehcydjf 2 | -------------------------------------------------------------------------------- /data/GRC_default/example_tx_source_for_tagged_stream.txt: -------------------------------------------------------------------------------- 1 | 0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz 2 | -------------------------------------------------------------------------------- /data/GRC_default/example_tx_source_ishex.txt: -------------------------------------------------------------------------------- 1 | 6669727374207061636b6574,7365636f6e64207061636b6574, 2 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-lora_sdr 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Setup dependencies 11 | ######################################################################## 12 | find_package(Doxygen) 13 | 14 | ######################################################################## 15 | # Begin conditional configuration 16 | ######################################################################## 17 | if(ENABLE_DOXYGEN) 18 | 19 | ######################################################################## 20 | # Add subdirectories 21 | ######################################################################## 22 | add_subdirectory(doxygen) 23 | 24 | endif(ENABLE_DOXYGEN) 25 | -------------------------------------------------------------------------------- /docs/README.lora_sdr: -------------------------------------------------------------------------------- 1 | This is the lora_sdr-write-a-block package meant as a guide to building 2 | out-of-tree packages. To use the lora_sdr blocks, the Python namespaces 3 | is in 'lora_sdr', which is imported as: 4 | 5 | import gnuradio.lora_sdr as lora_sdr 6 | 7 | See the Doxygen documentation for details about the blocks available 8 | in this package. A quick listing of the details can be found in Python 9 | after importing by using: 10 | 11 | help(lora_sdr) 12 | -------------------------------------------------------------------------------- /docs/doxygen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-lora_sdr 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Create the doxygen configuration file 11 | ######################################################################## 12 | file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir) 13 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir) 14 | file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} abs_top_srcdir) 15 | file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} abs_top_builddir) 16 | 17 | set(HAVE_DOT ${DOXYGEN_DOT_FOUND}) 18 | set(enable_html_docs YES) 19 | set(enable_latex_docs NO) 20 | set(enable_mathjax NO) 21 | set(enable_xml_docs YES) 22 | 23 | configure_file( 24 | ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in 25 | ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 26 | @ONLY) 27 | 28 | set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html) 29 | 30 | ######################################################################## 31 | # Make and install doxygen docs 32 | ######################################################################## 33 | add_custom_command( 34 | OUTPUT ${BUILT_DIRS} 35 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 36 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 37 | COMMENT "Generating documentation with doxygen" 38 | ) 39 | 40 | add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS}) 41 | 42 | install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR}) 43 | -------------------------------------------------------------------------------- /docs/doxygen/doxyxml/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 5 | # This file is a part of gr-lora_sdr 6 | # 7 | # SPDX-License-Identifier: GPL-3.0-or-later 8 | # 9 | # 10 | """ 11 | Python interface to contents of doxygen xml documentation. 12 | 13 | Example use: 14 | See the contents of the example folder for the C++ and 15 | doxygen-generated xml used in this example. 16 | 17 | >>> # Parse the doxygen docs. 18 | >>> import os 19 | >>> this_dir = os.path.dirname(globals()['__file__']) 20 | >>> xml_path = this_dir + "/example/xml/" 21 | >>> di = DoxyIndex(xml_path) 22 | 23 | Get a list of all top-level objects. 24 | 25 | >>> print([mem.name() for mem in di.members()]) 26 | [u'Aadvark', u'aadvarky_enough', u'main'] 27 | 28 | Get all functions. 29 | 30 | >>> print([mem.name() for mem in di.in_category(DoxyFunction)]) 31 | [u'aadvarky_enough', u'main'] 32 | 33 | Check if an object is present. 34 | 35 | >>> di.has_member(u'Aadvark') 36 | True 37 | >>> di.has_member(u'Fish') 38 | False 39 | 40 | Get an item by name and check its properties. 41 | 42 | >>> aad = di.get_member(u'Aadvark') 43 | >>> print(aad.brief_description) 44 | Models the mammal Aadvark. 45 | >>> print(aad.detailed_description) 46 | Sadly the model is incomplete and cannot capture all aspects of an aadvark yet. 47 | 48 | This line is uninformative and is only to test line breaks in the comments. 49 | >>> [mem.name() for mem in aad.members()] 50 | [u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness'] 51 | >>> aad.get_member(u'print').brief_description 52 | u'Outputs the vital aadvark statistics.' 53 | 54 | """ 55 | 56 | from .doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther 57 | 58 | 59 | def _test(): 60 | import os 61 | this_dir = os.path.dirname(globals()['__file__']) 62 | xml_path = this_dir + "/example/xml/" 63 | di = DoxyIndex(xml_path) 64 | # Get the Aadvark class 65 | aad = di.get_member('Aadvark') 66 | aad.brief_description 67 | import doctest 68 | return doctest.testmod() 69 | 70 | 71 | if __name__ == "__main__": 72 | _test() 73 | -------------------------------------------------------------------------------- /docs/doxygen/doxyxml/generated/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains generated files produced by generateDS.py. 3 | 4 | These do the real work of parsing the doxygen xml files but the 5 | resultant classes are not very friendly to navigate so the rest of the 6 | doxyxml module processes them further. 7 | """ 8 | -------------------------------------------------------------------------------- /docs/doxygen/doxyxml/generated/index.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Generated Mon Feb 9 19:08:05 2009 by generateDS.py. 5 | """ 6 | 7 | from xml.dom import minidom 8 | 9 | import os 10 | import sys 11 | from . import compound 12 | 13 | from . import indexsuper as supermod 14 | 15 | 16 | class DoxygenTypeSub(supermod.DoxygenType): 17 | def __init__(self, version=None, compound=None): 18 | supermod.DoxygenType.__init__(self, version, compound) 19 | 20 | def find_compounds_and_members(self, details): 21 | """ 22 | Returns a list of all compounds and their members which match details 23 | """ 24 | 25 | results = [] 26 | for compound in self.compound: 27 | members = compound.find_members(details) 28 | if members: 29 | results.append([compound, members]) 30 | else: 31 | if details.match(compound): 32 | results.append([compound, []]) 33 | 34 | return results 35 | 36 | 37 | supermod.DoxygenType.subclass = DoxygenTypeSub 38 | # end class DoxygenTypeSub 39 | 40 | 41 | class CompoundTypeSub(supermod.CompoundType): 42 | def __init__(self, kind=None, refid=None, name='', member=None): 43 | supermod.CompoundType.__init__(self, kind, refid, name, member) 44 | 45 | def find_members(self, details): 46 | """ 47 | Returns a list of all members which match details 48 | """ 49 | 50 | results = [] 51 | 52 | for member in self.member: 53 | if details.match(member): 54 | results.append(member) 55 | 56 | return results 57 | 58 | 59 | supermod.CompoundType.subclass = CompoundTypeSub 60 | # end class CompoundTypeSub 61 | 62 | 63 | class MemberTypeSub(supermod.MemberType): 64 | 65 | def __init__(self, kind=None, refid=None, name=''): 66 | supermod.MemberType.__init__(self, kind, refid, name) 67 | 68 | 69 | supermod.MemberType.subclass = MemberTypeSub 70 | # end class MemberTypeSub 71 | 72 | 73 | def parse(inFilename): 74 | 75 | doc = minidom.parse(inFilename) 76 | rootNode = doc.documentElement 77 | rootObj = supermod.DoxygenType.factory() 78 | rootObj.build(rootNode) 79 | 80 | return rootObj 81 | -------------------------------------------------------------------------------- /docs/doxygen/doxyxml/text.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 Free Software Foundation, Inc. 3 | # 4 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 5 | # This file is a part of gr-lora_sdr 6 | # 7 | # SPDX-License-Identifier: GPL-3.0-or-later 8 | # 9 | # 10 | """ 11 | Utilities for extracting text from generated classes. 12 | """ 13 | 14 | 15 | def is_string(txt): 16 | if isinstance(txt, str): 17 | return True 18 | try: 19 | if isinstance(txt, str): 20 | return True 21 | except NameError: 22 | pass 23 | return False 24 | 25 | 26 | def description(obj): 27 | if obj is None: 28 | return None 29 | return description_bit(obj).strip() 30 | 31 | 32 | def description_bit(obj): 33 | if hasattr(obj, 'content'): 34 | contents = [description_bit(item) for item in obj.content] 35 | result = ''.join(contents) 36 | elif hasattr(obj, 'content_'): 37 | contents = [description_bit(item) for item in obj.content_] 38 | result = ''.join(contents) 39 | elif hasattr(obj, 'value'): 40 | result = description_bit(obj.value) 41 | elif is_string(obj): 42 | return obj 43 | else: 44 | raise Exception( 45 | 'Expecting a string or something with content, content_ or value attribute') 46 | # If this bit is a paragraph then add one some line breaks. 47 | if hasattr(obj, 'name') and obj.name == 'para': 48 | result += "\n\n" 49 | return result 50 | -------------------------------------------------------------------------------- /docs/doxygen/other/group_defs.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | * \defgroup block GNU Radio LORA_SDR C++ Signal Processing Blocks 3 | * \brief All C++ blocks that can be used from the LORA_SDR GNU Radio 4 | * module are listed here or in the subcategories below. 5 | * 6 | */ 7 | -------------------------------------------------------------------------------- /docs/doxygen/other/main_page.dox: -------------------------------------------------------------------------------- 1 | /*! \mainpage 2 | 3 | Welcome to the GNU Radio LORA_SDR Block 4 | 5 | This is the intro page for the Doxygen manual generated for the LORA_SDR 6 | block (docs/doxygen/other/main_page.dox). Edit it to add more detailed 7 | documentation about the new GNU Radio modules contained in this 8 | project. 9 | 10 | */ 11 | -------------------------------------------------------------------------------- /docs/doxygen/pydoc_macros.h: -------------------------------------------------------------------------------- 1 | #ifndef PYDOC_MACROS_H 2 | #define PYDOC_MACROS_H 3 | 4 | #define __EXPAND(x) x 5 | #define __COUNT(_1, _2, _3, _4, _5, _6, _7, COUNT, ...) COUNT 6 | #define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1)) 7 | #define __CAT1(a, b) a##b 8 | #define __CAT2(a, b) __CAT1(a, b) 9 | #define __DOC1(n1) __doc_##n1 10 | #define __DOC2(n1, n2) __doc_##n1##_##n2 11 | #define __DOC3(n1, n2, n3) __doc_##n1##_##n2##_##n3 12 | #define __DOC4(n1, n2, n3, n4) __doc_##n1##_##n2##_##n3##_##n4 13 | #define __DOC5(n1, n2, n3, n4, n5) __doc_##n1##_##n2##_##n3##_##n4##_##n5 14 | #define __DOC6(n1, n2, n3, n4, n5, n6) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6 15 | #define __DOC7(n1, n2, n3, n4, n5, n6, n7) \ 16 | __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7 17 | #define DOC(...) __EXPAND(__EXPAND(__CAT2(__DOC, __VA_SIZE(__VA_ARGS__)))(__VA_ARGS__)) 18 | 19 | #endif // PYDOC_MACROS_H 20 | -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: gr310 2 | channels: 3 | - conda-forge 4 | - defaults 5 | dependencies: 6 | - boost-cpp>=1.82 7 | - cmake>=3.22,<3.27 8 | - doxygen 9 | - gcc>=11.2 10 | - gnuradio>=3.10 11 | - gxx_linux-64 12 | - make>=4.2 13 | - pkg-config 14 | - pybind11 15 | - python>=3.12 16 | - uhd 17 | - volk 18 | - pip: 19 | - pygccxml 20 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is a part of gr-lora_sdr 2 | # 3 | # SPDX-License-Identifier: GPL-3.0-or-later 4 | # 5 | 6 | install( 7 | FILES lora_RX.grc 8 | lora_TX.grc 9 | tx_rx_functionality_check.grc 10 | tx_rx_hier_functionality_check.grc 11 | tx_rx_simulation.grc 12 | tx_rx_usrp.grc 13 | DESTINATION share/gnuradio/examples/lora_sdr) 14 | -------------------------------------------------------------------------------- /grc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-lora_sdr 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | file(GLOB yml_files "*.yml") 9 | install(FILES ${yml_files} 10 | DESTINATION share/gnuradio/grc/blocks 11 | ) 12 | -------------------------------------------------------------------------------- /grc/lora_sdr_RH_RF95_header.block.yml: -------------------------------------------------------------------------------- 1 | id: lora_sdr_RH_RF95_header 2 | label: Rh rf95 header 3 | category: '[LoRa_TX]' 4 | 5 | parameters: 6 | - id: _to 7 | label: _to 8 | dtype: int 9 | - id: _from 10 | label: _from 11 | dtype: int 12 | - id: _id 13 | label: _id 14 | dtype: int 15 | - id: _flags 16 | label: _flags 17 | dtype: int 18 | 19 | inputs: 20 | - domain: message 21 | id: msg 22 | 23 | outputs: 24 | - domain: message 25 | id: msg 26 | 27 | templates: 28 | imports: import gnuradio.lora_sdr as lora_sdr 29 | make: lora_sdr.RH_RF95_header(${_to}, ${_from}, ${_id}, ${_flags}) 30 | 31 | documentation: |- 32 | Add 4 bytes in the beginning of the payload, required in order to send messages to a lora chip using the Radiohead library. 33 | Be careful to take those 4 additional bytes in consideration if used with a usrp as receiver. 34 | (During testing, we used the Adafruit Feather 32u4 RFM95). 35 | more information on thoses 4 bytes on : 36 | https://www.airspayce.com/mikem/arduino/RadioHead/classRHGenericDriver.html#abf4db9bddfee361cc44fbf4bd22202bc 37 | Parameters: 38 | _to: destination identifier 39 | _from: source identifier 40 | _id: message identifier 41 | _flags: flags 42 | Input: 43 | msg: payload as a string 44 | Output: 45 | out: radiohead header and payload as a string 46 | 47 | file_format: 1 48 | -------------------------------------------------------------------------------- /grc/lora_sdr_add_crc.block.yml: -------------------------------------------------------------------------------- 1 | # auto-generated by grc.converter 2 | 3 | id: lora_sdr_add_crc 4 | label: Add crc 5 | category: '[LoRa_TX]' 6 | 7 | parameters: 8 | - id: has_crc 9 | label: Has_crc 10 | dtype: bool 11 | default: 'False' 12 | 13 | inputs: 14 | - domain: stream 15 | dtype: byte 16 | 17 | 18 | outputs: 19 | - domain: stream 20 | dtype: byte 21 | 22 | templates: 23 | imports: import gnuradio.lora_sdr as lora_sdr 24 | make: lora_sdr.add_crc(${has_crc}) 25 | 26 | documentation: |- 27 | Append the payload CRC to the payload. 28 | Parameters: 29 | has_crc: indicate the presence of a payload CRC 30 | Input: 31 | in: stream of header and payload nibbles 32 | Output: 33 | out: stream of header, payload and CRC nibbles 34 | 35 | file_format: 1 36 | -------------------------------------------------------------------------------- /grc/lora_sdr_crc_verif.block.yml: -------------------------------------------------------------------------------- 1 | # auto-generated by grc.converter 2 | 3 | id: lora_sdr_crc_verif 4 | label: CRC verif 5 | category: '[LoRa_RX]' 6 | 7 | parameters: 8 | - id: print_rx_msg 9 | label: print_rx_msg 10 | dtype: enum 11 | options: ['0', '1', '2'] 12 | option_labels: ['None', 'ASCII', 'Hex'] 13 | default: 1 14 | - id: output_crc_check 15 | label: output_crc_check 16 | dtype: enum 17 | options: ['False', 'True'] 18 | option_labels: ['No', 'Yes'] 19 | default: 'False' 20 | 21 | inputs: 22 | - domain: stream 23 | dtype: byte 24 | outputs: 25 | - domain: stream 26 | label: payload_char 27 | dtype: byte 28 | optional: ${True if str(output_crc_check)=='False' else False} 29 | - domain: stream 30 | dtype: byte 31 | label: crc_check 32 | optional: ${True if str(output_crc_check)=='False' else False} 33 | hide: ${False if str(output_crc_check)=='True' else True} 34 | - domain: message 35 | id: msg 36 | optional: true 37 | templates: 38 | imports: import gnuradio.lora_sdr as lora_sdr 39 | make: lora_sdr.crc_verif( ${print_rx_msg}, ${output_crc_check}) 40 | 41 | documentation: |- 42 | Calculate the CRC of the received data and compare it with the received CRC. 43 | Parameters: 44 | rx_log: filename where to store the received messages and their timestamp, put "" for no log. "Walltime,payload\n" 45 | print_rx_msg: Print the received message in the terminal with the specified format. 0: None, 1: ASCII, 2: Hex 46 | output_crc_check: Ouput a stream of bytes containing either 0 or 1 based on the CRC check. If enabled, both stream output must be connected. 47 | Input: 48 | in: stream of payload bytes 49 | Output: 50 | (optional) msg: Received payload 51 | (optional) payload_char: Received payload as a stream of char, with tagged with payload length and CRC verification result. 52 | (optional) crc_check: stream indicating the result of the CRC verification. Enabled by the corresponding parameter. 53 | 54 | file_format: 1 55 | -------------------------------------------------------------------------------- /grc/lora_sdr_data_source.block.yml: -------------------------------------------------------------------------------- 1 | # auto-generated by grc.converter 2 | 3 | id: lora_sdr_data_source 4 | label: Data source 5 | category: '[LoRa_TX]' 6 | 7 | parameters: 8 | - id: pay_len 9 | label: Pay_len 10 | dtype: int 11 | - id: n_frames 12 | label: N_frames 13 | dtype: int 14 | 15 | inputs: 16 | - domain: message 17 | id: trigg 18 | 19 | outputs: 20 | - domain: message 21 | id: msg 22 | 23 | templates: 24 | imports: import gnuradio.lora_sdr as lora_sdr 25 | make: lora_sdr.data_source(${pay_len}, ${n_frames}) 26 | 27 | documentation: |- 28 | Generate a new random payload string every trigger.(Random string formed from characters: a-z, A-Z, 0-9) 29 | Parameters: 30 | Pay_len: length of the payload in bytes 31 | N_frames: number of frames to send 32 | Input: 33 | trigg: trigger signal (a message strobe for instance) 34 | Output: 35 | msg: payload data as a string 36 | 37 | file_format: 1 38 | -------------------------------------------------------------------------------- /grc/lora_sdr_deinterleaver.block.yml: -------------------------------------------------------------------------------- 1 | # auto-generated by grc.converter 2 | 3 | id: lora_sdr_deinterleaver 4 | label: Deinterleaver 5 | category: '[LoRa_RX]' 6 | 7 | parameters: 8 | - id: soft_decoding 9 | label: Soft_Decoding 10 | dtype: bool 11 | default: 'soft_decoding' 12 | options: [False, True] 13 | inputs: 14 | - domain: stream 15 | dtype: ${ 'f64' if soft_decoding else 'short'} 16 | vlen: ${ 12 if soft_decoding else 1} #12 is the max number of bits per symbol 17 | 18 | outputs: 19 | - domain: stream 20 | dtype: ${ 'f64' if soft_decoding else 'byte'} 21 | vlen: ${ 8 if soft_decoding else 1} 22 | 23 | templates: 24 | imports: import gnuradio.lora_sdr as lora_sdr 25 | make: lora_sdr.deinterleaver( ${soft_decoding}) 26 | 27 | documentation: |- 28 | Deinterleave the received codewords. 29 | Parameters: 30 | sodt_decoding: use soft-decision decoding 31 | sf: spreading factor 32 | Input: 33 | in: stream of received (gray demapped) decimal values 34 | Output: 35 | out: stream of deinterleaved codewords (one per byte) 36 | 37 | file_format: 1 38 | -------------------------------------------------------------------------------- /grc/lora_sdr_dewhitening.block.yml: -------------------------------------------------------------------------------- 1 | # auto-generated by grc.converter 2 | 3 | id: lora_sdr_dewhitening 4 | label: Dewhitening 5 | category: '[LoRa_RX]' 6 | 7 | inputs: 8 | - domain: stream 9 | dtype: byte 10 | 11 | outputs: 12 | - domain: stream 13 | dtype: byte 14 | 15 | templates: 16 | imports: import gnuradio.lora_sdr as lora_sdr 17 | make: lora_sdr.dewhitening() 18 | 19 | documentation: |- 20 | Dewhiten the payload data. 21 | Input: 22 | in: stream of payload and CRC nibbles 23 | pay_len: payload length in bytes 24 | new_frame: indicate beginning of new frame 25 | CRC: payload crc presence 26 | Output: 27 | out: dewhitened payload bytes (and CRC if present) 28 | 29 | file_format: 1 30 | -------------------------------------------------------------------------------- /grc/lora_sdr_fft_demod.block.yml: -------------------------------------------------------------------------------- 1 | # auto-generated by grc.converter 2 | 3 | id: lora_sdr_fft_demod 4 | label: fft_demod 5 | category: '[LoRa_RX]' 6 | 7 | parameters: 8 | - id: soft_decoding 9 | label: Soft_Decoding 10 | dtype: bool 11 | default: 'soft_decoding' 12 | options: [False, True] 13 | - id: max_log_approx 14 | label: Max Log approx 15 | dtype: enum 16 | default: True 17 | options: ['False', 'True'] 18 | option_labels: ['No', 'Yes'] 19 | hide: ${ 'all' if not soft_decoding else 'part' } 20 | 21 | inputs: 22 | - domain: stream 23 | dtype: complex 24 | 25 | outputs: 26 | - domain: stream 27 | dtype: ${ 'f64' if soft_decoding else 'short'} 28 | vlen: ${ 12 if soft_decoding else 1} #maximum bit per symbol is 12 29 | 30 | templates: 31 | imports: import gnuradio.lora_sdr as lora_sdr 32 | make: lora_sdr.fft_demod( ${soft_decoding}, ${max_log_approx}) 33 | 34 | documentation: |- 35 | Recover the value of a lora symbol using argmax(DFT(lora_symbol * ref_downchirp) 36 | Parameters: 37 | impl_head: usage of an implicit header (explicit will be used otherwise) 38 | soft_decoding: use soft-decision decoding, outputting LLRs instead of the argmax 39 | Input: 40 | in: vector of 2^sf complex samples 41 | Output: 42 | out: stream of lora symbol decimal values or bits LLRs if soft-decision decoding is selected 43 | 44 | file_format: 1 45 | -------------------------------------------------------------------------------- /grc/lora_sdr_gray_demap.block.yml: -------------------------------------------------------------------------------- 1 | id: lora_sdr_gray_demap 2 | label: Gray demapping 3 | category: '[LoRa_TX]' 4 | 5 | parameters: 6 | - id: sf 7 | label: SF 8 | dtype: int 9 | default: 'sf' 10 | inputs: 11 | - domain: stream 12 | dtype: int 13 | 14 | outputs: 15 | - domain: stream 16 | dtype: int 17 | 18 | templates: 19 | imports: import gnuradio.lora_sdr as lora_sdr 20 | make: lora_sdr.gray_demap(${sf}) 21 | callbacks: 22 | - set_sf(${sf}) 23 | 24 | documentation: |- 25 | Apply the gray mapping operation. (Corresponding to a reverse gray encoding with a shift) 26 | Parameters: 27 | sf: spreading factor 28 | Input: 29 | in: decimal value 30 | Output: 31 | out: decimal value mapped 32 | 33 | file_format: 1 34 | -------------------------------------------------------------------------------- /grc/lora_sdr_gray_mapping.block.yml: -------------------------------------------------------------------------------- 1 | id: lora_sdr_gray_mapping 2 | label: Gray mapping 3 | category: '[LoRa_RX]' 4 | 5 | parameters: 6 | - id: soft_decoding 7 | label: Soft_Decoding 8 | dtype: bool 9 | default: 'soft_decoding' 10 | options: [False, True] 11 | 12 | inputs: 13 | - domain: stream 14 | dtype: ${ 'f64' if soft_decoding else 'short'} 15 | vlen: ${ 12 if soft_decoding else 1} #max bin per symbol is 12 16 | 17 | outputs: 18 | - domain: stream 19 | dtype: int 20 | dtype: ${ 'f64' if soft_decoding else 'short'} 21 | vlen: ${ 12 if soft_decoding else 1} #max bin per symbol is 12 22 | 23 | templates: 24 | imports: import gnuradio.lora_sdr as lora_sdr 25 | make: lora_sdr.gray_mapping( ${soft_decoding}) 26 | 27 | documentation: |- 28 | Apply the gray demapping operation. (Corresponding to a gray encoding with a shift) 29 | Input: 30 | in: decimal value gray mapped 31 | Output: 32 | out: decimal value demapped 33 | 34 | file_format: 1 35 | -------------------------------------------------------------------------------- /grc/lora_sdr_hamming_dec.block.yml: -------------------------------------------------------------------------------- 1 | id: lora_sdr_hamming_dec 2 | label: Hamming dec 3 | category: '[LoRa_RX]' 4 | 5 | parameters: 6 | - id: soft_decoding 7 | label: Soft_Decoding 8 | dtype: bool 9 | default: 'soft_decoding' 10 | options: [False, True] 11 | 12 | inputs: 13 | - domain: stream 14 | dtype: ${ 'f64' if soft_decoding else 'byte'} 15 | vlen: ${ 8 if soft_decoding else 1} 16 | 17 | outputs: 18 | - domain: stream 19 | dtype: byte 20 | 21 | templates: 22 | imports: import gnuradio.lora_sdr as lora_sdr 23 | make: lora_sdr.hamming_dec(${soft_decoding}) 24 | 25 | documentation: |- 26 | Hamming decoder 27 | Parameters: 28 | soft_decoding: uses soft-decision decoding (necessary to benefit from coding rates 4/5 and 4/6) 29 | Input: 30 | in: Stream of bytes containing each a codeword 31 | Output: 32 | out: stream of bytes containing ones nibble of payload each 33 | 34 | file_format: 1 35 | -------------------------------------------------------------------------------- /grc/lora_sdr_hamming_enc.block.yml: -------------------------------------------------------------------------------- 1 | # auto-generated by grc.converter 2 | 3 | id: lora_sdr_hamming_enc 4 | label: Hamming enc 5 | category: '[LoRa_TX]' 6 | 7 | parameters: 8 | - id: cr 9 | label: CR 10 | dtype: int 11 | default: 1 12 | - id: sf 13 | label: SF 14 | dtype: int 15 | default: 7 16 | 17 | inputs: 18 | - domain: stream 19 | dtype: byte 20 | 21 | outputs: 22 | - domain: stream 23 | dtype: byte 24 | 25 | templates: 26 | imports: import gnuradio.lora_sdr as lora_sdr 27 | make: lora_sdr.hamming_enc(${cr}, ${sf}) 28 | callbacks: 29 | - set_cr(${cr}) 30 | - set_sf(${sf}) 31 | 32 | documentation: |- 33 | Append the parity bits to a nibble in accordance to the coding rate. 34 | Parameters: 35 | CR: coding rate 36 | SF: spreading factor 37 | Input: 38 | in: stream of nibble 39 | Output: 40 | out: stream of bytes containing a nibble of data and corresponding parity bits. 41 | 42 | file_format: 1 43 | -------------------------------------------------------------------------------- /grc/lora_sdr_header.block.yml: -------------------------------------------------------------------------------- 1 | id: lora_sdr_header 2 | label: Add header 3 | category: '[LoRa_TX]' 4 | 5 | parameters: 6 | - id: impl_head 7 | label: Impl_head 8 | dtype: bool 9 | - id: has_crc 10 | label: Has_crc 11 | dtype: bool 12 | default: 'False' 13 | - id: cr 14 | label: CR 15 | dtype: int 16 | default: 'cr' 17 | 18 | 19 | inputs: 20 | - domain: stream 21 | dtype: byte 22 | 23 | outputs: 24 | - domain: stream 25 | dtype: byte 26 | 27 | templates: 28 | imports: import gnuradio.lora_sdr as lora_sdr 29 | make: lora_sdr.header(${impl_head}, ${has_crc}, ${cr}) 30 | callbacks: 31 | - set_cr(${cr}) 32 | 33 | documentation: |- 34 | Add the explicit header in the beginning of a frame if this mode is specified. 35 | Parameters: 36 | impl_head: indicate to use the implicit header mode (explicit otherwise) 37 | has_crc: indicate the presence of a payload crc 38 | CR: coding rate 39 | 40 | Input: 41 | in: stream of payload nibbles 42 | Output: 43 | out: stream of header and payload nibbles 44 | 45 | file_format: 1 46 | -------------------------------------------------------------------------------- /grc/lora_sdr_header_decoder.block.yml: -------------------------------------------------------------------------------- 1 | # auto-generated by grc.converter 2 | 3 | id: lora_sdr_header_decoder 4 | label: Header decoder 5 | category: '[LoRa_RX]' 6 | 7 | parameters: 8 | - id: impl_head 9 | label: Impl_head 10 | dtype: bool 11 | - id: print_header 12 | label: print_header 13 | dtype: enum 14 | options: ['True','False'] 15 | option_labels: [ 'Yes','No'] 16 | - id: cr 17 | label: CR 18 | dtype: int 19 | default: '3' 20 | hide: ${ 'none' if impl_head else 'all' } 21 | - id: pay_len 22 | label: Pay_len 23 | dtype: int 24 | default: '255' 25 | hide: ${ 'none' if impl_head else 'all' } 26 | - id: has_crc 27 | label: Has_crc 28 | dtype: bool 29 | default: 'False' 30 | hide: ${ 'none' if impl_head else 'all' } 31 | - id: ldro 32 | label: LDRO 33 | dtype: int 34 | options: ['0','1','2'] 35 | option_labels: ['Disable','Enable','Auto'] 36 | default: '2' 37 | 38 | 39 | inputs: 40 | - domain: stream 41 | dtype: byte 42 | 43 | outputs: 44 | - domain: stream 45 | dtype: byte 46 | - domain: message 47 | id: frame_info 48 | 49 | templates: 50 | imports: import gnuradio.lora_sdr as lora_sdr 51 | make: lora_sdr.header_decoder(${impl_head}, ${cr}, ${pay_len}, ${has_crc}, ${ldro}, ${print_header}) 52 | 53 | documentation: |- 54 | Recover information present in the header of a frame and send them to the frame synchronization block, which forwards them to each other blocks. 55 | In implicit header mode, the values given as parameters will be transmitted to the other blocks. 56 | Parameters: 57 | impl_head: indicate the usage of implicit header mode (explicit otherwise) 58 | CR: coding rate 59 | pay_len: payload length in bytes 60 | has_crc: indicate the presence of a payload CRC 61 | LDRO: Use of low datarate optimisation mode ('Auto': enabled for symbols durations > 16ms) 62 | 63 | Input: 64 | in: stream of nibbles containing the header, payload (and CRC if used) 65 | Output: 66 | out: stream of nibbles containing payload (and CRC) 67 | frame_info: info of the frame contained in the header such as coding rate, CRC presence, and payload length 68 | 69 | file_format: 1 70 | -------------------------------------------------------------------------------- /grc/lora_sdr_interleaver.block.yml: -------------------------------------------------------------------------------- 1 | id: lora_sdr_interleaver 2 | label: Interleaver 3 | category: '[LoRa_TX]' 4 | 5 | parameters: 6 | - id: cr 7 | label: CR 8 | dtype: int 9 | default: 'cr' 10 | - id: sf 11 | label: SF 12 | dtype: int 13 | default: 'sf' 14 | - id: ldro 15 | label: LDRO 16 | dtype: int 17 | options: ['0','1','2'] 18 | option_labels: ['Disable','Enable','Auto'] 19 | default: '2' 20 | - id: bw 21 | label: BW 22 | dtype: int 23 | default: '125000' 24 | hide: ${'none' if str(ldro) == '2' else 'all'} 25 | 26 | inputs: 27 | - domain: stream 28 | dtype: byte 29 | 30 | outputs: 31 | - domain: stream 32 | dtype: int 33 | 34 | templates: 35 | imports: import gnuradio.lora_sdr as lora_sdr 36 | make: lora_sdr.interleaver(${cr}, ${sf}, ${ldro}, ${bw}) 37 | callbacks: 38 | - set_cr(${cr}) 39 | - set_sf(${sf}) 40 | 41 | documentation: |- 42 | Interleaves 'sf' codewords together following a diagonal interleaving pattern 43 | Parameters: 44 | CR: coding rate 45 | SF: spreading factor 46 | LDRO: Use of low datarate optimisation mode (Auto: enabled for symbols durations > 16ms) 47 | 48 | Input: 49 | in: stream of bytes containing a codeword each 50 | Output: 51 | out: stream of interleaved codewords as decimal values 52 | 53 | file_format: 1 54 | -------------------------------------------------------------------------------- /grc/lora_sdr_modulate.block.yml: -------------------------------------------------------------------------------- 1 | # auto-generated by grc.converter 2 | 3 | id: lora_sdr_modulate 4 | label: Modulate 5 | category: '[LoRa_TX]' 6 | 7 | parameters: 8 | - id: sf 9 | label: SF 10 | dtype: int 11 | default: 'sf' 12 | - id: samp_rate 13 | label: Samp_rate 14 | dtype: int 15 | - id: bw 16 | label: BW 17 | dtype: int 18 | - id: sync_words 19 | label: Sync words 20 | dtype: int_vector 21 | hide: part 22 | default: 0x12 23 | - id: preamb_len 24 | label: Preamble_len 25 | dtype: int 26 | default: 8 27 | hide: part 28 | - id: frame_zero_padd 29 | label: Frame zero padding 30 | hide: part 31 | dtype: int 32 | default: int(20*2**sf*samp_rate/bw) 33 | 34 | inputs: 35 | - domain: stream 36 | dtype: int 37 | 38 | outputs: 39 | - domain: stream 40 | dtype: complex 41 | 42 | templates: 43 | imports: import gnuradio.lora_sdr as lora_sdr 44 | make: lora_sdr.modulate(${sf}, ${samp_rate}, ${bw}, ${sync_words}, ${frame_zero_padd},${preamb_len}) 45 | asserts: 46 | - ${ (samp_rate/bw).is_integer()} 47 | - ${frame_zero_padd>=0} 48 | 49 | documentation: |- 50 | Add the preamble to the frame and modulate lora symbols according to the input decimal values. 51 | Parameters: 52 | sf: spreading factor 53 | samp_rate: sampling rate (need to be a integer multiple of the bandwidth) 54 | Bw: LoRa bandwidth 55 | preamb_len: Number of upchirps in the preamble. Should be in [6-65535] (default value 8); 56 | Frame zero padding: zero padding append after each frame. Value given in number of samples with a minimum of 1 57 | Input: 58 | in: stream of decimal symbol values 59 | Output: 60 | out: stream of complex valued samples 61 | 62 | file_format: 1 63 | -------------------------------------------------------------------------------- /grc/lora_sdr_payload_id_inc.block.yml: -------------------------------------------------------------------------------- 1 | id: lora_sdr_payload_id_inc 2 | label: payload id inc 3 | category: '[LoRa_TX]' 4 | templates: 5 | imports: import gnuradio.lora_sdr as lora_sdr 6 | make: lora_sdr.payload_id_inc(${separator}) 7 | parameters: 8 | - id: separator 9 | label: Separator 10 | dtype: string 11 | default: ':' 12 | inputs: 13 | - domain: message 14 | id: msg_in 15 | outputs: 16 | - domain: message 17 | id: msg_out 18 | documentation: |- 19 | Increment the number following the separator by one and output it as a new message. 20 | Parameters: 21 | Separator: the string separating the payload from the frame number. It should be unique in the meassage! 22 | Input: 23 | msg_in: payload as a string 24 | Output: 25 | msg_out: payload with ending index incremented by one 26 | file_format: 1 27 | -------------------------------------------------------------------------------- /grc/lora_sdr_whitening.block.yml: -------------------------------------------------------------------------------- 1 | id: lora_sdr_whitening 2 | label: Whitening 3 | category: '[LoRa_TX]' 4 | parameters: 5 | - id: source_type 6 | label: Source type 7 | dtype: enum 8 | default: message_strobe 9 | options: ['message_strobe', 'file_source'] 10 | option_labels: ['Message strobe', 'File source'] 11 | - id: use_length_tag 12 | label: Use length tag 13 | dtype: enum 14 | options: ['True','False'] 15 | option_labels: [ 'Yes','No'] 16 | default: 'False' 17 | hide: ${ ( 'none' if str(source_type) == "file_source" else 'all') } 18 | - id: separator 19 | label: Separator 20 | dtype: raw 21 | default: "','" 22 | hide: ${ ( 'none' if ((str(source_type) == "file_source") and (use_length_tag == 'False')) else 'all') } 23 | - id: length_tag_name 24 | label: Length tag key 25 | dtype: raw 26 | default: "'packet_len'" 27 | hide: ${ ( 'none' if ((str(source_type) == "file_source") and (use_length_tag == 'True')) else 'all') } 28 | - id: is_hex 29 | label: is_hex 30 | dtype: bool 31 | default: false 32 | hide: part 33 | 34 | inputs: 35 | - domain: stream 36 | dtype: byte 37 | optional: ${ ( False if str(source_type) == "file_source" else True) } 38 | hide: ${ ( False if str(source_type) == "file_source" else True) } 39 | - domain: message 40 | id: msg 41 | optional: ${ ( False if str(source_type) == "message_strobe" else True) } 42 | hide: ${ ( False if str(source_type) == "message_strobe" else True) } 43 | - label: dict 44 | domain: message 45 | optional: True 46 | outputs: 47 | - domain: stream 48 | dtype: byte 49 | 50 | templates: 51 | imports: import gnuradio.lora_sdr as lora_sdr 52 | make: lora_sdr.whitening(${is_hex},${use_length_tag},${separator},${length_tag_name}) 53 | 54 | documentation: |- 55 | Whiten the payload data with a pseudo random sequence 56 | Parameters: 57 | Source type: choose the input mode: message or file 58 | Use length tag: separate frame content based on a length tag or a separator character 59 | Separator: the separator used to separate frame contents 60 | Length tag key: the key of the length tag 61 | is_hex: If True, the input file contains hex values as sequence of digits, with frames separated with the separator. e.g(6669727374207061636b6574,7365636f6e64207061636b6574,). Else the file contains sequence of chars with frames separated by the separator. e.g(first packet,second packet). 62 | Input: 63 | msg: the payload as a PMT message string 64 | or 65 | in: a file source with payloads separated by separator. 66 | dict: a dictionary to set parameters such as sf, bw, cr 67 | Output: 68 | out: Stream of whitened payload nibbles 69 | 70 | file_format: 1 71 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-lora_sdr 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Install public header files 11 | ######################################################################## 12 | install(FILES 13 | api.h 14 | add_crc.h 15 | crc_verif.h 16 | dewhitening.h 17 | gray_demap.h 18 | gray_mapping.h 19 | hamming_dec.h 20 | hamming_enc.h 21 | header_decoder.h 22 | header.h 23 | interleaver.h 24 | modulate.h 25 | whitening.h 26 | RH_RF95_header.h 27 | fft_demod.h 28 | data_source.h 29 | frame_sync.h 30 | deinterleaver.h 31 | payload_id_inc.h 32 | utilities.h 33 | DESTINATION include/gnuradio/lora_sdr 34 | ) 35 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/RH_RF95_header.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_RH_RF95_HEADER_H 23 | #define INCLUDED_LORA_SDR_RH_RF95_HEADER_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API RH_RF95_header : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::RH_RF95_header. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::RH_RF95_header's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::RH_RF95_header::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(uint8_t _to, uint8_t _from, uint8_t _id, uint8_t _flags); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_RH_RF95_HEADER_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/add_crc.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_ADD_CRC_H 23 | #define INCLUDED_LORA_SDR_ADD_CRC_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API add_crc : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::add_crc. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::add_crc's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::add_crc::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(bool has_crc); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_ADD_CRC_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Free Software Foundation, Inc. 3 | * 4 | * This file was generated by gr_modtool, a tool from the GNU Radio framework 5 | * This file is a part of gr-lora_sdr 6 | * 7 | * SPDX-License-Identifier: GPL-3.0-or-later 8 | * 9 | */ 10 | 11 | #ifndef INCLUDED_LORA_SDR_API_H 12 | #define INCLUDED_LORA_SDR_API_H 13 | 14 | #include 15 | 16 | #ifdef gnuradio_lora_sdr_EXPORTS 17 | #define LORA_SDR_API __GR_ATTR_EXPORT 18 | #else 19 | #define LORA_SDR_API __GR_ATTR_IMPORT 20 | #endif 21 | 22 | #endif /* INCLUDED_LORA_SDR_API_H */ 23 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/crc_verif.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_CRC_VERIF_H 23 | #define INCLUDED_LORA_SDR_CRC_VERIF_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API crc_verif : virtual public gr::block 37 | { 38 | public: 39 | enum Print_type{ 40 | NONE, 41 | ASCII, 42 | HEX 43 | }; 44 | typedef std::shared_ptr sptr; 45 | 46 | /*! 47 | * \brief Return a shared_ptr to a new instance of lora_sdr::crc_verif. 48 | * 49 | * To avoid accidental use of raw pointers, lora_sdr::crc_verif's 50 | * constructor is in a private implementation 51 | * class. lora_sdr::crc_verif::make is the public interface for 52 | * creating new instances. 53 | */ 54 | static sptr make(int print_rx_msg, bool output_crc_check); 55 | }; 56 | 57 | } // namespace lora_sdr 58 | } // namespace gr 59 | 60 | #endif /* INCLUDED_LORA_SDR_CRC_VERIF_H */ 61 | 62 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/data_source.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_DATA_SOURCE_H 23 | #define INCLUDED_LORA_SDR_DATA_SOURCE_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API data_source : virtual public gr::sync_block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::data_source. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::data_source's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::data_source::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(int pay_len,int n_frames); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_DATA_SOURCE_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/deinterleaver.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_DEINTERLEAVER_H 23 | #define INCLUDED_LORA_SDR_DEINTERLEAVER_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API deinterleaver : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::deinterleaver. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::deinterleaver's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::deinterleaver::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make( bool soft_decoding); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_DEINTERLEAVER_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/dewhitening.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_DEWHITENING_H 23 | #define INCLUDED_LORA_SDR_DEWHITENING_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API dewhitening : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::dewhitening. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::dewhitening's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::dewhitening::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_DEWHITENING_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/fft_demod.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_FFT_DEMOD_H 23 | #define INCLUDED_LORA_SDR_FFT_DEMOD_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API fft_demod : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::fft_demod. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::fft_demod's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::fft_demod::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(bool soft_decoding, bool max_log_approx); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_FFT_DEMOD_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/frame_sync.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_FRAME_SYNC_H 23 | #define INCLUDED_LORA_SDR_FRAME_SYNC_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API frame_sync : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::frame_sync. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::frame_sync's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::frame_sync::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(uint32_t center_freq, uint32_t bandwidth, uint8_t sf, bool impl_head, std::vector sync_word, uint8_t os_factor, uint16_t preamble_len); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_FRAME_SYNC_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/gray_demap.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_GRAY_DEMAP_H 23 | #define INCLUDED_LORA_SDR_GRAY_DEMAP_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API gray_demap : virtual public gr::sync_block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | virtual void set_sf(uint8_t sf)=0; 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::gray_demap. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::gray_demap's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::gray_demap::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(uint8_t sf); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_GRAY_DEMAP_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/gray_mapping.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_GRAY_MAPPING_H 23 | #define INCLUDED_LORA_SDR_GRAY_MAPPING_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API gray_mapping : virtual public gr::sync_block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::gray_mapping. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::gray_mapping's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::gray_mapping::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make( bool soft_decoding); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_GRAY_MAPPING_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/hamming_dec.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_HAMMING_DEC_H 23 | #define INCLUDED_LORA_SDR_HAMMING_DEC_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API hamming_dec : virtual public gr::sync_block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::hamming_dec. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::hamming_dec's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::hamming_dec::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(bool soft_decoding); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_HAMMING_DEC_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/hamming_enc.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_HAMMING_ENC_H 23 | #define INCLUDED_LORA_SDR_HAMMING_ENC_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API hamming_enc : virtual public gr::sync_block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | virtual void set_cr(uint8_t cr)=0; 42 | virtual uint8_t get_cr()=0; 43 | virtual void set_sf(uint8_t sf)=0; 44 | 45 | 46 | /*! 47 | * \brief Return a shared_ptr to a new instance of lora_sdr::hamming_enc. 48 | * 49 | * To avoid accidental use of raw pointers, lora_sdr::hamming_enc's 50 | * constructor is in a private implementation 51 | * class. lora_sdr::hamming_enc::make is the public interface for 52 | * creating new instances. 53 | */ 54 | static sptr make(uint8_t cr, uint8_t sf); 55 | }; 56 | 57 | } // namespace lora_sdr 58 | } // namespace gr 59 | 60 | #endif /* INCLUDED_LORA_SDR_HAMMING_ENC_H */ 61 | 62 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/header.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_HEADER_H 23 | #define INCLUDED_LORA_SDR_HEADER_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API header : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr
sptr; 40 | 41 | virtual void set_cr(uint8_t cr)=0; 42 | virtual uint8_t get_cr()=0; 43 | 44 | /*! 45 | * \brief Return a shared_ptr to a new instance of lora_sdr::header. 46 | * 47 | * To avoid accidental use of raw pointers, lora_sdr::header's 48 | * constructor is in a private implementation 49 | * class. lora_sdr::header::make is the public interface for 50 | * creating new instances. 51 | */ 52 | static sptr make(bool impl_head, bool has_crc, uint8_t cr); 53 | }; 54 | 55 | } // namespace lora_sdr 56 | } // namespace gr 57 | 58 | #endif /* INCLUDED_LORA_SDR_HEADER_H */ 59 | 60 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/header_decoder.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_HEADER_DECODER_H 23 | #define INCLUDED_LORA_SDR_HEADER_DECODER_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API header_decoder : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::header_decoder. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::header_decoder's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::header_decoder::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(bool impl_head, uint8_t cr, uint32_t pay_len, bool has_crc, uint8_t ldro, bool print_header); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_HEADER_DECODER_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/interleaver.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_INTERLEAVER_H 23 | #define INCLUDED_LORA_SDR_INTERLEAVER_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API interleaver : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | virtual void set_cr(uint8_t cr)=0; 42 | virtual uint8_t get_cr()=0; 43 | virtual void set_sf(uint8_t sf)=0; 44 | /*! 45 | * \brief Return a shared_ptr to a new instance of lora_sdr::interleaver. 46 | * 47 | * To avoid accidental use of raw pointers, lora_sdr::interleaver's 48 | * constructor is in a private implementation 49 | * class. lora_sdr::interleaver::make is the public interface for 50 | * creating new instances. 51 | */ 52 | static sptr make(uint8_t cr, uint8_t sf, uint8_t ldro, int bw); 53 | }; 54 | 55 | } // namespace lora_sdr 56 | } // namespace gr 57 | 58 | #endif /* INCLUDED_LORA_SDR_INTERLEAVER_H */ 59 | 60 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/modulate.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_MODULATE_H 23 | #define INCLUDED_LORA_SDR_MODULATE_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API modulate : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::modulate. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::modulate's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::modulate::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(uint8_t sf, uint32_t samp_rate, uint32_t bw, std::vector sync_words,uint32_t inter_frame_padd, uint16_t preamble_len ); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_MODULATE_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/no_sfo_frame_sync.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2020 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_FRAME_SYNC_H 23 | #define INCLUDED_LORA_SDR_FRAME_SYNC_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API frame_sync : virtual public gr::block 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::frame_sync. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::frame_sync's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::frame_sync::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(float samp_rate, uint32_t bandwidth, uint8_t sf, bool impl_head, std::vector sync_word); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_FRAME_SYNC_H */ 56 | 57 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/payload_id_inc.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef INCLUDED_LORA_SDR_PAYLOAD_ID_INC_H 22 | #define INCLUDED_LORA_SDR_PAYLOAD_ID_INC_H 23 | 24 | #include 25 | #include 26 | 27 | namespace gr { 28 | namespace lora_sdr { 29 | 30 | /*! 31 | * \brief <+description of block+> 32 | * \ingroup lora_sdr 33 | * 34 | */ 35 | class LORA_SDR_API payload_id_inc : virtual public gr::sync_block 36 | { 37 | public: 38 | typedef std::shared_ptr sptr; 39 | 40 | /*! 41 | * \brief Return a shared_ptr to a new instance of lora_sdr::payload_id_inc. 42 | * 43 | * To avoid accidental use of raw pointers, lora_sdr::payload_id_inc's 44 | * constructor is in a private implementation 45 | * class. lora_sdr::payload_id_inc::make is the public interface for 46 | * creating new instances. 47 | */ 48 | static sptr make(std::string separator); 49 | }; 50 | 51 | } // namespace lora_sdr 52 | } // namespace gr 53 | 54 | #endif /* INCLUDED_LORA_SDR_PAYLOAD_ID_INC_H */ 55 | 56 | -------------------------------------------------------------------------------- /include/gnuradio/lora_sdr/whitening.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | #ifndef INCLUDED_LORA_SDR_WHITENING_H 23 | #define INCLUDED_LORA_SDR_WHITENING_H 24 | 25 | #include 26 | #include 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | /*! 32 | * \brief <+description of block+> 33 | * \ingroup lora_sdr 34 | * 35 | */ 36 | class LORA_SDR_API whitening : virtual public gr::sync_interpolator 37 | { 38 | public: 39 | typedef std::shared_ptr sptr; 40 | 41 | /*! 42 | * \brief Return a shared_ptr to a new instance of lora_sdr::whitening. 43 | * 44 | * To avoid accidental use of raw pointers, lora_sdr::whitening's 45 | * constructor is in a private implementation 46 | * class. lora_sdr::whitening::make is the public interface for 47 | * creating new instances. 48 | */ 49 | static sptr make(bool is_hex, bool use_length_tag, char separator =',', std::string length_tag_name = ""); 50 | }; 51 | 52 | } // namespace lora_sdr 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_LORA_SDR_WHITENING_H */ 56 | 57 | -------------------------------------------------------------------------------- /lib/RH_RF95_header_impl.cc: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif 4 | 5 | #include 6 | #include "RH_RF95_header_impl.h" 7 | 8 | namespace gr { 9 | namespace lora_sdr { 10 | 11 | RH_RF95_header::sptr 12 | RH_RF95_header::make(uint8_t _to, uint8_t _from, uint8_t _id, uint8_t _flags) 13 | { 14 | return gnuradio::get_initial_sptr 15 | (new RH_RF95_header_impl(_to, _from, _id, _flags)); 16 | } 17 | 18 | /* 19 | * The private constructor 20 | */ 21 | RH_RF95_header_impl::RH_RF95_header_impl(uint8_t _to, uint8_t _from, uint8_t _id, uint8_t _flags) 22 | : gr::block("RH_RF95_header", 23 | gr::io_signature::make(0, 0, 0), 24 | gr::io_signature::make(0, 0, 0)) 25 | { 26 | m_to = _to; 27 | m_from = _from; 28 | m_id = _id; 29 | m_flags = _flags; 30 | 31 | message_port_register_out(pmt::mp("msg")); 32 | message_port_register_in(pmt::mp("msg")); 33 | // set_msg_handler(pmt::mp("msg"), boost::bind(&RH_RF95_header_impl::msg_handler, this, _1)); 34 | set_msg_handler(pmt::mp("msg"), [this](pmt::pmt_t msg) { this->msg_handler(msg); }); 35 | } 36 | /* 37 | * Our virtual destructor. 38 | */ 39 | RH_RF95_header_impl::~RH_RF95_header_impl() 40 | {} 41 | 42 | void 43 | RH_RF95_header_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required) 44 | {} 45 | void RH_RF95_header_impl::msg_handler(pmt::pmt_t message){ 46 | std::string str=pmt::symbol_to_string(message); 47 | std::string s({ m_to,m_from,m_id,m_flags }); 48 | str=s+str; 49 | message_port_pub(pmt::intern("msg"),pmt::mp(str)); 50 | } 51 | 52 | int 53 | RH_RF95_header_impl::general_work (int noutput_items, 54 | gr_vector_int &ninput_items, 55 | gr_vector_const_void_star &input_items, 56 | gr_vector_void_star &output_items) 57 | { 58 | std::cout<<"there"< 5 | 6 | namespace gr { 7 | namespace lora_sdr { 8 | 9 | class RH_RF95_header_impl : public RH_RF95_header 10 | { 11 | private: 12 | char m_to; ///< radiohead specific header field "to" 13 | char m_from; ///< radiohead specific header field "from" 14 | char m_id; ///< radiohead specific header field "id" 15 | char m_flags; ///< radiohead specific header field "flags" 16 | std::vector m_payload; /// 6 | #include 7 | namespace gr { 8 | namespace lora_sdr { 9 | 10 | class add_crc_impl : public add_crc 11 | { 12 | private: 13 | bool m_has_crc; /// m_payload; ///< payload data 15 | uint8_t m_payload_len; ///< length of the payload in Bytes 16 | int m_frame_len; ///< length of the frame in number of gnuradio items 17 | int m_cnt; ///< counter of the number of symbol in frame 18 | 19 | unsigned int crc16(unsigned int crcValue, unsigned char newByte); 20 | 21 | public: 22 | add_crc_impl(bool has_crc); 23 | ~add_crc_impl(); 24 | 25 | // Where all the action really happens 26 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 27 | 28 | int general_work(int noutput_items, 29 | gr_vector_int &ninput_items, 30 | gr_vector_const_void_star &input_items, 31 | gr_vector_void_star &output_items); 32 | }; 33 | } // namespace lora 34 | } // namespace gr 35 | 36 | #endif /* INCLUDED_LORA_ADD_CRC_IMPL_H */ 37 | -------------------------------------------------------------------------------- /lib/crc_verif_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_LORA_CRC_VERIF_IMPL_H 2 | #define INCLUDED_LORA_CRC_VERIF_IMPL_H 3 | 4 | #include 5 | 6 | // #define GRLORA_DEBUG 7 | 8 | namespace gr { 9 | namespace lora_sdr { 10 | 11 | class crc_verif_impl : public crc_verif 12 | { 13 | private: 14 | uint32_t m_payload_len;///< Payload length in bytes 15 | bool m_crc_presence;///< Indicate if there is a payload CRC 16 | uint16_t m_crc;///< The CRC calculated from the received payload 17 | std::string message_str;///< The payload string 18 | char m_char;///< A new char of the payload 19 | bool new_frame; /// in_buff;///< input buffer containing the data bytes and CRC if any 21 | int print_rx_msg; ///< print received message in terminal. 0: no print, 1: ASCII, 2: HEX 22 | bool output_crc_check; ///< output the result of the payload CRC check 23 | tag_t current_tag; ///< the most recent tag for the packet we are currently processing 24 | 25 | 26 | uint32_t cnt=0;///< count the number of frame 27 | 28 | /** 29 | * \brief Handles the payload length received from the header_decoder block. 30 | */ 31 | void header_pay_len_handler(pmt::pmt_t payload_len); 32 | /** 33 | * \brief Handles the crc_presence received from the header_decoder block. 34 | */ 35 | void header_crc_handler(pmt::pmt_t crc_presence); 36 | /** 37 | * \brief Calculate the CRC 16 using poly=0x1021 and Init=0x0000 38 | * 39 | * \param data 40 | * The pointer to the data beginning. 41 | * \param len 42 | * The length of the data in bytes. 43 | */ 44 | unsigned int crc16(uint8_t* data, uint32_t len); 45 | 46 | public: 47 | crc_verif_impl(int print_rx_msg, bool output_crc_check); 48 | ~crc_verif_impl(); 49 | 50 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 51 | 52 | int general_work(int noutput_items, 53 | gr_vector_int &ninput_items, 54 | gr_vector_const_void_star &input_items, 55 | gr_vector_void_star &output_items); 56 | 57 | }; 58 | } // namespace lora 59 | } // namespace gr 60 | 61 | #endif /* INCLUDED_LORA_CRC_VERIF_IMPL_H */ 62 | -------------------------------------------------------------------------------- /lib/data_source_impl.cc: -------------------------------------------------------------------------------- 1 | 2 | #ifdef HAVE_CONFIG_H 3 | #include "config.h" 4 | #endif 5 | 6 | #include 7 | #include "data_source_impl.h" 8 | #include 9 | 10 | namespace gr { 11 | namespace lora_sdr { 12 | 13 | data_source::sptr 14 | data_source::make(int pay_len,int n_frames) 15 | { 16 | return gnuradio::get_initial_sptr 17 | (new data_source_impl(pay_len, n_frames)); 18 | } 19 | 20 | /* 21 | * The private constructor 22 | */ 23 | data_source_impl::data_source_impl(int pay_len,int n_frames) 24 | : gr::sync_block("data_source", 25 | gr::io_signature::make(0, 0, 0), 26 | gr::io_signature::make(0, 0, 0)) 27 | { 28 | m_n_frames = n_frames; 29 | m_pay_len = pay_len; 30 | frame_cnt = -5;// let some time to the Rx to start listening 31 | message_port_register_in(pmt::mp("trigg")); 32 | // set_msg_handler(pmt::mp("trigg"),boost::bind(&data_source_impl::trigg_handler, this, _1)); 33 | set_msg_handler(pmt::mp("trigg"), [this](pmt::pmt_t msg) { this->trigg_handler(msg); }); 34 | 35 | message_port_register_out(pmt::mp("msg")); 36 | } 37 | 38 | /* 39 | * Our virtual destructor. 40 | */ 41 | data_source_impl::~data_source_impl() 42 | {} 43 | std::string data_source_impl::random_string(int Nbytes){ 44 | const char* charmap = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; 45 | const size_t charmapLength = strlen(charmap); 46 | auto generator = [&](){ return charmap[rand()%charmapLength]; }; 47 | std::string result; 48 | result.reserve(Nbytes); 49 | std::generate_n(std::back_inserter(result), Nbytes, generator); 50 | return result; 51 | } 52 | void data_source_impl::trigg_handler(pmt::pmt_t msg){ 53 | if(frame_cnt=0){//send a new payload 54 | std::string str = random_string(m_pay_len); 55 | message_port_pub(pmt::intern("msg"),pmt::mp(str)); 56 | if(!mod(frame_cnt,50)) 57 | std::cout < 5 | #include 6 | 7 | namespace gr { 8 | namespace lora_sdr { 9 | 10 | class data_source_impl : public data_source 11 | { 12 | private: 13 | int frame_cnt; ///< count the number of frame sent 14 | int m_n_frames;///< The maximal number of frame to send 15 | int m_pay_len; ///< The payload length 16 | 17 | /** 18 | * \brief return a random string containing [a-z A-Z 0-9] 19 | * 20 | * \param nbytes 21 | * The number of char in the string 22 | */ 23 | std::string random_string(int nbytes); 24 | /** 25 | * \brief Handles trigger messages 26 | */ 27 | void trigg_handler(pmt::pmt_t id); 28 | 29 | public: 30 | data_source_impl(int pay_len,int n_frames); 31 | ~data_source_impl(); 32 | 33 | int work(int noutput_items, 34 | gr_vector_const_void_star &input_items, 35 | gr_vector_void_star &output_items); 36 | }; 37 | } // namespace lora_sdr 38 | } // namespace gr 39 | 40 | #endif /* INCLUDED_LORA_SDR_DATA_SOURCE_IMPL_H */ 41 | -------------------------------------------------------------------------------- /lib/deinterleaver_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_LORA_DEINTERLEAVER_IMPL_H 2 | #define INCLUDED_LORA_DEINTERLEAVER_IMPL_H 3 | 4 | // #define GRLORA_DEBUG 5 | #include 6 | 7 | namespace gr { 8 | namespace lora_sdr { 9 | 10 | class deinterleaver_impl : public deinterleaver 11 | { 12 | private: 13 | uint8_t m_sf; ///< Transmission Spreading factor 14 | uint8_t m_cr; ///< Transmission Coding rate 15 | uint8_t sf_app; ///< Spreading factor to use to deinterleave 16 | uint8_t cw_len; ///< Length of a codeword 17 | bool m_is_header; ///< Indicate that we need to deinterleave the first block with the default header parameters (cr=4/8, reduced rate) 18 | bool m_soft_decoding; ///< Hard/Soft decoding 19 | bool m_ldro; ///< use low datarate optimization mode 20 | 21 | public: 22 | deinterleaver_impl(bool soft_decoding); 23 | ~deinterleaver_impl(); 24 | 25 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 26 | 27 | int general_work(int noutput_items, 28 | gr_vector_int &ninput_items, 29 | gr_vector_const_void_star &input_items, 30 | gr_vector_void_star &output_items); 31 | 32 | }; 33 | 34 | } // namespace lora 35 | } // namespace gr 36 | 37 | #endif /* INCLUDED_LORA_DEINTERLEAVER_IMPL_H */ 38 | -------------------------------------------------------------------------------- /lib/dewhitening_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_LORA_DEWHITENING_IMPL_H 2 | #define INCLUDED_LORA_DEWHITENING_IMPL_H 3 | 4 | // #define GRLORA_DEBUG 5 | #include 6 | 7 | namespace gr { 8 | namespace lora_sdr { 9 | 10 | class dewhitening_impl : public dewhitening 11 | { 12 | private: 13 | int m_payload_len; ///< Payload length in bytes 14 | int m_crc_presence; ///< indicate the presence of a CRC 15 | int offset = 0; ///< The offset in the whitening table 16 | std::vector dewhitened; ///< The dewhitened bytes 17 | 18 | /** 19 | * \brief Handles the payload length received from the header_decoder block. 20 | */ 21 | void header_pay_len_handler(pmt::pmt_t payload_len); 22 | 23 | /** 24 | * \brief Reset the block variables for a new frame. 25 | */ 26 | void new_frame_handler(pmt::pmt_t id); 27 | /** 28 | * \brief Receive indication on the CRC presence 29 | */ 30 | void header_crc_handler(pmt::pmt_t crc_presence); 31 | 32 | public: 33 | dewhitening_impl(); 34 | ~dewhitening_impl(); 35 | 36 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 37 | 38 | int general_work(int noutput_items, 39 | gr_vector_int &ninput_items, 40 | gr_vector_const_void_star &input_items, 41 | gr_vector_void_star &output_items); 42 | }; 43 | 44 | } // namespace lora 45 | } // namespace gr 46 | 47 | #endif /* INCLUDED_LORA_DEWHITENING_IMPL_H */ 48 | -------------------------------------------------------------------------------- /lib/gray_demap_impl.cc: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif 4 | 5 | #include 6 | #include "gray_demap_impl.h" 7 | #include 8 | 9 | namespace gr { 10 | namespace lora_sdr { 11 | 12 | gray_demap::sptr 13 | gray_demap::make(uint8_t sf) 14 | { 15 | return gnuradio::get_initial_sptr 16 | (new gray_demap_impl(sf)); 17 | } 18 | 19 | 20 | /* 21 | * The private constructor 22 | */ 23 | gray_demap_impl::gray_demap_impl(uint8_t sf) 24 | : gr::sync_block("gray_demap", 25 | gr::io_signature::make(1, 1, sizeof(uint32_t)), 26 | gr::io_signature::make(1, 1, sizeof(uint32_t))) 27 | { 28 | m_sf = sf; 29 | set_tag_propagation_policy(TPP_ONE_TO_ONE); 30 | } 31 | 32 | void gray_demap_impl::set_sf(uint8_t sf){ 33 | m_sf = sf; 34 | } 35 | 36 | /* 37 | * Our virtual destructor. 38 | */ 39 | gray_demap_impl::~gray_demap_impl() 40 | {} 41 | 42 | int 43 | gray_demap_impl::work(int noutput_items, 44 | gr_vector_const_void_star &input_items, 45 | gr_vector_void_star &output_items) 46 | { 47 | const uint32_t *in = (const uint32_t *) input_items[0]; 48 | uint32_t *out = (uint32_t *) output_items[0]; 49 | 50 | std::vector tags; 51 | 52 | get_tags_in_window(tags, 0, 0, noutput_items, pmt::string_to_symbol("configuration")); 53 | if (tags.size() > 0) { 54 | //Update cr and sf 55 | pmt::pmt_t err_sf = pmt::string_to_symbol("error"); 56 | int new_sf = pmt::to_long(pmt::dict_ref(tags[0].value, pmt::string_to_symbol("sf"), err_sf)); 57 | if (new_sf != m_sf) { 58 | m_sf = new_sf; 59 | // std::cout<<"New sf gray demap "<< static_cast(m_sf) < "; 65 | #endif 66 | out[i]=in[i]; 67 | for(int j=1;j>j); 69 | } 70 | //do the shift of 1 71 | out[i]=mod(out[i]+1,(1< 6 | 7 | namespace gr { 8 | namespace lora_sdr { 9 | 10 | class gray_demap_impl : public gray_demap 11 | { 12 | private: 13 | uint8_t m_sf; 14 | 15 | public: 16 | gray_demap_impl(uint8_t sf); 17 | ~gray_demap_impl(); 18 | void set_sf(uint8_t sf); 19 | void frame_info_handler(pmt::pmt_t frame_info); 20 | 21 | int work( 22 | int noutput_items, 23 | gr_vector_const_void_star &input_items, 24 | gr_vector_void_star &output_items 25 | ); 26 | }; 27 | } // namespace lora 28 | } // namespace gr 29 | 30 | #endif /* INCLUDED_LORA_GRAY_DEMAP_IMPL_H */ 31 | -------------------------------------------------------------------------------- /lib/gray_mapping_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_LORA_GRAY_MAPPING_IMPL_H 2 | #define INCLUDED_LORA_GRAY_MAPPING_IMPL_H 3 | // #define GRLORA_DEBUG 4 | #include 5 | 6 | 7 | namespace gr { 8 | namespace lora_sdr { 9 | 10 | class gray_mapping_impl : public gray_mapping 11 | { 12 | private: 13 | uint8_t m_sf; ///< Spreading factor 14 | bool m_soft_decoding; ///< Hard/Soft decoding 15 | 16 | public: 17 | gray_mapping_impl(bool soft_decoding); 18 | ~gray_mapping_impl(); 19 | 20 | int work( 21 | int noutput_items, 22 | gr_vector_const_void_star &input_items, 23 | gr_vector_void_star &output_items 24 | ); 25 | }; 26 | } // namespace lora 27 | } // namespace gr 28 | 29 | #endif /* INCLUDED_LORA_GRAY_MAPPING_IMPL_H */ 30 | -------------------------------------------------------------------------------- /lib/hamming_dec_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_LORA_hamming_dec_IMPL_H 2 | #define INCLUDED_LORA_hamming_dec_IMPL_H 3 | 4 | #include 5 | 6 | namespace gr { 7 | namespace lora_sdr { 8 | 9 | class hamming_dec_impl : public hamming_dec 10 | { 11 | private: 12 | uint8_t m_cr; ///< Transmission coding rate 13 | uint8_t cr_app; ///< Coding rate use for the block 14 | bool is_header; ///< Indicate that it is the first block 15 | bool m_soft_decoding; ///< Hard/Soft decoding 16 | 17 | public: 18 | hamming_dec_impl(bool soft_decoding); 19 | ~hamming_dec_impl(); 20 | 21 | int work( 22 | int noutput_items, 23 | gr_vector_const_void_star &input_items, 24 | gr_vector_void_star &output_items 25 | ); 26 | }; 27 | 28 | } // namespace lora 29 | } // namespace gr 30 | 31 | #endif /* INCLUDED_LORA_hamming_dec_IMPL_H */ 32 | -------------------------------------------------------------------------------- /lib/hamming_enc_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_LORA_HAMMING_ENC_IMPL_H 2 | #define INCLUDED_LORA_HAMMING_ENC_IMPL_H 3 | 4 | #include 5 | 6 | namespace gr { 7 | namespace lora_sdr { 8 | 9 | class hamming_enc_impl : public hamming_enc 10 | { 11 | private: 12 | uint8_t m_cr; ///< Transmission coding rate 13 | uint8_t m_sf; ///< Transmission spreading factor 14 | int m_cnt; ///< count the number of processed items in the current frame 15 | 16 | public: 17 | hamming_enc_impl(uint8_t cr, uint8_t sf); 18 | ~hamming_enc_impl(); 19 | 20 | 21 | void set_cr(uint8_t cr); 22 | uint8_t get_cr(); 23 | void set_sf(uint8_t sf); 24 | 25 | 26 | // Where all the action really happens 27 | int work( 28 | int noutput_items, 29 | gr_vector_const_void_star &input_items, 30 | gr_vector_void_star &output_items 31 | ); 32 | }; 33 | 34 | } // namespace lora 35 | } // namespace gr 36 | 37 | #endif /* INCLUDED_LORA_HAMMING_ENC_IMPL_H */ 38 | -------------------------------------------------------------------------------- /lib/header_decoder_impl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef INCLUDED_LORA_HEADER_DECODER_IMPL_H 3 | #define INCLUDED_LORA_HEADER_DECODER_IMPL_H 4 | 5 | #include 6 | #include 7 | 8 | namespace gr { 9 | namespace lora_sdr { 10 | 11 | class header_decoder_impl : public header_decoder 12 | { 13 | private: 14 | const uint8_t header_len = 5; ///< size of the header in nibbles 15 | 16 | bool m_impl_header;///< Specify if we use an explicit or implicit header 17 | bool m_print_header; ///< print or not header information in terminal 18 | uint8_t m_payload_len;///< The payload length in bytes 19 | bool m_has_crc;///< Specify the usage of a payload CRC 20 | uint8_t m_cr;///< Coding rate 21 | uint8_t m_ldro_mode; ///< use low datarate optimisation 22 | 23 | uint8_t header_chk; ///< The header checksum received in the header 24 | 25 | uint32_t pay_cnt;///< The number of payload nibbles received 26 | uint32_t nout;///< The number of data nibbles to output 27 | bool is_header ;///< Indicate that we need to decode the header 28 | 29 | /** 30 | * \brief Reset the block variables for a new frame. 31 | */ 32 | void new_frame_handler(); 33 | /** 34 | * \brief publish decoding information contained in the header or provided to the block 35 | */ 36 | void publish_frame_info(int cr, int pay_len, int crc, uint8_t ldro, int err); 37 | 38 | public: 39 | header_decoder_impl(bool impl_head, uint8_t cr, uint32_t pay_len, bool has_crc, uint8_t ldro_mode, bool print_header); 40 | ~header_decoder_impl(); 41 | 42 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 43 | 44 | int general_work(int noutput_items, 45 | gr_vector_int &ninput_items, 46 | gr_vector_const_void_star &input_items, 47 | gr_vector_void_star &output_items); 48 | }; 49 | } // namespace lora 50 | } // namespace gr 51 | 52 | #endif /* INCLUDED_LORA_HEADER_DECODER_IMPL_H */ 53 | -------------------------------------------------------------------------------- /lib/header_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_LORA_HEADER_IMPL_H 2 | #define INCLUDED_LORA_HEADER_IMPL_H 3 | 4 | #include 5 | 6 | namespace gr { 7 | namespace lora_sdr { 8 | 9 | class header_impl : public header 10 | { 11 | private: 12 | bool m_impl_head; ///< indicate if the header is implicit 13 | bool m_has_crc; ///< indicate the presence of a payload crc 14 | uint8_t m_cr; ///< Transmission coding rate 15 | uint8_t m_payload_len; ///< Payload length 16 | unsigned int m_cnt_nibbles; ///< count the processes nibbles in a frame 17 | unsigned int m_cnt_header_nibbles; ///< count the number of explicit header nibbles output 18 | std::vector m_header; ///< contain the header to prepend 19 | 20 | bool m_has_config_tag; /// m_tags; 24 | void msg_handler(pmt::pmt_t message); 25 | 26 | public: 27 | header_impl(bool impl_head, bool has_crc, uint8_t cr); 28 | ~header_impl(); 29 | 30 | void set_cr(uint8_t cr); 31 | uint8_t get_cr(); 32 | 33 | 34 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 35 | 36 | int general_work(int noutput_items, 37 | gr_vector_int &ninput_items, 38 | gr_vector_const_void_star &input_items, 39 | gr_vector_void_star &output_items); 40 | 41 | }; 42 | 43 | } // namespace lora 44 | } // namespace gr 45 | 46 | #endif /* INCLUDED_LORA_HEADER_IMPL_H */ 47 | -------------------------------------------------------------------------------- /lib/interleaver_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_LORA_INTERLEAVER_IMPL_H 2 | #define INCLUDED_LORA_INTERLEAVER_IMPL_H 3 | 4 | #include 5 | // #define GRLORA_DEBUG 6 | 7 | namespace gr { 8 | namespace lora_sdr { 9 | 10 | class interleaver_impl : public interleaver 11 | { 12 | private: 13 | uint8_t m_cr; ///< Transmission coding rate 14 | uint8_t m_sf; ///< Transmission spreading factor 15 | 16 | uint32_t cw_cnt; ///< count the number of codewords 17 | int m_frame_len; /// 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | // #define GR_LORA_PRINT_INFO 12 | 13 | namespace gr { 14 | namespace lora_sdr { 15 | 16 | class modulate_impl : public modulate 17 | { 18 | private: 19 | uint8_t m_sf; ///< Transmission spreading factor 20 | uint32_t m_samp_rate; ///< Transmission sampling rate 21 | uint32_t m_bw; ///< Transmission bandwidth (Works only for samp_rate=bw) 22 | uint32_t m_number_of_bins; ///< number of bin per loar symbol 23 | int m_samples_per_symbol; ///< samples per symbols(Works only for 2^sf) 24 | std::vector m_sync_words; ///< sync words (network id) 25 | 26 | int m_ninput_items_required; ///< number of samples required to call this block (forecast) 27 | 28 | int m_os_factor; ///< ovesampling factor based on sampling rate and bandwidth 29 | 30 | uint32_t m_inter_frame_padding; ///< length in samples of zero append to each frame 31 | 32 | int m_frame_len;///< leng of the frame in number of items 33 | 34 | std::vector m_upchirp; ///< reference upchirp 35 | std::vector m_downchirp; ///< reference downchirp 36 | 37 | uint16_t m_preamb_len; ///< number of upchirps in the preamble 38 | int32_t samp_cnt; ///< counter of the number of lora samples sent 39 | int32_t preamb_samp_cnt; ///< counter of the number of preamble symbols output 40 | uint32_t padd_cnt; ///< counter of the number of null symbols output after each frame 41 | uint64_t frame_cnt; ///< counter of the number of frame sent 42 | bool frame_end; ///< indicate that we send a full frame 43 | 44 | tag_t m_config_tag; 45 | tag_t m_framelen_tag; 46 | 47 | public: 48 | modulate_impl(uint8_t sf, uint32_t samp_rate, uint32_t bw, std::vector sync_words, uint32_t frame_zero_padd, uint16_t preamb_len); 49 | ~modulate_impl(); 50 | 51 | void set_sf(uint8_t sf); 52 | 53 | // Where all the action really happens 54 | void forecast (int noutput_items, gr_vector_int &ninput_items_required); 55 | void update_var(int new_sf, int new_bw); 56 | int general_work(int noutput_items, 57 | gr_vector_int &ninput_items, 58 | gr_vector_const_void_star &input_items, 59 | gr_vector_void_star &output_items); 60 | }; 61 | 62 | } // namespace lora 63 | } // namespace gr 64 | 65 | #endif /* INCLUDED_LORA_MODULATE_IMPL_H */ 66 | -------------------------------------------------------------------------------- /lib/payload_id_inc_impl.cc: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2022 Tapparel Joachim @EPFL,TCL. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif 24 | 25 | #include 26 | #include "payload_id_inc_impl.h" 27 | 28 | namespace gr { 29 | namespace lora_sdr { 30 | 31 | payload_id_inc::sptr 32 | payload_id_inc::make(std::string separator) 33 | { 34 | return gnuradio::get_initial_sptr 35 | (new payload_id_inc_impl(separator)); 36 | } 37 | 38 | 39 | /* 40 | * The private constructor 41 | */ 42 | payload_id_inc_impl::payload_id_inc_impl(std::string separator) 43 | : gr::sync_block("payload_id_inc", 44 | gr::io_signature::make(0, 0, 0), 45 | gr::io_signature::make(0, 0, 0)) 46 | { 47 | m_separator = separator; 48 | message_port_register_in(pmt::mp("msg_in")); 49 | message_port_register_out(pmt::mp("msg_out")); 50 | // set_msg_handler(pmt::mp("noise_est"),boost::bind(&mu_detection_impl::noise_handler, this, _1)); 51 | set_msg_handler(pmt::mp("msg_in"), [this](pmt::pmt_t msg) 52 | { this->msg_handler(msg); }); 53 | } 54 | 55 | /* 56 | * Our virtual destructor. 57 | */ 58 | payload_id_inc_impl::~payload_id_inc_impl() 59 | { 60 | } 61 | void payload_id_inc_impl::msg_handler(pmt::pmt_t msg) 62 | { 63 | // std::cout << "[mu_detection_impl.cc] Noise estimation received: "< 25 | 26 | namespace gr { 27 | namespace lora_sdr { 28 | 29 | class payload_id_inc_impl : public payload_id_inc 30 | { 31 | private: 32 | std::string m_separator; 33 | void msg_handler(pmt::pmt_t msg); 34 | int m_cnt=0; 35 | 36 | public: 37 | payload_id_inc_impl(std::string separator); 38 | ~payload_id_inc_impl(); 39 | 40 | // Where all the action really happens 41 | int work( 42 | int noutput_items, 43 | gr_vector_const_void_star &input_items, 44 | gr_vector_void_star &output_items 45 | ); 46 | }; 47 | 48 | } // namespace lora_sdr 49 | } // namespace gr 50 | 51 | #endif /* INCLUDED_LORA_SDR_PAYLOAD_ID_INC_IMPL_H */ 52 | 53 | -------------------------------------------------------------------------------- /lib/tables.h: -------------------------------------------------------------------------------- 1 | #ifndef TABLES_H 2 | #define TABLES_H 3 | 4 | namespace gr { 5 | namespace lora_sdr { 6 | //whitenig sequence 7 | const uint8_t whitening_seq[] = { 8 | 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE1, 0xC2, 0x85, 0x0B, 0x17, 0x2F, 0x5E, 0xBC, 0x78, 0xF1, 0xE3, 9 | 0xC6, 0x8D, 0x1A, 0x34, 0x68, 0xD0, 0xA0, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08, 0x11, 0x23, 0x47, 10 | 0x8E, 0x1C, 0x38, 0x71, 0xE2, 0xC4, 0x89, 0x12, 0x25, 0x4B, 0x97, 0x2E, 0x5C, 0xB8, 0x70, 0xE0, 11 | 0xC0, 0x81, 0x03, 0x06, 0x0C, 0x19, 0x32, 0x64, 0xC9, 0x92, 0x24, 0x49, 0x93, 0x26, 0x4D, 0x9B, 12 | 0x37, 0x6E, 0xDC, 0xB9, 0x72, 0xE4, 0xC8, 0x90, 0x20, 0x41, 0x82, 0x05, 0x0A, 0x15, 0x2B, 0x56, 13 | 0xAD, 0x5B, 0xB6, 0x6D, 0xDA, 0xB5, 0x6B, 0xD6, 0xAC, 0x59, 0xB2, 0x65, 0xCB, 0x96, 0x2C, 0x58, 14 | 0xB0, 0x61, 0xC3, 0x87, 0x0F, 0x1F, 0x3E, 0x7D, 0xFB, 0xF6, 0xED, 0xDB, 0xB7, 0x6F, 0xDE, 0xBD, 15 | 0x7A, 0xF5, 0xEB, 0xD7, 0xAE, 0x5D, 0xBA, 0x74, 0xE8, 0xD1, 0xA2, 0x44, 0x88, 0x10, 0x21, 0x43, 16 | 0x86, 0x0D, 0x1B, 0x36, 0x6C, 0xD8, 0xB1, 0x63, 0xC7, 0x8F, 0x1E, 0x3C, 0x79, 0xF3, 0xE7, 0xCE, 17 | 0x9C, 0x39, 0x73, 0xE6, 0xCC, 0x98, 0x31, 0x62, 0xC5, 0x8B, 0x16, 0x2D, 0x5A, 0xB4, 0x69, 0xD2, 18 | 0xA4, 0x48, 0x91, 0x22, 0x45, 0x8A, 0x14, 0x29, 0x52, 0xA5, 0x4A, 0x95, 0x2A, 0x54, 0xA9, 0x53, 19 | 0xA7, 0x4E, 0x9D, 0x3B, 0x77, 0xEE, 0xDD, 0xBB, 0x76, 0xEC, 0xD9, 0xB3, 0x67, 0xCF, 0x9E, 0x3D, 20 | 0x7B, 0xF7, 0xEF, 0xDF, 0xBF, 0x7E, 0xFD, 0xFA, 0xF4, 0xE9, 0xD3, 0xA6, 0x4C, 0x99, 0x33, 0x66, 21 | 0xCD, 0x9A, 0x35, 0x6A, 0xD4, 0xA8, 0x51, 0xA3, 0x46, 0x8C, 0x18, 0x30, 0x60, 0xC1, 0x83, 0x07, 22 | 0x0E, 0x1D, 0x3A, 0x75, 0xEA, 0xD5, 0xAA, 0x55, 0xAB, 0x57, 0xAF, 0x5F, 0xBE, 0x7C, 0xF9, 0xF2, 23 | 0xE5, 0xCA, 0x94, 0x28, 0x50, 0xA1, 0x42, 0x84, 0x09, 0x13, 0x27, 0x4F, 0x9F, 0x3F, 0x7F 24 | }; 25 | } 26 | } 27 | 28 | #endif /* TABLES_H */ 29 | -------------------------------------------------------------------------------- /lib/whitening_impl.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef INCLUDED_LORA_WHITENING_IMPL_H 4 | #define INCLUDED_LORA_WHITENING_IMPL_H 5 | 6 | #include 7 | #include 8 | namespace gr 9 | { 10 | namespace lora_sdr 11 | { 12 | 13 | class whitening_impl : public whitening 14 | { 15 | private: 16 | bool m_is_hex; ///< indicate that the payload is given by a string of hex values 17 | char m_separator; ///< the separator for file inputs 18 | std::vector m_payload; ///< store the payload bytes 19 | std::vector payload_str; ///< payload as a string 20 | bool m_file_source; ///< indicate that the payload are provided by a file through an input stream 21 | bool m_use_length_tag; ///< whether to use the length tag to separate frames or the separator character 22 | std::string m_length_tag_name; ///< name/key of the length tag 23 | int m_input_byte_cnt; ///< number of bytes from the input already processed 24 | uint64_t m_tag_offset; ///< offset of the length tag 25 | 26 | void msg_handler(pmt::pmt_t message); 27 | void frame_info_handler(pmt::pmt_t frame_info); 28 | 29 | 30 | public: 31 | whitening_impl(bool is_hex, bool use_length_tag, char separator, std::string length_tag_name); 32 | ~whitening_impl(); 33 | 34 | // Where all the action really happens 35 | int work( 36 | int noutput_items, 37 | gr_vector_const_void_star &input_items, 38 | gr_vector_void_star &output_items); 39 | }; 40 | } // namespace lora 41 | } // namespace gr 42 | 43 | #endif /* INCLUDED_LORA_WHITENING_IMPL_H */ 44 | -------------------------------------------------------------------------------- /python/lora_sdr/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.pyc 3 | *.pyo 4 | build*/ 5 | examples/grc/*.py 6 | -------------------------------------------------------------------------------- /python/lora_sdr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file was generated by gr_modtool, a tool from the GNU Radio framework 4 | # This file is a part of gr-lora_sdr 5 | # 6 | # SPDX-License-Identifier: GPL-3.0-or-later 7 | # 8 | 9 | ######################################################################## 10 | # Include python install macros 11 | ######################################################################## 12 | include(GrPython) 13 | if(NOT PYTHONINTERP_FOUND) 14 | return() 15 | endif() 16 | 17 | add_subdirectory(bindings) 18 | 19 | ######################################################################## 20 | # Install python sources 21 | ######################################################################## 22 | GR_PYTHON_INSTALL( 23 | FILES 24 | __init__.py 25 | lora_sdr_lora_tx.py 26 | lora_sdr_lora_rx.py 27 | DESTINATION ${GR_PYTHON_DIR}/gnuradio/lora_sdr 28 | ) 29 | 30 | ######################################################################## 31 | # Handle the unit tests 32 | ######################################################################## 33 | include(GrTest) 34 | 35 | set(GR_TEST_TARGET_DEPS gnuradio-lora_sdr) 36 | 37 | # Create a package directory that tests can import. It includes everything 38 | # from `python/`. 39 | add_custom_target( 40 | copy_module_for_tests ALL 41 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} 42 | ${CMAKE_BINARY_DIR}/test_modules/gnuradio/lora_sdr/ 43 | ) 44 | -------------------------------------------------------------------------------- /python/lora_sdr/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2008,2009 Free Software Foundation, Inc. 3 | # 4 | # SPDX-License-Identifier: GPL-3.0-or-later 5 | # 6 | 7 | # The presence of this file turns this directory into a Python package 8 | 9 | ''' 10 | This is the GNU Radio LORA_SDR module. Place your Python package 11 | description here (python/__init__.py). 12 | ''' 13 | import os 14 | 15 | # import pybind11 generated symbols into the lora_sdr namespace 16 | try: 17 | # this might fail if the module is python-only 18 | from .lora_sdr_python import * 19 | except ModuleNotFoundError: 20 | pass 21 | 22 | # import any pure python here 23 | # 24 | from .lora_sdr_lora_tx import lora_sdr_lora_tx 25 | from .lora_sdr_lora_rx import lora_sdr_lora_rx -------------------------------------------------------------------------------- /python/lora_sdr/bindings/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # SPDX-License-Identifier: GPL-3.0-or-later 6 | # 7 | 8 | ######################################################################## 9 | # Check if there is C++ code at all 10 | ######################################################################## 11 | if(NOT lora_sdr_sources) 12 | MESSAGE(STATUS "No C++ sources... skipping python bindings") 13 | return() 14 | endif(NOT lora_sdr_sources) 15 | 16 | ######################################################################## 17 | # Check for pygccxml 18 | ######################################################################## 19 | GR_PYTHON_CHECK_MODULE_RAW( 20 | "pygccxml" 21 | "import pygccxml" 22 | PYGCCXML_FOUND 23 | ) 24 | 25 | include(GrPybind) 26 | 27 | ######################################################################## 28 | # Python Bindings 29 | ######################################################################## 30 | 31 | list(APPEND lora_sdr_python_files 32 | add_crc_python.cc 33 | crc_verif_python.cc 34 | data_source_python.cc 35 | deinterleaver_python.cc 36 | dewhitening_python.cc 37 | fft_demod_python.cc 38 | frame_sync_python.cc 39 | gray_demap_python.cc 40 | gray_mapping_python.cc 41 | hamming_dec_python.cc 42 | hamming_enc_python.cc 43 | header_decoder_python.cc 44 | header_python.cc 45 | interleaver_python.cc 46 | modulate_python.cc 47 | payload_id_inc_python.cc 48 | RH_RF95_header_python.cc 49 | whitening_python.cc 50 | python_bindings.cc) 51 | 52 | GR_PYBIND_MAKE_OOT(lora_sdr 53 | ../../.. 54 | gr::lora_sdr 55 | "${lora_sdr_python_files}") 56 | 57 | # copy bindings extension for use in QA test module 58 | add_custom_command(TARGET lora_sdr_python POST_BUILD 59 | COMMAND ${CMAKE_COMMAND} -E copy $ 60 | ${CMAKE_BINARY_DIR}/test_modules/gnuradio/lora_sdr/ 61 | ) 62 | 63 | install(TARGETS lora_sdr_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/lora_sdr COMPONENT pythonapi) 64 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapparelj/gr-lora_sdr/a8143cb6162e0ee0677531aec36ca5f05fd678e0/python/lora_sdr/bindings/README.md -------------------------------------------------------------------------------- /python/lora_sdr/bindings/RH_RF95_header_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(RH_RF95_header.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(23853c760a34c4b65100ef57957723ca) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_RH_RF95_header(py::module &m) { 33 | 34 | using RH_RF95_header = ::gr::lora_sdr::RH_RF95_header; 35 | 36 | py::class_>(m, "RH_RF95_header", 38 | D(RH_RF95_header)) 39 | 40 | .def(py::init(&RH_RF95_header::make), py::arg("_to"), py::arg("_from"), 41 | py::arg("_id"), py::arg("_flags"), D(RH_RF95_header, make)) 42 | 43 | ; 44 | } 45 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/add_crc_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(add_crc.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(8114106b38d74a7a3f546064110327f5) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_add_crc(py::module &m) { 33 | 34 | using add_crc = ::gr::lora_sdr::add_crc; 35 | 36 | py::class_>( 37 | m, "add_crc", D(add_crc)) 38 | 39 | .def(py::init(&add_crc::make), py::arg("has_crc"), D(add_crc, make)) 40 | 41 | ; 42 | } 43 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/bind_oot_file.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | import argparse 3 | from gnuradio.bindtool import BindingGenerator 4 | import sys 5 | import tempfile 6 | 7 | parser = argparse.ArgumentParser(description='Bind a GR Out of Tree Block') 8 | parser.add_argument('--module', type=str, 9 | help='Name of gr module containing file to bind (e.g. fft digital analog)') 10 | 11 | parser.add_argument('--output_dir', default=tempfile.gettempdir(), 12 | help='Output directory of generated bindings') 13 | parser.add_argument('--prefix', help='Prefix of Installed GNU Radio') 14 | 15 | parser.add_argument( 16 | '--filename', help="File to be parsed") 17 | 18 | parser.add_argument( 19 | '--defines', help='Set additional defines for precompiler', default=(), nargs='*') 20 | parser.add_argument( 21 | '--include', help='Additional Include Dirs, separated', default=(), nargs='*') 22 | 23 | parser.add_argument( 24 | '--status', help='Location of output file for general status (used during cmake)', default=None 25 | ) 26 | parser.add_argument( 27 | '--flag_automatic', default='0' 28 | ) 29 | parser.add_argument( 30 | '--flag_pygccxml', default='0' 31 | ) 32 | 33 | args = parser.parse_args() 34 | 35 | prefix = args.prefix 36 | output_dir = args.output_dir 37 | defines = tuple(','.join(args.defines).split(',')) 38 | includes = ','.join(args.include) 39 | name = args.module 40 | 41 | namespace = ['gr', name] 42 | prefix_include_root = name 43 | 44 | 45 | with warnings.catch_warnings(): 46 | warnings.filterwarnings("ignore", category=DeprecationWarning) 47 | 48 | bg = BindingGenerator(prefix, namespace, 49 | prefix_include_root, output_dir, define_symbols=defines, addl_includes=includes, 50 | catch_exceptions=False, write_json_output=False, status_output=args.status, 51 | flag_automatic=True if args.flag_automatic.lower() in [ 52 | '1', 'true'] else False, 53 | flag_pygccxml=True if args.flag_pygccxml.lower() in ['1', 'true'] else False) 54 | bg.gen_file_binding(args.filename) 55 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/crc_verif_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(crc_verif.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(0c1080da98c3ced88d2f4a26b7d592da) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_crc_verif(py::module &m) { 33 | 34 | using crc_verif = ::gr::lora_sdr::crc_verif; 35 | 36 | py::class_>( 37 | m, "crc_verif", D(crc_verif)) 38 | 39 | .def(py::init(&crc_verif::make), py::arg("print_rx_msg"), 40 | py::arg("output_crc_check"), D(crc_verif, make)) 41 | 42 | ; 43 | } 44 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/data_source_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(data_source.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(b669ea6cf8efb4e5ab10529acded9d52) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_data_source(py::module &m) { 33 | 34 | using data_source = ::gr::lora_sdr::data_source; 35 | 36 | py::class_>(m, "data_source", D(data_source)) 38 | 39 | .def(py::init(&data_source::make), py::arg("pay_len"), 40 | py::arg("n_frames"), D(data_source, make)) 41 | 42 | ; 43 | } 44 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/deinterleaver_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(deinterleaver.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(65d663d2dd00415de5989550a4b1fb3e) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_deinterleaver(py::module &m) { 33 | 34 | using deinterleaver = ::gr::lora_sdr::deinterleaver; 35 | 36 | py::class_>(m, "deinterleaver", 38 | D(deinterleaver)) 39 | 40 | .def(py::init(&deinterleaver::make), py::arg("soft_decoding"), 41 | D(deinterleaver, make)) 42 | 43 | ; 44 | } 45 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/dewhitening_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(dewhitening.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(735e07016a3172acc26576c3d2d1c76e) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_dewhitening(py::module &m) { 33 | 34 | using dewhitening = ::gr::lora_sdr::dewhitening; 35 | 36 | py::class_>(m, "dewhitening", D(dewhitening)) 38 | 39 | .def(py::init(&dewhitening::make), D(dewhitening, make)) 40 | 41 | ; 42 | } 43 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/README.md: -------------------------------------------------------------------------------- 1 | This directory stores templates for docstrings that are scraped from the include header files for each block 2 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/RH_RF95_header_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_RH_RF95_header = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_RH_RF95_header_RH_RF95_header = 20 | R"doc()doc"; 21 | 22 | static const char *__doc_gr_lora_sdr_RH_RF95_header_make = R"doc()doc"; 23 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/add_crc_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_add_crc = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_add_crc_add_crc = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_add_crc_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/crc_verif_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_crc_verif = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_crc_verif_crc_verif = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_crc_verif_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/data_source_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_data_source = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_data_source_data_source = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_data_source_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/deinterleaver_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_deinterleaver = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_deinterleaver_deinterleaver = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_deinterleaver_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/dewhitening_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_dewhitening = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_dewhitening_dewhitening = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_dewhitening_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/fft_demod_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_fft_demod = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_fft_demod_fft_demod = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_fft_demod_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/frame_sync_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_frame_sync = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_frame_sync_frame_sync = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_frame_sync_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/gray_demap_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_gray_demap = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_gray_demap_gray_demap_0 = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_gray_demap_gray_demap_1 = R"doc()doc"; 22 | 23 | static const char *__doc_gr_lora_sdr_gray_demap_set_sf = R"doc()doc"; 24 | 25 | static const char *__doc_gr_lora_sdr_gray_demap_make = R"doc()doc"; 26 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/gray_mapping_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_gray_mapping = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_gray_mapping_gray_mapping = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_gray_mapping_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/hamming_dec_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_hamming_dec = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_hamming_dec_hamming_dec = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_hamming_dec_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/hamming_enc_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_hamming_enc = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_hamming_enc_hamming_enc_0 = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_hamming_enc_hamming_enc_1 = R"doc()doc"; 22 | 23 | static const char *__doc_gr_lora_sdr_hamming_enc_set_cr = R"doc()doc"; 24 | 25 | static const char *__doc_gr_lora_sdr_hamming_enc_get_cr = R"doc()doc"; 26 | 27 | static const char *__doc_gr_lora_sdr_hamming_enc_set_sf = R"doc()doc"; 28 | 29 | static const char *__doc_gr_lora_sdr_hamming_enc_make = R"doc()doc"; 30 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/header_decoder_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_header_decoder = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_header_decoder_header_decoder = 20 | R"doc()doc"; 21 | 22 | static const char *__doc_gr_lora_sdr_header_decoder_make = R"doc()doc"; 23 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/header_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_header = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_header_header_0 = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_header_header_1 = R"doc()doc"; 22 | 23 | static const char *__doc_gr_lora_sdr_header_set_cr = R"doc()doc"; 24 | 25 | static const char *__doc_gr_lora_sdr_header_get_cr = R"doc()doc"; 26 | 27 | static const char *__doc_gr_lora_sdr_header_make = R"doc()doc"; 28 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/interleaver_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_interleaver = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_interleaver_interleaver_0 = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_interleaver_interleaver_1 = R"doc()doc"; 22 | 23 | static const char *__doc_gr_lora_sdr_interleaver_set_cr = R"doc()doc"; 24 | 25 | static const char *__doc_gr_lora_sdr_interleaver_get_cr = R"doc()doc"; 26 | 27 | static const char *__doc_gr_lora_sdr_interleaver_set_sf = R"doc()doc"; 28 | 29 | static const char *__doc_gr_lora_sdr_interleaver_make = R"doc()doc"; 30 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/modulate_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_modulate = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_modulate_modulate = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_modulate_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/payload_id_inc_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_payload_id_inc = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_payload_id_inc_payload_id_inc = 20 | R"doc()doc"; 21 | 22 | static const char *__doc_gr_lora_sdr_payload_id_inc_make = R"doc()doc"; 23 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/utilities_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_mod = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_double_mod = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_int2bool = R"doc()doc"; 22 | 23 | static const char *__doc_gr_lora_sdr_bool2int = R"doc()doc"; 24 | 25 | static const char *__doc_gr_lora_sdr_build_upchirp = R"doc()doc"; 26 | 27 | static const char *__doc_gr_lora_sdr_build_ref_chirps = R"doc()doc"; 28 | 29 | static const char *__doc_gr_lora_sdr_most_frequent = R"doc()doc"; 30 | 31 | static const char *__doc_gr_lora_sdr_random_string = R"doc()doc"; 32 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/docstrings/whitening_pydoc_template.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | #include "pydoc_macros.h" 10 | #define D(...) DOC(gr, lora_sdr, __VA_ARGS__) 11 | /* 12 | This file contains placeholders for docstrings for the Python bindings. 13 | Do not edit! These were automatically extracted during the binding process 14 | and will be overwritten during the build process 15 | */ 16 | 17 | static const char *__doc_gr_lora_sdr_whitening = R"doc()doc"; 18 | 19 | static const char *__doc_gr_lora_sdr_whitening_whitening = R"doc()doc"; 20 | 21 | static const char *__doc_gr_lora_sdr_whitening_make = R"doc()doc"; 22 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/failed_conversions.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/fft_demod_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(fft_demod.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(e1fc6fa289a3f514124b89738f3de4fd) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_fft_demod(py::module &m) { 33 | 34 | using fft_demod = ::gr::lora_sdr::fft_demod; 35 | 36 | py::class_>( 37 | m, "fft_demod", D(fft_demod)) 38 | 39 | .def(py::init(&fft_demod::make), py::arg("soft_decoding"), 40 | py::arg("max_log_approx"), D(fft_demod, make)) 41 | 42 | ; 43 | } 44 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/frame_sync_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(frame_sync.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(b4a54a4ca7837d4c1d890b6e75488fba) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_frame_sync(py::module &m) { 33 | 34 | using frame_sync = ::gr::lora_sdr::frame_sync; 35 | 36 | py::class_>(m, "frame_sync", D(frame_sync)) 38 | 39 | .def(py::init(&frame_sync::make), py::arg("center_freq"), 40 | py::arg("bandwidth"), py::arg("sf"), py::arg("impl_head"), 41 | py::arg("sync_word"), py::arg("os_factor"), py::arg("preamble_len"), 42 | D(frame_sync, make)) 43 | 44 | ; 45 | } 46 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/gray_demap_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(gray_demap.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(56d911460204a1c09c07030204c1056a) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_gray_demap(py::module &m) { 33 | 34 | using gray_demap = ::gr::lora_sdr::gray_demap; 35 | 36 | py::class_>(m, "gray_demap", D(gray_demap)) 38 | 39 | .def(py::init(&gray_demap::make), py::arg("sf"), D(gray_demap, make)) 40 | 41 | .def("set_sf", &gray_demap::set_sf, py::arg("sf"), D(gray_demap, set_sf)) 42 | 43 | ; 44 | } 45 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/gray_mapping_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(gray_mapping.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(42acb0b27196fd81600dab69004410d4) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_gray_mapping(py::module &m) { 33 | 34 | using gray_mapping = ::gr::lora_sdr::gray_mapping; 35 | 36 | py::class_>(m, "gray_mapping", D(gray_mapping)) 38 | 39 | .def(py::init(&gray_mapping::make), py::arg("soft_decoding"), 40 | D(gray_mapping, make)) 41 | 42 | ; 43 | } 44 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/hamming_dec_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(hamming_dec.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(05a3b2e4a4df8fc6c5efa22295ecced4) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_hamming_dec(py::module &m) { 33 | 34 | using hamming_dec = ::gr::lora_sdr::hamming_dec; 35 | 36 | py::class_>(m, "hamming_dec", D(hamming_dec)) 38 | 39 | .def(py::init(&hamming_dec::make), py::arg("soft_decoding"), 40 | D(hamming_dec, make)) 41 | 42 | ; 43 | } 44 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/hamming_enc_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(hamming_enc.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(95de0a3629edb5cc3f2e0463adb3a9e5) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_hamming_enc(py::module &m) { 33 | 34 | using hamming_enc = ::gr::lora_sdr::hamming_enc; 35 | 36 | py::class_>(m, "hamming_enc", D(hamming_enc)) 38 | 39 | .def(py::init(&hamming_enc::make), py::arg("cr"), py::arg("sf"), 40 | D(hamming_enc, make)) 41 | 42 | .def("set_cr", &hamming_enc::set_cr, py::arg("cr"), 43 | D(hamming_enc, set_cr)) 44 | 45 | .def("get_cr", &hamming_enc::get_cr, D(hamming_enc, get_cr)) 46 | 47 | .def("set_sf", &hamming_enc::set_sf, py::arg("sf"), 48 | D(hamming_enc, set_sf)) 49 | 50 | ; 51 | } 52 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/header_decoder_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(header_decoder.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(7e5b794530afbc2c66064c693a8e0bb1) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_header_decoder(py::module &m) { 33 | 34 | using header_decoder = ::gr::lora_sdr::header_decoder; 35 | 36 | py::class_>(m, "header_decoder", 38 | D(header_decoder)) 39 | 40 | .def(py::init(&header_decoder::make), py::arg("impl_head"), py::arg("cr"), 41 | py::arg("pay_len"), py::arg("has_crc"), py::arg("ldro"), 42 | py::arg("print_header"), D(header_decoder, make)) 43 | 44 | ; 45 | } 46 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/header_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(header.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(862c2e420c908cbb6a04129449df2f0a) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_header(py::module &m) { 33 | 34 | using header = ::gr::lora_sdr::header; 35 | 36 | py::class_>( 37 | m, "header", D(header)) 38 | 39 | .def(py::init(&header::make), py::arg("impl_head"), py::arg("has_crc"), 40 | py::arg("cr"), D(header, make)) 41 | 42 | .def("set_cr", &header::set_cr, py::arg("cr"), D(header, set_cr)) 43 | 44 | .def("get_cr", &header::get_cr, D(header, get_cr)) 45 | 46 | ; 47 | } 48 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/header_utils.py: -------------------------------------------------------------------------------- 1 | # Utilities for reading values in header files 2 | 3 | from argparse import ArgumentParser 4 | import re 5 | 6 | 7 | class PybindHeaderParser: 8 | def __init__(self, pathname): 9 | with open(pathname, 'r') as f: 10 | self.file_txt = f.read() 11 | 12 | def get_flag_automatic(self): 13 | # p = re.compile(r'BINDTOOL_GEN_AUTOMATIC\(([^\s])\)') 14 | # m = p.search(self.file_txt) 15 | m = re.search(r'BINDTOOL_GEN_AUTOMATIC\(([^\s])\)', self.file_txt) 16 | if (m and m.group(1) == '1'): 17 | return True 18 | else: 19 | return False 20 | 21 | def get_flag_pygccxml(self): 22 | # p = re.compile(r'BINDTOOL_USE_PYGCCXML\(([^\s])\)') 23 | # m = p.search(self.file_txt) 24 | m = re.search(r'BINDTOOL_USE_PYGCCXML\(([^\s])\)', self.file_txt) 25 | if (m and m.group(1) == '1'): 26 | return True 27 | else: 28 | return False 29 | 30 | def get_header_filename(self): 31 | # p = re.compile(r'BINDTOOL_HEADER_FILE\(([^\s]*)\)') 32 | # m = p.search(self.file_txt) 33 | m = re.search(r'BINDTOOL_HEADER_FILE\(([^\s]*)\)', self.file_txt) 34 | if (m): 35 | return m.group(1) 36 | else: 37 | return None 38 | 39 | def get_header_file_hash(self): 40 | # p = re.compile(r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)') 41 | # m = p.search(self.file_txt) 42 | m = re.search(r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)', self.file_txt) 43 | if (m): 44 | return m.group(1) 45 | else: 46 | return None 47 | 48 | def get_flags(self): 49 | return f'{self.get_flag_automatic()};{self.get_flag_pygccxml()};{self.get_header_filename()};{self.get_header_file_hash()};' 50 | 51 | 52 | def argParse(): 53 | """Parses commandline args.""" 54 | desc = 'Reads the parameters from the comment block in the pybind files' 55 | parser = ArgumentParser(description=desc) 56 | 57 | parser.add_argument("function", help="Operation to perform on comment block of pybind file", choices=[ 58 | "flag_auto", "flag_pygccxml", "header_filename", "header_file_hash", "all"]) 59 | parser.add_argument( 60 | "pathname", help="Pathname of pybind c++ file to read, e.g. blockname_python.cc") 61 | 62 | return parser.parse_args() 63 | 64 | 65 | if __name__ == "__main__": 66 | # Parse command line options and set up doxyxml. 67 | args = argParse() 68 | 69 | pbhp = PybindHeaderParser(args.pathname) 70 | 71 | if args.function == "flag_auto": 72 | print(pbhp.get_flag_automatic()) 73 | elif args.function == "flag_pygccxml": 74 | print(pbhp.get_flag_pygccxml()) 75 | elif args.function == "header_filename": 76 | print(pbhp.get_header_filename()) 77 | elif args.function == "header_file_hash": 78 | print(pbhp.get_header_file_hash()) 79 | elif args.function == "all": 80 | print(pbhp.get_flags()) 81 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/interleaver_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(interleaver.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(e042ec01a2fc5bf489c2aa1a4fef7394) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_interleaver(py::module &m) { 33 | 34 | using interleaver = ::gr::lora_sdr::interleaver; 35 | 36 | py::class_>(m, "interleaver", D(interleaver)) 38 | 39 | .def(py::init(&interleaver::make), py::arg("cr"), py::arg("sf"), 40 | py::arg("ldro"), py::arg("bw"), D(interleaver, make)) 41 | 42 | .def("set_cr", &interleaver::set_cr, py::arg("cr"), 43 | D(interleaver, set_cr)) 44 | 45 | .def("get_cr", &interleaver::get_cr, D(interleaver, get_cr)) 46 | 47 | .def("set_sf", &interleaver::set_sf, py::arg("sf"), 48 | D(interleaver, set_sf)) 49 | 50 | ; 51 | } 52 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/modulate_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(modulate.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(2f4e1101c5eabd18418839d5e0ac6b19) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_modulate(py::module &m) { 33 | 34 | using modulate = ::gr::lora_sdr::modulate; 35 | 36 | py::class_>( 37 | m, "modulate", D(modulate)) 38 | 39 | .def(py::init(&modulate::make), py::arg("sf"), py::arg("samp_rate"), 40 | py::arg("bw"), py::arg("sync_words"), py::arg("inter_frame_padd"), 41 | py::arg("preamble_len"), D(modulate, make)) 42 | 43 | ; 44 | } 45 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/payload_id_inc_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(payload_id_inc.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(b71e8140c759338633d5d5412e5eedce) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_payload_id_inc(py::module &m) { 33 | 34 | using payload_id_inc = ::gr::lora_sdr::payload_id_inc; 35 | 36 | py::class_>(m, "payload_id_inc", 38 | D(payload_id_inc)) 39 | 40 | .def(py::init(&payload_id_inc::make), py::arg("separator"), 41 | D(payload_id_inc, make)) 42 | 43 | ; 44 | } 45 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/python_bindings.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | #include 11 | 12 | #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 13 | #include 14 | 15 | namespace py = pybind11; 16 | 17 | // Headers for binding functions 18 | /**************************************/ 19 | // The following comment block is used for 20 | // gr_modtool to insert function prototypes 21 | // Please do not delete 22 | /**************************************/ 23 | // BINDING_FUNCTION_PROTOTYPES( 24 | void bind_add_crc(py::module& m); 25 | void bind_crc_verif(py::module& m); 26 | void bind_data_source(py::module& m); 27 | void bind_deinterleaver(py::module& m); 28 | void bind_dewhitening(py::module& m); 29 | void bind_fft_demod(py::module& m); 30 | void bind_frame_sync(py::module& m); 31 | void bind_gray_demap(py::module& m); 32 | void bind_gray_mapping(py::module& m); 33 | void bind_hamming_dec(py::module& m); 34 | void bind_hamming_enc(py::module& m); 35 | void bind_header_decoder(py::module& m); 36 | void bind_header(py::module& m); 37 | void bind_interleaver(py::module& m); 38 | void bind_modulate(py::module& m); 39 | void bind_payload_id_inc(py::module& m); 40 | void bind_RH_RF95_header(py::module& m); 41 | void bind_whitening(py::module& m); 42 | // ) END BINDING_FUNCTION_PROTOTYPES 43 | 44 | 45 | // We need this hack because import_array() returns NULL 46 | // for newer Python versions. 47 | // This function is also necessary because it ensures access to the C API 48 | // and removes a warning. 49 | void* init_numpy() 50 | { 51 | import_array(); 52 | return NULL; 53 | } 54 | 55 | PYBIND11_MODULE(lora_sdr_python, m) 56 | { 57 | // Initialize the numpy C API 58 | // (otherwise we will see segmentation faults) 59 | init_numpy(); 60 | 61 | // Allow access to base block methods 62 | py::module::import("gnuradio.gr"); 63 | 64 | /**************************************/ 65 | // The following comment block is used for 66 | // gr_modtool to insert binding function calls 67 | // Please do not delete 68 | /**************************************/ 69 | // BINDING_FUNCTION_CALLS( 70 | bind_add_crc(m); 71 | bind_crc_verif(m); 72 | bind_data_source(m); 73 | bind_deinterleaver(m); 74 | bind_dewhitening(m); 75 | bind_fft_demod(m); 76 | bind_frame_sync(m); 77 | bind_gray_demap(m); 78 | bind_gray_mapping(m); 79 | bind_hamming_dec(m); 80 | bind_hamming_enc(m); 81 | bind_header_decoder(m); 82 | bind_header(m); 83 | bind_interleaver(m); 84 | bind_modulate(m); 85 | bind_payload_id_inc(m); 86 | bind_RH_RF95_header(m); 87 | bind_whitening(m); 88 | // ) END BINDING_FUNCTION_CALLS 89 | } 90 | -------------------------------------------------------------------------------- /python/lora_sdr/bindings/whitening_python.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Free Software Foundation, Inc. 3 | * 4 | * This file is part of GNU Radio 5 | * 6 | * SPDX-License-Identifier: GPL-3.0-or-later 7 | * 8 | */ 9 | 10 | /***********************************************************************************/ 11 | /* This file is automatically generated using bindtool and can be manually 12 | * edited */ 13 | /* The following lines can be configured to regenerate this file during cmake */ 14 | /* If manual edits are made, the following tags should be modified accordingly. 15 | */ 16 | /* BINDTOOL_GEN_AUTOMATIC(0) */ 17 | /* BINDTOOL_USE_PYGCCXML(0) */ 18 | /* BINDTOOL_HEADER_FILE(whitening.h) */ 19 | /* BINDTOOL_HEADER_FILE_HASH(6adc1c750354c5146ec5d8d340847c1a) */ 20 | /***********************************************************************************/ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace py = pybind11; 27 | 28 | #include 29 | // pydoc.h is automatically generated in the build directory 30 | #include 31 | 32 | void bind_whitening(py::module &m) { 33 | 34 | using whitening = ::gr::lora_sdr::whitening; 35 | 36 | py::class_>( 37 | m, "whitening", D(whitening)) 38 | 39 | .def(py::init(&whitening::make), py::arg("is_hex"), 40 | py::arg("use_length_tag"), py::arg("separator") = ',', 41 | py::arg("length_tag_name") = "", D(whitening, make)) 42 | 43 | ; 44 | } 45 | -------------------------------------------------------------------------------- /python/lora_sdr/lora.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | # import matplotlib.pyplot as plt 3 | 4 | def gen_upchirp(SF): 5 | N = 2**SF 6 | n = np.arange(N, dtype=np.float32) 7 | 8 | x = np.exp(2*np.pi*1j*(np.square(n)/(2*N)-n/2)) 9 | return x 10 | 11 | def gen_downchirp(SF): 12 | return np.conj(gen_upchirp(SF)) 13 | 14 | def gen_preamble(SF, net_id=64, sto_frac=0, R=1): 15 | # sto_frac \in [0, 1/R[ 16 | N = 2**SF 17 | n = np.arange(N * R, dtype=np.float32)/R - sto_frac 18 | #print(n) 19 | 20 | upchirp = np.exp(2*np.pi*1j*(np.square(n)/(2*N)-n/2)) 21 | downchirp = np.conj(upchirp) 22 | 23 | idx_fold = (N - net_id)*R 24 | # sync_word = np.zeros(N*R, dtype=np.complex64) 25 | # n1, n2 = n[0:idx_fold], n[idx_fold:-1] 26 | # sync_word[0:idx_fold] = np.exp(2*np.pi*1j*(np.square(n1)/(2*N) + net_id*n1/N - n1/2)) 27 | # sync_word[idx_fold:-1] = np.exp(2*np.pi*1j*(np.square(n2)/(2*N) + net_id*n2/N + n2/2)) 28 | sync_word = gen_sym(SF, net_id, sto_frac=sto_frac, R=R) 29 | 30 | quarter_downchirp = downchirp[0:N*R/4] 31 | preamble = np.concatenate([np.tile(upchirp, 8), np.tile(sync_word, 2), np.tile(downchirp, 2), quarter_downchirp]) 32 | return preamble 33 | 34 | def gen_sym(SF, S, sto_frac=0, R=1): 35 | N = 2**SF 36 | n = np.arange(N * R, dtype=np.float32)/R - sto_frac 37 | 38 | idx_fold = (N - S)*R 39 | sym = np.zeros(N*R, dtype=np.complex64) 40 | n1, n2 = n[0:idx_fold], n[idx_fold:] 41 | sym[0:idx_fold] = np.exp(2*np.pi*1j*(np.square(n1)/(2*N) + S*n1/N - n1/2)) 42 | sym[idx_fold:] = np.exp(2*np.pi*1j*(np.square(n2)/(2*N) + S*n2/N - 3*n2/2)) 43 | 44 | return sym 45 | 46 | def gen_syms(SF, S, sto_frac=0, R=1): 47 | return np.concatenate([gen_sym(SF, s, sto_frac=sto_frac, R=R) for s in S]) 48 | 49 | def gen_packet(SF, S, sto_frac=0, R=1): 50 | preamble = gen_preamble(SF, sto_frac=sto_frac, R=R) 51 | payload = gen_syms(SF, S, sto_frac=sto_frac, R=R) 52 | return np.concatenate([preamble, payload]) 53 | 54 | def demod_sym(SF, x): 55 | y = np.fft.fft(x * gen_downchirp(SF)) 56 | return np.argmax(np.abs(y)) 57 | 58 | def add_cfo(SF, x, cfo, R=1): 59 | n = np.arange(len(x), dtype=np.float32) / R 60 | return np.multiply(x, np.exp(2*np.pi*1j*n*cfo/2**SF)) 61 | 62 | 63 | if __name__ == '__main__': 64 | SF = 4 65 | N = 2**SF 66 | x = gen_upchirp(SF) 67 | 68 | # R = 4 69 | 70 | 71 | # k = 8 72 | # y = gen_preamble(SF, R=R, sto_frac=0.0) 73 | # y = add_cfo(SF, y, 0.5, R=R) 74 | # yk = y[k*N*R+0 : (k+1)*N*R : R] 75 | 76 | # Yk = np.fft.fft(yk * gen_downchirp(SF)) 77 | 78 | y = gen_syms(SF, [1, 2, 3, 4]) 79 | print(demod_sym(SF, y[2*N:3*N])) 80 | 81 | # plt.stem(np.abs(Yk)) 82 | # plt.show() 83 | 84 | # print(repr(np.abs(Yk))) 85 | # print(np.argmax(np.abs(Yk))) 86 | -------------------------------------------------------------------------------- /python/lora_sdr/utils.py: -------------------------------------------------------------------------------- 1 | from gnuradio import gr, gr_unittest 2 | from gnuradio import blocks 3 | import numpy as np 4 | import pmt 5 | 6 | SYNC_TYPE_VOID = 0 7 | SYNC_TYPE_UPCHIRP = 1 8 | SYNC_TYPE_SYNCWORD = 2 9 | SYNC_TYPE_DOWNCHIRP = 3 10 | SYNC_TYPE_QUARTERDOWN = 4 11 | SYNC_TYPE_PAYLOAD = 5 12 | SYNC_TYPE_UNDETERMINED = 6 13 | 14 | def gr_cast(x): 15 | return [complex(z) for z in x] 16 | 17 | def np_cast(x): 18 | return np.complex64(x) 19 | 20 | class TagSink(gr.sync_block): 21 | def __init__(self): 22 | gr.sync_block.__init__(self, name='Tag sink', in_sig=[float], out_sig=None) 23 | self.tags = [] 24 | 25 | def work(self, input_items, output_items): 26 | elems = self.get_tags_in_window(0, 0, len(input_items[0])) 27 | for t in elems: 28 | self.tags.append(gr.tag_to_python(t)) 29 | 30 | return len(input_items[0]) 31 | 32 | def get_tags(self): 33 | tags = self.tags 34 | self.tags = [] 35 | return tags 36 | 37 | class TagSinkInt(TagSink): 38 | def __init__(self): 39 | gr.sync_block.__init__(self, name='Tag sink', in_sig=[np.int32], out_sig=None) 40 | self.tags = [] 41 | 42 | class Tagger(gr.sync_block): 43 | def __init__(self, tags): 44 | gr.sync_block.__init__(self, name='Tagger', in_sig=[float], out_sig=[float]) 45 | self.tags = tags # dictionary {offset:(name, dict)} 46 | 47 | def work(self, input_items, output_items): 48 | for idx, _ in enumerate(input_items[0]): 49 | abs_idx = self.nitems_written(0) + idx 50 | if abs_idx in self.tags: 51 | key = pmt.intern(self.tags[abs_idx][0]) 52 | d = pmt.make_dict() 53 | for k,v in self.tags[abs_idx][1].items(): 54 | if isinstance(v, str): 55 | pmt_v = pmt.intern(v) 56 | elif isinstance(v, int): 57 | pmt_v = pmt.from_long(v) 58 | elif isinstance(v, float): 59 | pmt_v = pmt.from_double(v) 60 | else: 61 | raise TypeError("The type {} is not supported as value in a new_user tag.".format(type(v))) 62 | 63 | d = pmt.dict_add(d, pmt.intern(k), pmt_v) 64 | 65 | self.add_item_tag(0, abs_idx, key, d) 66 | 67 | output_items[0][:] = input_items[0] # copy input to output 68 | return len(output_items[0]) --------------------------------------------------------------------------------