Android Open Source - android-weather-station Sensor Factory






From Project

Back to project page android-weather-station.

License

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.

Java Source Code

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);
  }
}




Java Source Code List

de.grundid.weather.Beeper.java
de.grundid.weather.Constants.java
de.grundid.weather.MainActivity.java
de.grundid.weather.SensorHandler.java
de.grundid.weather.SerialDataHandler.java
de.grundid.weather.io.AttachedDeviceHandler.java
de.grundid.weather.io.ConnectedUsbDevice.java
de.grundid.weather.io.PermissionBroadcastReceiver.java
de.grundid.weather.io.SerialReceiverListener.java
de.grundid.weather.io.SerialReceiver.java
de.grundid.weather.io.UsbConnectionException.java
de.grundid.weather.sensor.InsideSensor.java
de.grundid.weather.sensor.LightSensor.java
de.grundid.weather.sensor.OutsideSensor.java
de.grundid.weather.sensor.SensorFactory.java
de.grundid.weather.sensor.SensorListener.java
de.grundid.weather.sensor.Sensor.java
de.grundid.weather.sensor.WeatherLogger.java
de.grundid.weather.utils.Utils.java