Class UserDevice

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class UserDevice

Summary
Using UserDevice
Format
Examples
Notes
Public Methods
UserDevice(isDM, user_id, pc_id, setting_id, appmode, region, group)
UserDevice(user_id, pc_id, setting_id, appmode, region, new_group)
UserDevice(id)
inline DbRecNum getUserId() const
inline DbRecNum getConnectionId() const
inline DbRecNum getPlayerId() const
inline DbRecNum getSettingId() const
inline const string& getAppMode() const
inline const string& getServerGroup() const
inline const string& getRegion() const
inline bool isDM() const
inline bool isPlayer() const
inline bool isConnection() const
inline bool isUser() const
inline UserDevice& setUserId(newId)
inline UserDevice& setConnectionId(newId)
inline UserDevice& setPlayerId(newId)
inline UserDevice& setSettingId(newId)
inline UserDevice& setAppMode(newMode)
inline UserDevice& setServerGroup(newGroup)
inline UserDevice& setRegion(newRegion)
inline UserDevice& clearRegion()
inline UserDevice& setDM(yes)
inline UserDevice& setPC(yes)
bool valid() const
string toString() const
bool pushSettingId(newSettingId)
bool pushPlayerId(newPlayerId)
bool setfield(group, field, value)
bool setfield(group, field, value)
bool setfield(group, field, value)
bool settext(text, tag, style)
bool settext(num, tag, style)
bool settext(num, tag, style)
bool settext(num, tag, style)
bool write(text, tag, style)
bool write(num, tag, style)
bool writeln(text, tag, style)
bool writeln(num, tag, style)
bool writewiki(text, tag)
bool addhotspot(text, action, cbdata, tag, style)
bool addhotspot(num, action, cbdata, tag, style)
bool addhotspot(image, action, cbdata, tag)
bool addhinttext(text, tag)
bool button(text, action, cbdata, tag)
bool strong(on, tag)
bool emphasis(on, tag)
bool bold(on, tag)
bool italic(on, tag)
bool underline(on, tag)
bool color(color, bg_color, tag)
inline bool colorDefaults(tag)
bool style(styleName, tag)
bool attention(text)
bool record(recordName, values, tag, overwrite)
bool recordTemplate(recordName, idmap, values, tag, overwrite)
bool selection(value, tag)
bool chat(from, text)
bool report(report, table, table_id, tag)
UserDevice addRegion(tag, styleName, size)
UserDevice& clear(tag)
bool show(tag)
bool hide(tag)
bool prompt(query, value, promptType, xid, tag, style)
bool form(form, vars, xid, tag)
bool select(option0, options, xid, tag, selected)
bool checkbox(query, value, xid, tag, style)
bool textarea(text, xid, tag, style, saveLabel)
bool download(query, fileclass, xid, tag)
bool setMenu(menu, option, action)
bool unsetMenu(menu, option)
bool setKey(key, action)
bool unsetKey(key)
UserDevice setWindow(windowName)
bool unsetWindow(windowName)
UserDevice setIndex(indexName)
bool unsetIndex(indexName)
UserDevice newTable(name, tableType, rows, columns)
UserDevice setTable(name)
UserDevice tableRowColumn(row, column)
UserDevice newSection(title, sectionType, tag)
UserDevice getSection(title, tag)
UserDevice& collapseSection()
UserDevice& expandSection()
UserDevice& rmSection(title, tag)
UserDevice newList(name, items)
UserDevice listItem(item_no)
Image newImage(imageName, module) const
bool drawImage(image, tag)
bool bufferImage(imageName, image_type, width, height, size, data, binary)
bool displayBufferedImage(imageName, image_type, action, cbdata, tag)
bool displayImage(image_id, action, cbdata, tag)
bool upload(imageName, image_type)
bool download(query, action, cbdata, types, tag)
inline bool downloadImageLib(query, action, cbdata, tag)
bool playAudio(audioName)
static bool registerMenu(menuname, submenuname, action, appmode)
static bool registerKey(keystroke, action, appmode)
static bool registerHotspot(region, action, appmode)
static bool redirectHotspot(region, otherapp, appmode)
static bool registerMouse(region, action, appmode)
static bool registerCommand(cmd, cbdata, appmode)
bool run(appname, params)
bool webpage(url)
bool quit()
bool switchapp(appname, params)
bool logout()
bool query(question, queryType, cbtag, cbdata, displayTag, style, prefillAnswer)
bool query(question, queryType, cbapp, cbtag, cbdata, displayTag, style, prefillAnswer)
bool query(question, prefillAnswer, queryType, cbapp, cbtag, cbdata, displayTag, style)
bool queryText(question, cbapp, cbtag, cbdata, displayTag)
bool queryText(question, cbtag, cbdata, displayTag)
bool queryRoll(question, dieRoll, cbapp, cbtag, cbdata, displayTag)
bool queryYN(question, cbapp, cbtag, cbdata, displayTag)
bool queryInt(question, cbtag, cbdata, displayTag, prefillAnswer)
bool queryInt(question, cbapp, cbtag, cbdata, displayTag, prefillAnswer)
bool querySelection(question, choices, cbapp, cbtag, cbdata, displayTag, defaultValue)
bool querySelection(question, choices, cbapp, cbtag, cbdata, displayTag, defaultValue)
bool queryCheckbox(question, cbapp, cbtag, cbdata, displayTag, defaultValue, style)
bool queryTextarea(question, origText, cbapp, cbtag, cbdata, displayTag, style, saveButtonLabel)
bool queryPassword(question, cbapp, cbtag, cbdata, displayTag, style, prefillAnswer)
bool queryPassword(question, cbtag, cbdata, displayTag, style, prefillAnswer)
static bool setQueryCB(cbfn)
bool form(formName, formDefaults, cbtag, cbdata, displayTag)
static bool setFormCB(cbfn)
static inline bool isQueryCB(messenger, src, dest, request, param)
Protected Methods
inline void invalidate()
static string cleanTag(tag)
Private Properties
Private Methods
bool format(control, on, tag)
inline bool imager(request, params)
bool send(channel, request, params)
static void inputCB(messenger, src, dest, request, param)
bool setUserVariable(variable, value)
bool setUserVariable(variable, value)
string getUserVariable(variable)
DbRecNum getUserVariableInt(variable)
static long sectionHash(title)

