1 /* 2 * Copyright 2021 HIMSA II K/S - www.himsa.com. 3 * Represented by EHIMA - www.ehima.com 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package com.android.bluetooth.tbs; 19 20 import android.bluetooth.BluetoothLeCall; 21 22 import java.util.UUID; 23 24 public class TbsCall { 25 26 public static final int INDEX_UNASSIGNED = 0x00; 27 public static final int INDEX_MIN = 0x01; 28 public static final int INDEX_MAX = 0xFF; 29 30 private int mState; 31 private String mUri; 32 private int mFlags; 33 private String mFriendlyName; 34 TbsCall(int state, String uri, int flags, String friendlyName)35 private TbsCall(int state, String uri, int flags, String friendlyName) { 36 mState = state; 37 mUri = uri; 38 mFlags = flags; 39 mFriendlyName = friendlyName; 40 } 41 create(BluetoothLeCall call)42 public static TbsCall create(BluetoothLeCall call) { 43 return new TbsCall(call.getState(), call.getUri(), call.getCallFlags(), 44 call.getFriendlyName()); 45 } 46 47 @Override equals(Object o)48 public boolean equals(Object o) { 49 if (this == o) 50 return true; 51 if (o == null || getClass() != o.getClass()) 52 return false; 53 TbsCall that = (TbsCall) o; 54 // check the state only 55 return mState == that.mState; 56 } 57 getState()58 public int getState() { 59 return mState; 60 } 61 setState(int state)62 public void setState(int state) { 63 mState = state; 64 } 65 getUri()66 public String getUri() { 67 return mUri; 68 } 69 getFlags()70 public int getFlags() { 71 return mFlags; 72 } 73 isIncoming()74 public boolean isIncoming() { 75 return (mFlags & BluetoothLeCall.FLAG_OUTGOING_CALL) == 0; 76 } 77 getFriendlyName()78 public String getFriendlyName() { 79 return mFriendlyName; 80 } 81 } 82