Skip to content
danbim edited this page Jul 20, 2011 · 1 revision

The StringFormatter is a utility which is used by several plugins that extracts data from individual SpyGlass packets and places this interpreted data in user defined Strings.

Expression Format

A StringFormatter expression combines arbitrary text with information from SpyGlass packets. The placeholders in these expressions define the type and the position of the value in the packet. Such a placeholder always starts with a % followed by specific letter, that represents the type of the value. All possible value types and the corresponding letter are shown in the table below. Afterwards the offset of the value in the packet must be given to complete the placeholder. If the string should contain the literal "%", it must be masked as %%. A line break must be masked as \n.

Letter Type
u uint8 (unsigned, 1 byte)
v uint16 (unsigned, 2 bytes)
U uint32 (unsigned, 4 bytes)
i int16 (signed, 2 bytes)
f float (signed, 4 bytes)

In a packet a signed 16 bit integer must be provided in two’s complement, while a float value must be given conform to norm IEEE 754 (IEEE Standard for Binary Floating-Point Arithmetic for microprocessor systems (ANSI/IEEE Std 754-1985)).

Example

Packet Content (Hexadecimal) StringFormatter Expression Formatted String
E7.DF.A0.00.00.00.32.C8.88.03.EF.89 Temp: %U3 Degrees\n Battery: %u9 V Temp: 50 Degrees
Battery: 3 V
Clone this wiki locally