#include <UserDevice.h >

Summary

This class provides abstracted access to a user's session/device.

The device is a collection of named regions where text and images may be

displayed.  Additional named sub-regions can be created and written to as

well.  A number of display structures are supported (tables, etc.).

There is no exclusivity communicating with a user; multiple apps may use

the same UserDevice to update diverse parts of the user's display at the

same time.

Using UserDevice

This class abstracts the end-user's device, which is presumably a web browser, but may be something else. The user views information, enters responses, selects users controls (buttons, pull-downs, etc), uploads data, and downloads data.

The UserDevice class is used to identify an I/O endpoint abstractly so an application can have a handle to that endpoint without needing to understand protocols, terminal information, graphics standards, etc.  This class abstracts all of that.

An I/O endpoint is a user.  The user operatates in a role, presently the roles are dm (referee) and pc (player).  A pc is unique to a setting or game milieux/environment/system.  A dm may referee multiple settings.  A pc  connection may be from the owning user id, a proxy user id (friend), or the dm.

An I/O endpoint runs one or more applications inside the system.  This is called the app mode.

The UserDevice class captures the role, user id, pc id, setting id, and app mode.  Those elements uniquely identify a endpoint/connection.

The endpoint has predefined elements: menus, attention box, and chat box. The menus are implmented using the local graphics system.  Menus are only two-levels.  An attention box is a prominent way to present a message/alert to the user.  The chat box is used for communicating among multiple users.

The UserDevice class also has an optional pararameter known as a region. This is an area/hotspot/named element of the interface.  To format text into something attractive, the various elements of the screen/page/display are named.  Text is sent to that named region so output appears comprehensible (and hopefully user-friendly!) to the end-user.  When the user enters data, clicks or otherwise activates an element of the interface, that element's name is passed through UserDevice as the region.

The UserDevice class has a method toString() which can be later passed to instantiate another UserDevice with all the key information.

Format

Syntax:

This string follows the format:

