• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 package com.android.server.uwb.info;
17 
18 /**
19  * Power related status reported by the UWB subsystem.
20  * All values should never decrease after the start of subsystem.
21  */
22 public class UwbPowerStats {
23     private static final String TAG = UwbPowerStats.class.getSimpleName();
24 
25     /**
26      * The duration of UWB operating in the Tx mode in millis.
27      * This may include time for HW configuration, ramp up and down.
28      */
29     private int mTxTimeMs;
30 
31     /**
32      * The duration of UWB operating in the Rx mode in millis.
33      * This may include time for HW configuration and listen mode.
34      */
35     private int mRxTimeMs;
36 
37     /**
38      * The duration of UWB operating in the idle mode (neither Tx nor Rx).
39      * For the HW with very low idle current, it may not be meaningful to maintain this
40      * count and thus the value could be always zero.
41      */
42     private int mIdleTimeMs;
43 
44     /**
45      * Total count of host wakeup due to UWB subsystem event.
46      */
47     private int mTotalWakeCount;
48 
UwbPowerStats(int txTimeMs, int rxTimeMs, int idleTimeMs, int totalWakeCount)49     public UwbPowerStats(int txTimeMs, int rxTimeMs, int idleTimeMs, int totalWakeCount) {
50         mTxTimeMs = txTimeMs;
51         mRxTimeMs = rxTimeMs;
52         mIdleTimeMs = idleTimeMs;
53         mTotalWakeCount = totalWakeCount;
54     }
55 
56     /**
57      * get total Tx time in millis
58      */
getTxTimeMs()59     public int getTxTimeMs() {
60         return mTxTimeMs;
61     }
62 
63     /**
64      * get total Rx time in millis
65      */
getRxTimeMs()66     public int getRxTimeMs() {
67         return mRxTimeMs;
68     }
69 
70     /**
71      * get total idle time in millis
72      */
getIdleTimeMs()73     public int getIdleTimeMs() {
74         return mIdleTimeMs;
75     }
76 
77     /**
78      * get total wakeup count
79      */
getTotalWakeCount()80     public int getTotalWakeCount() {
81         return mTotalWakeCount;
82     }
83 
84     @Override
toString()85     public String toString() {
86         StringBuilder sb = new StringBuilder();
87         sb.append("UwbPowerStats: tx_time_ms=").append(mTxTimeMs)
88                 .append(" rx_time_ms=").append(mRxTimeMs)
89                 .append(" idle_time_ms=").append(mIdleTimeMs)
90                 .append(" total_wake_count=").append(mTotalWakeCount);
91         return sb.toString();
92     }
93 }
94