<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=RMSG</id>
	<title>RMSG - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ice-online.com/index.php?action=history&amp;feed=atom&amp;title=RMSG"/>
	<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=RMSG&amp;action=history"/>
	<updated>2026-06-13T13:18:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.ice-online.com/index.php?title=RMSG&amp;diff=710&amp;oldid=prev</id>
		<title>ConvertBot: Remote Midas InterFace (RMIF) message constructor/destructor and sender.</title>
		<link rel="alternate" type="text/html" href="https://wiki.ice-online.com/index.php?title=RMSG&amp;diff=710&amp;oldid=prev"/>
		<updated>2020-04-27T22:04:34Z</updated>

		<summary type="html">&lt;p&gt;Remote Midas InterFace (RMIF) message constructor/destructor and sender.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Remote Midas InterFace (RMIF) message constructor/destructor and sender.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;verb&amp;gt;   - Function to perform (SEND,T2R,R2T)&lt;br /&gt;
&amp;lt;addr&amp;gt;   - Remote Address (NODE:PORT or 0X?? form)&lt;br /&gt;
&amp;lt;func&amp;gt;   - Packet Function (SET,GET,RET,ACK)&lt;br /&gt;
&amp;lt;info&amp;gt;   - Info field&lt;br /&gt;
&amp;lt;data&amp;gt;   - Data Table {KEY1=VALUE1,KEY2=VALUE2,...)&lt;br /&gt;
&amp;lt;prefix&amp;gt; - Prefix of results to hold table data (max of 32 characters)&lt;br /&gt;
&lt;br /&gt;
This command is a helper function for macros dealing with RMIF/PKT messages. The&lt;br /&gt;
SET, RET, GET, and ACK messages are often tables which are not easily dealt with&lt;br /&gt;
in X-Midas.  This function translates those messages from tables to results&lt;br /&gt;
(T2R) constructs that are easier to deal with in the X-Midas macro language.&lt;br /&gt;
The SEND function also makes it easy to send the above supported message types&lt;br /&gt;
over RMIF to the desired remote address (hostname/IP:port or hexadecimal form).&lt;br /&gt;
&lt;br /&gt;
To get RMIF to pass PKT messages to the macro use the /PKTMSG switch on RMIF.&lt;br /&gt;
To get RMIF to pass KEY messages to the macro use the /KEYMSG switch on RMIF.&lt;br /&gt;
&lt;br /&gt;
The macro should have a global switch /RMIFID=N where n is the id of the RMIF&lt;br /&gt;
primitive.  This switch will get picked up by RMSG wherever it appears in the&lt;br /&gt;
macro for all functions that need to talk to the RMIF primitive.&lt;br /&gt;
&lt;br /&gt;
  startmacro/rmifid=10&lt;br /&gt;
&lt;br /&gt;
    res l:rmif_id /rmifid&lt;br /&gt;
&lt;br /&gt;
    xpipe on&lt;br /&gt;
    waveform _cb&lt;br /&gt;
    rmif/id=rmif_id/pktmsg port _cb&lt;br /&gt;
    xpipe off&lt;br /&gt;
&lt;br /&gt;
  endmacro&lt;br /&gt;
&lt;br /&gt;
A NeXtMidas table has the form:&lt;br /&gt;
&lt;br /&gt;
 {KEY1=Value1,KEY2=Value2,...KEYN=ValueN}&lt;br /&gt;
&lt;br /&gt;
The RMSG command can be used to construct and send a message of this form.&lt;br /&gt;
&lt;br /&gt;
 rmsg SEND &amp;lt;addr&amp;gt; &amp;quot;ACK&amp;quot; &amp;lt;info&amp;gt; {FREQ=^MYFREQ,AMP=^MYAMP,MOD=FM}&lt;br /&gt;
