// Path: fsensor/src/main/java/com/kircherelectronics/fsensor/observer/SensorSubject.java
// public class SensorSubject {
//     private final List<SensorObserver> observers = new ArrayList<>();
// 
//     public interface SensorObserver {
//         void onSensorChanged(float[] values);
//     }
// 
//     public void register(SensorObserver observer) {
//         if(!observers.contains(observer)) {
//             observers.add(observer);
//         }
//     }
// 
//     public void unregister(SensorObserver observer) {
//         observers.remove(observer);
//     }
// 
//     public void onNext(float[] values) {
//         for(int i = 0; i < observers.size(); i++) {
//             observers.get(i).onSensorChanged(values);
//         }
//     }
// }
// 
// Path: fsensor/src/main/java/com/kircherelectronics/fsensor/sensor/FSensor.java
// public interface FSensor {
//     void register(SensorSubject.SensorObserver sensorObserver);
//     void unregister(SensorSubject.SensorObserver sensorObserver);
// 
//     void start();
//     void stop();
//     void reset();
// }


import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import com.kircherelectronics.fsensor.observer.SensorSubject;
import com.kircherelectronics.fsensor.sensor.FSensor;
package com.kircherelectronics.fsensor.sensor.acceleration;



/*
 * Copyright 2018, Kircher Electronics, LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class AccelerationSensor implements FSensor {
    private static final String TAG = AccelerationSensor.class.getSimpleName();

    private final SensorManager sensorManager;
    private final SimpleSensorListener listener;
    private float startTime = 0;
    private int count = 0;

    private float[] acceleration = new float[3];
    private float[] output = new float[4];

    private int sensorDelay = SensorManager.SENSOR_DELAY_FASTEST;

// Path: fsensor/src/main/java/com/kircherelectronics/fsensor/observer/SensorSubject.java
// public class SensorSubject {
//     private final List<SensorObserver> observers = new ArrayList<>();
// 
//     public interface SensorObserver {
//         void onSensorChanged(float[] values);
//     }
// 
//     public void register(SensorObserver observer) {
//         if(!observers.contains(observer)) {
//             observers.add(observer);
//         }
//     }
// 
//     public void unregister(SensorObserver observer) {
//         observers.remove(observer);
//     }
// 
//     public void onNext(float[] values) {
//         for(int i = 0; i < observers.size(); i++) {
//             observers.get(i).onSensorChanged(values);
//         }
//     }
// }
// 
// Path: fsensor/src/main/java/com/kircherelectronics/fsensor/sensor/FSensor.java
// public interface FSensor {
//     void register(SensorSubject.SensorObserver sensorObserver);
//     void unregister(SensorSubject.SensorObserver sensorObserver);
// 
//     void start();
//     void stop();
//     void reset();
// }


// Path: fsensor/src/main/java/com/kircherelectronics/fsensor/sensor/acceleration/AccelerationSensor.java
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import com.kircherelectronics.fsensor.observer.SensorSubject;
import com.kircherelectronics.fsensor.sensor.FSensor;

package com.kircherelectronics.fsensor.sensor.acceleration;



/*
 * Copyright 2018, Kircher Electronics, LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class AccelerationSensor implements FSensor {
    private static final String TAG = AccelerationSensor.class.getSimpleName();

    private final SensorManager sensorManager;
    private final SimpleSensorListener listener;
    private float startTime = 0;
    private int count = 0;

    private float[] acceleration = new float[3];
    private float[] output = new float[4];

    private int sensorDelay = SensorManager.SENSOR_DELAY_FASTEST;

    private final SensorSubject sensorSubject;