Back to project page mha-android.
The source code is released under:
Copyright (c) 2011-2012 Cameron Porter, Ryan Brown http://github.com/camporter/mha-android Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated...
If you think the Android project mha-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.teamacra.myhomeaudio.locations; /* ww w .j a v a 2 s . c om*/ import org.json.JSONException; import org.json.JSONObject; import com.teamacra.myhomeaudio.node.Node; /** * For any room, each node has a signal range. The NodeSignalRange object * represents what a single node's ranges are within that room. We can get the * max and min values that were recorded. * */ public class NodeSignalRange { private Node node; private Integer min; private Integer max; public NodeSignalRange(Node node) { this.node = node; } public boolean checkRange(int value) { if (value >= min && value <= max) { return true; } return false; } /** * Stores the rssi value. * * @param rssi The RSSI value that our node's signal is at. */ public void storeRSSIValue(int rssi) { if (min == null && max ==null) { // No RSSI values have been recorded yet min = rssi; max = rssi; } else if (rssi < min) { min = rssi; } else if (rssi > max) { max = rssi; } } public int getMin() { return min; } public int getMax() { return max; } public Node getNode() { return node; } public JSONObject toJSON() { JSONObject object = new JSONObject(); try { object.put("max", max); object.put("min", min); object.put("id", node.id()); } catch (JSONException e) { e.printStackTrace(); } return object; } public String toString() { return "id: " + node.id() + " min: " + min + " max: " + max; } }