Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: edits/style, syntax from Dev
Scripting_function


Panel
titleDescription

Attempts to retrieve a response message from the Gateway. The transaction id from the sent message is used to retrieve the response.

Client permissions restrictions


Panel
titleSyntax

system.secsgem.getResponse(transactionID, equipment, [timeout], [poll])

  • Parameters

Integer transactionID - The transactionID of the request and response. The transactionID is used to retrieve the response. Typically used in conjunction with system.secsgem.sendRequest to generate a transactionID.

String equipment - Name of equipment connection.

Integer timeout - Specifies in seconds how long to wait for a response before returning None. If omitted the timeout will be 5 seconds. [optional]

Integer poll - Specifies in milliseconds how often to poll the system for a response. If omitted the poll will be 150 milliseconds. [optional]

  • Returns

Object Any - A Python object, typically a dictionary. The actual result is a JSON string that's decoded into a Python object, as shown on the mapping on the system.util.jsonDecode page. 

  • Scope

Gateway, Vision Client, Perspective Session

Panel
titleCode Examples
Code Block
languagepy
titleCode Snippet
# Replace the string below with the equipment name you want to send the request to.
myEquipment = "EquipmentOne"
 
# Define the contents of the body. We're using an empty string, since S1F1 doesn't expect a body, and we need to define something (Python's None will result in an exception).
body = ""
 
# Store the returned transactionID in a variable. 
transactionID = system.secsgem.sendRequest("S1F1", True, body, myEquipment)

# Use the transactionID to lookup the response.
response = system.secsgem.getResponse(transactionID, myEquipment, 2)

# We're printing out the response here, but you could do something more useful instead. 
print response
Code Block
languagepy
titleCode Snippet
# This example demonstrates how to retrieve the value of a Status Variable via S1F3. 
# If using the simulator that comes with the SECS/GEM module, this example will return the current time from the Clock Status Variable.

# Replace the string below with the equipment name you want to send the request to.
myEquipment = "EquipmentOne"

# Define the contents of the body. The Clock Status Variable has an SVID of 1.
body = [{"format":"U4", "value":1}]

# Store the returned transactionID in a variable.  
transactionID = system.secsgem.sendRequest("S1F3", True, body, myEquipment)

# Retrieve the response.
response = system.secsgem.getResponse(transactionID, myEquipment, 2)

## We need to do some digging to get the value of the Clock:
## -The response is a Dictionary.
## -Inside of the response is the key "body".
## -The value of "body" is a Python List containing another Dictionary (which has our Clock value)
## 		Thus we use [0] to access the Dictionary.
## -The Dictionary contains a key named "value", which is the value of our clock.
theDatetime = response["body"][0]["value"]

# We parse the date into something more human readable, and print it out. 
print system.date.parse(theDatetime, "yyMMddHHmmss")
Panel
titleKeywords

system secsgem getResponse, secsgem.getResponse