For the measurement class and the data class all data is sent in a form that is related to the default format of the data. The number of data bytes in the frame also reflects the size of the variable. In this definition there is a very important assumption. If two nodes should be able to talk to each other they have to know each others data formats. So our assumption is that if a node is interested in what another node has to say it must learn its data format. Also if a node needs to control another node it has to learn its data format to do so.
As a guideline the format defined bellow for the first data byte of a data frame can be used but if a user likes to use another format it is perfectly fine to do so.
Tells how data that follows should be interpreted. This is used for CLASS1.MEASUREMENT and CLASS1.DATA
| Bits | Descriptions |
|---|---|
| 5,6,7 | Represent one of several numerical representations in which the data that follows is represented in |
The data should be represented as a set of bits. This can be used for picture coding etc.
The data should be represented as a set of bytes.
The data should be represented as an UTF-8 (Unicode) string. No terminating zero or length data in string.
Data is coded as an integer. The integer is coded in the bytes that follows and can be 1-7 bytes where the most significant byte always is in byte 1 (big endian).
If total event length=2 the data is a 1 byte integer or 1 byte. If total event length=3 the data is a 16-bit integer or 2 bytes. If total event length=4 the data is a 24-bit integer or 3 bytes. If total event length=5 the data is a 32-bit integer or 4 bytes. If total event length=6 the data is a 40-bit integer or 5 bytes. If total event length=7 the data is a 48-bit integer or 6 bytes. If total event length=8 the data is a 56-bit integer or 7 bytes.
Data is coded as a normalized integer. In this case the format byte is followed by the normalizer byte which have bit 7 set if the value that is represented by the integer that follow should have a decimal point that is shifted to the right. I bit 7 is reset the decimal point should be shifted to the left.
The normalizer bytes lower seven bits tells how many position the decimal point should be shifted left or right.
The actual integer is coded in the bytes that follows and can be 1-6 bytes where the most significant byte always is in byte 1. This integer is always signed and always given as a two's complement number.
A right shift of the decimal point is equal to a multiply by 10^n where n is the value of bit 0-6 and a divide by 10^n for a left shift.
example
0x02 0x1B 0x22 0x1B22 = 6946 Decimal 0x02 has bit 7 cleared meaning the decimal point should be moved two steps to the left i.e. the value is 69.46 which is the same as dividing with 10^2=100
example
0x05 0xF1 0x07 0xF107 = -3833 Decimal 0x05 has bit 7 clear meaning the decimal point should be moved five steps to the left i.e. the value is -0.03833 which is the same as dividing with 10^5 = 100000
example
0x85 0x01 0x07 0x0107 = 263 0x85 has bit 7 set meaning the decimal point should moved be five steps to the right i.e. the value is 26300000 which is the same as multiplying the value with 10^5 = 100000
Data is coded as a IEEE-754 1985 floating point value
s eeeeeeee mmmmmmmmmmmmmmmmmmmmmmm s = sign bit( 1-bit) e = exponent ( 8-bit) m = mantissa (23-bit)
That is a total of 32-bits. The most significant byte is stored first. The frame holds a total of five bytes. The full definition is at http://www.psc.edu/general/software/packages/ieee/ieee.html and further info at http://en.wikipedia.org/wiki/IEEE_754-1985
The format is yet to be defined.
The format is yet to be defined.
| Bits | Descriptions |
|---|---|
| 3,4 | Indicates how the data should be interpreted. |
Every event, measurement events for example, that generate coded data have a default type. For temperature for example this type is Kelvin. So default is that temperature data should be interpreted as a Kelvin temperature. Celsius and Fahrenheit is other possibilities for temperature and which is used will be known by the value if these bits.
Standard format. All other codes in this field are message class/type specific.
| Bits | Descriptions |
|---|---|
| 0,1,2 | Zero based sensor index which can be used if there are more then one sensor handled by the node. |
Discussion