mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-09-09 23:54:32 +00:00
fixed more robust parsing
This commit is contained in:
parent
6b33cf434f
commit
1865f13f3a
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: SensorData.java,v 1.5 2008/11/10 21:14:20 adamdunkels Exp $
|
||||
* $Id: SensorData.java,v 1.6 2008/11/26 14:22:54 nifi Exp $
|
||||
*
|
||||
* -----------------------------------------------------------------
|
||||
*
|
||||
@ -34,8 +34,8 @@
|
||||
*
|
||||
* Authors : Joakim Eriksson, Niclas Finne
|
||||
* Created : 3 jul 2008
|
||||
* Updated : $Date: 2008/11/10 21:14:20 $
|
||||
* $Revision: 1.5 $
|
||||
* Updated : $Date: 2008/11/26 14:22:54 $
|
||||
* $Revision: 1.6 $
|
||||
*/
|
||||
|
||||
package se.sics.contiki.collect;
|
||||
@ -99,7 +99,7 @@ public class SensorData implements SensorInfo {
|
||||
}
|
||||
|
||||
public static SensorData parseSensorData(CollectServer server, String line, long systemTime) {
|
||||
String[] components = line.split(" ");
|
||||
String[] components = line.trim().split(" ");
|
||||
if (components.length == SensorData.VALUES_COUNT + 1) {
|
||||
// Sensor data with system time
|
||||
try {
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: SensorDataAggregator.java,v 1.1 2008/08/29 09:00:15 nifi Exp $
|
||||
* $Id: SensorDataAggregator.java,v 1.2 2008/11/26 14:22:54 nifi Exp $
|
||||
*
|
||||
* -----------------------------------------------------------------
|
||||
*
|
||||
@ -34,8 +34,8 @@
|
||||
*
|
||||
* Authors : Joakim Eriksson, Niclas Finne
|
||||
* Created : 20 aug 2008
|
||||
* Updated : $Date: 2008/08/29 09:00:15 $
|
||||
* $Revision: 1.1 $
|
||||
* Updated : $Date: 2008/11/26 14:22:54 $
|
||||
* $Revision: 1.2 $
|
||||
*/
|
||||
|
||||
package se.sics.contiki.collect;
|
||||
@ -79,7 +79,7 @@ public class SensorDataAggregator implements SensorInfo {
|
||||
}
|
||||
|
||||
public void addSensorData(SensorData data) {
|
||||
for (int i = 0, n = Math.max(VALUES_COUNT, data.getValueCount()); i < n; i++) {
|
||||
for (int i = 0, n = Math.min(VALUES_COUNT, data.getValueCount()); i < n; i++) {
|
||||
values[i] += data.getValue(i);
|
||||
}
|
||||
dataCount++;
|
||||
|
Loading…
Reference in New Issue
Block a user