Encoding And Decoding: Binary And Xml - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

Encoding and Decoding: Binary and XML

There are six special functions used to encode and decode variables in NetLinx. This encoding process
takes a NetLinx variable, no matter how complex, and converts it into a string. The decode process will
take this string and copy the contents back into a variable.
These functions can be used to take the contents of NetLinx variables and convert them to string. Once
the variable exists in string form, it can then be sent across an RS-232 connection, sent over and IP
socket or saved to the NetLinx master's file system (disc on chip). Once the string is retrieved, either
from a data event or by reading the information from the NetLinx master's file system, the data can be
converted back to a variable.
There are two version of this encoding and decoding: Binary and XML. The binary conversion routines
are:
STRING_TO_VARIABLE
LENGTH_ VARIABLE_TO_STRING
The XML routines are
LENGTH_ VARIABLE_TO_XML
string differs in protocol. The binary conversion routines uses a compact binary representation of the
variable while the XML represents the variable as a ASCII text only XML document.
The binary routines are ideal when sending data from one NetLinx system to another NetLinx system
over RS-232 or IP since the variable will be as compact as possible. It is also ideal for saving a file to the
NetLinx master's file system if you do not intend to edit the file later. The binary routines encode and
decode a variable sequentially meaning that the order and type of the variables must match on both the
encoding and decoding side.
The XML routines are ideal when sending data from one NetLinx system to another type of system over
RS232 or IP, since XML is more universally accepted by other types of computer systems. XML is also
ideal for saving a file to the NetLinx master's file system if you intend to edit the file later since it is
entirely ASCII text. It should be noted that while the XML is more universal, is not very compact. The
XML routines encode and decode a variable non-sequentially, meaning that the order and type of
variables do not need to match on both the encoding and decoding side.
Below are some examples of how to use these encoding routines:
PROGRAM_NAME='ConversionExample'
(*{{PS_SOURCE_INFO(PROGRAM STATS)
(***********************************************************)
(*
FILE CREATED ON: 05/22/2001 AT: 11:09:27
(***********************************************************)
(*
FILE_LAST_MODIFIED_ON: 05/22/2001 AT: 11:26:44
(***********************************************************)
(*
ORPHAN_FILE_PLATFORM: 1
(***********************************************************)
(*!!FILE REVISION:
(*
REVISION DATE: 05/22/2001
(*
(*
COMMENTS:
(*
(***********************************************************)
(*}}PS_SOURCE_INFO
NetLinx Programming Language Reference Guide
,
VARIABLE_TO_STRING
.
,
XML_TO_VARIABLE
VARIABLE_TO_XML
. Both sets of routines accomplish the same function but the encoded
Encoding and Decoding: Binary and XML
and
and
*)
*)
*)
*)
*)
*)
*)
*)
*)
*)
209

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents