Back to project page android-weather-station.
The source code is released under:
Apache License
If you think the Android project android-weather-station 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 de.grundid.weather.sensor; //w w w . ja va 2 s . c o m public class SensorFactory { public static Sensor createSensor(byte[] data) { int type = (byte)(data[1] & (byte)0x7F); if (type >= 0x40 && type <= 0x4f) { return new InsideSensor(data); } else if (type >= 0x58 && type <= 0x5f) { return new LightSensor(data); } else if (type >= 0x00 && type <= 0x1f) { return new OutsideSensor(data); } throw new RuntimeException("Unknown sensor ID: " + type); } }