summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothHidDeviceCallback.java
diff options
context:
space:
mode:
authorIvan Podogov <ginkage@google.com>2018-02-27 17:58:16 +0000
committerHansong Zhang <hsz@google.com>2018-03-22 16:29:54 -0700
commit690633fc66ed83b20c75b7e116123ff3e078099f (patch)
tree703b36029bd014bf00952cde331c75cf5b7629b8 /framework/java/android/bluetooth/BluetoothHidDeviceCallback.java
parenta70a16b3e9d2433b7517e679f630d9dab33eea8a (diff)
HIDD: Address API Review concerns
* Replace bare field usage with getter methods; * Remove Builder; * Move BluetoothHidDeviceCallback to inner class; * Remove toArray() and equals(); * Throw IllegalArgumentException where applicable; * Add an Executor parameter before Callback; Bug: 72168436, 72168126 Test: make update-api, make, make sl4a.Common Change-Id: I13095458bf3ded7a376e8d20fd13df12ef426693 (cherry picked from commit f2f5dc355fa9a962ded0d29368535796aa4116d8)
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothHidDeviceCallback.java')
-rw-r--r--framework/java/android/bluetooth/BluetoothHidDeviceCallback.java120
1 files changed, 0 insertions, 120 deletions
diff --git a/framework/java/android/bluetooth/BluetoothHidDeviceCallback.java b/framework/java/android/bluetooth/BluetoothHidDeviceCallback.java
deleted file mode 100644
index e71b00f234..0000000000
--- a/framework/java/android/bluetooth/BluetoothHidDeviceCallback.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.bluetooth;
-
-import android.util.Log;
-
-/**
- * The template class that applications use to call callback functions on events from the HID host.
- * Callback functions are wrapped in this class and registered to the Android system during app
- * registration.
- *
- * <p>{@see BluetoothHidDevice}
- */
-public abstract class BluetoothHidDeviceCallback {
-
- private static final String TAG = "BluetoothHidDevCallback";
-
- /**
- * Callback called when application registration state changes. Usually it's called due to
- * either {@link BluetoothHidDevice#registerApp (String, String, String, byte, byte[],
- * BluetoothHidDeviceCallback)} or {@link BluetoothHidDevice#unregisterApp()} , but can be also
- * unsolicited in case e.g. Bluetooth was turned off in which case application is unregistered
- * automatically.
- *
- * @param pluggedDevice {@link BluetoothDevice} object which represents host that currently has
- * Virtual Cable established with device. Only valid when application is registered, can be
- * <code>null</code>.
- * @param registered <code>true</code> if application is registered, <code>false</code>
- * otherwise.
- */
- public void onAppStatusChanged(BluetoothDevice pluggedDevice, boolean registered) {
- Log.d(TAG,
- "onAppStatusChanged: pluggedDevice=" + pluggedDevice + " registered=" + registered);
- }
-
- /**
- * Callback called when connection state with remote host was changed. Application can assume
- * than Virtual Cable is established when called with {@link BluetoothProfile#STATE_CONNECTED}
- * <code>state</code>.
- *
- * @param device {@link BluetoothDevice} object representing host device which connection state
- * was changed.
- * @param state Connection state as defined in {@link BluetoothProfile}.
- */
- public void onConnectionStateChanged(BluetoothDevice device, int state) {
- Log.d(TAG, "onConnectionStateChanged: device=" + device + " state=" + state);
- }
-
- /**
- * Callback called when GET_REPORT is received from remote host. Should be replied by
- * application using {@link BluetoothHidDevice#replyReport(BluetoothDevice, byte, byte,
- * byte[])}.
- *
- * @param type Requested Report Type.
- * @param id Requested Report Id, can be 0 if no Report Id are defined in descriptor.
- * @param bufferSize Requested buffer size, application shall respond with at least given number
- * of bytes.
- */
- public void onGetReport(BluetoothDevice device, byte type, byte id, int bufferSize) {
- Log.d(TAG, "onGetReport: device=" + device + " type=" + type + " id=" + id + " bufferSize="
- + bufferSize);
- }
-
- /**
- * Callback called when SET_REPORT is received from remote host. In case received data are
- * invalid, application shall respond with {@link
- * BluetoothHidDevice#reportError(BluetoothDevice, byte)}.
- *
- * @param type Report Type.
- * @param id Report Id.
- * @param data Report data.
- */
- public void onSetReport(BluetoothDevice device, byte type, byte id, byte[] data) {
- Log.d(TAG, "onSetReport: device=" + device + " type=" + type + " id=" + id);
- }
-
- /**
- * Callback called when SET_PROTOCOL is received from remote host. Application shall use this
- * information to send only reports valid for given protocol mode. By default, {@link
- * BluetoothHidDevice#PROTOCOL_REPORT_MODE} shall be assumed.
- *
- * @param protocol Protocol Mode.
- */
- public void onSetProtocol(BluetoothDevice device, byte protocol) {
- Log.d(TAG, "onSetProtocol: device=" + device + " protocol=" + protocol);
- }
-
- /**
- * Callback called when report data is received over interrupt channel. Report Type is assumed
- * to be {@link BluetoothHidDevice#REPORT_TYPE_OUTPUT}.
- *
- * @param reportId Report Id.
- * @param data Report data.
- */
- public void onInterruptData(BluetoothDevice device, byte reportId, byte[] data) {
- Log.d(TAG, "onInterruptData: device=" + device + " reportId=" + reportId);
- }
-
- /**
- * Callback called when Virtual Cable is removed. After this callback is
- * received connection will be disconnected automatically.
- */
- public void onVirtualCableUnplug(BluetoothDevice device) {
- Log.d(TAG, "onVirtualCableUnplug: device=" + device);
- }
-}