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 /** 19 * A blob of response data to AT+CLCC command from HF 20 * 21 * <p>Example: AT+CLCC +CLCC:[index],[direction],[status],[mode],[mpty][,[number],[type]] 22 */ 23 class HeadsetClccResponse extends HeadsetMessageObject { 24 /** Index of the call, starting with 1, by the sequence of setup or receiving the calls */ 25 int mIndex; 26 27 /** Direction of the call, 0 is outgoing, 1 is incoming */ 28 int mDirection; 29 30 /** 31 * Status of the call, currently defined in bthf_call_state_t of bt_hf.h or {@link 32 * com.android.server.telecom.BluetoothPhoneServiceImpl} or {@link HeadsetHalConstants} 33 * 34 * <p>0 - Active 1 - Held 2 - Dialing 3 - Alerting 4 - Incoming 5 - Waiting 6 - Call held by 35 * response and hold 36 */ 37 int mStatus; 38 39 /** Call mode, 0 is Voice, 1 is Data, 2 is Fax */ 40 int mMode; 41 42 /** 43 * Multi-party indicator 44 * 45 * <p>0 - this call is NOT a member of a multi-party (conference) call 1 - this call IS a 46 * multi-party (conference) call 47 */ 48 boolean mMpty; 49 50 /** Phone number of the call (optional) */ 51 String mNumber; 52 53 /** Phone number type (optional) */ 54 int mType; 55 HeadsetClccResponse( int index, int direction, int status, int mode, boolean mpty, String number, int type)56 HeadsetClccResponse( 57 int index, int direction, int status, int mode, boolean mpty, String number, int type) { 58 mIndex = index; 59 mDirection = direction; 60 mStatus = status; 61 mMode = mode; 62 mMpty = mpty; 63 mNumber = number; 64 mType = type; 65 } 66 67 @Override buildString(StringBuilder builder)68 public void buildString(StringBuilder builder) { 69 if (builder == null) { 70 return; 71 } 72 builder.append(this.getClass().getSimpleName()) 73 .append("[index=") 74 .append(mIndex) 75 .append(", direction=") 76 .append(mDirection) 77 .append(", status=") 78 .append(mStatus) 79 .append(", callMode=") 80 .append(mMode) 81 .append(", isMultiParty=") 82 .append(mMpty) 83 .append(", number="); 84 if (mNumber == null) { 85 builder.append("null"); 86 } else { 87 builder.append("***"); 88 } 89 builder.append(", type=").append(mType).append("]"); 90 } 91 } 92