40 lines
1.1 KiB
Python
Executable File
40 lines
1.1 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
import websocket
|
|
import json
|
|
import time
|
|
# TODO: adjust port, bsm id, ...
|
|
server_port = 33997
|
|
bsm_id = 11001
|
|
originator_id = 4711
|
|
tas_code = 1
|
|
number_of_flashes = 1
|
|
# in sec
|
|
pause_flash = 1
|
|
|
|
ws = websocket.create_connection("ws://127.0.0.1:%s" % server_port)
|
|
ws.recv()
|
|
ws.recv()
|
|
|
|
# BsmTriggerFlashlight
|
|
tele = { 'type' : 'BsmTriggerFlashlight', 'data': {'sensorId': bsm_id, 'numberOfFlashes': number_of_flashes, 'pauseBetweenFlashesSec': pause_flash} }
|
|
ws.send(json.dumps(tele))
|
|
|
|
# GetBsmConfiguration
|
|
tele = { 'type' : 'GetBsmConfiguration', 'data': {'sensorId': bsm_id} }
|
|
ws.send(json.dumps(tele))
|
|
|
|
# GetBsmBitTimeout
|
|
tele = { 'type' : 'GetBsmBitTimeout', 'data': {'sensorId': bsm_id} }
|
|
ws.send(json.dumps(tele))
|
|
|
|
# GetBsmTechnicalStatus
|
|
tele = { 'type' : 'GetBsmTechnicalStatus', 'data': {'sensorId': bsm_id} }
|
|
ws.send(json.dumps(tele))
|
|
|
|
# DebugSimulateBSMHit, effectTimeMSec = 0 -> now
|
|
tele = { 'type' : 'DebugSimulateBSMHit', 'data': {'effectTime': 0, 'sensorId': bsm_id, 'originatorId': originator_id, 'tasCodeDirect': tas_code, 'deposition1': 0, 'deposition2': 0} }
|
|
ws.send(json.dumps(tele))
|
|
|
|
ws.close()
|