1 /* 2 * Copyright (C) 2016 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 17 package com.android.bluetooth.avrcpcontroller; 18 19 import android.bluetooth.BluetoothDevice; 20 21 import com.android.bluetooth.Utils; 22 23 /* 24 * Contains information about remote device specifically the player and features enabled on it along 25 * with an encapsulation of the current track and playlist information. 26 */ 27 class RemoteDevice { 28 29 /* 30 * Remote features from JNI 31 */ 32 private static final int FEAT_NONE = 0; 33 private static final int FEAT_METADATA = 1; 34 private static final int FEAT_ABSOLUTE_VOLUME = 2; 35 private static final int FEAT_BROWSE = 4; 36 37 private static final int VOLUME_LABEL_UNDEFINED = -1; 38 39 final BluetoothDevice mBTDevice; 40 private int mRemoteFeatures; 41 private boolean mAbsVolNotificationRequested; 42 private boolean mFirstAbsVolCmdRecvd; 43 private int mNotificationLabel; 44 45 RemoteDevice(BluetoothDevice mDevice) { 46 mBTDevice = mDevice; 47 mRemoteFeatures = FEAT_NONE; 48 mAbsVolNotificationRequested = false; 49 mNotificationLabel = VOLUME_LABEL_UNDEFINED; 50 mFirstAbsVolCmdRecvd = false; 51 } 52 53 synchronized void setRemoteFeatures(int remoteFeatures) { 54 mRemoteFeatures = remoteFeatures; 55 } 56 57 public synchronized byte[] getBluetoothAddress() { 58 return Utils.getByteAddress(mBTDevice); 59 } 60 61 public synchronized void setNotificationLabel(int label) { 62 mNotificationLabel = label; 63 } 64 65 public synchronized int getNotificationLabel() { 66 return mNotificationLabel; 67 } 68 69 public synchronized void setAbsVolNotificationRequested(boolean request) { 70 mAbsVolNotificationRequested = request; 71 } 72 73 public synchronized boolean getAbsVolNotificationRequested() { 74 return mAbsVolNotificationRequested; 75 } 76 77 public synchronized void setFirstAbsVolCmdRecvd() { 78 mFirstAbsVolCmdRecvd = true; 79 } 80 81 public synchronized boolean getFirstAbsVolCmdRecvd() { 82 return mFirstAbsVolCmdRecvd; 83 } 84 } 85