[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r1156 - /projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/DefaultDeserializer.java
scm-notify at zb4osgi.aaloa.org
scm-notify at zb4osgi.aaloa.org
Fri Jan 30 10:54:05 CET 2015
Author: giancarlo.riolo
Date: Fri Jan 30 10:54:05 2015
New Revision: 1156
Log:
Changed SinglePrecision and HalfPrecision bodies.
Modified:
projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/DefaultDeserializer.java
Modified: projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/DefaultDeserializer.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/DefaultDeserializer.java (original)
+++ projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/DefaultDeserializer.java Fri Jan 30 10:54:05 2015
@@ -162,8 +162,19 @@
}
public float readSinglePrecision() {
+
+ float result = ByteBuffer
+ .wrap(payload, index, ZigBeeType.SinglePrecision.getLength())
+ .order(ByteOrder.LITTLE_ENDIAN).getFloat();
+ index += 4;
+ return result;
+
+ }
+
+ public float readSemiPrecision() {
throw new UnsupportedOperationException(
"readSinglePrecision:Please implement it");
+
/*
* The fowllowing code was proposed as solution for converting
* semi-precision but it will always the BufferUnderflowException
@@ -176,19 +187,10 @@
*
*
* float result = ByteBuffer .wrap(payload, index,
- * ZigBeeType.SinglePrecision.getLength())
- * .order(ByteOrder.LITTLE_ENDIAN).getFloat(); index += 4; return
+ * ZigBeeType.SemiPrecision.getLength())
+ * .order(ByteOrder.LITTLE_ENDIAN).getFloat(); index += 2; return
* result;
*/
- }
-
- public float readSemiPrecision() {
-
- float result = ByteBuffer
- .wrap(payload, index, ZigBeeType.SemiPrecision.getLength())
- .order(ByteOrder.LITTLE_ENDIAN).getFloat();
- index += 2;
- return result;
}
More information about the Commit
mailing list