1/*
2 * Copyright 2014 Intel Corporation All Rights Reserved.
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
17package com.intel.thermal;
18
19import android.util.Log;
20
21import java.util.ArrayList;
22import java.util.Arrays;
23
24/**
25 * The ThermalSensorAttrib class describes the attributes of a Thermal Sensor that are
26 * zone specific.
27 * @hide
28 */
29public class ThermalSensorAttrib {
30
31    private static final String TAG = "ThermalSensorAttrib";
32    private String mSensorName;
33    private Integer mWeights[];
34    private Integer mOrder[];
35
36    public String getSensorName() {
37        return mSensorName;
38    }
39
40    public void setSensorName(String name) {
41        mSensorName = name;
42    }
43
44    public Integer[] getWeights() {
45        return mWeights;
46    }
47
48    public void setWeights(ArrayList<Integer> list) {
49        if (list != null) {
50            mWeights = new Integer[list.size()];
51            if (mWeights != null) {
52                mWeights = list.toArray(mWeights);
53            }
54        }
55    }
56
57    public Integer[] getOrder() {
58        return mOrder;
59    }
60
61    public void setOrder(ArrayList<Integer> list) {
62        if (list != null) {
63            mOrder = new Integer[list.size()];
64            if (mOrder != null) {
65                mOrder = list.toArray(mOrder);
66            }
67        }
68    }
69
70    public void printAttrs() {
71        Log.i(TAG, "SensorAttrib: " + mSensorName);
72        Log.i(TAG, "mWeights[]: " + Arrays.toString(mWeights));
73        Log.i(TAG, "mOrder[]: " + Arrays.toString(mOrder));
74        if (mWeights != null && mOrder != null && mWeights.length != mOrder.length) {
75            Log.i(TAG, "mismatch in weights and order array, raw sensor temp will be used");
76        }
77    }
78}
79