Skip to content
Snippets Groups Projects
Commit b3a06b94 authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

"devhub" example (CORVUS)

parent c79c8ad2
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# Rolf Niepraschk, Rolf.Niepraschk@ptb.de, 2023-03-08
# Rolf Niepraschk, Rolf.Niepraschk@ptb.de, 2023-03-09
import socket, signal, sys, time
import json
import sys, requests
DEVHUB_URL = 'http://e75491:9009/'
HTTP_HEADER = 'Content-Type: application/json'
DATA_TEMPLATE = { 'Action':'TCP', 'Host':CONTROLER_HOST }
LAN_RS232_HOST = 'e75491'
LAN_RS232_PORT = 10001
CORVUS_EOL = '\r'
CORVUS_GETPOS = ' pos' + CORVUS_EOL
DEVHUB_HOST = 'i75419' # 'localhost'
DEVHUB_PORT = 9009
DEVHUB_URL = 'http://{}:{}/'.format(DEVHUB_HOST, DEVHUB_PORT)
DEVHUB_DATA = {
'Action':'TCP', 'Host':LAN_RS232_HOST, 'Timeout': 10000,
'Port':LAN_RS232_PORT, 'Value': CORVUS_GETPOS
}
response = requests.post(DEVHUB_URL, json=DEVHUB_DATA)
result = response.json()
#print(response.status_code)
print(result)
print(result.get('_x'))
print('\nEnde!')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment