Class MgmtClient

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

Summary
Public Methods
MgmtClient(channel)
inline void setChannel(newChannel)
inline string getChannel() const
bool addGetParameter(category, newParam, fixedValue)
bool addGetParameter(category, newParam, intRef)
bool addGetParameter(category, newParam, intRef)
bool addGetParameter(category, newParam, longRef)
bool addGetParameter(category, newParam, floatRef)
bool addGetParameter(category, newParam, stringRef)
bool addGetParameter(category, newParam, getFunction)
bool addSetParameter(category, newParam, setFunction)
void supervisorGUI(device, newParam)
void operatorGUI(device, newParam)
void handleInputResponse(device, cbtag, cbdata, response)
bool handleMesssage(newParam)
string getParameter(category, param)
bool setParameter(category, param, value)
inline void incrementInboundRequestCount()
inline void incrementInboundBroadcastCount()
inline void incrementInputCount()
inline void incrementInboundErrorCount()
inline void incrementInputErrorCount()
void noteRequestResponseTime(delta)
Private Properties
Private Methods
void init(channel)
void ensureInit()
void initIntrinsics()
bool parameterExists(category, qparam, get)
StringSet getCategories(get)
StringSet getNames(get, category)
static string uptime()

#include <MgmtClient.h >

Summary

The Supervisor app monitors all the running programs and provides a user interface to allow an admin to view detailed app state.  But it can only see what the app shares.  Use this class to declare what supervisor can view and change.

You will need to provide callbacks to MgmtClient can call into your app to get and set data. And you'll need to declare the variables available for supervisor to see.

Public Methods

MgmtClient(channel)

const string& channel

name of the channel to use (if not primary task channel)

Default value: ""


Constructor.

inline void setChannel(newChannel)

const string& newChannel

the new channel to use


Set the channel name

inline string getChannel() const

Get the channel name

Return value: the channel name

bool addGetParameter(category, newParam, fixedValue)

const string& category

the variable category (app defines its categories)

const string& newParam

parameter name (app defines parameter names)

string fixedValue

the value of the parameter


Declare a variable with a stable value that can be queried by supervisor using get.

Return value: true upon success, false upon error

bool addGetParameter(category, newParam, intRef)

const string& category

the variable category (app defines its categories)

const string& newParam

parameter name (app defines parameter names)

int* intRef

a pointer the the variable


Declare an int variable with a dynamic value that can be queried by supervisor using get.

Return value: true upon success, false upon error

bool addGetParameter(category, newParam, intRef)

const string& category

the variable category (app defines its categories)

const string& newParam

parameter name (app defines parameter names)

unsigned int* intRef

a pointer the the variable


Declare an unsigned int variable with a dynamic value that can be queried by supervisor using get.

Return value: true upon success, false upon error

bool addGetParameter(category, newParam, longRef)

const string& category

the variable category (app defines its categories)

const string& newParam

parameter name (app defines parameter names)

long* longRef

a pointer the the variable


Declare a long variable with a dynamic value that can be queried by supervisor using get.

Return value: true upon success, false upon error

bool addGetParameter(category, newParam, floatRef)

const string& category

the variable category (app defines its categories)

const string& newParam

parameter name (app defines parameter names)

float* floatRef

a pointer the the variable


Declare a float variable with a dynamic value that can be queried by supervisor using get.

Return value: true upon success, false upon error

bool addGetParameter(category, newParam, stringRef)

const string& category

the variable category (app defines its categories)

const string& newParam

parameter name (app defines parameter names)

string* stringRef

a pointer the the variable


Declare a string variable with a dynamic value that can be queried by supervisor using get.

Return value: true upon success, false upon error

bool addGetParameter(category, newParam, getFunction)

const string& category

the variable category (app defines its categories)

const string& newParam

parameter name (app defines parameter names)

MgmtClientGet getFunction

a function point to a function that can provide the parameter's value


Declare a special variable with a dynamic value that can be queried by supervisor using get - that must be queried via function call.

Return value: true upon success, false upon error

bool addSetParameter(category, newParam, setFunction)

const string& category

the variable category (app defines its categories)

const string& newParam

parameter name (app defines parameter names)

MgmtClientSet setFunction

a function point to a function that can provide the parameter's value


Declare the function to use to set/change the value of a variable. Your function performs error checking and bounds checking.  If the new value changes the behavior of your app, then your function makes sure the behavior changes.

Return value: true upon success, false upon error

void supervisorGUI(device, newParam)

UserDevice& device

the UserDevice instance for the user's UI

const HashArray& newParam


SysAdmin user interface (defined by app)

void operatorGUI(device, newParam)

UserDevice& device

the UserDevice instance for the user's UI

const HashArray& newParam


Operator user interface (defined by app)

void handleInputResponse(device, cbtag, cbdata, response)

UserDevice& device

the UserDevice instance for the user's UI

const string& cbtag

the action the UI is requesting to be taken

const XMLData& cbdata

callback data for the action

string response

the user's response to the UI control


Your app defines this method, typically in support of your supervisorGUI() and operatorGUI() methods

Your capp also calls this instead of your own of the same name if cbdata["sysadmin"] is True

bool handleMesssage(newParam)

const XMLData& newParam


Your handleMessage() method should call this handleMessage() when it receives a "sysadmin" request. The class defines this method (not your app)

string getParameter(category, param)

const string& category

the parameter category

const string& param

the parameter name


Query a parameter

bool setParameter(category, param, value)

const string& category

the parameter category

const string& param

the parameter name

const HashArray& value

new value for parameter


Set a parameter

inline void incrementInboundRequestCount()

Report another inbound message request

inline void incrementInboundBroadcastCount()

Report another inbound broadcast message request

inline void incrementInputCount()

Report another inbound user response

inline void incrementInboundErrorCount()

Report an inbound message that was erroneous

inline void incrementInputErrorCount()

Report an inbound user response that could not be processed

void noteRequestResponseTime(delta)

float delta

number of seconds


Note the response time used by the MgmtClient class's handleMessage()

Private Properties

string channel

The channel to use for communication

int inboundRequestCount

inbound # of message requests

int inboundBroadcastCount

inbound # of broadcast messages

int inboundInputsCount

inbound # of user responses

int inboundRequestErrors

inbound # of message request errors

int inboundInputErrors

inbound # of unprocessable user responses

float inboundRequestTime

last request latency time

static long time0

clock timer used for latency tracking

XMLData uidata

For use by user interface code

Note: MgmtClient UI can only be used by one user at a time

because there is only one (static) instance of this variable in *App class

vector <MgmtClientParameter > param

Portfolio of app parameters available to supervisor

bool initialized

Flag: are we intialized yet


Private Methods

void init(channel)

const string& channel

the channel to use

Default value: ""


Initialization routine (defined by app)

This calls addGetParameter*() and addSetParameter*() to define the management space

void ensureInit()

Ensure that we are initialized

void initIntrinsics()

Initialize the intrinsics

bool parameterExists(category, qparam, get)

const string& category

the parameter category

const string& qparam

the parameter name

bool get

true to check if parameter is available for get, false to check if available for set

Default value: true


Check to see if a parameter exists

StringSet getCategories(get)

bool get

true to check if parameter is available for get, false to check if available for set


Get a list of parameter categories

Return value: list of categories

StringSet getNames(get, category)

bool get

true to check if parameter is available for get, false to check if available for set

const string& category


For a particular category, query the list of parameter names

Return value: list of parameter names

static string uptime()

Intrinsic paramter calculator for uptime.

Return value: uptime