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

Uploaded Source

File details

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

File metadata

  • Download URL: stanag4586vsm-0.0.16.tar.gz
  • Upload date:
  • Size: 21.9 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.16.tar.gz
Algorithm Hash digest
SHA256 11f50690f043b6bbdaeb6d938b3196557c5ffb5b182670a8d8d0a3165fe2aa45
MD5 f9fb156c34e754cbf42d37e1260ebbbe
BLAKE2b-256 b60494aed438ca01855990fdcd8219140941ab64c210b022323266d45f4ffea5

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