Python MgmtClient
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 |
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 |
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