• 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 package com.android.bluetooth.hfp;
17 
18 /** A blob of data representing AG's device state in response to an AT+CIND command from HF */
19 class HeadsetDeviceState extends HeadsetMessageObject {
20     /**
21      * Service availability indicator
22      *
23      * <p>0 - no service, no home/roam network is available 1 - presence of service, home/roam
24      * network available
25      */
26     int mService;
27 
28     /**
29      * Roaming status indicator
30      *
31      * <p>0 - roaming is not active 1 - roaming is active
32      */
33     int mRoam;
34 
35     /** Signal strength indicator, value ranges from 0 to 5 */
36     int mSignal;
37 
38     /** Battery charge indicator from AG, value ranges from 0 to 5 */
39     int mBatteryCharge;
40 
HeadsetDeviceState(int service, int roam, int signal, int batteryCharge)41     HeadsetDeviceState(int service, int roam, int signal, int batteryCharge) {
42         mService = service;
43         mRoam = roam;
44         mSignal = signal;
45         mBatteryCharge = batteryCharge;
46     }
47 
48     @Override
buildString(StringBuilder builder)49     public void buildString(StringBuilder builder) {
50         if (builder == null) {
51             return;
52         }
53         builder.append(this.getClass().getSimpleName())
54                 .append("[hasCellularService=")
55                 .append(mService)
56                 .append(", isRoaming=")
57                 .append(mRoam)
58                 .append(", signalStrength")
59                 .append(mSignal)
60                 .append(", batteryCharge=")
61                 .append(mBatteryCharge)
62                 .append("]");
63     }
64 }
65