diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..517004f --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [Schrolli91] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..9a859e1 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,67 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ develop, master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ develop ] + schedule: + - cron: '33 03 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/README.md b/README.md index d883755..7811566 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,19 @@ ![BOSWatch](logo/bw3.png "BOSWatch 3 Logo") +![pytest](https://github.com/BOSWatch/BW3-Core/workflows/pytest/badge.svg) +![documentation](https://github.com/BOSWatch/BW3-Core/workflows/build_docs/badge.svg) +![CodeQL](https://github.com/BOSWatch/BW3-Core/workflows/CodeQL/badge.svg) **Es wird darauf hingewiesen, dass für die Teilnahme am BOS-Funk nur nach den Technischen Richtlinien der BOS zugelassene Funkanlagen verwendet werden dürfen.** **Der BOS-Funk ist ein nichtöffentlicher mobiler Landfunk. Privatpersonen gehören nicht zum Kreis der berechtigten Funkteilnehmer.** _(Quelle: TR-BOS)_ +### Documentation: [https://docs.boswatch.de](https://docs.boswatch.de) + +Wenn dir dieses Projekt gefällt, gib uns bitte einen **STAR** + *** -**The intercept of the German BOS radio is strictly prohibited and will be prosecuted. The use is only permitted for authorized personnel.** \ No newline at end of file +**The intercept of the German BOS radio is strictly prohibited and will be prosecuted. The use is only permitted for authorized personnel.** + +If you like this project, please give us a **STAR** diff --git a/boswatch/inputSource/inputBase.py b/boswatch/inputSource/inputBase.py index 001d102..3b1c414 100644 --- a/boswatch/inputSource/inputBase.py +++ b/boswatch/inputSource/inputBase.py @@ -20,6 +20,7 @@ import threading from abc import ABC, abstractmethod from boswatch.utils import paths from boswatch.processManager import ProcessManager +from boswatch.decoder.decoder import Decoder logging.debug("- %s loaded", __name__) @@ -61,10 +62,11 @@ class InputBase(ABC): logging.debug("input thread stopped") def addToQueue(self, data): - """!Adds alarm data to the queue for further processing during boswatch client""" - self._inputQueue.put_nowait((data, time.time())) - logging.debug("Add received data to queue") - print(data) + """!Decode and add alarm data to the queue for further processing during boswatch client""" + bwPacket = Decoder.decode(data) + if bwPacket is not None: + self._inputQueue.put_nowait((bwPacket, time.time())) + logging.debug("Added received data to queue") def getDecoderInstance(self, decoderConfig, StdIn): mmProc = ProcessManager(str(decoderConfig.get("path", default="multimon-ng")), textMode=True) diff --git a/bw_client.py b/bw_client.py index 560f05b..0a2b69a 100644 --- a/bw_client.py +++ b/bw_client.py @@ -46,12 +46,12 @@ logging.debug("Import BOSWatch modules") from boswatch.configYaml import ConfigYAML from boswatch.network.client import TCPClient from boswatch.network.broadcast import BroadcastClient -from boswatch.decoder.decoder import Decoder from boswatch.utils import header from boswatch.utils import misc from boswatch.inputSource.sdrInput import SdrInput from boswatch.inputSource.lineInInput import LineInInput from boswatch.inputSource.pulseaudioInput import PulseAudioInput +from boswatch.decoder.decoder import Decoder # for test mode header.logoToLog() header.infoToLog() @@ -106,7 +106,8 @@ try: for testData in testFile: if (len(testData.rstrip(' \t\n\r')) > 1) and ("#" not in testData[0]): logging.info("Testdata: %s", testData.rstrip(' \t\n\r')) - inputQueue.put_nowait((testData.rstrip(' \t\n\r'), time.time())) + bwPacket = Decoder.decode(testData.rstrip(' \t\n\r')) + inputQueue.put_nowait((bwPacket, time.time())) logging.debug("finished reading testdata") bwClient = TCPClient() @@ -123,13 +124,9 @@ try: data = inputQueue.get() logging.info("get data from queue (waited %0.3f sec.)", time.time() - data[1]) logging.debug("%s packet(s) still waiting in queue", inputQueue.qsize()) - - bwPacket = Decoder.decode(data[0]) + bwPacket = data[0] inputQueue.task_done() - if bwPacket is None: - continue - bwPacket.printInfo() misc.addClientDataToPacket(bwPacket, bwConfig) diff --git a/docu/docs/modul/descriptor.md b/docu/docs/modul/descriptor.md index 73cdc50..43444d3 100644 --- a/docu/docs/modul/descriptor.md +++ b/docu/docs/modul/descriptor.md @@ -16,6 +16,8 @@ Mit diesem Modul können einem Alarmpaket beliebige Beschreibungen in Abhänigke ## Konfiguration Informationen zum Aufbau eines [BOSWatch Pakets](../develop/packet.md) +**Achtung:** Zahlen welche führende Nullen entahlten müssen in Anführungszeichen gesetzt werden Bsp. `'0012345'` + |Feld|Beschreibung|Default| |----|------------|-------| |scanField|Feld des BW Pakets welches geprüft werden soll|| @@ -40,7 +42,7 @@ Informationen zum Aufbau eines [BOSWatch Pakets](../develop/packet.md) descriptions: - for: 12345 add: FF DescriptorTest - - for: 45678 + - for: '05678' # führende Nullen in '' ! add: FF TestDescription - scanField: status descrField: fmsStatDescr diff --git a/requirements.txt b/requirements.txt index 580f9da..5e215ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ # for pip to install all needed -# called with 'pip -r requirements.txt' - +# called with 'pip install -r requirements.txt' pyyaml # for documentation generating