Normally, when your client application issues a TUI / aaS command to Fluent
using doMenuCommand() or
doMenuCommandToString() Fluent will use default values
for any unspecified arguments. You can instruct Fluent to instead prompt for
missing arguments by appending the character sequence
‘<space>-?’ to the command string.
For example, the following line would send the report
summary command to Fluent through the CORBA scheme interface and
request that Fluent prompt with questions:
fluentSchemeInterface.doMenuCommandToString(“report summary -?”)
If Fluent requires additional information to execute the command it will throw one of the CORBA exceptions in Exceptions depending on the type of question. The client can catch the exception and process it as necessary to respond with the additional information.
Thus, a typical sequence for a client application conducting a dialog with Fluent proceeds as follows:
Client sends a command to Fluent with the
‘<space>-?’ sequence
appended.
Fluent checks whether an argument is required and if so returns a CORBA exception.
Client catches the exception and determines how to respond to the question from Fluent.
Client reformulates the command with the answer to the question
now appended as an argument (along with
‘<space>-?’) and sends
the new command to Fluent.
Fluent checks whether an additional argument is required and, if so, returns a CORBA exception.
Steps 3–5 are repeated until Fluent determines that it has a complete command.
The following is a sample Python code block showing a basic implementation of exception handling to receive prompts from a remote Fluent as a Server session and present them to a user operating the client application. For each prompt with a default answer, if the user presses Enter without entering any text, the default value is used.
success=False
while not success:
try:
output=scheme_interface.doMenuCommandToString(''.join([command," -?"]))
success=True
except AAS_CORBA.EYesNoQuestion as e:
moreinfo=raw_input(''.join([e.questionPromptWithDefaultAnswer," "]))
if not moreinfo:
moreinfo=e.defaultAnswer
command=''.join([command," ",moreinfo])
except AAS_CORBA.EReadUnquotedString as e:
moreinfo=raw_input(''.join([e.questionPrompt," ","[",e.defaultAnswer,"]"]))
if not moreinfo:
moreinfo=e.defaultAnswer
command=''.join([command," ",moreinfo])
except AAS_CORBA.EReadQGenericQuestion as e:
moreinfo=raw_input(''.join([e.questionPromptWithDefaultAnswer," "]))
if not moreinfo:
moreinfo=e.rawDefaultAnswer
command=''.join([command," ",moreinfo])
except AAS_CORBA.EMenuGetQuestion as e:
print(e.questionMenu)
moreinfo=raw_input(''.join([e.questionPrompt," "]))
command=''.join([command," ",moreinfo])
except:
e=sys.exc_info()
print( "Error: %s" % e[0])
print(e[1])
sys.exit(1)