Fixing ControlSystemMonitor and PowerMonitor in RMS 4.6
Table of Contents
Fixing ControlSystemMonitor and PowerMonitor in RMS 4.6:
Since 4.6 the ControlSystemMonitor and PowerMonitor located inside of it fail to run correctly. The way around this is to instead use the callback functions to get it operating the same way.
In ControlSystemMonitor replace the ExecuteAssetControlMethod function with the following:
DEFINE_FUNCTION ExecuteAssetControlMethod(CHAR methodKey[], CHAR arguments[])
{
// the system power and system mode control method executions are
// handled inside the RMS client and translated into the following
// event commands over the vdvRMS virtual device interface:
//
// SYSTEM.POWER.ON
// SYSTEM.POWER.OFF
// SYSTEM.MODE-<modename>
//
// these raw event commands are watched for by the RmsMonitorCommon include
// and are fired as callback functions: SystemPowerChanged() and SystemModeChanged()
#WARN 'This is a hack to fix System Power directives form the server - triggers SystemEventHandler.axi events'
#WARN 'Administrator access to this file required to edit'
amx_log(AMX_ERROR,"__FILE__'->ExecuteAssetControlMethod(',methodKey,', ',arguments,')'");
switch (upper_string(methodKey))
{
case RMS_EVENT_SYSTEM_POWER_ON:
{
send_command vdvRMS,"'@',RMS_EVENT_SYSTEM_POWER_REQUEST_ON";
}
case RMS_EVENT_SYSTEM_POWER_OFF:
{
send_command vdvRMS,"'@',RMS_EVENT_SYSTEM_POWER_REQUEST_OFF";
}
case RMS_EVENT_SYSTEM_MODE_CHANGE:
{
send_command vdvRMS,"'@',RMS_EVENT_SYSTEM_MODE_CHANGE_REQUEST,'-',arguments";
}
}
}
Then in your main code, add in the following:
#DEFINE INCLUDE_RMS_EVENT_CUSTOM_COMMAND_CALLBACK // Support hacked system power and mode requests
// include RmsEventListener (which also includes RMS API)
#include 'RmsEventListener';
DEFINE_FUNCTION RmsEventCustomCommand(CHAR header[], CHAR data[])
{
amx_log(AMX_INFO,"__FILE__,'->RmsEventCustomCommand(',header,', ',data,')'");
remove_string(header, '@', 1);
switch (upper_string(header))
{
case RMS_EVENT_SYSTEM_POWER_REQUEST_ON:
{
amx_log(AMX_ERROR,'System Power On Request from Server');
}
case RMS_EVENT_SYSTEM_POWER_REQUEST_OFF:
{
amx_log(AMX_ERROR,'System Power Off Request from Server');
}
case RMS_EVENT_SYSTEM_MODE_CHANGE_REQUEST:
{
amx_log(AMX_ERROR,"'System Mode to ',data,' Request from Server'");
}
}
}
This combination of steps will properly re-enable both monitoring functions.
Table of Contents