1 /*
2  * Copyright (C) 2018 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 #ifndef LOCATION_LBS_CONTEXTHUB_NANOAPPS_CALIBRATION_OVER_TEMP_OVER_TEMP_MODEL_H_
18 #define LOCATION_LBS_CONTEXTHUB_NANOAPPS_CALIBRATION_OVER_TEMP_OVER_TEMP_MODEL_H_
19 
20 #include <stdint.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 // Defines the maximum size of the OverTempCal 'model_data' array.
27 #define OTC_MODEL_SIZE (40)
28 
29 /*
30  * Over-temperature data structures that contain a modeled sensor offset
31  * estimate, an associated temperature, and the age of the data point since it
32  * first entered the model.
33  */
34 
35 struct OverTempModelThreeAxis {
36   // Sensor offset estimate, temperature, and age timestamp.
37   uint64_t offset_age_nanos;  // [nanoseconds]
38   float offset_temp_celsius;  // [Celsius]
39 
40   // Three-axis offset estimate (indices: 0=x, 1=y, 2=z).
41   float offset[3];
42 };
43 
44 struct OverTempModelSingleAxis {
45   // Sensor offset estimate, temperature, and age timestamp.
46   uint64_t offset_age_nanos;  // [nanoseconds]
47   float offset_temp_celsius;  // [Celsius]
48 
49   // Single-axis offset estimate.
50   float offset;
51 };
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif  // LOCATION_LBS_CONTEXTHUB_NANOAPPS_CALIBRATION_OVER_TEMP_OVER_TEMP_MODEL_H_
58