Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72283a33 authored by Hemant Gupta's avatar Hemant Gupta Committed by Steve Kondik
Browse files

Bluetooth: HID-C: Add support for error parameter for reportError

This patch adds support for error parameter in reportError providing
better flexibiltiy to application to respond to errors for Set Report
received from HID Host.

Change-Id: Ieada7be8a6a91d310f20849af9e5a9b04766f4a5
CRs-Fixed: 595139
parent 2a4c5f6a
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -69,6 +69,18 @@ public final class BluetoothHidDevice implements BluetoothProfile {
    public static final byte REPORT_TYPE_OUTPUT = (byte) 2;
    public static final byte REPORT_TYPE_FEATURE = (byte) 3;

    /**
     * Constants representing error response for Set Report.
     *
     * @see BluetoothHidDeviceCallback#onSetReport(byte, byte, byte[])
     */
    public static final byte ERROR_RSP_SUCCESS = (byte) 0;
    public static final byte ERROR_RSP_NOT_READY = (byte) 1;
    public static final byte ERROR_RSP_INVALID_RPT_ID = (byte) 2;
    public static final byte ERROR_RSP_UNSUPPORTED_REQ = (byte) 3;
    public static final byte ERROR_RSP_INVALID_PARAM = (byte) 4;
    public static final byte ERROR_RSP_UNKNOWN = (byte) 14;

    /**
     * Constants representing protocol mode used set by host. Default is always
     * {@link #PROTOCOL_REPORT_MODE} unless notified otherwise.
@@ -386,16 +398,17 @@ public final class BluetoothHidDevice implements BluetoothProfile {
     * Sends error handshake message as reply for invalid SET_REPORT request
     * from {@link BluetoothHidDeviceCallback#onSetReport(byte, byte, byte[])}.
     *
     * @param error Error to be sent for SET_REPORT via HANDSHAKE.
     * @return
     */
    public boolean reportError() {
        Log.v(TAG, "reportError()");
    public boolean reportError(byte error) {
        Log.v(TAG, "reportError(): error = " + error);

        boolean result = false;

        if (mService != null) {
            try {
                result = mService.reportError();
                result = mService.reportError(error);
            } catch (RemoteException e) {
                Log.e(TAG, e.toString());
            }
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ interface IBluetoothHidDevice {
    boolean unregisterApp(in BluetoothHidDeviceAppConfiguration config);
    boolean sendReport(in int id, in byte[] data);
    boolean replyReport(in byte type, in byte id, in byte[] data);
    boolean reportError();
    boolean reportError(byte error);
    boolean unplug();
    boolean connect();
    boolean disconnect();