get_description Command
This command returns a description of the instrument hardware in JSON format to FlexOTO. The following figure show the actions that occur with this command.
The returned JSON string provides the following information about the instrument. FlexOTO uses this information when drawing one or more Instrument blocks on FlexOTO's Hardware Diagram. FlexOTO also passes input connector names as arguments to the measure command. The instrument performs all of its assigned measurements to each listed connector.
- Instrument's model number. (shown on switch block)
- Instrument's serial number. (shown on switch block)
- List of the names of the instrument's measurement input connectors. (shown on switch block)
Command Sent from FlexOTO
get_description
Response Returned from Driver
Returns a JSON string that describes the Instrument, followed by "DONE"
, on separate lines.
print(error_messages) # if needed print(json_string) print("DONE")
The following example JSON string creates an Instrument block (My Instrument SN12345) that will be available for placing on FlexOTO's Hardware Diagram.
json_string = """
{
"ModelNumber": "My Instrument",
"SerialNumber": "SN12345",
"Inputs": ["IN A", "IN B"]
} """
print(json_string)
print("DONE")
Or, you could make Python variables and a list and convert them to JSON using json.dumps
method:
mn = 'My Instrument'
sn = 'SN12345'
InputNames = ['IN A', 'IN B']
description = json.dumps({'ModelNumber':mn, 'SerialNumber':sn, 'Inputs':InputNames})
print(description)
print("DONE")
The instrument block that this JSON string creates is shown placed on the Hardware Diagram in the following figure. The model number, serial number, and port labels appear on the block.
JSON ModelNumber
Element
The ModelNumber
element is a string that names the instrument on FlexOTO's Hardware Diagram. The name that you give is entirely up to you and need not be related to the actual instrument.
"ModelNumber": "My Instrument",
JSON SerialNumber
Element
The SerialNumber
element is a string that is the instrument 's serial number. You can query this value from the instrument and then insert the name into the JSON string.
"SerialNumber": "Z1234",
JSON Inputs
Element
The Inputs
element lists the names of the instrument's input connectors on which measurements will be performed. These strings label Instrument block connectors on FlexOTO's Hardware Diagram. While not required, the labels specified should match those on the instrument's front panel. FlexOTO sends these input connector names as arguments to the driver's measure command. Your driver will need to translate these strings to the correct SCPI strings for the instrument. Consult the instrument's manual to find the exact strings to use.
"Inputs": ["IN A", "IN B"]