• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 package com.android.powermodel.component;
18 
19 import java.util.Arrays;
20 
21 import com.android.powermodel.ComponentProfile;
22 import com.android.powermodel.ParseException;
23 
24 public class ModemProfile extends ComponentProfile {
25     public float sleepMa;
26     public float idleMa;
27     public float scanningMa;
28     public float rxMa;
29     public float[] txMa;
30 
getSleepMa()31     public float getSleepMa() {
32         return sleepMa;
33     }
34 
getIdleMa()35     public float getIdleMa() {
36         return idleMa;
37     }
38 
getRxMa()39     public float getRxMa() {
40         return rxMa;
41     }
42 
getTxMa()43     public float[] getTxMa() {
44         return Arrays.copyOf(txMa, txMa.length);
45     }
46 
getScanningMa()47     public float getScanningMa() {
48         return scanningMa;
49     }
50 
51     public static class Builder {
52         private float mSleepMa;
53         private float mIdleMa;
54         private float mRxMa;
55         private float[] mTxMa;
56         private float mScanningMa;
57 
Builder()58         public Builder() {
59         }
60 
setSleepMa(float value)61         public void setSleepMa(float value) throws ParseException {
62             mSleepMa = value;
63         }
64 
setIdleMa(float value)65         public void setIdleMa(float value) throws ParseException {
66             mIdleMa = value;
67         }
68 
setRxMa(float value)69         public void setRxMa(float value) throws ParseException {
70             mRxMa = value;
71         }
72 
setTxMa(float[] value)73         public void setTxMa(float[] value) throws ParseException {
74             mTxMa = Arrays.copyOf(value, value.length);
75         }
76 
setScanningMa(float value)77         public void setScanningMa(float value) throws ParseException {
78             mScanningMa = value;
79         }
80 
build()81         public ModemProfile build() throws ParseException {
82             ModemProfile result = new ModemProfile();
83             result.sleepMa = mSleepMa;
84             result.idleMa = mIdleMa;
85             result.rxMa = mRxMa;
86             result.txMa = mTxMa == null ? new float[0] : mTxMa;
87             result.scanningMa = mScanningMa;
88             return result;
89         }
90     }
91 }
92 
93