&lt;br /&gt;
where the table can be up to 1024 characters in length.&lt;br /&gt;
&lt;br /&gt;
When a macro gets a message from RMIF, it can be parsed into results parameters&lt;br /&gt;
with a named prefix.  For example with &amp;lt;prefix&amp;gt; = R_ :&lt;br /&gt;
&lt;br /&gt;
  R_NK = N&lt;br /&gt;
  R_K1 = KEY1&lt;br /&gt;
  R_V1 = VALUE1&lt;br /&gt;
  R_K2 = KEY2&lt;br /&gt;
  R_V2 = VALUE2&lt;br /&gt;
  ...&lt;br /&gt;
  R_KN = KEYN&lt;br /&gt;
  R_VN = VALUEN&lt;br /&gt;
&lt;br /&gt;
When a macro gets a message from RMIF, use the T2R function to parse the table&lt;br /&gt;
into individual results parameters for each key=value pair.  The macro can then&lt;br /&gt;
loop through the individual key/value pairs and execute the necessary functions.&lt;br /&gt;
&lt;br /&gt;
  message get /M/&lt;br /&gt;
  if M.name eq &amp;quot;RMIF&amp;quot;&lt;br /&gt;
    rmsg T2R ,,,, M.RPKT.data R_&lt;br /&gt;
    loop R_NK nn&lt;br /&gt;
      say &amp;quot;Message ^M.RPKT.func of key=^{R_K^nn} to value=^{R_V^nn}&amp;quot;&lt;br /&gt;
    endloop&lt;br /&gt;
  else&lt;br /&gt;
  endif&lt;br /&gt;
&lt;br /&gt;
Since 3.1.3, T2R supports X-Midas Tables utilizing the H: or h: syntax.&lt;br /&gt;
'H' is the type letter for X-Midas Table; they could not use 'T:' since that&lt;br /&gt;
was already used for the widget tags type. Instead 'H:' for hash was used. For&lt;br /&gt;
a listing of most Midas types, see NeXtMidas Training/Getting Started-Part 2/&lt;br /&gt;
Advanced Results Parameters/Typecasting.&lt;br /&gt;
&lt;br /&gt;
If M.RPKT.func is a SET, the individual key values may be adjusted to an&lt;br /&gt;
allowable value, and all of them sent back in an ACK message to the sender using&lt;br /&gt;
the SEND function with the &amp;lt;data&amp;gt; field blank and &amp;lt;prefix&amp;gt; defined. For&lt;br /&gt;
examples, see the SD360 macro.  Here is an excerpt:&lt;br /&gt;
&lt;br /&gt;
  else if M.RPKT.func eqs &amp;quot;GET&amp;quot;&lt;br /&gt;
    rmsg &amp;quot;T2R&amp;quot; ,,,, M.RPKT.data d_&lt;br /&gt;
    loop d_nk nn   ! loop through table entries&lt;br /&gt;
      res  d_v^nn P_^{d_k^nn}&lt;br /&gt;
    endloop&lt;br /&gt;
    rmsg &amp;quot;SEND&amp;quot; M.RPKT.addr &amp;quot;RET&amp;quot; M.info ,, d_&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;prefix&amp;gt; is defined when sending a message, the message data is built by&lt;br /&gt;
reversing the T2R function to build the table for the data object.  If  &amp;lt;prefix&amp;gt;&lt;br /&gt;
is not entered, it is assumed that the &amp;lt;data&amp;gt; entry is a table in serialized&lt;br /&gt;
form built on the command line.  For example:&lt;br /&gt;
&lt;br /&gt;
    rmsg &amp;quot;SEND&amp;quot; &amp;quot;MYNODE:9001&amp;quot; &amp;quot;SET&amp;quot; 0 {FREQ=1e6,DEMOD=FM}&lt;br /&gt;
&lt;br /&gt;
Switches:&lt;br /&gt;
  /RMIFID=n - the ID of the RMIF primitive in this macro&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:NXM_Explain]]&lt;/div&gt;</summary>
		<author><name>ConvertBot</name></author>
		
	</entry>
</feed>