role:/userid/pcid/wid/app[/region[/group]

where

Term

Description

role

The role is either dm or pc.  In DM role, the userid must be non-zero; and the pcid is 0.

userid

The id from the User datastore. In PC role, the userid may be 0 to broadcast something to all endpoints in used by the pc.  In PC role, pcid must be non-zero.

pcid

The id from the PC datastore.  In DM mode, the pcid is 0 for privileged/referee interaction.

wid

The id from the Setting datastore.

appmode

The appmode can be one of:  console, userman, mapedit, hexit, market, supervisor.

The label for the appmode may be 100 characters or less.

region

The region varies based upon the appmode.  It identifies the UI area of focus, whether for input or output. The region 'attn' is common to all apps; it represents the attention box.

The label for the region may be 100 characters or less.

group

This is an internal value used for routing.


Examples

Example UserDevice endpoint identification strings:

dm:/1/0/console

pc:/1/3/console

pc:/3/3/3/console//E3

pc:/3/3/3/console/attn/E3

pc:/3/3/console/attn

Notes

UserDevice is implmented using messages across a message bus to two daemons: usergw (channel: display) and guibroker (channel: input, gui).  The usergw daemon is like a device driver - it knows how to convert the request into the graphical display's protocol/API/syntax.  It also knows how to take input from the endpoint and standardize it into an understandable input in this system.  It forwards those inputs to the guibroker daemon.  The guibroker daemon plays two key roles:  it responds to user input (such as user keystroke, mouse click, hotspot activiaction or command request) and it handles non-simple I/O (such as prompting user with a question, sending a user interface control (selector, textbox), or handling a form with multiple input entry areas).  The guibroker daemon is more abstract than the device-aware usergw daemon.

Input initiated by the user and non-simple I/O is then translated into requests on the message bus to which system applications subscribe and process.  For example, the setting daemon as a SettingApp class with a method to process messages on the 'setting' channel.  These messages often come from guibroker, but they may come from other daemons in the system as well.  The SettingApp daemon acts as a setting processor that responds to its defined set of requests.

Public Methods

UserDevice(isDM, user_id, pc_id, setting_id, appmode, region, group)

bool isDM

true if this user has elevated privileges

DbRecNum user_id

the database record id in the User table of the user on this device

DbRecNum pc_id

a secondary database record id of this user

DbRecNum setting_id

a context id of this user, e.g. group id, company id, project id, etc.

Default value: 0

const string& appmode

the channel of the primary app responsible for managing interaction with this user

Default value: ""

const string& region

the named region where the last user interaction happened

Default value: ""

const string& group

name of server group handling this user's session

Default value: ""


Constructor for structure to manage user interactions.

UserDevice(user_id, pc_id, setting_id, appmode, region, new_group)

DbRecNum user_id

the database record id in the User table of the user on this device

DbRecNum pc_id

a secondary database record id of this user (if 0, then isDM is implied)

DbRecNum setting_id

a context id of this user, e.g. group id, company id, project id, etc.

Default value: 0

const string& appmode

the channel of the primary app responsible for managing interaction with this user

Default value: ""

const string& region

the named region where the last user interaction happened

Default value: ""

string new_group

name of server group handling this user's session

Default value: ""


Constructor for structure to manage user interactions.

UserDevice(id)

const string& id

a serialized representation of a user session (see toString())


Constructor for structure to manage user interactions.

inline DbRecNum getUserId() const

Get the relevant user's DB table User id for this session.

Return value: the user's record id, 0 for public or invalid session

inline DbRecNum getConnectionId() const

If the User id is 0, it may be a public (non authorized) session.

If so, the ConnectionId will be non-zero.

Return value: the unqiue connection id (only valid if User id is 0)

inline DbRecNum getPlayerId() const

The MAE app doubles the connection id with the PC id.

Return value: the database table PC id of content being displayed

inline DbRecNum getSettingId() const

The MAE app maintains a game session, which is the database

table Setting id.

Return value: the game Setting id

inline const string& getAppMode() const

The application mode is set by the application and used to route

user responses to the correct app.  It is actually the application

channel handled by msgbroker.

Return value: the application mode

inline const string& getServerGroup() const

When scaling MAE deployments, we track which group of servers is

handling this user's session.

Return value: the server group name

inline const string& getRegion() const

Return the current region to control or the last region the user

interacted with. This region may have dashes in it, but no spaces.

The region is sometimes referred to as a display tag.

Return value: the region name

inline bool isDM() const

Determine if this is an elevated privilege session.

Return value: true if session is elevated in privilege

inline bool isPlayer() const

Determine if this is not an elevated privilege session.

Return value: true if session is not elevated in privilege

inline bool isConnection() const

Determine if this is an unauthorized but valid user session.

Such connections are considered public or anonymous because we

don't have information on who the user is.

Return value: true if session is public

inline bool isUser() const

Determine if this is an authorized session where a person has

authenticated and we know who the user is.

Return value: true if this is an authorized session

inline UserDevice& setUserId(newId)

DbRecNum newId

a valid id from the User table


Set the database table User id for this session.

This is typically set by the device gateway daemon, e.g. usergw.

Return value: this UserDevice instance back

inline UserDevice& setConnectionId(newId)

unsigned long newId

a valid connection id


Set the connection id for this ession.

This is typically set by the device gateway daemon, e.g. usergw.

Return value: this UserDevice instance back

inline UserDevice& setPlayerId(newId)

DbRecNum newId

a valid PC table id


For the MAE app, set PC table id, which is the context for the

displayed content.

This is typically set by the device gateway daemon, e.g. usergw.

Return value: this UserDevice instance back

inline UserDevice& setSettingId(newId)

DbRecNum newId

a valid Setting table id


For the MAE app, set the Setting table id (game id).

This is typically set by the device gateway daemon, e.g. usergw.

Return value: this UserDevice instance back

inline UserDevice& setAppMode(newMode)

const string& newMode

an application where users responses are managed


Set the application mode for this session.

This is typically set by the device gateway daemon, e.g. usergw.

If an app sets it, it must know that the use device is also monitoring

the new application mode, otherwise the user will never see the

intended output.

Return value: this UserDevice instance back

inline UserDevice& setServerGroup(newGroup)

const string& newGroup

an application where users responses are managed


Set the server group managing this user session.

This is typically set by the device gateway daemon, e.g. usergw.

If an app sets it, it must know that the use device is inside

the group, otherwise the user will never see the  intended output.

Return value: this UserDevice instance back

inline UserDevice& setRegion(newRegion)

const string& newRegion

the name of new target region (aka display tag)


Specify the target display region that successive plans are

controlling/displaying output to.

Return value: this UserDevice instance back

inline UserDevice& clearRegion()

Clear the name of the target display region.

An unnamed region cannot be controlled. Only named regions can

be controlled.

Return value: this UserDevice instance back

inline UserDevice& setDM(yes)

bool yes

true for privileged connection, false for non-privileged

Default value: true


Set user privileged mode for this session.

This is typically set by the device gateway daemon, e.g. usergw.

Return value: this UserDevice instance back

inline UserDevice& setPC(yes)

bool yes

true for non-privileged connection, false for privileged

Default value: true


Set user unprivileged mode for this session.

This is typically set by the device gateway daemon, e.g. usergw.

Return value: this UserDevice instance back

bool valid() const

Determine if this is a valid UserDevice session or not.

Manipulating an invalid session is pointless.

Return value: true if this UserDevice is a valid session

string toString() const

Serialize the UserDevice class into a string so it can be communicated

to another MAE app.  See constructor that takes a lone string.

Return value: a string representation of UserDevice

bool pushSettingId(newSettingId)

DbRecNum newSettingId

the new id the user should use

Default value: 0


Change the active tenant id (in MAE app, the setting id) on the user's device. Going forward, user responses will designate the new tenant id.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device)

bool pushPlayerId(newPlayerId)

DbRecNum newPlayerId

the new id the user should use

Default value: 0


Change the active display context for the user.  (In MAE app, this is the player id on the user's device.) Going forward, user responses will designate the new player id in UserDevice.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device)

bool setfield(group, field, value)

const string& group

the name for the group of fields

const string& field

the name of the field in the group to update

const string& value

the new (string) value to display (the old value is cleared)


Update a specific display tag (field) of a group of value values. If you setup your display areas using group_field, then use setfield to set its value on the user's display.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool setfield(group, field, value)

const string& group

the name for the group of fields

const string& field

the name of the field in the group to update

long value

the new (integer) value to display (the old value is cleared)


Update a specific display tag (field) of a group of value values. If you setup your display areas using group_field, then use setfield to set its value on the user's display.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool setfield(group, field, value)

const string& group

the name for the group of fields

const string& field

the name of the field in the group to update

bool value

the new (boolean) value to display (the old value is cleared)


Update a specific display tag (field) of a group of value values. If you setup your display areas using group_field, then use setfield to set its value on the user's display.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool settext(text, tag, style)

const string& text

the new plain text

const string& tag

the name of the region to update

Default value: ""

const string& style

The formatting style name to assert for this region of the display

Default value: ""


Update the display with plain text at the tagged location (replace previous text).

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool settext(num, tag, style)

int num

the new (integer) number

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Update the display with plain text at the tagged location (replace previous text).

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool settext(num, tag, style)

float num

the new (floating point) number

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Update the display with plain text at the tagged location (replace previous text).

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool settext(num, tag, style)

double num

the new (double floating point) number

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Update the display with plain text at the tagged location (replace previous text).

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool write(text, tag, style)

const string& text

the text to add to the display region

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Add more text to the display at the tagged location.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool write(num, tag, style)

long num

the integer to add to the display region

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Add more text to the display at the tagged location.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool writeln(text, tag, style)

const string& text

the text to add to the display region

Default value: ""

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Add more text and a line break to the display at the tagged location.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool writeln(num, tag, style)

long num

the integer to add to the display region

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Add more text and a line break to the display at the tagged location.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool writewiki(text, tag)

const string& text

wiki formatted text

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Add formatted text using simple wiki formatting.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool addhotspot(text, action, cbdata, tag, style)

const string& text

the text to display to the user

const string& action

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Create an actionable hotspot in output stream at display region.

If cbdata["device"] is set, it overrides the user's input device.

An action may be a keyword processed in guibroker:hotspot.cpp, but

it may also be cmd:..., click:..., key:...; see guibroker:ioConsole.cpp

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool addhotspot(num, action, cbdata, tag, style)

long num

the text to display to the user

const string& action

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Create an actionable hotspot in output stream at display region.

If cbdata["device"] is set, it overrides the user's input device.

An action may be a keyword processed in guibroker:hotspot.cpp, but

it may also be cmd:..., click:..., key:...; see guibroker:ioConsole.cpp

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool addhotspot(image, action, cbdata, tag)

Image& image

the image to display to the user

const string& action

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Create an actionable image hotspot in output stream at display region.

This hotspot will return mouse (x,y) coordnates where the click occurred.

If cbdata["device"] is set, it overrides the user's input device.

An action may be a keyword processed in guibroker:hotspot.cpp, but

it may also be cmd:..., click:..., key:...; see guibroker:ioConsole.cpp

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool addhinttext(text, tag)

const string& text

the help/hint text for user

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


If supported on end-user device, display some help/hint text to user for this region, perhaps when the user hovers over the text.

bool button(text, action, cbdata, tag)

const string& text

the label for the button

const string& action

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Display a button on the end-user device; when the user click on it, it will trigger an action (a message to the calling app)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool strong(on, tag)

bool on

true if the following text should be displayed bold; false if not

const string& tag

display region where bold is enabled; if blank, use last setRegion() tag

Default value: ""


Deprecated. Enable/Disable strong/bold text in the text to follow.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool emphasis(on, tag)

bool on

true if the following text should be displayed italic; false if not

const string& tag

display region where italic is enabled; if blank, use last setRegion() tag

Default value: ""


Deprecated. Enable/Disable emphasis/italic text in the text to follow.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool bold(on, tag)

bool on

true if the following text should be displayed bold; false if not

const string& tag

display region where bold is enabled; if blank, use last setRegion() tag

Default value: ""


Deprecated. Enable/Disable strong/bold text in the text to follow.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool italic(on, tag)

bool on

true if the following text should be displayed italic; false if not

const string& tag

display region where italic is enabled; if blank, use last setRegion() tag

Default value: ""


Deprecated. Enable/Disable emphasis/italic text in the text to follow.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool underline(on, tag)

bool on

true if the following text should be displayed underlined; false if not

const string& tag

display region where underline is enabled; if blank, use last setRegion() tag

Default value: ""


Deprecated. Enable/Disable underlining in the text to follow.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool color(color, bg_color, tag)

const string& color

name of the color for the text; blank for default

const string& bg_color

name of background color of the text; blank for default

Default value: ""

const string& tag

display region where color is enabled; if blank, use last setRegion() tag

Default value: ""


Deprecated. Enable colored text to follow.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

inline bool colorDefaults(tag)

const string& tag

display region where color is disabled; if blank, use last setRegion() tag

Default value: ""


Deprecated. Disable colored text to follow.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool style(styleName, tag)

const string& styleName

configured in /usr/mae/html/ (in css file)

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Set the display style for the display region. Existing text will be re-displayed using next style.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool attention(text)

const string& text

The message to display.


Send a message to the attention! box to call it out to the user.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool record(recordName, values, tag, overwrite)

const string& recordName

template file from /usr/mae/html/record/

const HashArray& values

key/value pairs to assert into the record

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

bool overwrite

true if existing content at tag should be cleared first; otherwise this record is added to that display region

Default value: true


Output a record of information.

When recordName contains a period, the tag prefixes are truncated there.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool recordTemplate(recordName, idmap, values, tag, overwrite)

const string& recordName

template file from /usr/mae/html/record/

HashArray idmap

key/value pairs for mapping the keys of values to the keys in the record (key/value is: values key / recordName id)

HashArray values

key/value pairs to assert into the record

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

bool overwrite

true if existing content at tag should be cleared first; otherwise this record is added to that display region

Default value: true


Output a record of information using a templte to map old UI ids to new ones

for idmap, the key is the old id and the value is the new id

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool selection(value, tag)

const string& value

a valid selector option of the tag'ed selector

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Set the selection value for a selector.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool chat(from, text)

const string& from

the name of the sender of the message

const string& text

the text of the message


Send a chat message to a PC (if PC=0, then from DM).

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool report(report, table, table_id, tag)

const string& report

the name of the report to use

const string& table

the group name / table name

DbRecNum table_id

table record id of data to display

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Future feature (not implemented). Output a report of information

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

UserDevice addRegion(tag, styleName, size)

string tag

the name of the new region

const string& styleName

configured in /usr/mae/html/ (as css file)

Default value: ""

int size

(optional) expected size (in characters), 0 means dynamic

Default value: 0


Create an ad hoc region right here (size is charater allocation for region) inside the current region.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

UserDevice& clear(tag)

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Update the display by clearing all text in the target region.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool show(tag)

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Show/unhide a tagged region or display block

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool hide(tag)

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Hide a tagged region or display block

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool prompt(query, value, promptType, xid, tag, style)

const string& query

a question to display to the user before the prompt

const string& value

the default value to display

const string& promptType

the query type; see query()

DbRecNum xid

a GuiXact record id for tracking this user interaciton

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Sent by guibroker to display (usergw). Prompt user with a question.

Non-guibroker apps should not use this method.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool form(form, vars, xid, tag)

const string& form

the name of the form from /usr/mae/html/form/

const HashArray& vars

list of variables (keys) and their initial values in the form

DbRecNum xid

a GuiXact record id for tracking this user interaciton

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Sent by guibroker to display (usergw). Output a form to be completed by PC

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool select(option0, options, xid, tag, selected)

const string& option0

Text for the topmost option, which returns $NA

const HashArray options

key/value pairs of display text/value to return

DbRecNum xid

a GuiXact record id for tracking this user interaciton

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& selected

the value to initially highlight

Default value: ""


Sent by guibroker to display (usergw). Output a selector for user to selection one from it

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool checkbox(query, value, xid, tag, style)

const string& query

the text before the checkbox

const string& value

T or F, whether selected or not

DbRecNum xid

a GuiXact record id for tracking this user interaciton

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Sent by guibroker to display (usergw). Prompt user with a checkbox

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool textarea(text, xid, tag, style, saveLabel)

const string& text

initial text inside textarea

DbRecNum xid

a GuiXact record id for tracking this user interaciton

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""

const string& saveLabel

T or F, whether a "Save" button should be displayed or not

Default value: ""


Sent by guibroker to display (usergw). Output a text area for user to type lots of text into

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool download(query, fileclass, xid, tag)

const string& query

text for the Download area

const string& fileclass

filename extensions allowed to be downloaded (comma separated)

DbRecNum xid

a GuiXact record id for tracking this user interaciton

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Sent by guibroker to display (usergw). Ask user to upload a file to us (it's a download from our perspective)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool setMenu(menu, option, action)

string menu

Name of menu

const string& option

Text of option under menu name

const string& action

message to send to app when menu selected


Enable a menu option; your app gets a message (action) when option selected by user.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool unsetMenu(menu, option)

string menu

Name of menu

const string& option

Text of option under menu name; if none, then all options disabled

Default value: ""


Disable a menu option

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool setKey(key, action)

const string& key

a key may be "a" or "ctrl-a" or "alt-a" etc.

const string& action

message to send to app when keystroke typed


Enable a keystoke input; your app gets a message (action) when option selected by user. If not registered, a keystroke is ignored.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool unsetKey(key)

const string& key

a key may be "a" or "ctrl-a" or "alt-a" etc.


Disable a keystroke input

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

UserDevice setWindow(windowName)

string windowName

the name of the window to create or switch to


Enable a window option or create a window, return the device handle for the window

Create a new region that is a window in a set of windows

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool unsetWindow(windowName)

string windowName

the name of the window to unset; if none, then all

Default value: ""


Disable a window option

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

UserDevice setIndex(indexName)

string indexName

the name of the index to create or switch to


Enable a window option or create a window, return the device handle for the window

Create a new region that is an index in a set of indices

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool unsetIndex(indexName)

string indexName

the name of the index to unset; if none, then all

Default value: ""


Disable a index option

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

UserDevice newTable(name, tableType, rows, columns)

string name

the unique name for the table (used by setTable())

const string& tableType

is for future use

Default value: ""

int rows

number of rows, if known

Default value: 1

int columns

number of columns, if known

Default value: 1


Create a table of rows and columns; it is created inside the current display region.

Create a new region that is a table of cells. Each cell in the table is its own display region.

Return value: the device handle for the table

UserDevice setTable(name)

string name

the name of the table


Reference an existing table, return the device handle for the table

Return value: the device handle for the table

UserDevice tableRowColumn(row, column)

int row

The row number (starting at 1)

int column

The column number (starting at 1)

Default value: 1


Return a UserDevice pointer to a cell of the table

This operates on a UserDevice that is a table (row 1+, column 1+).

If you request one column beyond the current column count, a new column is allocated for it.

If you request one row beyond the current row count, a new row is allocated for it.

Return value: the device handle for the table at the specific row and column

UserDevice newSection(title, sectionType, tag)

const string& title

title to display for this section

const string& sectionType

An example type is "h3,collapsable", which styles the name has h3 and adds interface compontent to expand/collapse the section

const string& tag

region name in which new section should be placed

Default value: ""


Create a display section, which the user can control whether its hidden or not

Return value: the device handle for the section

UserDevice getSection(title, tag)

const string& title

title to display for this section

const string& tag

region name in which the section was placed

Default value: ""


Get a previously devined section. Note: if the tag was specified before, it must be specified again to find the right section.

Return value: the device handle for the section

UserDevice& collapseSection()

Display a collapsable section as collapsed

Return value: the device handle for the section

UserDevice& expandSection()

Display a collapsable section as expanded

Return value: the device handle for the section

UserDevice& rmSection(title, tag)

const string& title

title to display for this section

const string& tag

region name in which the section was placed

Default value: ""


Remove a section

Return value: the device handle for the section

UserDevice newList(name, items)

string name

the unique list name

int items

a count of the number of items in the list

Default value: 1


Create a new region that is a list of list items. No bullets implied.

Return value: the device handle for the list

UserDevice listItem(item_no)

int item_no

the item position (starting at 1)


Return a UserDevice pointing to a list item of the list. Each list item is its own region.

This operates on a UserDevice that is a list.

Return value: the device handle for the list item

Image newImage(imageName, module) const

const string& imageName

the name/keyword of the image

const string& module

the name of the module that is creating the image; interpretation by app

Default value: ""


Create an image buffer to manipulate

Return value: an initialized Image structure to use to create an image to display

bool drawImage(image, tag)

Image& image

an image created by newImage()

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Display a created image to the user (apps call this)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool bufferImage(imageName, image_type, width, height, size, data, binary)

const string& imageName

the name/keyword of the image

const string& image_type

type of image, e.g. png, jpg, gif

int width

width of image in pixels

int height

heigh of image in pixels

int size

size of image in bytes

const void* data

a pointer to the raw image

bool binary

set to true if raw image data is binary

Default value: true


Send an image to be displayed (does not display image) on display channel (usergw)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool displayBufferedImage(imageName, image_type, action, cbdata, tag)

const string& imageName

the name/keyword of the image

const string& image_type

type of image, e.g. png, jpg, gif

const string& action

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Used by imager daemon.  Display a buffered image to the user

Specify action (callback) if this image is a hotspot, leave blank otherwise

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool displayImage(image_id, action, cbdata, tag)

ImageLibId image_id

image's id in Image Library

const string& action

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& tag

the name of the region to update; if blank, use last setRegion() tag

Default value: ""


Display an image out of the Image Library (ImageLib DB table).

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool upload(imageName, image_type)

const string& imageName

the base name of the suggested filename

const string& image_type

the type (file extension) of image sent


Upload a buffered image (or content) in out-of-band from the display to upload it to the user

bool download(query, action, cbdata, types, tag)

const string& query

the prompt for the user

const string& action

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const StringSet& types

a list of file types that may be received

Default value: StringSet("")

const string& tag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""


Download a file from the user. Creates a special download region which the user uses to send a file to MAE.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

inline bool downloadImageLib(query, action, cbdata, tag)

const string& query

the prompt for the user

const string& action

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& tag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""


Download a file from the user and transfer it to the Image Library. Creates a special download region which the user uses to send a file to MAE.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

bool playAudio(audioName)

const string& audioName

the audio sound's name (or HTML tag, e.g. audio_audioName)


Play the referenced audio sound.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)

static bool registerMenu(menuname, submenuname, action, appmode)

const string& menuname

Name of menu

const string& submenuname

Text of option under menu name; if none, then all options disabled

const string& action

message to send to app when menu selected

const string& appmode

the app mode for this menu option

Default value: ""


Register a Menu option for guibroker to manage. When the user first connects to the appmode/channel, guibroker will setup the mneu system automatically.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

static bool registerKey(keystroke, action, appmode)

const string& keystroke

a key may be "a" or "ctrl-a" or "alt-a" etc.

const string& action

message to send to app when keystroke typed

const string& appmode

the app mode for this keystroke

Default value: ""


Register a keystroke for guibroker to manage. When the user first connects to the appmode/channel, guibroker will setup the keystrokes automatically.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

static bool registerHotspot(region, action, appmode)

const string& region

a display region name

const string& action

message to send to app when clicked upon

const string& appmode

the app mode for this click

Default value: ""


Register a hotspot for guibroker to manage. When the user first connects to the appmode/channel, guibroker will setup the keystrokes automatically.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

static bool redirectHotspot(region, otherapp, appmode)

const string& region

a display region name

const string& otherapp

the channel of where to send the click

const string& appmode

the app mode for this click

Default value: ""


Register a hotspot for guibroker to manage and when clicked upon, redirect to a different app. When the user first connects to the appmode/channel, guibroker will setup the keystrokes automatically.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

static bool registerMouse(region, action, appmode)

const string& region

a display region name

const string& action

message to send to app when clicked upon

const string& appmode

the app mode for this click

Default value: ""


Register a hotspot for guibroker to manage; when the user clicks upon it, they (x,y) coordinates in the region are sent. When the user first connects to the appmode/channel, guibroker will setup the keystrokes automatically.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

static bool registerCommand(cmd, cbdata, appmode)

const string& cmd

the action/request to permit

const XMLData& cbdata

the parameters to send with the command

Default value: XMLData("")

const string& appmode

the app mode for this command

Default value: ""


Register a valid command from the user device. If an action is initiated from the display that was not otherwise registered, this call permits it to pass through to the app.

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool run(appname, params)

const string& appname

the new app to switch to (appmode)

const XMLData& params

parameters to pass to the called app

Default value: XMLData("")


Switch to a different application - this is the one for you to call

guibroker handles this first to clean up the GUI before switching to the new app

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool webpage(url)

const string& url

a website URL on the Internet


Pull up a webpage from another site

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool quit()

Stop running the current application - switch to default/home app

guibroker handles this first to clean up the GUI before switching to the new app

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool switchapp(appname, params)

const string& appname

the new app to switch to (appmode)

const XMLData& params

parameters to pass to the called app

Default value: XMLData("")


Guibroker uses this. Switch to a different application - this is the one called by guibroker (you don't call it)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool logout()

Stop running all applications, de-authenticate user, and switch to default/home pages

guibroker handles this first to clean up the GUI before switching to the new app

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool query(question, queryType, cbtag, cbdata, displayTag, style, prefillAnswer)

const string& question

Text to appear next to the prompt

const string& queryType

queryType may be:  text - a text string; YN - prompt for yes or no response; int - prompt for an integer; select - prompt for a selection; textarea - prompt for a block of text; (die roll, e.g. Dice.toString()) - prompt player to roll dice

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""

const string& prefillAnswer

the default answer for the user; in a form, this is the previous value

Default value: ""


Send a query for the user to respond to and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool query(question, queryType, cbapp, cbtag, cbdata, displayTag, style, prefillAnswer)

const string& question

Text to appear next to the prompt

const string& queryType

queryType may be:  text - a text string; YN - prompt for yes or no response; int - prompt for an integer; select - prompt for a selection; textarea - prompt for a block of text; (die roll, e.g. Dice.toString()) - prompt player to roll dice

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""

const string& prefillAnswer

the default answer for the user; in a form, this is the previous value

Default value: ""


Send a query for the user to respond to and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool query(question, prefillAnswer, queryType, cbapp, cbtag, cbdata, displayTag, style)

const string& question

Text to appear next to the prompt

const string& prefillAnswer

the default answer for the user; in a form, this is the previous value

const string& queryType

queryType may be:  text - a text string; YN - prompt for yes or no response; int - prompt for an integer; select - prompt for a selection; textarea - prompt for a block of text; (die roll, e.g. Dice.toString()) - prompt player to roll dice

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Send a query for the user to respond to and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryText(question, cbapp, cbtag, cbdata, displayTag)

const string& question

Text to appear next to the prompt

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""


Send a query for the user to respond to with a short text answer and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryText(question, cbtag, cbdata, displayTag)

const string& question

Text to appear next to the prompt

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""


Send a query for the user to respond to with a short text answer and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryRoll(question, dieRoll, cbapp, cbtag, cbdata, displayTag)

const string& question

Text to appear next to the prompt

Dice dieRoll

the dice range, e.g. Dice("2d4+2")

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""


Send a query for the user to respond to with a dir roll (number) and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryYN(question, cbapp, cbtag, cbdata, displayTag)

const string& question

Text to appear next to the prompt

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""


Send a query for the user to respond to with a yes or no and specify how to receive response.

Appends (Y/N) to question. Verifies answer starts with Y/y or N/n.

The response text will be either "Y" or "N" (not the user's actual text).

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryInt(question, cbtag, cbdata, displayTag, prefillAnswer)

const string& question

Text to appear next to the prompt

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

int prefillAnswer

the default answer for the user; in a form, this is the previous value

Default value: 0


Send a query for the user to respond to with an integer and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryInt(question, cbapp, cbtag, cbdata, displayTag, prefillAnswer)

const string& question

Text to appear next to the prompt

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

int prefillAnswer

the default answer for the user; in a form, this is the previous value

Default value: 0


Send a query for the user to respond to with an integer and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool querySelection(question, choices, cbapp, cbtag, cbdata, displayTag, defaultValue)

const string& question

Text to appear next to the prompt

const HashArray& choices

key/value pairs are the selection choices; the keys are displayed; the appropriate value is returned as response

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

const string& defaultValue

the default answer (value) for the user

Default value: ""


Send a pull-down query for the user to respond to with a selection from the provided list and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool querySelection(question, choices, cbapp, cbtag, cbdata, displayTag, defaultValue)

const string& question

Text to appear next to the prompt

const StringSet& choices

a list of options; the text of the selection option is the response

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

const string& defaultValue

the default answer (value) for the user

Default value: ""


Send a pull-down query for the user to respond to with a selection from the provided list and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryCheckbox(question, cbapp, cbtag, cbdata, displayTag, defaultValue, style)

const string& question

Text to appear next to the prompt

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

const bool defaultValue

the default answer (value) for the user, true or false

Default value: false

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""


Send a checkbox query for the user to respond to and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryTextarea(question, origText, cbapp, cbtag, cbdata, displayTag, style, saveButtonLabel)

const string& question

Text to appear next to the prompt

string origText

the default answer (value) for the user, true or false

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""

const string saveButtonLabel

label for Save button next to text; blank for no button

Default value: "Save"


Send a long text query for the user to respond to and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryPassword(question, cbapp, cbtag, cbdata, displayTag, style, prefillAnswer)

const string& question

Text to appear next to the prompt

const string& cbapp

the message channel where the response is to be sent

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""

const string& prefillAnswer

the default answer for the user; in a form, this is the previous value; it will display as stars; it is not transmitted to the user

Default value: ""


Send a query for the user to respond to with a password and specify how to receive response.

If cbapp is specified, then the app's handleInputResponse() will be called where cbtag is used to produce the appropriate callback.

If cbapp is unspecified, then the cbtag is first processed in InputApp::userInputResponse() (post error-checking) which should send a message to the app with the response. Typically the app that sent the query processes the response.  If so, that app receives the response in its handleMessage() message handler, which routes the response to the appropriate callback.  Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

bool queryPassword(question, cbtag, cbdata, displayTag, style, prefillAnswer)

const string& question

Text to appear next to the prompt

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""

const string& style

The formatting style name to assert for this region of the display; if blank, don't change existing style

Default value: ""

const string& prefillAnswer

the default answer for the user; in a form, this is the previous value; it will display as stars; it is not transmitted to the user

Default value: ""


Send a query for the user to respond to with a password and specify how to receive response.

Cbtag is used instead of callback routines to preserve stateless continuity (the app can restart and the callback is still processed correctly.)

Return value: true if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)

static bool setQueryCB(cbfn)

GuiResponseFN cbfn

the callback function pointer


Specify the handleInputResponse() method to use.

MAE sets this up for you, but you may override it with your callback.  This callback tells your app the user's answer to your query.

Return value: true

bool form(formName, formDefaults, cbtag, cbdata, displayTag)

const string& formName

the name of the form from /usr/mae/html/form/

const HashArray& formDefaults

key/value pairs for display area tags and their default values

const string& cbtag

the action to take (message received by app)

const XMLData& cbdata

callback data included in message for app

const string& displayTag

the name of the region for the upload control; if blank, use last setRegion() tag

Default value: ""


A multi-part query - a form.  When the user hits submit, then all the values of the form are sent as a message to the app.

static bool setFormCB(cbfn)

GuiFormResponseFN cbfn

the callback function pointer


Specify the handleInputFormResponse() method to use.

MAE sets this up for you, but you may override it with your callback.  This callback tells your app the user's answer to your query.

Return value: true

static inline bool isQueryCB(messenger, src, dest, request, param)

Messenger& messenger

handle to Messenger service

const string& src

the source channel that sent the message

const string& dest

the destination channel for the message, e.g. storyedit

const string& request

the action/keyword/request for this message

XMLData& param

the data payload for this request


Check if a handleMessage() message is actually a input response that needs to be routed to handleInputResponse(). When true, handleInputResponse() is called implicitly.

Return value: true if it's a user response and handleInputResponse() handled it

Protected Methods

inline void invalidate()

Invalidate the UserDevice instance to make it unusable.

static string cleanTag(tag)

string tag

the region name to clean up


Given a region name (tag), modify it so it doesn't break any downstream use.

Basically, get rid of whitespace and punctuation.

Return value: a clean region name

Private Properties

bool dm

Convenience flags for console and other group-oriented apps

bool pc

Convenience flags for console and other group-oriented apps

DbRecNum user_id

User's id (ties to User table)

DbRecNum pc_id

an alternate id to support the application's use of the UI

DbRecNum setting_id

the context id (application specific)

string appmode

the message channel to service UI requests

string group

used when multiple servers in use (multiple usergw, etc.) to route back to user's server

string region

Target area for display or source area for input from user I/O device

static GuiResponseFN cbfn

Callback for a user UI response

static GuiFormResponseFN formcbfn

Callback for a user form response


Private Methods

bool format(control, on, tag)

const string& control

type of display control, e.g. bold

bool on

true to enable the control, false to disable it

const string& tag

the region name where control is asserted

Default value: ""


Deprecated. Take a control type and mode (on/off) and assert it for a region.

Return value: true if command successfully sent, false it not sent

inline bool imager(request, params)

const string& request

the request keyword

XMLData& params

data to support the keyword


Convenience function to send messages to imager

Return value: true if command successfully sent, false it not sent

bool send(channel, request, params)

const string& channel

destination channel

const string& request

request keyword for destination channel

XMLData& params

data to support request


Send a message to the specified channel (typically the display channel)

Return value: true if message sent

static void inputCB(messenger, src, dest, request, param)

Messenger& messenger

instance of Messenger class handling the message

const string& src

the source channel where the request came from, like input from guibroker

const string& dest

the destination channel, which is likely taskname.UserDevice

const string& request

the request keyword

XMLData& param

data to support the request


The default callback function, called from MAETask class.

This is typically used for handling user UI responses.

bool setUserVariable(variable, value)

const string& variable

the end-user device variable to set; two reserved variables: WID (Setting id) and pc (Player id)

const string& value

the new value of the variable (string)


Set a session-specific variable for this app mode.

bool setUserVariable(variable, value)

const string& variable

the end-user device variable to set; two reserved variables: WID (Setting id) and pc (Player id)

DbRecNum value

the new value of the variable (unsigned long)


Set a session-specific variable for this app mode.

string getUserVariable(variable)

const string& variable

the end-user device variable to set; two reserved variables: WID and pc


Complement to setUserVariable(): pull the current variable value for the app mode specific session. This may be handy for sharing certain state between multiple apps that operator together for an application. Or for one app to remember state between calls.

Return value: the current value (string) of the named variable

DbRecNum getUserVariableInt(variable)

const string& variable

the end-user device variable to set; two reserved variables: WID and pc


Complement to setUserVariable(): pull the current variable value for the app mode specific session. This may be handy for sharing certain state between multiple apps that operator together for an application. Or for one app to remember state between calls.

Return value: the current value (string) of the named variable

static long sectionHash(title)

const string& title

the title to hash


Sections use a hash code, so create it from the setion title.

Return value: the hash value