CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Wed Oct 16, 2019 10:54 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Sep 11, 2013 9:26 pm 
Offline

Joined: Fri Nov 23, 2012 11:42 am
Posts: 54
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)));


Top
   
PostPosted: Thu Sep 12, 2013 5:59 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3491
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


Top
   
PostPosted: Thu Sep 12, 2013 8:24 am 
Offline

Joined: Fri Nov 23, 2012 11:42 am
Posts: 54
Thanks Edwin - that worked a treat. I would never have guessed that :D


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited