Files
qt5-legatus-legacy/Lts/Proxies/HighLevelArchitecture/Hla_test_tool/web_socket_telegrams.py
T
2026-08-13 18:33:10 +02:00

42 lines
1.2 KiB
Python
Executable File

#!/usr/bin/python
# Connect to ngs / hla and provide the basic interface
# $Id$
# $HeadURL$
# $Author$
# Created by Norbert Thoden, SLSE, 2022-03-04
import websocket
import json
import time
server_ip = "192.168.133.73"
server_port = 23456
ws = websocket.create_connection("ws://%s:%s" % (server_ip, server_port))
#ws.recv()
#ws.recv()
# create/updateMineField
time.sleep(2)
epoch_time = int(time.time())*1000
print(epoch_time)
#d = { 'typeId' : 8011, 'data': {'objectId': 4711, 'name': 'myNewMindefield', 'activationTime': 12345678, 'isDeactivated': True, 'duration': 10, 'area2D':{ 'centerPoint': {'lat':52.477,'lon':11.597}, 'width' : 123 } , 'timestamp': epoch_time} }
d = { 'typeId' : 8011, 'data': {'objectId': 4711, 'name': 'myNewMindefield', 'activationTime': 12345678, 'isDeactivated': True, 'duration': 10, 'area2D':{ 'centerPoint': {'lat':52.477,'lon':11.597}, 'width' : 123 } , 'timestamp': epoch_time} }
ws.send(json.dumps(d))
# removeAesObject
# Aes == AreaEffectSimulation
time.sleep(2)
epoch_time = int(time.time())*1000
d = { 'typeId' : 8010, 'data': {'objectId': 4711, 'name': 'removeAesObject', 'timestamp': epoch_time} }
#ws.send(json.dumps(d))
print("close ws and exit")
ws.close()