1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.hardware.cts.helpers.sensorverification;
18 
19 import android.hardware.cts.helpers.SensorStats;
20 import android.hardware.cts.helpers.TestSensorEnvironment;
21 import android.hardware.cts.helpers.TestSensorEvent;
22 
23 import java.util.Collection;
24 
25 /**
26  * Interface describing the sensor verification.
27  * This class was designed to handle streaming of events.
28  *
29  * The method {@link #addSensorEvents(Collection)} should be called in the order that the events are
30  * received.
31  *
32  * The method {@link #verify(TestSensorEnvironment, SensorStats)} should be called after all events
33  * are added.
34  */
35 public interface ISensorVerification {
36 
37     /**
38      * Add a list of {@link TestSensorEvent}s to be evaluated.
39      */
40     // TODO: refactor verifications to be stateless, and pass the list of events in verify()
addSensorEvents(Collection<TestSensorEvent> events)41     void addSensorEvents(Collection<TestSensorEvent> events);
42 
43     /**
44      * Evaluate all added {@link TestSensorEvent}s and update stats.
45      *
46      * @param stats a {@link SensorStats} object used to keep track of the stats.
47      * @throws AssertionError if the verification fails.
48      */
verify(TestSensorEnvironment environment, SensorStats stats)49     void verify(TestSensorEnvironment environment, SensorStats stats);
50 
51     /**
52      * Clones the {@link ISensorVerification}
53      */
clone()54     ISensorVerification clone();
55 }
56