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