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