diff options
author | Mike Lockwood <lockwood@google.com> | 2014-06-12 11:23:40 -0700 |
---|---|---|
committer | Mike Lockwood <lockwood@google.com> | 2014-06-13 09:06:35 -0700 |
commit | f48a72776380b9691c85aba73012bd3d69cebe01 (patch) | |
tree | 1924a8d8678ca3be9e9171f9cc10de27f18b99cd /framework/java/android/bluetooth/BluetoothHeadsetClientCall.java | |
parent | 67a995ada9ae181651c436130a56d46699a120c1 (diff) |
Rename BluetoothHandsfreeClient to BluetoothHeadsetClient
This makes our terminology consistent with the existing BluetoothHeadset profile
Also updated arguments to Context.bindService()
Change-Id: I27cc5a6fde256b1f5dccca53a7a15ec8f58691c2
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothHeadsetClientCall.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothHeadsetClientCall.java | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHeadsetClientCall.java b/framework/java/android/bluetooth/BluetoothHeadsetClientCall.java new file mode 100644 index 0000000000..159e1f7946 --- /dev/null +++ b/framework/java/android/bluetooth/BluetoothHeadsetClientCall.java @@ -0,0 +1,193 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.bluetooth; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * This class represents a single call, its state and properties. + * It implements {@link Parcelable} for inter-process message passing. + * @hide + */ +public final class BluetoothHeadsetClientCall implements Parcelable { + + /* Call state */ + /** + * Call is active. + */ + public static final int CALL_STATE_ACTIVE = 0; + /** + * Call is in held state. + */ + public static final int CALL_STATE_HELD = 1; + /** + * Outgoing call that is being dialed right now. + */ + public static final int CALL_STATE_DIALING = 2; + /** + * Outgoing call that remote party has already been alerted about. + */ + public static final int CALL_STATE_ALERTING = 3; + /** + * Incoming call that can be accepted or rejected. + */ + public static final int CALL_STATE_INCOMING = 4; + /** + * Waiting call state when there is already an active call. + */ + public static final int CALL_STATE_WAITING = 5; + /** + * Call that has been held by response and hold + * (see Bluetooth specification for further references). + */ + public static final int CALL_STATE_HELD_BY_RESPONSE_AND_HOLD = 6; + /** + * Call that has been already terminated and should not be referenced as a valid call. + */ + public static final int CALL_STATE_TERMINATED = 7; + + private final int mId; + private int mState; + private String mNumber; + private boolean mMultiParty; + private final boolean mOutgoing; + + /** + * Creates BluetoothHeadsetClientCall instance. + */ + public BluetoothHeadsetClientCall(int id, int state, String number, boolean multiParty, + boolean outgoing) { + mId = id; + mState = state; + mNumber = number != null ? number : ""; + mMultiParty = multiParty; + mOutgoing = outgoing; + } + + /** + * Sets call's state. + * + * <p>Note: This is an internal function and shouldn't be exposed</p> + * + * @param state new call state. + */ + public void setState(int state) { + mState = state; + } + + /** + * Sets call's number. + * + * <p>Note: This is an internal function and shouldn't be exposed</p> + * + * @param number String representing phone number. + */ + public void setNumber(String number) { + mNumber = number; + } + + /** + * Sets this call as multi party call. + * + * <p>Note: This is an internal function and shouldn't be exposed</p> + * + * @param multiParty if <code>true</code> sets this call as a part + * of multi party conference. + */ + public void setMultiParty(boolean multiParty) { + mMultiParty = multiParty; + } + + /** + * Gets call's Id. + * + * @return call id. + */ + public int getId() { + return mId; + } + + /** + * Gets call's current state. + * + * @return state of this particular phone call. + */ + public int getState() { + return mState; + } + + /** + * Gets call's number. + * + * @return string representing phone number. + */ + public String getNumber() { + return mNumber; + } + + /** + * Checks if call is an active call in a conference mode (aka multi party). + * + * @return <code>true</code> if call is a multi party call, + * <code>false</code> otherwise. + */ + public boolean isMultiParty() { + return mMultiParty; + } + + /** + * Checks if this call is an outgoing call. + * + * @return <code>true</code> if its outgoing call, + * <code>false</code> otherwise. + */ + public boolean isOutgoing() { + return mOutgoing; + } + + /** + * {@link Parcelable.Creator} interface implementation. + */ + public static final Parcelable.Creator<BluetoothHeadsetClientCall> CREATOR = + new Parcelable.Creator<BluetoothHeadsetClientCall>() { + @Override + public BluetoothHeadsetClientCall createFromParcel(Parcel in) { + return new BluetoothHeadsetClientCall(in.readInt(), in.readInt(), + in.readString(), in.readInt() == 1, in.readInt() == 1); + } + + @Override + public BluetoothHeadsetClientCall[] newArray(int size) { + return new BluetoothHeadsetClientCall[size]; + } + }; + + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeInt(mId); + out.writeInt(mState); + out.writeString(mNumber); + out.writeInt(mMultiParty ? 1 : 0); + out.writeInt(mOutgoing ? 1 : 0); + } + + @Override + public int describeContents() { + return 0; + } +} |