IAlarmNotifier - cannot get message from itfAlarm.GetMessage

2013-09-11
2013-09-12
  • DavidCozens

    DavidCozens - 2013-09-11

    I have a function block that implements the IAlarmNotifier interface, I have it doing most of what I want, but I cannot get the alarm message. The key part of the execute method is below. Any ideas why GetMessage always returns a null string. I am successfully getting the name of the AlarmGroup and the AlarmClass it is just this interface function that is tripping me up.
    {attribute '''DOCU__COMMENT' := ' Executes the action.'}
    ( Executes the action.)
    METHOD Execute
    VAR_INPUT
    ( The currently processed alarm state transition. This will be
    evaluated in order to determine, whether the action has to be
    executed or not
    )
    eCurrTransition : AlarmStateTransition;
    ( The alarm, for which the action has to be performed)
    itfAlarm : IAlarm;
    ( An optional pointer to a structure variable containing
    additional parameter
    )
    pbyAdditionalData : POINTER TO BYTE;
    END_VAR
    VAR
    cbpMessage: AlarmManager.CharBufferPtr; ( for holding the AlarmMessage )
    END_VAR


    cbpMessage := itfAlarm.GetMessage(__SYSTEM.TYPE_CLASS.TYPE_STRING);
    StrConcatA(cbpMessage,ADR(sLastAlarm[0]),USINT_TO_INT(SIZEOF(sLastAlarm)));

     
  • eschwellinger

    eschwellinger - 2013-09-12

    Hi David,
    The message text is empty because no visualization occurs in the project.

    background:
    Without visualization, the text lists are not transferred to the control, and therefore the text can not be determined.
    This is as designed, to fix that you Need to add a visu to your project.

    Edwin

     
  • DavidCozens

    DavidCozens - 2013-09-12

    Thanks Edwin - that worked a treat. I would never have guessed that

     

Log in to post a comment.