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.9.tar.gz (21.5 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: stanag4586vsm-0.0.9.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.7

File hashes

Hashes for stanag4586vsm-0.0.9.tar.gz
Algorithm Hash digest
SHA256 72dffa49dbe3138cda5bfb921118135c203ace70aae85ce66c3d094616705145
MD5 87dd7989510cd9309870f2ee757d7d40
BLAKE2b-256 aa9ea557ad877a2a12dc1db17bea0c9bde088991c00f4bf4c408ede112b38a4a

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