JSONMachineControl Device allows for the querying of machine list and machine status via JSON.
A JSONMachineControl Device requires the use of Telnet. Follow these steps to properly configure the Disguise server for Telnet communication:
-
Enable Telnet by navigating to Control Panel > Programs > Turn on Windows Features > Telnet Client
-
Click on the link telnet://127.0.0.1:9864
-
To get the name of the machine, enter: {"query":{"q":"machineList"}}
-
To get the framerate, enter {"query":{"q":"machineStatus hostName"}}
Using Live framerate is recommended. This python code method may be used to get Live framerate:
live framerate
import json
from telnetlib import Telnet
from socket import gethostbyaddr
hostIP = "127.0.0.1" # stick the server IP here
port = 9864
host_name = gethostbyaddr(hostIP)
print(f'd3 name is: {host_name[0]}')
q = '{"query":{"q":"machineStatus ' + host_name[0] + '"}}'
print(f"sending - {q.encode('ASCII').decode('ASCII')} - to {host_name[0]}")
def readFPS():
with Telnet(hostIP, port) as tn:
tn.write(q.encode('ASCII') + b'\r\n')
buf_as_dict = json.loads(tn.read_until(b"}]}"))
return buf_as_dict['results'][0]['fps']
if __name__ == '__main__':
while True:
fps = readFPS()
print(fps)
A JSONMachineControl device is created in the same way as any other device type. Please see the sub-chapter Creating devices for step-by-step instructions on how to create a device, and select JSONMachineControl from the menu of different device types. This will open the device editor (explained below).
Listening Port
The listening port the device is set to.
Machine list:{"query":{"q":"machineList"}}
Returns a list of dictionaries containing information about the machine: d3 name, hostname role and machine type.
Example return: {"request":0,"status":"OK","results":
[{"machine":"4x4-DEMO","hostname":"4X4-DEMO","role":"Dedicated director","type":"4x4pro"}]}
Machine status:{"query":{"q":"machineStatus 4X4-DEMO"}}
Returns extra information about a machine: session status, failover status and current FPS.
Example return:{"request":0,"status":"OK","results":[{"active":true,
"Failed":false, "fps":32.345558166503909}]}