guibroker

Index Home MAE > MAE Architecture > MAE Daemons > guibroker

GuiBroker Daemon

The GuiBroker daemon acts as an abstracted user console manager.  Software components tell GuiBroker what is needed and GuiBroker deals with the I/O of the device driver, UserGW, to carry out that request.

Daemon Parameters

GuiBroker reads these commhub attributes (that originate from the commhub.ini file):

Keyword

Value

ImageLib.types

Comma separated list of files types that may be uploaded.  For example: svg,png,jpg,gif


Programming API to GuiBroker

Use the UserDevice class to communicate with GuiBroker (and UserGW and Imager), which communicates with the user.

Behind the scenes, the UserDevice class communicates with GuiBroker's GuiAPI and InputAPI interfaces.

When the user initiates a session with an application, GuiBroker sends the userstart message to your application; your application needs a #userstart command in your .mreg file for genmae to convert the message into a method call.

Database Tables

GuiBroker uses these database tables:

Table Name

Description

GuiXact

Table of outstanding transactions awaiting user response.

GuiState

Table of UI state variables.

Property

Table of app-specific properties.  For guibroker, pre-configured menu options.


Messages Received and Processed (gui)

The following messages may be received on the gui channel.

Server API Messages (gui)

MsgTag

Description

prompt

Ask the user a question and provide instruction on where to send the answer.

device - the end-user's device

question - the text prompt for the user; the user is answering this question

prefillAnswer - (optional) the default input for the user

queryType - the type of prompt for the user, e.g. text, int, YN, (dice)

cbapp - (deprecated) the task where the user's response should be set.  Default: your app

cbtag - when responding with the user's answer, this cbtag will be used (see handleInputResponse())

cbdata - when responding with the user's answer, this callback data will be provided

style - (optional) the style to use when displaying this prompt

@return true if sent successfully

select

Provide the user with a question and a selection of choices. When the user selectrs a choice, send a response to the app.

device - the end-user's device

question - the text prompt for the user; the user is answering this question

choices - key/value pairs of display text (key) and response text (value)

cbtag - when responding with the user's answer, this cbtag will be used (see handleInputResponse())

cbdata - when responding with the user's answer, this callback data will be provided

defaultValue - (optional) the default input for the user

@return true if sent successfully

textarea

Setup an area where the user can type in a lot of text.  When the user saves the text, send a response to the app.

device - the end-user's device

question - the text prompt for the user; the user is answering this question

origText - prefill the text block with this text

cbtag - when responding with the user's answer, this cbtag will be used (see handleInputResponse())

cbdata - when responding with the user's answer, this callback data will be provided

style - (optional) the style to use when displaying this prompt

saveButtonLabel - (optional) the text for the button for the user to save the text

@return true if sent successfully

checkbox

Provide the user with a set of checkboxes (radio buttons - select one at a time). When the user selects one, send a response to the app.

device - the end-user's device

question - the text prompt for the user; the user is answering this question

cbtag - when responding with the user's answer, this cbtag will be used (see handleInputResponse())

cbdata - when responding with the user's answer, this callback data will be provided

defaultValue - (optional) the checked box when presented to user

@return true if sent successfully

form

Present the user with a form (see file in ../html/form).

Note that all the formDefault values will be merged into the cbdata hash array.  Don't use the same keys!

The cbtag & cbdata here is delivered to userInputFormValid() in guibroker:cmd.cpp for form validation.

The cbtag & cbdata here is delivered to messageResponse() in guibroker:cmd.cpp.

device - the end-user's device

formName - the form (in ../html/form) to use with questions for the user

formDefaults - key/value pairs for form question ids (key) and filled in answers (value)

cbtag - when responding with the user's answer, this cbtag will be used (see handleInputResponse())

cbdata - when responding with the user's answer, this callback data will be provided

@return true if sent successfully

run

Run another app inside MAE.  The user's attention will be forced to the new app.  App-specific parameters may be provided.

device - the end-user's device

appname - the name of the MAE app

appparams - app-specific parameters for the MAE app

@return true if sent successfully

download

Request the user to send the app a file.

device - the end-user's device

query - the text prompt for the user; the user is answering this question

cbtag - when responding with the user's answer, this cbtag will be used (see handleInputResponse())

cbdata - when responding with the user's answer, this callback data will be provided

fileclass - a comma separated list of types of file expected, e.g. html, svg, jpg, etc.

@return true if sent successfully

