IAdvAeSoftAlarmsHandler returns error code 8abb000b on DefineCondition
The interface IAdvAeSoftAlarmsHandler returns the error code 8abb000b when calling DefineCondition. 8abb000b means 'E_AFW_CS_NOCONN No connection could be set up or connection lost'.
I am trying to make a console windows program which can be used to generate a softalarm in 800xA. Why does the interface return the error code?
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr;
CoInitialize(NULL);
hr = m_pAeSoftAlrmHdlr.CoCreateInstance(CLSID_AdvAeSoftAlarmsHandler);
if (FAILED(hr)) return 1;
hr = m_pObjMgr.Create();
if (FAILED(hr)) return 1;
hr = m_pAeSoftAlrmHdlr->Init(m_pObjMgr);
if (FAILED(hr)) return 1;
CAfwNLSStringData nlsData;
CComQIPtr<IAfwUserContext> pUC(m_pObjMgr);
long language;
pUC->GetLCID(&language);
AfwDeliveryLayer layer;
pUC->GetLayer(&layer);
CComBSTR condName = L"SoftAlarm";
nlsData.SetString((short)language, layer, condName);
AfwConditionDefinition conditionDefinition = { 0 };
conditionDefinition.cb = sizeof AfwConditionDefinition;
conditionDefinition.severity = 400;
conditionDefinition.retainAtRestart = TRUE;
conditionDefinition.condId = SOFTALARM_COND_ID;
nlsData.Detach(&conditionDefinition.name);
hr = m_pAeSoftAlrmHdlr->DefineCondition(&conditionDefinition);
printf("Define condition : hr=0x%x\n", hr);
return 0;
}
Answers
Your modification will likely void product warranty and support (which may be a calculated risk, maybe even so low you don't calculate with it...).
The error code could be due to access attempted from a not authorized user (a proper user known to 800xA is required, the LocalSystem account used by e.g background services does not work).
Instead of performing open chest surgery, may I suggest writing to OPC properties via ABB Aspect Automation Model (still very sparsely documented, but less risky than making calls to central services for alarm production) and create your alarms based on OPC DA property changes?
PLC properties often have native alarm functions. Alarm Expressions can be put on General Properties. SoftPoint have semi-native alarm functionality (based on SoftAlarm).
Below code writes to a PLC property. Try to keep General Property writes low (as they constitute Aspect Directory transactions) or write to SoftPoints.
REM Note!
REM May need to be called from elevated and 32-bit version of WScript
REM C:\WINDOWS\SysWOW64\wscript.exe mytest.vbs
dim systems
set systems = CreateObject("ABB.ABBSystems")
dim system
set system = systems.defaultsystem
dim obj
set obj = system.object("[Control Structure]Root/Control Network 2/SoftProj2/Applications/Application_2/Diagrams/Diagram2")
obj.properties("Diagram:ResetPulse") = true
Add new comment