Python UserDevice
debug_on |
Flag: True if debug output should generated, False if not Default value: 0 |
programName |
The program's name, as known to MAE Default value: 'programName not set' |
dbgf |
The file pointer to the debug file Default value: None |
MAX_OFFSET |
Default value: 26 |
cypher |
Default value: "OriginalSoftwareWrittenInBasicOnCommodore64,PortedToTurboPascal,ThenPortedToC/C++,AndNowOntoLinuxAndMySQL." |
db |
Default value: None |
TEXT_FONT_SIZE |
Default value: 12 |
svgStartTag |
Default value: None |
svgEndTag |
Default value: None |
clientInit |
Default value: None |
clientSupervisorGUI |
Default value: None |
clientOperatorGUI |
Default value: None |
IMAGE_CMDS_PER_BATCH |
About 100 Image commands generates about 13K long message Default value: 100 |
POINT_PRECISION |
Default value: .01 |
PI |
Default value: 3.14159265358979323 |
INVALID_MAGIC_NUMBER |
Default value: -123456 |
CHUNK_SIZE |
When sending raw data, it will be broken down into chunks of this size per message Default value: 4096 |
device |
the end-user's device |
table |
the area with a collection of fields in it |
field |
the specific field within that area |
value |
the string to display |
Update/Replace the table and field entry with the value provided
Return value: true if sent successfully
device |
the end-user's device |
text |
the text to put there |
style |
display style for the text |
Replace the display region with the text provided.
Return value: true if sent successfully
device |
the end-user's device |
text |
the text to append |
style |
display style for the text |
Append to the display reagion with the provided text for the user specified
Return value: true if sent successfully
device |
the end-user's device |
text |
the text to append |
style |
display style for the text |
Append to the display reagion with the provided text for the user specified, followed by a line break.
Return value: true if sent successfully
device |
the end-user's device |
text |
the text to append |
Convert the text from wiki text (see wiki2doc) and display to the display region.
Return value: true if sent successfully
device |
the end-user's device |
text |
the text to append |
action |
the message keyword to send when user clicks on text (aka request) |
cbdata |
data to send along with action message |
style |
the preset way to display the text (color, font, etc) |
Append the tagged area with the provided text for the user specified and make it a hot spot that triggers an action.
Return value: true if sent successfully
device |
the end-user's device |
text |
the hint text to show the user |
Provide hint text to the end-user for the display region. Exact implementation up to the end interface, but it may be to display text when the user hovers over the display region.
Return value: true if sent successfully
device |
the end-user's device |
text |
the text on the button |
action |
the message keyword to send when user clicks on text (aka request) |
cbdata |
data to send along with action message |
Append the tagged area with the provided text on a button for the user on the device specified. When clicked, it triggers a a message with the action and callback data.
device |
the end-user's device |
control |
the UI state keyword to update, e.g. strong, emphasis, bold, italic, underline, color:color |
on |
flag to say turn the control on or off |
DEPRECATED - use style() instead. Update the current display style state.
Return value: true if sent successfully
device |
the end-user's device |
newtag |
the new region's name |
styleName |
the preset way to display the text (color, font, etc) |
size |
the number of characters wide for the new region (suggestion) |
Create a new display region inside device's current display region.
Return value: true if sent successfully
device |
the end-user's device |
styleName |
the new region's name |
Set the named display style for device's current display region. See the configured properties of the style in the appropriate end-user display type (e.g. usergw uses HTML CSS).
Return value: true if sent successfully
device |
the end-user's device |
text |
the text for the user to see |
Display a message to get the user's attention.
Return value: true if sent successfully
device |
the end-user's device |
value |
the value to show on the selector |
When a display region contains a selector, set the active selection to the value provided. If the value is not a valid selection, behavior is undefined.
Return value: true if sent successfully
device |
the end-user's device |
from |
name of user whom the message is from |
text |
the message to display |
Send a chat message to the end-user's device.
Return value: true if sent successfully
device |
the end-user's device |
Clear all displayed objects and text from the current display region of the device.
Return value: true if sent successfully
device |
the end-user's device |
Display the objects and text inside the current display region of the device.
Return value: true if sent successfully
device |
the end-user's device |
Hide the objects and text inside the current display region of the device. Make them non-visible.
Return value: true if sent successfully
device |
the end-user's device |
tableName |
the name of the table |
tableType |
the type of table, e.g. left, center, right |
rows |
the number of rows in the table |
columns |
the number of columns in the table |
Create a table display region on the user'd device. It will be setup with the rows and columns specified. Note that referencing one column more to the right will create that column; and referencing one more row below will create that row.
Return value: true if sent successfully
device |
the end-user's device |
name |
the name of the list |
items |
a count of the expected number of list items (suggestion) |
Create a bulleted list that can contains items. Note that adding a list item immediately beyond the end will expand the list.
Return value: true if sent successfully
device |
the end-user's device |
recordName |
the record template's name (this corresponds to a file under .../html/record) |
idmap |
(optional) mapping of template field names to actual ids to use |
values |
key/value paris of id/values to fill in values in the record |
overwrite |
flag: true to replace existing display region, false to append |
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 sent successfully
device |
the end-user's device |
reportName |
the name of the report to output |
table |
the name of the table to ...? |
table_id |
the id for the table ...? |
FUTURE USE. Output a report of information
Return value: true if sent successfully
device |
the end-user's device |
query |
(optional) the question text for the user |
value |
the default value |
promptType |
the type of prompt, e.g. text, yn, int, etc. |
xid |
a transaction id maintained by the calling app (guibroker) |
style |
the style to use for the query |
Present the user with a question and response (text entry) box. The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).
Return value: true if sent successfully
device |
the end-user's device |
option0 |
The visible question that is the first option on the list - and the default if no value is given. If the user actually selects this option, the app will be given the value $NA |
options |
the list of options to show the user. They key is show; the value is returned as the reply. |
xid |
a transaction id maintained by the calling app (guibroker) |
selected |
the selected option |
Present the user with a selection of choices. The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).
Return value: true if sent successfully
device |
the end-user's device |
query |
(optional) the question text for the user |
value |
the default value |
xid |
a transaction id maintained by the calling app (guibroker) |
style |
the style to use for the query |
Present the user with a selection of choices as checkboxes. The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).
Return value: true if sent successfully
device |
the end-user's device |
text |
the initial text in the box |
xid |
a transaction id maintained by the calling app (guibroker) |
style |
the style to use for the query |
saveLabel |
the label on the button for the user to click on to send the revised text |
Present the user with an area to type a lot of text. The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).
Return value: true if sent successfully
device |
the end-user's device |
formName |
the name of the form (relates to .../html/form files) |
vars |
key/value paris of id/values to fill in default values |
xid |
a transaction id maintained by the calling app (guibroker) |
Present the user with input form template. The xid parameter ties back to the appropriate response action and callback data to use when replying (see GuiAPI).
Return value: true if sent successfully
device |
the end-user's device |
name |
the name of the screen for reference |
rows |
number of rows in the screen |
columns |
the number of columns in the screen |
Create a terminal screen of the specified size on the user's device.
Return value: true if sent successfully
device |
the end-user's device |
attributes |
a comma separated list of styles, e.g. cursor, bold, underline, reverse, red, blue, etc |
Set the current terminal screen attributes for the next character(s) to be written.
Return value: true if sent successfully
device |
the end-user's device |
row |
the terminal row |
column |
the terminal column |
letter |
a numerical value for the letter to write, e.g. ASCII. Note that letters 0-31 are non-printable. |
amount |
the number of letters to write out (repeating letters) |
Write a character to the terminal screen previously defined at device's display region.
Return value: true if sent successfully
device |
the end-user's device |
menu |
the menu heading that contains menu options |
option |
the menu option text |
command |
the request keyword to send to the app |
Configure the end-user's device with the menu option under the specified menu. When the end-user selects it, the specified command will be sent as a message request of the app.
Return value: true if sent successfully
device |
the end-user's device |
menu |
the menu heading that contains menu options |
option |
the menu option text |
Remove the menu option under the specified menu on the end-user's device.
Return value: true if sent successfully
device |
the end-user's device |
windowName |
the name of the window; it appears as the window's title |
Configure the end-user's device with a window, titled with the name provided.
Return value: true if sent successfully
device |
the end-user's device |
windowName |
the name of the window; it appears as the window's title |
Remove/Close the named window from the end-user's device.
Return value: true if sent successfully
device |
the end-user's device |
indexName |
the name of the index; it appears as the index's title |
Configure the end-user's device with the index (tab).
Return value: true if sent successfully
device |
the end-user's device |
indexName |
the name of the index; it appears as the index's title |
Remove the named index from the end-user's device.
Return value: true if sent successfully
device |
the end-user's device |
title |
the section title |
sectionType |
a comma separated list of section qualities, e.g. collabsable, h2, h3 |
newtag |
the tag for the section (must begin with Section_) |
Add a section the the UI. Sections can be manipulated, for example expanded/collapsed.
Return value: true if sent successfully
device |
the end-user's device |
Collapse the section identified as the current display region.
Return value: true if sent successfully
device |
the end-user's device |
Expand the section identified as the current display region.
Return value: true if sent successfully
device |
the end-user's device |
imageName |
the Image's name (see Image class) |
image_type |
the image type, e.g. svg, gif |
action |
(optional) if specified, then image is a hot spot; when the user clicks on it, a message will be send with this action/request keyword |
cbdata |
(optional) if an action was specified, then image is a hot spot; when the user clicks on it, a message will be send with this callback data |
append |
Add the image or replace the contents of the device's current region. Default: false/replace. |
Display the referenced buffered image that has already been transferred to display channel. If an action is provided, the image can be clicked on to trigger the action with its callback data.
Return value: true if sent successfully
device |
the end-user's device |
image_id |
the image id from the ImageLib library |
action |
(optional) if specified, then image is a hot spot; when the user clicks on it, a message will be send with this action/request keyword |
cbdata |
(optional) if an action was specified, then image is a hot spot; when the user clicks on it, a message will be send with this callback data |
append |
Add the image or replace the contents of the device's current region. Default: false/replace. |
Display the referenced buffered image that has already been transferred to display channel. If an action is provided, the image can be clicked on to trigger the action with its callback data.
Return value: true if sent successfully
device |
the end-user's device |
audioName |
the audio sound's name (or HTML tag, e.g. audio_audioName) |
Play the referenced audio sound.
Return value: true if sent successfully
device |
the end-user's device |
query |
the question/prompt to the user |
fileclass |
a comma separated list of file types, e.g. html, pdf, svg, etc. |
xid |
a transaction id maintained by the calling app (guibroker) |
Request that the user send the app a file.
Return value: true if sent successfully
device |
the end-user's device |
imageName |
the Image's name (see Image class) |
image_type |
the image type, e.g. svg, gif |
Send a file to the end-user's device that has already been transferred to display channel.
Return value: true if sent successfully
device |
the end-user's device |
id |
the image's id in ImageLib |
Pre-fetch and image from ImageLib.
Return value: true if sent successfully
device |
the end-user's device |
imageName |
the Image's name (see Image class) |
image_type |
the image type, e.g. svg, gif |
width |
image width, in pixels |
height |
image height, in pixels |
size |
size of image, in bytes |
binary |
flag set to true if data is binary (hex encoded) |
chunk |
chunk #, starting at 0, increasing with subsequent chunks |
totalChunks |
total number of chunks being sent |
chunksize |
size of this chunk of data, in bytes |
data |
the data of this chunk |
Send a chunk of data to the display chennel (to fit within a message max size).
Return value: true if sent successfully
device |
the end-user's device |
variable |
the end-user device variable to set, e.g. wid (tenant id), pc |
value |
the new value of the variable |
Alter a end-user device built-in variable value.
Return value: true if sent successfully
device |
the end-user's device |
variable |
the end-user device variable to set, e.g. wid (tenant id), pc |
value |
(output) the current value of the variable |
Alter a end-user device built-in variable value.
Return value: true if sent successfully
device |
the end-user's device |
appname |
the app to run |
startParams |
the initial parameters for running that app (app-specific); note that any XML sub-objects will not pass through to new process - only key/value property pairs |
Switch the user from running one app to a different app using the provided parameters.
Return value: true if sent successfully
device |
the end-user's device |
Stop running the current application.
Return value: true if sent successfully
userId |
User datastore's id for user |
action |
Action to take on user's account, e.g disable |
value |
Parameter for action, e.g. T, F |
Take an action on a user's account.
Return value: true if sent successfully
appmode |
Name of appmode, likely the app's name. All URL's for //site/appmode/ will trigger a message using action below |
apptype |
type of behavior to remote client: Ux (asynchronous user experience in browser), Direct (synchronous query gets synchronous response), Pipe (streamed data from remote connection is fed to app by line or binary block) |
action |
name of action to send to app when URL connection established |
contentInputType |
the expected input content payload. A HTTP simple form POSTing sends form-data; a REST call may send json or xml. |
contentOutputType |
the default response content payload, e.g. json, xml |
operations |
a list of HTTP operations allowed. "GET,POST" is typical, but a REST interface may also include PUT, DELETE, or PATCH. The value is a comma separted list. |
msgchannel |
specify if other than the default channel for the calling app. |
privatePages |
true if only authenticated users may access, false if public |
Register an app mode with UserGW. This captures all URL activity for URLs that begin with that appmode.
Return value: true if sent successfully
device |
the end-user's device |
statusCode |
disposition status of the connection: 0- Success, 1- Input error, 2- Invalid, 3- Not authorized, 4- Failure (no output |
contentType |
the output content type, likely json or xml. However a major/minor value is allowed (and passes straight through) |
Declare to UserGW that response output is ready to send.
Return value: true if sent successfully
device |
the end-user's device |
text |
the text to send |
isBinary |
true if text is hexadecimal codes for binary data |
Output text to the connection without modifying the text at all. If the text is binary, it is converted from hex codes to binary before transmission.
Return value: true if sent successfully
device |
the end-user's device) |
Append to the display reagion with the provided text for the user specified
Return value: true if sent successfully
request |
|
params |
text: str |
|
offset: int |
Default value: -1 |
Return str value:
text: str |
|
likeOtherText: str |
Return str value:
text: str |
Return bool value:
text: str |
Return str value:
device |
|
question |
|
prefillAnswer |
|
queryType |
|
cbapp |
|
cbtag |
|
cbdata |
|
style |
device |
|
question |
|
choices |
|
cbtag |
|
cbdata |
|
defaultValue |
device |
|
question |
|
origText |
|
cbtag |
|
cbdata |
|
style |
|
saveButtonLabel |
device |
|
question |
|
cbtag |
|
cbdata |
|
defaultValue |
|
style |
device |
|
formName |
|
formDefaults |
|
cbtag |
|
cbdata |
device |
|
appname |
|
appparams |
device |
|
query |
|
cbtag |
|
cbdata |
|
fileclass |
device |
|
menuname |
|
menuoption |
|
action |
device |
|
keystroke |
|
action |
device |
|
region |
|
action |
device |
|
region |
|
otherapp |
error check
device |
|
region |
|
action |
device |
|
cmd |
|
cmdparams |
request |
|
params |
url: str |
Converts a string to a string usable inside HTML code.
The returned pointer should be free()ed by the calling routine.
Return str value:
url: str |
Operations performed:
change % to %25
change = to nothing
change + to %3b
change space to %20
change # to %23
Return str value:
device |
|
iid |
|
errmsg |
|
action |
|
cbdata |
device |
|
filename |
|
filetype |
|
filecontent |
|
xid |
|
category |
image_id |
|
filename |
|
filetype |
|
filecontent |
|
category |
image_id |
image_id |
|
filecontent |
image_id |
|
category |
image_id |
|
name |
image_id |
|
type |
table |
|
id |
request |
|
params |
device |
|
xid |
|
text |
device |
|
text |
device |
|
cmd |
device |
|
key |
device |
device |
|
direction |
|
x |
|
y |
|
action |
|
cbdata |
device |
|
action |
|
cbdata |
device |
|
fileclass |
|
filetype |
|
imagelibid |
|
xid |
device |
device |
|
value |
device |
|
appparams |
device |
device |
request |
|
params |
name |
|
mode |
|
cbtag |
|
cbdata |
ioId |
|
c |
|
ioChannel |
ioId |
|
text |
|
ioChannel |
ioId |
|
data |
|
ioChannel |
ioId |
|
offset |
|
ioChannel |
ioId |
|
exclusive |
|
wait |
|
ioChannel |
ioId |
|
exclusive |
|
wait |
|
ioChannel |
ioId |
|
ioChannel |
node |
|
ioChannel |
dirResourceId |
|
ioChannel |
node |
|
size |
node |
|
change |
|
size |
maepath |
maepathandfilename |
|
statbuf |
request |
|
params |
|
channel |
request |
|
params |
device |
|
key |
|
keycode |
device |
request |
|
params |
notice |
comment |
request |
|
params |
device |
cmd |
|
device |
channel |
|
group |
group |
|
list |
|
status |
channel |
|
group |
group |
|
list |
|
status |
channel |
|
group |
|
variable |
group |
|
variable |
|
value |
|
status |
group |
|
variables |
|
status |
channel |
|
group |
|
variable |
|
value |
device |
|
header |
device |
|
row |
device |
|
channel |
|
topic |
|
param |
device |
|
channel |
|
topic |
|
param |
device |
|
channel |
|
cbtag |
|
param |
|
response |
request |
|
params |
device |
|
name |
|
rows |
|
width |
|
termtype |
device |
device |
|
c |
device |
|
text |
device |
|
y |
|
x |
device |
|
c |
|
module |
device |
|
text |
|
module |
device |
|
termtype |
|
module |
device |
|
termType |
device |
|
mode |
device |
|
mode |
device |
|
mode |
device |
|
mode |
device |
|
newcolor |
device |
|
area |
device |
|
y |
|
amount |
device |
|
y |
|
amount |
device |
|
y |
|
x |
|
amount |
device |
|
y |
|
x |
|
c |
|
amount |
device |
|
y1 |
|
x1 |
|
y2 |
|
x2 |
|
c |
device |
|
y1 |
|
x1 |
|
y2 |
|
x2 |
|
yt |
|
xt |
|
c |
device |
|
direction |
|
amount |
request |
|
params |
|
channel |
request |
|
params |
argv |
rc |
Default value: 0 |
msg |
Default value: |
objType |
the class of the object to cache |
size: int |
the maximum size allowable for the cache Default value: 0 |
Constructor.
Destructor
newKey: int |
|
newOne |
Add a record to the cache. It must be valid().
Return int value:
key |
Remove a record from the cache
Return bool value:
pos: int |
Remove a record from the cache
Return bool value:
searchKey |
|
fetchIfMissing: bool |
Default value: True |
Locate the cache position (-1 if not found)
Note: Pull into cache if fetchIfNotFound is True
Note: key must be a positive (non-zero) number
Return int value:
searchKey: int |
Check if key exists in list
Return bool value:
key |
Get pointer to data for the key. Check if result is valid().
Note: key must be a positive (non-zero) number
pos: int |
position in cache, from 0+ |
This method allows the class instance to be indexed, e.g. HelloCache[2] to get the second element (not key==2)
Return value: the instance at position
Return the size of the cache when using the len() function
This class abstracts database protocols and allows an app to use this interface to perform database table queries and changes.
This class connects to dbbroker, which actually performs the database manipulation. Note that dbbroker can be configured to connect to a variety of databases; this gets rid of app responsibility for database connection and syntax; an app can simply use the database.
It is safe (and convenient) to create an instance of this class for each table your program uses.
If you have an existing database table and you want to create a class interface to it, consider using genmae like this:
genmae db2h tablename > classname.h
genmae py classname.h > classname.py
Likewise, if you create .h file with the core class variables, you can use genmae to create the SQL code to setup the table, like this:
genmae h2sql classname.h > tablename.sql
Note that database manipulation commands will block program execution until a response from dbbroker is received.
FieldType |
Default value: Enum('FieldType', 'FieldInt', 'FieldTime', 'FieldEnum', 'FieldLogical', 'FieldString', 'FieldFloat', 'FieldDate', 'FieldBinary') |
OK |
DB operation was successful (no error) Default value: 0 |
INVALID_NAME |
DB operation failed - invalid name given Default value: -1 |
OPEN |
DB operation failed - cannot open table Default value: -2 |
INVALID_TYPE |
DB operation failed - invalid field type Default value: -3 |
INVALID_FIELD |
DB operation failed - invalid field name Default value: -4 |
INVALID_REC |
DB operation failed - invalid record id Default value: -5 |
INVALID_ENUM |
DB operation failed - invalid enum Default value: -6 |
INVALID_PARAM |
DB operation failed - invalid parameter Default value: -7 |
LOCKED |
DB operation failed - record locked Default value: -8 |
NOT_SUPPORTED |
DB operation failed - operation not supported Default value: -9 |
FAILED |
DB operation failed - (non-specific) Default value: -10 |
REC_NOT_FOUND |
DB operation failed - record not found Default value: -11 |
ALREADY_EXISTS |
DB operation failed - record already exists Default value: -12 |
INVALID_SCHEMA |
DB operation failed - invalid schema Default value: -13 |
COMM_ERROR |
DB operation failed - communications error Default value: -14 |
CORRUPT_REPLY |
DB operation failed - reply was corrupt (cannot parse) Default value: -15 |
INVALID_CONN |
DB operation failed - invalid connection Default value: -16 |
INVALID_EXPR |
DB operation failed - invalid expression Default value: -17 |
LINEPAYLOADMAX |
Maximum line length to send to dbbroker Default value: 10000 - 100 |
PAYLOADMAX |
Default value: 10000 |
tableName: str |
Default value: |
Constructor to initialize our data structure. This does not yet setup the connection to dbbroker.
Determine status of our connection to database - is it valid?
Return int value: True if connected to db
Get the status of the last request
Return int value: the status of the last request (see codes at top of Datastore.py)
Determine if the status of the last operator was successful.
Return bool value: True if last operation successful, False otherwise.
Determine if the database connection is established and ready.
Return bool value: True if db connection ready
Return human readable status of last request.
Return str value: msg corresponding to last DB request
name: str |
fieldtype |
Return str value:
rcToGetMsgFor: int |
the return code number to look up Default value: 1 |
Get the status message of the specified return code.
Return str value: the text of the error message
tableName: str |
the name of the table to use as the current table. If not successful, check status() for the code or statusMsg() for human readable description. |
Set the currently active table by opening it.
Return int value: the status code of the operation.
tableName: str |
the name of the table to use as the current table. If not successful, check status() for the code or statusMsg() for human readable description. |
Identifical to open(). Set the currently active table by opening it.
Return int value: the status code of the operation.
Check to make sure the database connection is working.
Return bool value: True if db responding to our requests
Pack the database (remove deleted records), if the database supports this.
Otherwise, it is ignored.
Return bool value: True upon success, False upon failure (see statusMsg())
specifiedTable: str |
Signal to close this database table.
@param table name of the table to close; if none, then last table used
Return bool value: True upon success, False upon failure (see statusMsg())
Get the list of defined tables.
Return value: the list of tables in the database
fieldName: str |
name of field for operation |
type |
type of field (string, int, float) |
size: int |
(optional) size of field in bytes |
table: str |
name of table for operation Default value: |
isIndex: bool |
True if this field is an index for the table Default value: False |
Obsolete. Add a field to the named database table.
Return 0 value: field id of new field
fieldName: str |
name of the field for which to get the fieldid |
table: str |
name of table for operation Default value: |
Query field id from field name for the named table.
Return int value: nonzero on success, 0 on failure
fieldName: str |
id of the enum field |
enumName: str |
name/identifier for enum |
enumId: int |
(optional) integer value to use for enum |
table: str |
name of table for operation Default value: |
Obsolete. Add field enumeration to the nanmed table.
Return int value: new enum value
fieldName: str |
id of the enum field |
table: str |
name of table for operation Default value: |
Query a field type (string, float, etc) for the provided field name in the provided table.
Return value: the field type
data |
any data to pre-populate the record |
recno: int |
(optional) id for the record Default value: 0 |
table: str |
name of table for operation Default value: |
Add/Append a new record to the table provided, populated with the data provided.
Return value: new record number added
recno |
number of the record to delete |
table: str |
name of table for operation Default value: |
Delete a record in the named table.
Return bool value: transaction status (see statusMsg())
recno |
number of the record to lock |
table: str |
name of table for operation Default value: |
Lock a record in the named table; prevent other applications from modifying this record until it is unlocked.
Return bool value: transaction status (see statusMsg())
recno |
number of the record to unlock |
table: str |
name of table for operation Default value: |
Unlock a record in the named table, allowing other applications to now modify it.
Return bool value: transaction status (see statusMsg())
recno |
number of the record containing the field |
fieldName: str |
name of the field to clear |
table: str |
name of table for operation Default value: |
clear/empty the value for the field with this field name
Return bool value: transaction status (see statusMsg())
recno |
number of the record in which to set the value |
fieldName: str |
|
value |
the value to set |
table: str |
name of table for operation Default value: |
change a string value identified by field ID
@param field name of the field in which to set the value
Return bool value: transaction status (see statusMsg())
recno |
number of the record in which to set the value |
newValues |
|
table: str |
name of table for operation Default value: |
change several field values at once
@param newValue key/value pairs for new field/value changes
Return bool value: transaction status (see statusMsg())
recno |
number of the record containing the value |
fieldName: str |
name of the field to get |
table: str |
name of table for operation Default value: |
get an int field value identified by field name
Return int value: the int value or -1 if unsuccessful
recno |
number of the record containing the value |
fieldName: str |
name of the field to get |
table: str |
name of table for operation Default value: |
get a string field value identified by field name
Return str value: the string value or zero length string if unsuccessful
recno |
number of the record containing the value |
fieldName: str |
name of the field to get |
table: str |
name of table for operation Default value: |
get a float field value identified by field name
Return float value: the float value or ??? if unsuccessful
recno |
number of the record containing the value |
fieldName: str |
name of the field to get |
table: str |
name of table for operation Default value: |
get an enum value identified by field name
Return str value: the enum value or zero length string if unsuccessful
recno |
number of the record containing the value |
fields |
Default value: [] |
table: str |
name of table for operation Default value: |
get an int field value identified by field name
@param fieldName name of the field to get
Return value: key/value pairs of field/value values from record. Error if empty, check status()/statusMsg().
recno |
number of the record containing the value |
fieldName: str |
name of the field to get |
table: str |
name of table for operation Default value: |
get an enum value as an int identified by field name
Return int value: the enum value or zero length string if unsuccessful
fieldName: str |
name of field to search |
value: str |
enum value to search for |
sortby: str |
Default value: |
table: str |
name of table for operation Default value: |
simple query for enum value by field name
Return list value: list of record numbers matching criteria
fieldName: str |
Name of field to search, paired with the value; alternatively fieldName can be an XMLData object with key/value pairs to search for (if so, value is ignored) |
value: str |
string value to search for Default value: |
sortby: str |
Default value: |
table: str |
name of table for operation Default value: |
simple query for string value by field name
Return list value: list of record numbers matching criteria
criteria |
|
ANDed: bool |
Default value: True |
sortby: str |
Default value: |
table: str |
name of table for operation Default value: |
compound query for a field value
@param list list of field key/value pairs to be searched for
Return list value: list of record numbers matching criteria
expression: str |
using field names, comparison operators, and logic operators, specify which records match the query |
fields: list |
a list of fields to return Default value: 'Id' |
sortby: str |
field name to use to sort the results start with + (default) for ascending sort, - for descending sort Default value: |
table: str |
name of table for operation Default value: |
Using an expression, query records and return the requested fields, sorted if specified.
@param results - (output) a list of records and their fields that matched
Return bool value: True upon success
sortby: str |
Default value: |
table: str |
Default value: |
query for all records in the named (or current) table
Return list value: recList with results which will be empty if unsuccessful
table: str |
the name of the table to query for fields Default value: |
query for all field names and types
Return value: XMLData which will be empty if unsuccessful. Otherwise key is field name, value is field type.
table: str |
the name of the table to query for fields
Default value: |
query for all field names and types
Connect to database server.
In actuality, this only checks to make sure we're connected to the MAE daemon, commhub.
Return bool value: True on success; False on failure
cmd: str |
|
params |
Default value: None |
Send a command for dbbroker that has no parameters. And wait for the reply.
Return bool value: True on success; False on failure
params |
Send data to commhub for DB operation
Return bool value: True if sent; False if failed
Wait for a dbbroker response from commhub.
Return bool value: True if reply received; False if not
text: str |
the text to encode |
commhub wants a comment to have new \n characters, so encode them
text: str |
the text to unencode |
commhub didn't let dbbroker send any \n characters, so unencode them
Super class: dict
This class behaves a lot like the dict class, but with more control over the value types.
Note that all keys are strings.
The HashArray data type is a key-value container.
It is typeless, but a specific type can be asserted (e.g. setBool()) or retrieved (e.g. getBool(), getInt(), etc). It is up the the application to store/retrieve by type consistently.
This data type is very convenient for messaging. Calling the toString() method converts the HashArray into a string. Using the fromString() method or constructor converts it back.
value: str |
Default value: |
separator: str |
Default value: '\n' |
Constructor
other |
Set the properties of the other HashArray into this HashArray, replacing any previous values
Return the number of key-value pairs.
Return int value: # keys in hash array
Determine if there are no key-value pairs in the hash array.
Return bool value: True if there are no key-value pairs, False if there's at least one
key: str |
name of the key to set |
value |
value to set to key |
Assign a value into the dict
key: str |
name of the key to set |
value: bool |
value to set to key |
Assign a boolean value to a key.
key: str |
name of the key to unset |
Remove a key/value pair from the dict
key: str |
name of the key to unset |
Get a string value from the dict key
Return str value:
key: str |
name of the key to unset |
Get a integer value from the dict key
Return int value:
key: str |
name of the key to unset |
Get a floating point value from the dict key
Return float value:
key: str |
name of the key to unset |
Get a double precision floating point value from the dict key. Same as getFloat().
Return float value:
key: str |
name of the key to unset |
Get a boolean value from the dict key
Return bool value:
separator: str |
text that separates each key/value pair. Default value: '\n' |
Serialize the HashArray into a string.
text: str |
a text string to examine |
Examine the text string provided and determine if it's a HashArray or not.
Return bool value: True if text string is a serialized HashArray, False otherwise
text: str |
the text string to decode |
separatorCharacter: str |
the text that separated key/value pairs Default value: '\n' |
Take a text string that was generated by toString() and restore the data inside HashArray.
Return bool value: True if text could be fully decoded.
This class holds a reference to and then ultimately delivers the binary content of an image in the Image Library (the ImageLib table). This class holds the image id, name, category, image type, height and width of the image.
id |
name: str |
|
category: str |
data |
data |
forDB: bool |
id |
Return bool value:
Return str value:
data: str |
Return bool value:
Return int value:
id |
Return str value:
id |
|
height: int |
|
width: int |
Return bool value:
id |
Return str value:
name: str |
|
category: str |
This class represents images within the MAE system.
Images may be drawn by the app or pulled from ImageLib database table.
Drawn images draw into a coordinate system with the size (height, width) and origin specified by the application. For example, to create an image with a coordinate system that is 5 units wide and 4 units tall with the origin(0,0) in the center, you specify setSize(5, 4) and setOrigin(-2.5,-2). How large the image is when it is displayed depends upon the unit size. If you'd like your 5 unit wide image to be 50 pixes wide, then specify setSize(5, 4, 10).
To display an image to the user, see the UserDevice class.
Use this class to communicate with imager, which renders them appropriately for the user.
This data structure abstracts a vector image. The API is used to describe the image. It is not rendered into JPG, PNG, SVG, or other specific image technology until it is ready to be rendered to the end-user. Rendering is performed by the imager daemon.
The API could be richer, but the API must be able to render to each of the ultimate image types.
The Image class may refer to an existing image file in a specific format via ImageLib class, which specifies where to retrieve the image and the image's size.
setSize(double newWidth, double newHeight, int newUnitSize)
Set the canvas dimensions and specify how many pixes per unit. For example, a 4.0x5.0 image where unit size is 10 would create a 40x50 pixel image.
setOrigin(double newOriginX, double newOriginY)
Specify how many units over the origin should be located if (0,0) is the lower left
setWindow(double minX, double minY, double maxX, double maxY, int newUnitSize)
Specify the width and origin implicitly by specifying the window into the view. Use this instead of setSize() setOrigin()
drawBox([[#Point]] corner1, Point corner2, string color, bool fill, string link)
Draw a rectangle with the corners specified. Default color is black. The box may be an outline or solid/fiilled.
An optional link (e.g. URL) may be provided if resulting image supports linking.
drawLine([[#Point]] p1, Point p2, string color, string link)
Draw a line from p1 to p2 of the color specified.
An optional link (e.g. URL) may be provided if resulting image supports linking.
drawCircle([[#Point]] center, double radius, string color, bool fill, string link)
Draw a full circle with the specified center and radius. The default color is black. The circle may be an outline or solid/fiilled.
An optional link (e.g. URL) may be provided if resulting image supports linking.
drawText([[#Point]] start, string text, string color, string link)
Draw text into the image with the lower left corner of the text at the start point.
bool drawArc([[#Point]] center, double startang, double endang, double radius, string color, bool fill)
drawPolygon([[#Point]]List p, string color, bool fill, string link)
Given a series of points, draw the enclosed polygon. The default color is black. The polygon may be an outline or solid/fiilled.
An optional link (e.g. URL) may be provided if resulting image supports linking.
drawPolyline([[#Point]]List p, string color, string link)
Given a series of points, the the line that connects them from start to end. The default color is black.
An optional link (e.g. URL) may be provided if resulting image supports linking.
group_id: int |
this is an application-specific number to differentiate this image name from others; it is used to help create a unique image name for the user's display device Default value: 0 |
imageName: str |
this is the application-specific name given to the image Default value: |
module: str |
this is the application-specific category for the image, such as the application's name Default value: |
Construct an empty image.
Query if the current image is valid.
Return bool value: True if valid; False if invalid
Super class: MAE
This class builds on top of the MAE class. It ensures MAE knows that your MAE task is an app and supports it appropriately. An app is a persistent program servicing user requests via UI.
programName: str |
the name of the task as registered inside MAE |
appchannels: str |
a comma separated list of message channels used. Default is one channel using the program's name. Default value: |
Declare your app MAE instance of this task.
Super class: Socket
This class handles the communication layer between a MAE daemon/app and CommHub.
The challenge that this class faces is that CommHub communicates asynchronously with its client daemons/app, so an app may have sent a DB request (for example) and while wating for the DB response, it may receive some messages, an RPC request, or control message (perhaps initiated by the user). So, this class has to remember those messages and then process them after the DB response arrives.
Internally, MAEConn discerns these logical communication categories:
dbPrefix |
Default value: "Db" |
msgPrefix |
Default value: "Msg" |
rpcPrefix |
Default value: "Rpc" |
commhub |
Default value: [] |
db |
Default value: [] |
msg |
Default value: [] |
rpc |
Default value: [] |
tapf |
Default value: None |
COMMHUB_LINE_NOFMT |
CommHub line protocol characters Default value: 0 |
COMMHUB_LINE_TEXT |
Default value: ' ' |
COMMHUB_LINE_CHUNK |
Default value: '=' |
COMMHUB_LINE_BINARY |
Default value: 'x' |
COMMHUB_LINE_SUCCESS |
Default value: '+' |
COMMHUB_LINE_FAILURE |
Default value: '-' |
host: str |
The hostname to connect to (if empty, then localhost) Default value: |
port: int |
The remote TCP port to connect to Default value: 0 |
Prepare for a TCP socket connection
Return value: instance of Socket to open(). If FALSE, check errno().
text: str |
Send text to commhub
Any \n will be converted to text (and later back)
Return bool value:
Read any inbound text.
Use its callback (if defined) to process the inbound text.
Return int value: socket status (-1 EOF) - messages ready to be ready (with no callback)
wait: bool |
block until we have input from commhub Default value: False |
rcLineOnly: bool |
wait until we get a response line (starts with + or -) and return that; other lines are queued Default value: False |
Wait for text from commhub.
Read text up to a newline.
Return str value: the string read. If empty, check errno().
wait: bool |
Default value: False |
lockoutCallbacks: bool |
Default value: False |
Wait for DB response.
Read DB response text up to a newline.
Return str value: the string read. If empty, check errno().
wait: bool |
Set to True to wait until there's valid input, False if just checking quickly Default value: False |
queueOk: bool |
Set to True if it's OK to pull queued/pending messages (this is normal/default) Default value: True |
Wait for text message.
Read a Message text up to a newline.
Return str value: the string read. If empty, check errno().
wait: bool |
Set to True to wait until there's valid input, False if just checking quickly Default value: False |
lockoutCallbacks: bool |
Set to prevent other requests from being serviced while waiting Default value: False |
queueOk: bool |
Set to True if it's OK to pull queued/pending messages (this is normal/default) Default value: True |
Wait for text message.
Read an RPC text up to a newline.
Return str value: the string read. If empty, check errno().
Return True if commhub command queue has a command ready to be processed
Return bool value: True if there's 1+ backlog commands
Return True if DB command queue has a command ready to be processed
Return bool value: True if there's 1+ backlog commands
Return True if msgbroker message command queue has a command ready to be processed
Return bool value: True if there's 1+ backlog commands
Return True if RPC command queue has a command ready to be processed
Return bool value: True if there's 1+ backlog commands
Get size of msg backlog queue
Return int value: size of the queue
Get size of db backlog queue
Return int value: size of the queue
Get size of rpc backlog queue
Return int value: size of the queue
cb |
callback function Default value: None |
data |
callback data Default value: None |
Setup the commhub callback
cb |
callback function Default value: None |
data |
callback data Default value: None |
Setup the DB callback
cb |
callback function Default value: None |
data |
callback data Default value: None |
Setup the msgbroker message callback
cb |
callback function Default value: None |
data |
callback data Default value: None |
Setup the RPC request callback
cb |
callback function Default value: None |
data |
callback data Default value: None |
Setup the RPC response callback
Get the msgbroker message callback method
Return value: the msgbroker message callback method
wait: bool |
Default value: False |
lockoutCallbacks: bool |
Default value: False |
Read text up to a newline.
Return bool value: True if something read
line: str |
the line from commhub to process |
lockoutCallbacks: bool |
True if no callbacks should be called to immediately handle a message Default value: False |
Put line into right queue or send to callback (if not locked out/blocked)
of lines received
Return int value:
includingCommHub: bool |
Default value: True |
If any callbacks are configured and data is pending, service them.
Return bool value:
prefix: str |
the new prefix |
If a different DB prefix is needed, configure new prefix here
prefix: str |
the new prefix |
If a different msgbroker message prefix is needed, configure new prefix here
prefix: str |
the new prefix |
If a different RPC prefix is needed, configure new prefix here
send: bool |
True is message is outbound, False if message is inbound |
text: str |
the message |
Save a message out to tap file
tap |
Default value: None |
Useful for monitoring all socket communication - a socket tap
will record all read/write activity (set to NULL to disable)
Use msgplayer to replay messages for testing/debugging.
Query the tap's file pointer
Determine if tap is active
Return bool value:
Super class: MAE
This class builds on top of the MAE class. It ensures MAE knows that your MAE task is an app and supports it appropriately. A daemon is a persistent program providing support to other MAE tasks.
programName: str |
the name of the task as registered inside MAE |
appchannels: str |
a comma separated list of message channels used. Default is one channel using the program's name. Default value: |
Declare your daemon MAE instance of this task.
Super class: MAETask
This class is the starting point of the MAE platform. Create a single instance for MAE to operate correctly in your main source file. More than likely, you'll instead declare a sub-class - MAEApp, MAEDaemon, or MAEUtility - which is tailored to your tasks's purpose.
tasktype |
The type of task: app/daemon/utility Default value: 'daemon' |
instance |
The task instance (0 is base) Default value: 0 |
channellist |
The channels used for communicating Default value: [] |
tdir |
Path MAE support files Default value: '/usr/mae' |
forkit |
Flag: should we fork() when we run? Default value: False |
module: str |
the name of the module where the app runs (used for callbacks) |
name: str |
the name of the task as registered inside MAE |
channels: str |
a comma separated list of message channels used. Default is one channel using the program's name. Default value: |
Constructor for integration with MAE.
name: str |
Set the MAE task name (with an instance, if non-0). This is the name used to communicate with commhub. The name is often the same as the program's filesystem name, but it is not required to be so.
Get our MAE task name, including instance if non-0.
Return str value: the MAE task name
Query the instance of this task
Return int value: the instance of the task/app; note that 0 is for the base app
Declare this task as a daemon - a persistent program providing support to other MAE tasks.
Declare this task as an app - a persistent program servicing user requests via UI.
Declare this task as a utility - a one-shot program that performs a task and exits.
Query if the current task behaves like a daemon.
Return bool value: True if the task is a daemon (because setDaemon() was called), False otherwise.
Query if the current task behaves like an app.
Return bool value: True if the task is a daemon (because setApp() was called), False otherwise.
Query if the current task behaves like a utility.
Return bool value: True if the task is a daemon (because setUtility() was called), False otherwise.
MAE calls this when the task environment is setup to let task initialize itself. The Python application needs to define this.
MAE calls this once this task's environment is fully initialized.
This is where your task performs its main functionality.
The Python application needs to define this.
rc |
the program's exit code (0 means normal exit, 1+ means err exit) Default value: 0 |
msg |
an explanation why the app is shutting down Default value: |
Either the user or the ecosystem has initiated a task exit. The Python application needs to define this.
message: str |
the message to write to log file |
Output a log message to the debug-only log file - if debug mode is on. When debug mode is off, the message is ignored. The log file is /usr/mae/log/<appname>dbg.log
This is handy to do just before a program crash to ensure all debug messages have been written to the debug log file. This methods makes sure no messages are in-memory in a buffer, but written to the file.
Toggle the debug mode for the program.
Ensures debug.dbgf is pointing to a valid log file, e.g. /usr/mae/log/<taskname>dbg.log
Future feature.
MAETask is the class used to communicate with CommHub. It sends status and MAE platform commands (such as messages, RPC calls, database queries, global parameter queries). And it handles the responses and commands from CommHub.
COMMHUB_PORT |
Default value: 4847 |
CACHEMAX |
Default value: 20000 |
TDIR |
Default value: '/usr/mae' |
MAECommand |
Default value: Enum('MAECommand', ['TaskSuspend', |
messenger |
Default value: None |
The constructor
By default, task is not a daemon
By default, task is not managed
An app calls this when the task immediately starts.
This moves the task into 'Initializing' state
If managed and commhub can't run, this will cause exit(227)
Return bool value: Flag: True if connected to CommHub, False if failed to connect
text: str |
the message to log |
Log any messages here (commhub logs them)
message: str |
the message to write to log file |
Output a log message to the debug-only log file - if debug mode is on. When debug mode is off, the message is ignored. The log file is /usr/mae/log/<appname>dbg.log
This is handy to do just before a program crash to ensure all debug messages have been written to the debug log file. This methods makes sure no messages are in-memory in a buffer, but written to the file.
This is a file descriptor for select() so the task can monitor for control communication.
Return int value: OS file descriptor of connection to CommHub
Return True when CommHub is using this class (commhub/MAETask.h returns True)
Return bool value: False for all tasks/apps except commhub.
ok: bool |
Default value: True |
The daemon app calls this if your daemon is suspendable
if it is not, it will never receive the TaskSuspend command
Ask if we're currently suspended.
Return bool value: True if current setting is that the task/app can be suspended
forcePid: int |
the OS process id of the task Default value: 0 |
An app calls this after fork()ing to notify CommHub of its new pid.
msg: str |
a status message, e.g. 'Ready' |
The app calls this when the task has finished initializing or to simply report updated run status.
msg: str |
a status message, e.g. 'Lost connection to ServiceNow' |
The app calls this when the task realizes it is performing suboptimally.
msg: str |
a status message, e.g. 'Unable to connect to port tcp/80' |
The app calls this when the task has failed and cannot continue
msg: str |
a status message, e.g. 'Complete' |
Call this when the task has completed successfully
cbfn |
static method or function to call, e.g. void exitNow(int n) |
Setup callback when CommHub sends Quit.
Default action: call exit(0).
cbfn |
static method or function to call, e.g. void suspendNow(int n) |
Setup callback when CommHub sends Suspend.
Default action: call ignored
cbfn |
static method or function to call, e.g. void resumeNow(int n) |
Setup callback when CommHub sends Resume.
Default action: call ignored
cbfn |
static method or function to call, e.g. void toggleDebug(int n) |
Setup callback when commhub sends Debug.
Default action: toggle debug_on
Detach from parent process
forever: bool |
if True, process() never returns if False, process() returns immediately, possibly after processing a command Default value: True |
justone: bool |
if True, process() exits after processing just one message Default value: False |
Handle events from commhub (perhaps forever) until quit sent. Gets all events or just one event.
commhubHost: str |
Default value: |
Connect via TCP to CommHub, the control daemon.
Return bool value: Flag: True upon success False upon failure
startIfNoAnswer: bool |
Flag: True if we should launch commhub when it's not running Default value: False |
hostname: str |
the IP host where CommHub is running Default value: |
Connect to commhub (and start it if we can't connect.
Return bool value: Flag: True upon success False upon failure
name: str |
name of task to start |
Start the named daemon
Return bool value: tuple of (success (True/False), status of task after started)
name: str |
name of task to start |
instanceId: int |
instance for task to start, e.g. 1+ |
Return str value: tuple of (success (True/False), status of task after started)
name: str |
the name of the daemon, possibly with instance apended, e.g. maeterm.1 |
Request that CommHub stop the named daemon instance.
Return bool value: Flag: tuple of (success (True/False), status of task after started)
name: str |
the name of the daemon, possibly with instance apended, e.g. maeterm.1 |
Request that CommHub suspend the named daemon instance.
Return bool value: tuple of (success (True/False), status of task after started)
name: str |
the name of the daemon, possibly with instance apended, e.g. maeterm.1 |
Request that CommHub resume the named daemon instance.
Return bool value: tuple of (success (True/False), status of task after started)
name: str |
the name of the daemon, possibly with instance apended, e.g. maeterm.1 |
Get the named daemon's status
Return bool value: tuple of (success (True/False), status of task after started). Status information in the format: <name> <pid> <cluster> <state> <msg>
name: str |
name of task to query |
Get the list of instances for the named daemon
Return bool value: tuple of (success (True/False), list of instances running)
status: str |
(output) text output with a table of connections |
Get CommHub communication statistics.
Return bool value: tuple of (success (True/False), status of task after started)
node: str |
name of the node to query, e.g. root |
status: str |
Get a list of connected CommHub spokes.
Return bool value: tuple of (success (True/False), list of spokes)
status: str |
Get daemon status details
Return str value:
status: str |
Return int value: the task's pid
status: str |
Return str value:
status: str |
Return str value:
status: str |
Return str value:
name: str |
the name of the daemon, possibly with instance apended, e.g. maeterm.1 |
msg: str |
(output) additional information about the request |
level: int |
Level 0 is off level -1 means toggle on/off level 1-4 are various increased debug levels. Default value: -1 |
Request to change the debug mode of the named daemon.
Return bool value: tuple of (Flag: True upon success or False upon failure, status message)
name: str |
the name of the daemon, possibly with instance apended, e.g. maeterm.1 |
msg: str |
(output) additional information about the request |
Request to tap into the CommHub messages of the named daemon.
Return bool value: tuple of (Flag: True upon success or False upon failure, status message)
name: str |
the name of the daemon |
msg: str |
(output) additional information about the request |
Tell commhub a new task exists
Return bool value: tuple of (Flag: True upon success or False upon failure, status message)
name: str |
the name of the daemon |
msg: str |
(output) additional information about the request |
Tell commhub an old task is deleted
Return bool value: tuple of (Flag: True upon success or False upon failure, status message)
The big STOP button - stop commhub and everything else
Return bool value: tuple of (Flag: True upon success or False upon failure, status message)
cmd: str |
the command/request to send it must not include any newline characters |
General method to send a command/request to CommHub.
@Return tuple with two values:
Flag: True if command return code is True, False otherwise return the response from commhub (minus the lead char)
Response from command
Return bool value:
daemon: bool |
Flag: True if we are a daemon False if we a one-shot program |
quitIfNoAnswer: bool |
Flag: if True, then force program to exit if False, let program keep running Default value: True |
Our first message to CommHub: Declare our identity.
Return bool value: Flag: True if connected to CommHub and CommHub allows our connection
wait: bool |
Flag: wait for something from CommHub (or return immediately) Default value: False |
Call this routine to get a CommHub (single keyword) control command from the MAETask.socket.
Return MAECommand value: the command code received, e.g. TaskExit, TaskNop, etc.
Get control command arguments
Return str value: the command arguments
newname: str |
the new task name |
If you want to change the name of this task, use this method
newInstance: int |
a number representing the task's instance Default value: 0 |
Set the instance id for this task (default is 0).
Query the name of this task.
Return str value: the name of the task/app
Query the instance of this task
Return int value: the instance of the task/app; note that 0 is for the base app
Query if the current task is an instance (versus the base task:
Return bool value: True if the current task is an instance, False if base task
taskname: str |
Default value: |
Query the task's name without its instance id.
Return str value: the base task name
appid: str |
the id / message channel. |
Set the app id / messenge channel. Set this before calling init().
Query the app id / message channel in use.
Return str value: the id / message channel
newtype: str |
the new application type |
FUTURE USE. To change the application type of this task, use this method
msg: str |
|
state: str |
|
extra: str |
Default value: |
Set the current status into the database.
Return str value:
isManaged: bool |
Configure if this task is managed. (Default: no:
A managed task has status in taskdb
isDaemon: bool |
Configure if this task is a daemon. (Default: no:
A daemon talks to the task manager.
@param isDameon -
Query if this task is a daemon that runs until told to stop.
Return bool value:
name: str |
Configure if this task is part of a cluster. (Default: no:
A cluster member is a thread inside a VM
parameterName: str |
|
taskname: str |
Default value: |
Query a system value for this task (not from data store)
In general, you should need to use this
Return str value:
parameterName: str |
|
parameterValue: str |
|
taskname: str |
Default value: |
Set a system value for this task (not from data store)
In general, you should need to use this
Return bool value:
rc: int |
Default value: 0 |
msg: str |
Default value: |
Quit the service
Suspend the service
Resume the service
_unused: int |
Default value: 0 |
Toggle message tapping mode
Get the directory with Configuration files
Return str value: conf directory
Get the directory with log files
Return str value: log directory
triggerTime: int |
the future time when the timer goes off |
cbfn |
the method to call when the timer goes off |
data |
callback data to provide to the timer |
triggerLabel: str |
the unique name of the timer (useful for tracking timers) |
Setup a one-time timer event for a specific time point in the future.
Return bool value: True if timer successfully setup
delay: int |
the number of seconds in the future the timer should go off |
cbfn |
the method to call when the timer goes off |
data |
callback data to provide to the timer |
triggerLabel: str |
the unique name of the timer (useful for tracking timers) |
Setup a one-time timer event after a delay of specified seconds.
Return bool value: True if timer successfully setup
seconds: int |
the number of seconds between repeating timer triggers |
cbfn |
the method to call when the timer goes off |
data |
callback data to provide to the timer |
triggerLabel: str |
the unique name of the timer (useful for tracking timers) |
Setup a time to trigger every so many seconds.
Return bool value: True if timer successfully setup
Query if a timer has been triggered.
Return bool value: True if a timer has been triggered and not serviced yet
Service all outstanding timers
Return int value: the number of timers serviced
Get the list of future times in a dict.
The key is the triggerLabel, the value is the number of seconds to go before it triggers.
Return dict value: a dict with each trigger's time till it goes off
Super class: MAE
This class builds on top of the MAE class. It ensures MAE knows that your MAE task is an utility and supports it appropriately. A utility is a one-shot program that performs a task and exits.
programName: str |
the name of the task as registered inside MAE |
Declare your utility MAE instance of this task.
Class to handle MAE (one-way) messages between MAE apps.
Messages are routed by MsgBroker.
This class works in conjunction with the MAETask class, which maintains the connection to CommHub, which is required to reach the MsgBroker daemon.
The MAE class class sets up message channels for your app and code generated by genmae uses this class to send messages.
list |
Default value: [] |
Constructor. Connects to app MAETask class instance.
By default, sent messages will be sent on the task's first registered channel.
Desctructor. Disconnects from app MAETask class instance.
Close all open channels.
channel: str |
the Messenger channel to find. |
Get Messenger instance of channel
Return value: the instance Messenger registered to the named channel
Get list of all channels open for listening
Return value: a list of all registered channels
channel: str |
the unique channel name for listening (this is is registered with MsgBroker) |
persist: bool |
True if MsgBroker should queue up messages to this channel even when the channel is off-line |
cbfn |
specify the message handler that will process the messages, typically handleMessage() |
MAE calls this for your app; your app should not call it.
Start listening to a channel.
(Only listen to one channel per instance of Messenger)
Return bool value:
dest: str |
the name of the channel to send this message to |
request: str |
the message type or name of the request being sent (a keyword) |
data |
the data/payload of the message. You should make sure it is compatbile with the app that is receiving the request to make sure they key-value pairs in the payload can be processed by the receiving app |
Send a message
Return bool value: True if message sent
dest: str |
the name of the channel to send this message to |
errorMessage: str |
the message to send to the destination channel |
Send an error back to the calling app
Return bool value: True if message sent
Close the current channel.
Return bool value:
Close a persistent channel. MsgBroker will stop queuing messages for this channel.
Return bool value:
sock |
the socket for communication with commhub |
intext: str |
Master callback handler for inbound messages
@param text - the message to handle
@param data - callback data
channel: str |
newChannel: str |
the new channel to use |
Set the channel name
Get the channel name
Return str value: the channel name
category: str |
|
newParam: str |
|
fixedValue: str |
These variables have fixed values
Return bool value:
category: str |
|
newParam: str |
|
getFunction |
These variables are provided by function call because they're involved
Return bool value:
category: str |
|
newParam: str |
|
setFunction |
Declare the variables that can be changed (after calling respective addGet*()
Return bool value:
category: str |
|
qparam: str |
locate the parameter
Return str value:
category: str |
|
qparam: str |
|
get: bool |
locate the parameter
Return bool value:
category: str |
|
setparam: str |
|
value |
locate the parameter
Return bool value:
get: bool |
Return list value:
get: bool |
|
category: str |
cmdparam: dict |
Return bool value:
Return str value:
Report another inbound message request
Report another inbound broadcast message request
Report another inbound user response
Report an inbound message that was erroneous
Report an inbound user response that could not be processed
This is used as a cache to construct an image being received.
Constructor.
Get the image's id
Return str value: the image's id
See also: Image
Prepare to receive a new image; reset any previous image out
msgr |
instance of Messenger
|
src: str |
|
iid: int |
|
image_id: str |
|
param |
Message handling method to receive image fragement messages.
Constructor to send an image through MAE messaging system.
Get the size of the Image cache.
Return int value: the cache size
max_size: int |
maximum images to receive simultaneously |
Set the cache size for the number of images to receive simultaneously
request: str |
the message request coming in
|
param |
|
msgr |
|
src: str |
Check if the inbound message request/command is intended for us. If it is, process it.
Return bool value:
lib_id |
Fetch an image from ImageLib, queue it for sending, and return its image id.
Return str value: the image id
image_id: str |
the image id to pull from the cache
|
deleteAfterGet: bool |
Get the received image with the provided image_id.
image_id: str |
the image id to pull from the cache
|
Get the received image with the provided image_id.
destination: str |
MAE channel to send the image to
|
request: str |
|
params |
|
image |
|
errmsg: str |
|
group: str |
Send the provided image to the destination.
Return bool value:
This class is handy for representing a point in 3-D space. It's just as handy for representing just a point in 2-D space, too.
It holds the (x,y,z) value so a variety of methods can operate on it or between it and other points.
p |
Default value: None |
invalid |
Default value: None |
pt: str |
Default value: None |
Construct a point from the inputs.
if the inupt is text, it takes the form of (<number>,<number>) or (<number>,<number>,<number>) as produced by toString(). y and z are ignored.
If the input is a Point, it is copied. y and z are ignored.
If the input is a float, then all three inputs are taken as the Point's (x,y,z) values.
@param text - the string to convert to a point
Get the x coordinate value
Return float value: x
Get the y coordinate value
Return float value: y
Get the z coordinate value
Return float value: z
value: float |
the new x value |
Set the x coordinate value
Return value: an instance of this point
value: float |
the new y value |
Set the y coordinate value
Return value: an instance of this point
value: float |
the new z value |
Set the z coordinate value
Return value: an instance of this point
newX: float |
the new x value |
newY: float |
the new y value |
newZ: float |
the new z value Default value: 0.0 |
Set the (x,y,z) coordinates for this point
Return value: an instance of this point
Set the (x,y,z) coordinates for this point from another point
@param p - the point to copy (x,y,z) from
Return value: an instance of this point
Translate/Shift this point by the Point given. The (x,y,z) of the new Point is added to this Point.
@param p - the Point with the amount to shift
Return value: an instance of this point
dx: float |
the amount to add to this->x |
dy: float |
the amount to add to this->y |
Translate/Shift the point by the (dx,dy) given. The (dx,dy) is added to this Point.
Return value: an instance of this point
dx: float |
the amount to add to this->x |
dy: float |
the amount to add to this->y |
dz: float |
Translate/Shift the point by the (dx,dy,dz) given. The (dx,dy,dz) is added to this Point.
Return value: an instance of this point
radius: float |
amount to move |
theta: float |
direction to move, in radians |
Adjust/translate point relative to old using polar coordinates given.
Return value: an instance of this point
Given a point, return the translated point.
@param p - the Point with the amount to translate
Return value: the translated point
Reverse-shift thie point by the amount in the Point provided. The (x,y,z) of the new Point is subtracted from this Point to form a new point.
@param p - the Point with the amount to subtract
Return value: the offset Point
Calculate the distance from this Point to the Point provided
@param p - the other Point
Return float value: the distance between the points
Calculate the distance on the XZ plane from this Point to the Point provided, ignoring any y-axis difference.
@param p - the other Point
Return float value: the distance between the points
Calculate the distance on the XY plane from this Point to the Point provided, ignoring any z-axis difference.
@param p - the other Point
Return float value: the distance between the points
Determine the difference between the x values of the two points
@param p - the other Point
Return float value: the difference in x
Determine the difference between the y values of the two points
@param p - the other Point
Return float value: the difference in y
Determine the difference between the z values of the two points
@param p - the other Point
Return float value: the difference in z
The absolute (positive) distance between the x values of the two points.
@param p - the other Point
Return float value: the absolute distance in x (0 or positive)
The absolute (positive) distance between the y values of the two points.
@param p - the other Point
Return float value: the absolute distance in y (0 or positive)
The absolute (positive) distance between the z values of the two points.
@param p - the other Point
Return float value: the absolute distance in z (0 or positive)
precision: float |
the precision to use |
Adjust point to align with precision
Return the point at the origin.
Return value: a Point at the origin
Test if the point is valid
Return bool value: True if point is valid (not invalid)
Test if the point is at the origin.
Return bool value: True if this Point is at the origin
Return an invalid point. That is, this point returns True when passed to isInvalid().
Return value: the invalid point
Test if the point is invalid
Return bool value: True if point is invalid
Test if the point is invalid
Return float value: True if point is invalid
Calculate phi, the aizmuth angle to p, where current point is focus. Useful for creating 3-D polar coordinates.
@param p - the other Point
Return float value: the angle
Calculate phi, angle to p, where current point is focus, on the XY plane.
@param p - the other Point
Return float value: the angle, phi
Return float value:
Calcualted angle to p, if current point is focus, on the ZY plane.
@param p - the other Point
Return float value: the angle
Calculate phi, angle to p, where current point is focus, on the XY plane.
@param p - the other Point
Return float value: the angle, phi
tolerance: float |
the precision to use Default value: POINT_PRECISION |
Determine if this (x,y,z) point and the provided (x,y,z) point are the same, within a precision tolerance
@param p - the other Point
Return bool value: True if both points are the same, within tolerance
tolerance: float |
the precision to use Default value: POINT_PRECISION |
Determine if this (x,y) point and the provided (x,y) point are the same, within a precision tolerance
@param p - the other Point
Return bool value: True if both points are the same, within tolerance
Determine if this point is equal to the provided point. This is not best practice for comparing values; instead use same().
@param p - the other Point
Return bool value: True if both points are equal
tolerance: float |
the precision to use Default value: POINT_PRECISION |
Determine if this point and the provided point lie in the same x-y plane (same z value) within the tolerance provided.
@param p - the other Point
Return bool value: True if both points have the same z value within tolerance
theta: float |
amount to rotate |
focus |
point to rotate around |
Rotate the point clockwise around focus
theta: float |
amount to rotate |
focus |
point to rotate around |
Rotate the point clockwise around focus
theta: float |
amount to rotate |
focus |
point to rotate around |
Rotate the point counter-clockwise around focus
theta: float |
amount to rotate |
focus |
point to rotate around |
Rotate the point counter-clockwise around focus
accuracy |
the accuracy to use |
Round the Point to the accuracy
Return value: the Point, rounded
fraction: float |
the fraction of the way from this Point to other Point to calculate Default value: .5 |
Determine a midpoint a certain fraction of the way from this point to p
If fraction not specified, then half-way point returned
@param p - the other Point
Add two points together and return the new point
@param a - the other Point
Return value: the new point
Subtract the provided Point from this Point
@param a - the other Point (on the right)
Return value: the updated Point
Subtract the provided Point from this Point
@param a - the other Point (on the left)
Return value: the updated Point
Scale this point out by the amount provided from the origin.
@param a - the amount to scale the point
Return value: the updated Point
pts |
a list of Points (is modified) |
focus |
a Point of focus for rotation and scale |
angle: float |
the amount to rotate each p[] around the focus |
scale: float |
the amount to scale each p[] from the focus |
Given a list of Points, rotate and scale them around a focus Point.
@param n - the number of Points in array
pt |
the Point (is modified) |
focus |
a Point of focus for rotation and scale |
angle: float |
the amount to rotate pt around the focus |
scale: float |
the amount to scale pt from the focus |
Given a Point, rotate and scale it around a focus Point.
Return value: the morphed Point
text: str |
Convert text in the form of (x,y) or (x,y,z) or x,y or x,y,z into a Point
Convert the Point to a text string.
Return str value: a text representation of the point
pts |
Default value: [] |
Create a PointList from an array of Points
@param list - an array of Points
@param size - the size of the array
text: str |
Convert a string that was output by toString() back into a PointList
Convert the PointList into a string.
Return str value: a string
Class to handle MAE (two-way) messages between MAE apps.
Synchronous messages are managed by RpcBroker.
This class works in conjunction with the MAETask class, which maintains the connection to CommHub, which is required to reach the RpcBroker daemon.
Caution about using remote services: A calling app suspends execution until the response comes back. If the daemon handling the service makes a service call to the app (or perhaps indirectly through a third daemon), you'll have a deadlock condition, causing a timeout.
To register to receive and process these messages, the registering daemon creates an instance of RemoteService; as long as that instance exists, the daemon will be registered to receive the requests; when the instance is destroyed, the daemon will no longer receive requests to process the service.
list |
Default value: [] |
service: str |
the unique (within MAE) name of the service to register (a keyword) |
cbfn |
the method to handle all requests for this service |
cbdata |
any data to accompany the method call |
timeout: int |
number of seconds to allow for a response before issuing a timeout to the calling app |
Setup/Register a new remote service
Destructor for the service. The app will no longer recognize and process the service setup by the constructor.
text: str |
the message to send |
Prepare a message to be sent through commhub
Return str value: encoded text that is compatible for transmission
text: str |
the message that was sent |
Process a message sent from commhub to restore it to the original request.
Return str value: decoded text that is restored and ready for processing
service: str |
the name of the service requested |
params |
the input paramters to that service |
Call a remote service with the provided service name and parameters. This is synchronous SOA. If the service has been registered with RpcBroker, then the registered daemon will process the request and send back a response. Otherwise, an error is returned.
Return value: the response from that service (status, return data); if an error occured, result["rpc_error"] holds the error message. The response comes directly from the registered daemin, with these additional XML fields:
Same as service |
rpc_request_id RpcBroker id for the transaction |
rpc_app_id Id of the registered daemon that serviced that request |
sock |
the socket for communication with commhub |
text: str |
the message to handle |
data |
callback data Default value: None |
Master callback handler for inbound RPC responses
result |
a structure that will be passed back as a result |
error: str |
the error message to insert into the structure |
Set error message into response
Return value: updqated result
Get the name of this remote service.
Return str value: the name of the service.
result |
the value returned by call() |
Get the error message after a call
Return str value: a string that is the error message
This class abstracts a socket connection to another process via TCP, UDP, Unix domain socket, etc., providing a higher level interface that is easier for an application to manage.
limit |
Default value: 100 |
host: str |
The hostname to socket.connect to (if empty, then localhost) Default value: |
port: int |
The remote TCP port to socket.connect to Default value: 0 |
Prepare for a TCP socket socket.connection
Return value: instance of Socket to open()
host: str |
The hostname to connect to (if empty, then localhost) Default value: |
port: int |
The remote TCP port to connect to Default value: 0 |
Open a TCP socket connection
Return bool value: True if connected, False otherwise
Finish using (close) a socket socket.connection.
Close the TCP socket.connection
Return bool value: True if closed, False otherwise
Determine if socket is open/active
Return bool value: True if socket is closed
Determine if the socket socket.connection has hit EOF
Return bool value: True if EOF detected
Get the file descriptor (for select() of socket)
Return int value: file descriptor
Get the last known error state after a Socket method is called
Return int value: the value of errno after the last I/O call
seconds: int |
Default value: 0 |
useconds: int |
Default value: 0 |
exitOnInterrupt: bool |
Default value: False |
return True if sleep lasted whole time, False if sleep was interrupted
Return bool value:
wait: bool |
True if this routine should wait until it's ready Default value: False |
Determine if socket is ready to be read (it has input)
@return -1 on error (EOF), 1 if ready, 0 if not ready
Return int value: 1 if data ready to be read, 0 if it's not ready, -1 on error or EOF
wait: bool |
Default value: False |
Determine if socket is ready to be written
Return int value: 1 if data ready to be written, 0 if not ready (or EOF), -1 see errno
Check if an alarm signal was received during I/O
Return bool value: True if an alarm signal was signal.raised
Clear the flag that a signal was signal.raised
locked: bool |
Signal is locked when being serviced
text: str |
The text scring to write |
Write out the specified bytes to the socket
Return int value: the number of bytes successfully written
Write out a single character to socket
@param c the character to write
Return int value: the number of characters successfully written (1 or 0)
wait: bool |
True if this routine should wait until there's a response Default value: True |
ignoreSignal: bool |
True if signals should not be serviced Default value: False |
Read text up to a newline.
Return str value: the string read. If empty, check self.getErrno().
nodelay: bool |
Disable buffering on socket.
Return bool value: True if operation successful, False otherwise
This class is handy for timing things, like with a stopwatch. It measures the amount of time between the start() call and the stop() call at the microsecond level.
startImmediately: bool |
Flag: True to start the stopwatch immediately, False to wait Default value: True |
Instantiate the stopwatch. By default, it starts starts immediately.
Start or restart the stopwatch. Time elapsed will be counted from this point.
Return bool value: True if the stopwatch was reset, False if the stopwatch was not previously running
Restart the stopwatch to count time from this point.
Return bool value: True if the stopwatch was reset, False if the stopwatch was not previously running
Stop the stopwatch. Elapsed time will no longer be counted.
Return bool value: True if it was stopped False if it was already stopped
Return the amount of time (in seconds) for the elapsed time
If the stopwatch is running, calling this method does not change its run status
Return float value: seconds of elapsed time
Return the time (in epoch/unix time) in seconds when the stopwatch began
Return float value: the time (in epoch/unix time) when the stopwatch began, accurate to microsecond
Calculate the elapsed time and put it in the this.value
This class provides conversion, parsing and other useful additions for string manipulation. Member functions defined in this class should be all static. These functions were wrapped by this class for organization purposes.
whitespaceChars |
Default value: " \t\r\n\f" |
input: str |
the text string to split apart |
delimiter: str |
the text separator |
Tokenize a string using the char parameter as a delimiter, and put each sub string into a vector of strings.
Return value: the vector of strings
textlist |
a series of strings to combine |
delimiter: str |
the delimiter to insert between the strings |
Combine an array of strings and insert delimiters between them.
This is the complement of split().
Return value: a single string
input: str |
the string to analyze |
separator: int |
the character that separates the tokens |
How many tokens are in this string?
Return int value: the count of the number of tokens; if the string is blank, 0 is returned
input: str |
the text string to split apart |
delimiter: str |
the text separator |
pos: int |
the token to return, e.g. 0+. If it doesn't exist, null string returned |
honorEscape: bool |
if True and separator is preceded by \, then it's not a separator; note that the \ is removed from the result Default value: False |
Tokenize a string using split() and then return the nth token at pos.
Return str value: the nth token from input string; or null string
strToStrip: str |
the string to be stripped (in place) |
charsToStrip: str |
contains all chars to be stripped |
Strip specified chars from beginning of string
Return str value: ref to string passed in, now stripped
strToStrip: str |
the string to be stripped (in place) |
Strip whitespace from beginning of string
Return str value: ref to string passed in, now stripped
strToStrip: str |
the string to be stripped (in place) |
charsToStrip: str |
contains all chars to be stripped |
Strip specified chars from end of string
Return str value: ref to string passed in, now stripped
strToStrip: str |
the string to be stripped (in place) |
Strip whitespace from end of string
Return str value: ref to string passed in, now stripped
strToStrip: str |
the string to be stripped (in place) |
charsToStrip: str |
contains all chars to be stripped |
Strip specified chars from beginning and end of string
Return str value: ref to string passed in, now stripped
strToStrip: str |
the string to be stripped (in place) |
Strip whitespace from beginning and end of string
Return str value: ref to string passed in, now stripped
input: str |
the long string |
start: str |
the text to match at start |
Check if input tring starts with text that matches
Return bool value: T/F if input string starts with /start/ string
input: str |
the long string |
ending: str |
the text to match at start |
Check if input tring ends with text that matches
Return bool value: T/F if input string starts with /start/ string
text: str |
|
length: int |
the number of characters to remove from the front |
Remove characters from beginning of input string.
@param input input string being reduced
Return str value: the input string minus strlen(token) off the front
text: str |
|
length: int |
the number of characters to remove from the end |
Remove characters from end of input string.
@param input input string being reduced
Return str value: the input string minus strlen(token) off the end
text: str |
|
token: str |
the token string being removed from input string |
trimWhite: bool |
flag to remove whitespace after removed token Default value: True |
Remove token from beginning of input string.
Note, no matching is performed to see if token really begins
the string or not. This is simply a convenience for length counting.
@param input input string being reduced
Return str value: the input string minus strlen(token) off the front
input: str |
input string being reduced |
token: str |
the token string being removed from input st |
trimWhite: bool |
Default value: True |
Remove token from nextQuotedToken() from beginning of input string.
Note, no matching is performed to see if token really begins
the string or not. This is simply a convenience for length counting.
A check is performed, however, to see if input string has quotes; if so,
2 extra characters are trimmed in addition to token.
Return str value:
input: str |
input string being reduced |
textToTrim: str |
the token string being removed from input string |
Remove leading text from input string if text present, otherwise
leave input string alone.
Return str value: the input string minus textToTrim off the front
input: str |
input string being reduced |
textToTrim: str |
the token string being removed from input string |
Remove trailing text from input string if text present, otherwise
leave input string alone.
Return str value: the input string minus textToTrim off the front
text: str |
Get first/next token (up to whitespace) in input string
Use trimToken() to remove the token; token not removed from input.
@param input the string being parsed
Return str value: the first token in the string.
text: str |
|
trimWhite: bool |
Default value: True |
Returns a tuple - (text, token) - with the modified text plus the extracted token
input: str |
the string being parsed |
allowClass: bool |
flag to allow classname:: to precede identifier; if True, class name and identifier are returned Default value: False |
Get first/next identifier in input string. An identifier starts with an alphabetic character (or _) and is optionally followed by more characters, which may be alphanumeric or _.
Use trimToken() to remove the token; token not removed from input.
Return str value: the first identifier in the string.
input: str |
the string being parsed and token removed (in place) |
trimWhite: bool |
flag to remove whitespace after removed identifer |
allowClass: bool |
flag to allow classname:: to precede identifier; if True, class name and identifier are returned Default value: False |
Extract and return first/next identifier in input string.
Convenience over using nextIdentifier() and trimToken().
Return value: the first identifier in the string.
input: str |
the string being parsed |
removeQuotes: bool |
Default value: True |
Get first/next token in input string that may be quote contained.
No quotes means just call nextToken(). Quotes may be " or '.
Quotes inside quoted string must be escaped.
Use trimToken() to remove the token; token not removed from input.
Return str value: the first token in the string.
input: str |
the string being parsed and token removed (in place) |
removeQuotes: bool |
specify whether to remove the quotes from result Default value: True |
Extract and return first/next quoted string in input string
Convenience over using nextQuotedToken() and trimToken(). Quotes may be " or '.
Quotes inside quoted string must be escaped.
Return value: the first token in the string.
input: str |
Convert a string into an integer as best as possible; default is 0
Return int value:
input: str |
Convert a string into an float as best as possible; default is 0.0
Return float value:
value: str |
Get a boolean value from the input
Return bool value:
input: str |
string to be modified |
findThis: str |
the substring to search for in input |
replaceWith: str |
the substring to replace findThis with |
startNdx: int |
the index into input at which to begin searching Default value: 0 |
maxReplacements: int |
the max number of replacements to perform, 0 means replace all Default value: 0 |
Replace occurences of a specified substring within a string with another string
Return value: reference to input string, now potentially modified
stringToEscape: str |
string with \n |
Escape any newline characters.
This converts the new line character to the two characters "".
And converts the two characters "" to "\".
And converts the three characters "\" to "\\". Etc.
Return str value: the string with \n's removed and escaped
stringToUnescape: str |
escaped string |
Unescape any newline characters.
This converts the two characters "" to the new line character.
And converts the three characters "\" to "".
And converts the four characters "\\" to "\". Etc.
Return str value: the string with \n's escaped
Super class: list
A class to manage an ordered list of strings. This is not a set; a string may appear on the list multiple times.
Note: by default, a string must not contain a comma to leverage this class's full functionality. A different separator character can be used if commas are needed in the strings.
text: str |
|
separator: int |
Constructor. Create a StringList from a vector of string
@param list - a vector of strings to convert
separator: str |
the separator token Default value: ' |
Serialize the string list.
Return str value: a string with the ordered list of strings in it
text: str |
a serialized list of strings, which may optionally be enclosed in double quotes |
separator: str |
the character that separates the strings Default value: ' |
Reload the string list from the serialized string list in text.
element: str |
the new string to add |
Add a new string to the list.
Return bool value: True if element is not empty
element: str |
a string to check |
Determine if a specific string is in the list. A literal comparison
is performed, case sensitive.
Return bool value: True if element is already in the list (literal)
element: str |
a string to check |
Determine if a specific string is in the list. A literal comparison
is performed, case sensitive.
Return bool value: True if element is already in the list (literal)
element: str |
a string to check |
Locate the position of a string in the string list.
Return int value: the position, 0+ or -1 on error
element: str |
Remove a single string or a list of strings from the list.
@param other_list - the list of string to remove
Return bool value: True if string at least one string was found and removed
oldtext: str |
the string to locate |
newtext: str |
the replacement string |
all: bool |
if True, check whole list (don't stop at first match) |
Replace a string in the list with a new string.
Return bool value: True if at least one string was found and replaced
Alphabetically sort the list of strings.
Return value: the instance back
Class to manage multiple timers, whether one-shot or periodic.
Unlike the Unix timer, this class provides app-provided callback data when each timer trigters.
This class is useful when you have multiple timed activities that need to happen at various times. When the time comes, the callback function is called.
It's also useful for event-driven programming where execution hangs off a select() statement.
Note: Only use one instance of this class. It claims the alarm() signal. If you use multiple instances, only the last instance invoked will be handled.
TIMER_END_OF_TIME |
A special number to represent the end of time Default value: 999999 |
secondsTillEndOfTime |
A special number to represent how many seconds till the end of time Default value: 999999 |
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.
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. |
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
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.
cbfn |
Callback to call for UI events Default value: None |
formcbfn |
Callback to handle a submitted form Default value: None |
Determine if this is a valid UserDevice session or not.
Manipulating an invalid session is pointless.
Return bool value: True if this UserDevice is a valid session
user_id |
the database record id in the User table of the user on this device. Alternately, if this is text, it is taken as a previously serialized instance of UserDevice and unserialized (and rest of params are ignored) Default value: 0 |
pc_id: int |
a secondary database record id of this user Default value: 0 |
setting_id: int |
a context id of this user, e.g. group id, company id, project id, etc. Default value: 0 |
appmode: str |
the channel of the primary app responsible for managing interaction with this user Default value: |
region: str |
the named region where the last user interaction happened Default value: |
group: str |
name of server group handling this user's session Default value: |
Constructor for structure to manage user interactions.
text: str |
Unserialize a serialized instance of UserDevice.
Example strings:
dm:/1/0/3/console
pc:/1/3/3/console
pc:/3/3/3/console#E3
pc:/3/3/3/console/attn/E3
pc:/3/3/console/attn
Syntax: dm|pc :/<userid>/<wid>/<app>[/<region>]
Serialize the UserDevice class into a string so it can be communicated
to another MAE app. See:ructor that takes a lone string.
Return str value: a string representation of UserDevice
Make a copy of ourself
Get the relevant user's DB table User id for this session.
Return int value: the user's record id, 0 for public or invalid session
If the User id is 0, it may be a public (non authorized) session.
If so, the ConnectionId will be non-zero.
Return int value: the unqiue connection id (only valid if User id is 0)
The Arana app doubles the connection id with the PC id.
Return int value: the database table PC id of content being displayed
The Arana app maintains a game session, which is the database
table Setting id.
Return int value: the game Setting id
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 str value: the application mode
When scaling MAE deployments, we track which group of servers is
handling this user's session.
Return str value: the server group name
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 str value: the region name
Determine if this is an elevated privilege session.
Return bool value: True if session is elevated in privilege
Determine if this is not an elevated privilege session.
Return bool value: True if session is not elevated in privilege
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 bool value: True if session is public
Determine if this is an authorized session where a person has
authenticated and we know who the user is.
Return bool value: True if this is an authorized session
newId: int |
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
newId: int |
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
newId: int |
a valid PC table id |
For the Arana 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
newId: int |
a valid Setting table id |
For the Arana 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
newMode: str |
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
newGroup: str |
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
newRegion: str |
the name of new target region (aka display tag); size limited to 100 chars |
Specify the target display region that successive plans are
controlling/displaying output to.
Return value: this UserDevice instance back
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
yes: bool |
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
yes: bool |
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
variable: str |
the end-user device variable to set; two reserved variables: WID (Setting id) and pc (Player id) |
value: str |
the new value of the variable |
Set a session-specific variable for this app mode.
Return bool value:
variable: str |
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 str value: the current value (string) of the named variable
variable: str |
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 (int) of the named variable
newSettingId: int |
the new id the user should use Default value: 0 |
Change the active tenant id (in Arana app, the setting id) on the user's device. Going forward, user responses will designate the new tenant id.
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device)
newPlayerId: int |
the new id the user should use Default value: 0 |
Change the active display context for the user. (In Arana app, this is the player id on the user's device.) Going forward, user responses will designate the new player id in UserDevice.
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device)
table: str |
|
field: str |
the name of the field in the group to update |
value: str |
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.
@param group - the name for the group of fields
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
value: str |
|
tag: str |
the name of the region to update Default value: |
style: str |
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).
@param text - the new plain text
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
text: str |
the text to add to the display region |
tag: str |
the name of the region to update; if blank, use last setRegion() tag Default value: |
style: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
text: str |
the text to add to the display region Default value: |
tag: str |
the name of the region to update; if blank, use last setRegion() tag Default value: |
style: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
text: str |
wiki formatted text |
tag: str |
the name of the region to update; if blank, use last setRegion() tag Default value: |
Add formatted text using simple wiki formatting.
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
text: str |
the text to display to the user |
action: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
tag: str |
Default value: |
style: str |
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.py, but
it may also be cmd:..., click:..., key:...; see guibroker:ioConsole.py
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
text: str |
the label for the button |
action: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
tag: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
styleName: str |
configured in /usr/mae/html/ (in css file) |
tag: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
text: str |
Send a message to the attention! box to call it out to the user.
param text - The message to display.
return True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
Return bool value:
recordName: str |
template file from /usr/mae/html/record/ |
values: HashArray |
key/value pairs to assert into the record |
tag: str |
the name of the region to update; if blank, use last setRegion() tag Default value: |
overwrite: bool |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
recordName: str |
template file from /usr/mae/html/record/ |
idmap: HashArray |
key/value pairs for mapping the keys of values to the keys in the record (key/value is: values key / recordName id) |
values: HashArray |
key/value pairs to assert into the record |
tag: str |
the name of the region to update; if blank, use last setRegion() tag Default value: |
overwrite: bool |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
value: str |
a valid selector option of the tag'ed selector |
tag: str |
the name of the region to update; if blank, use last setRegion() tag Default value: |
Set the selection value for a selector.
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
fromuser: str |
the name of the sender of the message |
text: str |
the text of the message |
Send a chat message to a PC (if PC=0, then from DM).
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
reportName: str |
|
table: str |
the group name / table name |
table_id |
table record id of data to display |
tag: str |
the name of the region to update; if blank, use last setRegion() tag Default value: |
Future feature (not implemented). Output a report of information
@param report - the name of the report to use
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
tag: str |
the name of the new region |
styleName: str |
configured in /usr/mae/html/ (as css file) Default value: |
size: int |
(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)
tag: str |
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)
tag: str |
the name of the region to update; if blank, use last setRegion() tag Default value: |
Show/unhide a tagged region or display block
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
tag: str |
the name of the region to update; if blank, use last setRegion() tag Default value: |
Hide a tagged region or display block
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
menu: str |
Name of menu |
option: str |
Text of option under menu name |
action: str |
message to send to app when menu selected |
Enable a menu option; your app gets a message (action) when option selected by user.
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
menu: str |
Name of menu |
option: str |
Text of option under menu name; if none, then all options disabled Default value: |
Disable a menu option
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
windowName: str |
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)
windowName: str |
the name of the window to unset; if none, then all Default value: |
Disable a window option
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
indexName: str |
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)
indexName: str |
the name of the index to unset; if none, then all Default value: |
Disable a index option
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
name: str |
the unique name for the table (used by setTable()) |
tableType: str |
is for future use Default value: |
rows: int |
number of rows, if known Default value: 1 |
columns: int |
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
name: str |
the name of the table |
Reference an existing table, return the device handle for the table
Return value: the device handle for the table
row: int |
The row number (starting at 1) |
column: int |
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
title: str |
title to display for this section |
sectionType: str |
An example type is 'h3,collapsable', which styles the name has h3 and adds interface compontent to expand/collapse the section |
tag: str |
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
title: str |
title to display for this section |
tag: str |
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
Display a collapsable section as collapsed
Return value: the device handle for the section
Display a collapsable section as expanded
Return value: the device handle for the sectio
title: str |
title to display for this section |
tag: str |
region name in which the section was placed Default value: |
Remove a section
Return value: the device handle for the section
name: str |
the unique list name |
items: int |
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
item_no: int |
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
imageName: str |
the name/keyword of the image |
module: str |
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
image |
an image created by newImage() |
tag: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
image |
the image to display to the user |
action: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
tag: str |
the name of the region to update; if blank, use last setRegion() tag |
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.py, but
it may also be cmd:..., click:..., key:...; see guibroker:ioConsole.py
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
text: str |
the help/hint text for user |
tag: str |
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.
Return bool value:
imageName: str |
the name/keyword of the image |
image_type: str |
type of image, e.g. png, jpg, gif |
width: int |
width of image in pixels |
height: int |
heigh of image in pixels |
size: int |
size of image in bytes |
data |
the raw image |
binary: bool |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
image_id |
image's id in Image Library |
action: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
tag: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
audioName: str |
the audio sound's name (or HTML tag, e.g. audio_audioName) |
Play the referenced audio sound.
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
imageName: str |
the base name of the suggested filename |
image_type: str |
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
Return bool value:
query: str |
the prompt for the user |
cbtag: str |
|
cbdata |
callback data included in message for app |
fileclass: list |
Default value: [] |
tag: str |
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.
@param action - the action to take (message received by app)
@param types - a list of file types that may be received
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
query: str |
the prompt for the user |
action: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
tag: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to display channel (usergw)
menuname: str |
Name of menu |
submenuname: str |
Text of option under menu name; if none, then all options disabled |
action: str |
message to send to app when menu selected |
appmode: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
keystroke: str |
a key may be 'a' or 'ctrl-a' or 'alt-a' etc. |
action: str |
message to send to app when keystroke typed |
appmode: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
region: str |
a display region name |
action: str |
message to send to app when clicked upon |
appmode: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
region: str |
a display region name |
otherapp: str |
the channel of where to send the click |
appmode: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
region: str |
a display region name |
action: str |
message to send to app when clicked upon |
appmode: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
cmd: str |
the action/request to permit |
cbdata |
the parameters to send with the command Default value: XMLData() |
appmode: str |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
appname: str |
the new app to switch to (appmode) |
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)p
url: str |
a website URL on the Internet |
Pull up a webpage from another site
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
question: str |
Text to appear next to the prompt |
prefillAnswer: str |
the default answer for the user; in a form, this is the previous value |
queryType: str |
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 |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
the name of the region for the upload control; if blank, use last setRegion() tag Default value: |
style: str |
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.
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
question: str |
Text to appear next to the prompt |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
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.
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
question: str |
Text to appear next to the prompt |
dieRoll |
the dice range, e.g. Dice('2d4+2') |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
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.
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
question: str |
Text to appear next to the prompt |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
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).
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
question: str |
Text to appear next to the prompt |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
the name of the region for the upload control; if blank, use last setRegion() tag Default value: |
prefillAnswer: int |
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.
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
question: str |
Text to appear next to the prompt |
choices |
a list or key/value pairs are the selection choices; the keys are displayed; the appropriate value is returned as response |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
the name of the region for the upload control; if blank, use last setRegion() tag Default value: |
defaultValue: str |
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.
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
question: str |
Text to appear next to the prompt |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
the name of the region for the upload control; if blank, use last setRegion() tag Default value: |
defaultValue: bool |
the default answer (value) for the user, True or False Default value: False |
style: str |
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.
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
question: str |
Text to appear next to the prompt |
origText: str |
the default answer (value) for the user, True or False |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
the name of the region for the upload control; if blank, use last setRegion() tag Default value: |
style: str |
The formatting style name to assert for this region of the display; if blank, don't change existing style Default value: |
saveButtonLabel: str |
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.
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
question: str |
Text to appear next to the prompt |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
the name of the region for the upload control; if blank, use last setRegion() tag Default value: |
style: str |
The formatting style name to assert for this region of the display; if blank, don't change existing style Default value: |
prefillAnswer: str |
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.
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 bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
formName: str |
the name of the form from /usr/mae/html/form/ |
formDefaults |
key/value pairs for display area tags and their default values |
cbtag: str |
the action to take (message received by app) |
cbdata |
callback data included in message for app |
displayTag: str |
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.
Note that all the formDefault values will be merged into the cbdata hash array. Don't use the same keys!
Return bool value: True if message successfully transmitted (not a guarantee of delivery to end user device) to gui channel (guibroker)
newcbfn |
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.
@param cbfn - the callback function pointer
Return bool value: True
newcbfn |
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.
@param cbfn - the callback function pointer
Return bool value: True
messenger |
handle to Messenger service |
src: str |
the source channel that sent the message |
dest: str |
the destination channel for the message, e.g. storyedit |
request: str |
the action/keyword/request for this message |
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 bool value: True if it's a user response and handleInputResponse() handled it
Invalidate the UserDevice instance to make it unusable.
tag: str |
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 str value: a clean region name