regmenu

Register a menu selection, which will automatically be provided with the user starts the UI for this application. Menu options are grouped under a menu name.

device - the end-user's device (only AppMode is used)

menuname - the name for a group of options

menuoption - the text presented to the user as the menu option

action - the message keyword to send to the app when the user selects this menu option

@return true if sent successfully

regkey

Register a keystroke, so when the user presses that key the provided action will be sent as a message to the app.

device - the end-user's device (only AppMode is used)

keystroke - the key to register, which may be a special key such as ctrl-s, F2, alt-a

action - the message keyword to send to the app when the user selects this menu option

@return true if sent successfully

reghotspot

Register a hotspot or group of hotspots, so when the user clicks on it the specified action is sent as a message to the app.

device - the end-user's device (only AppMode is used)

region - this can be a specific region name or it may contain one or more wildcards, e.g. tile_*

action - the message keyword to send to the app when the user clicks on the hotspot

@return true if sent successfully

deflecthotspot

Redirect a hotspot or group of hotspots, so when the user clicks on it the specified action is sent as a message to the app.

device - the end-user's device (only AppMode is used)

region - this can be a specific region name or it may contain one or more wildcards, e.g. tile_*

otherapp - the task id of the other app that will handle this click

@return true if sent successfully

regmouse

Register a mouse callback (with x,y inside region as well as mouse direction) for a region or group of regions, so when the user clicks on it the specified action is sent as a message to the app as a mouise response.

device - the end-user's device (only AppMode is used)

region - this can be a specific region name or it may contain one or more wildcards, e.g. tile_*

action - the message keyword to send to the app when the user clicks on the region

@return true if sent successfully

regcmd

Register a command so when that command is triggered through the UI, the command provided parameters will also be sent with it.

device - the end-user's device (only AppMode is used)

cmd - they keyword

cmdparams - the parameters/callback data to be sent with the command

@return true if sent successfully


Messages Received and Processed (input)

The following messages may be received on the input channel.

Server API Messages (input)

MsgTag

Description

response

The user has responded and input control that is now transmitting the use's response back; relay it to the appropriate application.  Input controls include prompt boxes, pull down selectors, check boxes, textareas, etc.

device - the end-user's device

xid - the transaction id (GuiXact id) that guibroker assigned to the prompt

text - the user response text

@return  true if sent successfully

chat

The user is sending a chat line.  Relay it to the app that handles chat.

device - the end-user's device

text - the chat message

@return  true if sent successfully

cmd

The user has pushed a button to trigger a command

device - the end-user's device

cmd - the action that becomes a message to appropriate app

@return  true if sent successfully

key

The user has pressed a keystroke.

device - the end-user's device

key - the ASCII value of the key; if it leads with 0, then it's a special key

@return  true if sent successfully

click

The user has clicked on an area/region (which is implicit in UserDevice)

device - the end-user's device

@return  true if sent successfully

mouse

The user has pressed or released the mouse inside an image at a point

device - the end-user's device

direction - the direction of the mouse click, e.g. up, down

x - the lower left of the image is (0,0); this is the x offset from there

y - the lower left of the image is (0,0); this is the x offset from there

action - the keyword action for the callback to the app

cbdata - the callback data for the app

@return  true if sent successfully

hotspot

The user has activated a hotspot

device - the end-user's device

action - the keyword action for the callback to the app

cbdata - the callback data for the app

@return  true if sent successfully

upload

The user has uploaded a file.

device - the end-user's device

fileclass - the provided class of the file

filetype - the type of file, e.g. svg, html, etc

imagelibid - ImageLib idthe transaction id (GuiXact id) that guibroker assigned to the prompt

xid - the transaction id (GuiXact id) that guibroker assigned to the prompt

@return  true if sent successfully

refresh

We are getting a redraw request for the UI.

device - the end-user's device

@return  true if sent successfully

select

The user has selected something from a list.  This is the key from that list.

device - the end-user's device

value - selected value

@return  true if sent successfully

online

The user has activated his/her display and is now on-line.

device - the end-user's device

appparams - any parameters associated with this user going -online, to relay to app

@return  true if sent successfully

withdraw

The user has disconnected or gone off-line

device - the end-user's device

@return  true if sent successfully

timeout

The user has disappeared (connection idle)

device - the end-user's device

@return  true if sent successfully


Client API Messages (input)

MsgTag

From

Description

chat

input

See InputApp::messageChat()