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