Skip to main content

Python Stanag 4586 VSM implementation

Project description

Tested with python 3.8x

Published branch Development branch
build status main branch build status development branch

About

Minimal implementation of a STANAG 4586 Vehicle Specific Module (VSM) which uses a lower level library python-stanag-4586-EDA-v1 to exchange STANAG messages with a remote CUCS.

This library uses asyncio to create two UDP mulicast sockets, one for sending and other for receiving STANG 4586 messages.

Basic operations such as answering to discover broadcast messages from CUCS, granting control and monitor requests or responding with appropriate levels of interoperability statuses is taken care of by this library.

This is one of the libraries which supports the larger project of Surveillance Simulator.

Usage example

import asyncio
import logging
from stanag4586vsm.stanag_server import *

FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(format=FORMAT)

logger = logging.getLogger("main")
logger.setLevel(logging.DEBUG)

async def main():

    loop = asyncio.get_running_loop()
    server = StanagServer(logging.DEBUG)

    logger.debug("Creating server")
    await server.setup_service(loop)

    logger.info("Listening, press Ctrl+C to terminate")
    await asyncio.sleep(3600*100)

    logger.info("Server exiting")

asyncio.run(main())

The above example code will produce an output as follows in case a control LOI request is received by the VSM

2021-06-01 20:14:32,372 - main - DEBUG - Creating server
2021-06-01 20:14:32,373 - main - INFO - Listening, press Ctrl+C to terminate
2021-06-01 20:14:48,086 - StanagProtocol - DEBUG - Got packet of len [65]
2021-06-01 20:14:48,086 - StanagProtocol - DEBUG - Got message [1]
2021-06-01 20:14:48,086 - StanagProtocol - DEBUG - callback scheduled
2021-06-01 20:14:48,086 - StanagServer - DEBUG - Got message [1]
2021-06-01 20:14:48,086 - ControllableEntity[0] - DEBUG - Got message [1]
2021-06-01 20:14:48,086 - ControllableEntity[0] - DEBUG - Message is auth request.
2021-06-01 20:14:48,086 - ControllableEntity[0] - DEBUG - Message is of type LOI request
2021-06-01 20:14:48,086 - ControllableEntity[0] - DEBUG - Processing LOI request
2021-06-01 20:14:48,086 - ControllableEntity[0] - DEBUG - Control granted to [160]
2021-06-01 20:14:48,086 - ControllableEntity[0] - DEBUG - Responding with Message 21
2021-06-01 20:14:48,102 - StanagProtocol - DEBUG - Got packet of len [65]
2021-06-01 20:14:48,102 - StanagProtocol - DEBUG - Got message [1]
2021-06-01 20:14:48,102 - StanagProtocol - DEBUG - callback scheduled
2021-06-01 20:14:48,102 - StanagServer - DEBUG - Got message [1]
2021-06-01 20:14:48,102 - ControllableEntity[0] - DEBUG - Got message [1]
2021-06-01 20:14:48,102 - ControllableEntity[0] - DEBUG - Message is auth request.
2021-06-01 20:14:48,102 - ControllableEntity[0] - DEBUG - Message is of type LOI request
2021-06-01 20:14:48,102 - ControllableEntity[0] - DEBUG - Processing LOI request
2021-06-01 20:14:48,102 - ControllableEntity[0] - DEBUG - Control revoked from [160]
2021-06-01 20:14:48,102 - ControllableEntity[0] - DEBUG - Responding with Message 21

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stanag4586vsm-0.0.15.tar.gz (21.8 kB view details)

Uploaded Source

File details

Details for the file stanag4586vsm-0.0.15.tar.gz.

File metadata

  • Download URL: stanag4586vsm-0.0.15.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.7

File hashes

Hashes for stanag4586vsm-0.0.15.tar.gz
Algorithm Hash digest
SHA256 662d0014bf76c6123d5c9264f83690c7a05313026b5720d536f7e49c9fd27a1f
MD5 5cf3c3d030ff58bed78f51d63b09dc0b
BLAKE2b-256 acff08408541c300ddc098414710b0152e0a2de989b7d398209bda07a232f79f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page