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.leaudio;
19 
20 import android.bluetooth.BluetoothDevice;
21 import android.bluetooth.BluetoothHapPresetInfo;
22 import android.bluetooth.BluetoothLeBroadcastReceiveState;
23 
24 import androidx.core.util.Pair;
25 import androidx.lifecycle.MutableLiveData;
26 
27 import java.util.HashMap;
28 import java.util.List;
29 import java.util.Map;
30 import java.util.TreeMap;
31 
32 public class LeAudioDeviceStateWrapper {
33     public BluetoothDevice device;
34     public LeAudioData leAudioData = null;
35     public VolumeControlData volumeControlData = null;
36     public BassData bassData = null;
37     public HapData hapData = null;
38 
LeAudioDeviceStateWrapper(BluetoothDevice device)39     public LeAudioDeviceStateWrapper(BluetoothDevice device) {
40         this.device = device;
41     }
42 
43     public static class LeAudioData {
44         public MutableLiveData<Boolean> isConnectedMutable = new MutableLiveData<>();
45         public MutableLiveData<Pair<Integer, Integer>> nodeStatusMutable = new MutableLiveData<>();
46         public MutableLiveData<Pair<Integer, Pair<Integer, Integer>>> groupStatusMutable =
47                 new MutableLiveData<>();
48         public MutableLiveData<Pair<Integer, Boolean>> groupLockStateMutable =
49                 new MutableLiveData<>();
50         public MutableLiveData<Integer> microphoneStateMutable = new MutableLiveData<>();
51 
52         public Object viewsData = null;
53     }
54 
55     public static class HapData {
56         public MutableLiveData<Integer> hapStateMutable = new MutableLiveData<>();
57         public MutableLiveData<String> hapStatusMutable = new MutableLiveData<>();
58         public MutableLiveData<Integer> hapFeaturesMutable = new MutableLiveData<>();
59         public MutableLiveData<Integer> hapActivePresetIndexMutable = new MutableLiveData<>();
60         public MutableLiveData<List<BluetoothHapPresetInfo>> hapPresetsMutable =
61                 new MutableLiveData<>();
62 
63         public Object viewsData = null;
64     }
65 
66     public static class VolumeControlData {
67         public MutableLiveData<Boolean> isConnectedMutable = new MutableLiveData<>(false);
68         public MutableLiveData<Integer> numInputsMutable = new MutableLiveData<>(0);
69         public MutableLiveData<Integer> numOffsetsMutable = new MutableLiveData<>(0);
70         public MutableLiveData<Integer> volumeStateMutable = new MutableLiveData<>(0);
71         public MutableLiveData<Boolean> mutedStateMutable = new MutableLiveData<>(false);
72 
73         public MutableLiveData<Map<Integer, String>> inputDescriptionsMutable =
74                 new MutableLiveData<>(new TreeMap<>());
75         public MutableLiveData<Map<Integer, Integer>> inputStateGainMutable =
76                 new MutableLiveData<>(new TreeMap<>());
77         public MutableLiveData<Map<Integer, Integer>> inputStateGainModeMutable =
78                 new MutableLiveData<>(new TreeMap<>());
79         public MutableLiveData<Map<Integer, Integer>> inputStateGainUnitMutable =
80                 new MutableLiveData<>(new TreeMap<>());
81         public MutableLiveData<Map<Integer, Integer>> inputStateGainMinMutable =
82                 new MutableLiveData<>(new TreeMap<>());
83         public MutableLiveData<Map<Integer, Integer>> inputStateGainMaxMutable =
84                 new MutableLiveData<>(new TreeMap<>());
85         public MutableLiveData<Map<Integer, Boolean>> inputStateMuteMutable =
86                 new MutableLiveData<>(new TreeMap<>());
87         public MutableLiveData<Map<Integer, Integer>> inputStatusMutable =
88                 new MutableLiveData<>(new TreeMap<>());
89         public MutableLiveData<Map<Integer, Integer>> inputTypeMutable =
90                 new MutableLiveData<>(new TreeMap<>());
91 
92         public MutableLiveData<Map<Integer, Integer>> outputVolumeOffsetMutable =
93                 new MutableLiveData<>(new TreeMap<>());
94         public MutableLiveData<Map<Integer, Integer>> outputLocationMutable =
95                 new MutableLiveData<>(new TreeMap<>());
96         public MutableLiveData<Map<Integer, String>> outputDescriptionMutable =
97                 new MutableLiveData<>(new TreeMap<>());
98 
99         public Object viewsData = null;
100     }
101 
102     public static class BassData {
103         public MutableLiveData<Boolean> isConnectedMutable = new MutableLiveData<>();
104         public MutableLiveData<HashMap<Integer, BluetoothLeBroadcastReceiveState>>
105                 receiverStatesMutable = new MutableLiveData<>();
106 
107         public Object viewsData = null;
108     }
109 }
110