1 /* 2 * Copyright (C) 2021 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.google.android.tv.btservices.settings; 18 19 import android.bluetooth.BluetoothDevice; 20 import android.content.Context; 21 22 import com.google.android.tv.btservices.remote.DfuManager; 23 import com.google.android.tv.btservices.remote.RemoteProxy.DfuResult; 24 import com.google.android.tv.btservices.remote.Version; 25 26 public interface BluetoothDeviceProvider { 27 28 interface Listener { onDeviceUpdated(BluetoothDevice device)29 void onDeviceUpdated(BluetoothDevice device); 30 } 31 getBatteryLevel(BluetoothDevice device)32 int getBatteryLevel(BluetoothDevice device); 33 mapBatteryLevel(Context context, BluetoothDevice device, int level)34 String mapBatteryLevel(Context context, BluetoothDevice device, int level); 35 getVersion(BluetoothDevice device)36 Version getVersion(BluetoothDevice device); 37 hasUpgrade(BluetoothDevice device)38 boolean hasUpgrade(BluetoothDevice device); 39 isBatteryLow(BluetoothDevice device)40 boolean isBatteryLow(BluetoothDevice device); 41 getDfuState(BluetoothDevice device)42 DfuResult getDfuState(BluetoothDevice device); 43 startDfu(BluetoothDevice device)44 void startDfu(BluetoothDevice device); 45 connectDevice(BluetoothDevice device)46 void connectDevice(BluetoothDevice device); 47 disconnectDevice(BluetoothDevice device)48 void disconnectDevice(BluetoothDevice device); 49 forgetDevice(BluetoothDevice device)50 void forgetDevice(BluetoothDevice device); 51 renameDevice(BluetoothDevice device, String newName)52 void renameDevice(BluetoothDevice device, String newName); 53 addListener(Listener listener)54 void addListener(Listener listener); 55 removeListener(Listener listener)56 void removeListener(Listener listener); 57 addListener(DfuManager.Listener listener)58 void addListener(DfuManager.Listener listener); 59 removeListener(DfuManager.Listener listener)60 void removeListener(DfuManager.Listener listener); 61 } 62