<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to How to read string from CharBufferPtr?</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/b2f921e6bf/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Visualization/thread/b2f921e6bf/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Visualization/thread/b2f921e6bf/</id><updated>2024-02-21T08:28:48.325000Z</updated><subtitle>Recent posts to How to read string from CharBufferPtr?</subtitle><entry><title>How to read string from CharBufferPtr?</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/b2f921e6bf/?limit=25#65bc" rel="alternate"/><published>2024-02-21T08:28:48.325000Z</published><updated>2024-02-21T08:28:48.325000Z</updated><author><name>dtamm</name><uri>https://forge.codesys.com/u/dtamm/</uri></author><id>https://forge.codesys.com0dd80db55b504213aa0e19cec0a9a5bd7d8e0b0f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Solved it! The simple answer was to declare a variable as POINTER TO STRING and assign the GetMessage result to that variable. Then, the ^ operator can be used to extract the message as string.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to read string from CharBufferPtr?</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/b2f921e6bf/?limit=25#4be1" rel="alternate"/><published>2024-02-21T07:56:01.935000Z</published><updated>2024-02-21T07:56:01.935000Z</updated><author><name>dtamm</name><uri>https://forge.codesys.com/u/dtamm/</uri></author><id>https://forge.codesys.com413b7b18ac3f40a937211bd8571a5dca8bd195a8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am trying to implement a mechanism to send alarm SMS. For this, I have created an Alarm Class with a Notification Action which calls a POU. This POU implements IAlarmNotifiable making it selectable in the Alarm Class configuration. IAlarmNotifiable has an Execute method which is called by the alarm class.&lt;br/&gt;
Now, I want to extract the alarm message of the triggered alarm. The Execute method comes with a &lt;code&gt;VAR_INPUT itfAlarm: AlarmManager.IAlarm&lt;/code&gt; which supplies a method called GetMessage. The help text says:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Returns the message text, that has been configured for the alarm. The result is a pointer to the buffer, where the message text is stored&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The type of the result is CharBufferPtr, and at some place I read that it can be interpreted as a pointer to string. But I cannot manage to extract the alarm message, all I get are numbers. I have tried the following:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;psAlarmText&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;itfAlarm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;__SYSTEM&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;TYPE_CLASS&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;TYPE_STRING&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;sAlarmText&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;TO_STRING&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;itfAlarm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;__SYSTEM&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;TYPE_CLASS&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;TYPE_STRING&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So how do I get access to the alarm message as clear text? (In this case, "Larm 1")&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>