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

Uploaded Source

File details

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

File metadata

  • Download URL: stanag4586vsm-0.0.2.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.7

File hashes

Hashes for stanag4586vsm-0.0.2.tar.gz
Algorithm Hash digest
SHA256 85714c8d77123421bf76ea6c4fd58bb4dea5d8ef0f37d2d0e19c47dcb2c2c088
MD5 238ce84939acc7a16ab37ef18bd5320c
BLAKE2b-256 2324d45d30959fb5f1fc783562f33e70d2e188767ace503c88e48272078347fb

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