Stargate NetBridge Gateway User’s Manual
extract the necessary bytes with a logical AND.
shift
The number of bits to shift the resulting masked
value to position the value correctly
YES
<XConversion>
Each Field Definition maps the raw values from the packet to a named field. In most cases the
value in the packet is a hardware specific value and is not in a format which is understandable by
users or external applications. To handle this, each field definition tag can optionally contain a
<
XConversion
> tag which describes a mathematical equation to convert the raw values into a
user desired unit of measure. The equation can contain values from other fields in the packet
allowing complex equations. The values used for each field input into the equation are the raw
value pulled from the data packet.
For example a light reading from a sensor packet requires conversion from its raw resistance
value to a unit of conversion appropriate for light (mV). Below is the necessary equation:
Light(mV) = (( (light_value) * (1252352/(voltage_value)) / 1023)* 4)
The equation takes both the light reading in the packet and the voltage value in the packet to
convert it to the correct unit of measure.
<XField name="light" byteoffset="21" length="1" type="uint8">
<XConversion function="((y * (1252352/x) / 1023)* 4)" returntype="uint16">
<XConvParam variablename="x" fieldname="vref" type="float"/>
<XConvParam variablename="y" fieldname="light" type="uint8"/>
</XConversion>
</XField>
Table 8-4. XConversion Attributes
Attribute
Description
Required
function
The mathematical equation required to convert the
value to its appropriate unit of measure
YES
returntype
The type of the field value after conversion.
Possible values are:
•
byte
•
char
•
short
•
int
•
long
•
uint8
•
uint16
•
uint32
•
uint64
•
raw
•
string
•
float
•
double
YES
<XConversionParam>
Doc. # 7430-0449-01 Rev. A
Page
45
Summary of Contents for Stargate NetBridge
Page 1: ...Stargate NetBridge Gateway User s Manual Revision A October 2007 PN 7430 0449 01 ...
Page 6: ......
Page 60: ......
Page 61: ......