android.bluetooth.BluetoothHidDeviceAppQosSettings

Here are the examples of the java api android.bluetooth.BluetoothHidDeviceAppQosSettings taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

18 Source : Constants.java
with Apache License 2.0
from ginkage

/**
 * Handy constants for the HID Report Descriptor and SDP configuration.
 */
clreplaced Constants {

    static final byte ID_KEYBOARD = 1;

    static final byte ID_MOUSE = 2;

    static final byte ID_BATTERY = 32;

    private static final byte[] HIDD_REPORT_DESC = { // Keyboard
    // Usage page (Generic Desktop)
    (byte) 0x05, // Usage page (Generic Desktop)
    (byte) 0x01, // Usage (Keyboard)
    (byte) 0x09, // Usage (Keyboard)
    (byte) 0x06, // Collection (Application)
    (byte) 0xA1, // Collection (Application)
    (byte) 0x01, // Report ID
    (byte) 0x85, // Report ID
    ID_KEYBOARD, // Usage page (Key Codes)
    (byte) 0x05, // Usage page (Key Codes)
    (byte) 0x07, // Usage minimum (224)
    (byte) 0x19, // Usage minimum (224)
    (byte) 0xE0, // Usage maximum (231)
    (byte) 0x29, // Usage maximum (231)
    (byte) 0xE7, // Logical minimum (0)
    (byte) 0x15, // Logical minimum (0)
    (byte) 0x00, // Logical maximum (1)
    (byte) 0x25, // Logical maximum (1)
    (byte) 0x01, // Report size (1)
    (byte) 0x75, // Report size (1)
    (byte) 0x01, // Report count (8)
    (byte) 0x95, // Report count (8)
    (byte) 0x08, // Input (Data, Variable, Absolute) ; Modifier byte
    (byte) 0x81, // Input (Data, Variable, Absolute) ; Modifier byte
    (byte) 0x02, // Report size (8)
    (byte) 0x75, // Report size (8)
    (byte) 0x08, // Report count (1)
    (byte) 0x95, // Report count (1)
    (byte) 0x01, // Input (Constant)                 ; Reserved byte
    (byte) 0x81, // Input (Constant)                 ; Reserved byte
    (byte) 0x01, // Report size (8)
    (byte) 0x75, // Report size (8)
    (byte) 0x08, // Report count (6)
    (byte) 0x95, // Report count (6)
    (byte) 0x06, // Logical Minimum (0)
    (byte) 0x15, // Logical Minimum (0)
    (byte) 0x00, // Logical Maximum (101)
    (byte) 0x25, // Logical Maximum (101)
    (byte) 0x65, // Usage page (Key Codes)
    (byte) 0x05, // Usage page (Key Codes)
    (byte) 0x07, // Usage Minimum (0)
    (byte) 0x19, // Usage Minimum (0)
    (byte) 0x00, // Usage Maximum (101)
    (byte) 0x29, // Usage Maximum (101)
    (byte) 0x65, // Input (Data, Array)              ; Key array (6 keys)
    (byte) 0x81, // Input (Data, Array)              ; Key array (6 keys)
    (byte) 0x00, // End Collection
    (byte) 0xC0, // Mouse
    // Usage Page (Generic Desktop)
    (byte) 0x05, // Usage Page (Generic Desktop)
    (byte) 0x01, // Usage (Mouse)
    (byte) 0x09, // Usage (Mouse)
    (byte) 0x02, // Collection (Application)
    (byte) 0xA1, // Collection (Application)
    (byte) 0x01, // Report ID
    (byte) 0x85, // Report ID
    ID_MOUSE, // Usage (Pointer)
    (byte) 0x09, // Usage (Pointer)
    (byte) 0x01, // Collection (Physical)
    (byte) 0xA1, // Collection (Physical)
    (byte) 0x00, // Usage Page (Buttons)
    (byte) 0x05, // Usage Page (Buttons)
    (byte) 0x09, // Usage minimum (1)
    (byte) 0x19, // Usage minimum (1)
    (byte) 0x01, // Usage maximum (3)
    (byte) 0x29, // Usage maximum (3)
    (byte) 0x03, // Logical minimum (0)
    (byte) 0x15, // Logical minimum (0)
    (byte) 0x00, // Logical maximum (1)
    (byte) 0x25, // Logical maximum (1)
    (byte) 0x01, // Report size (1)
    (byte) 0x75, // Report size (1)
    (byte) 0x01, // Report count (3)
    (byte) 0x95, // Report count (3)
    (byte) 0x03, // Input (Data, Variable, Absolute)
    (byte) 0x81, // Input (Data, Variable, Absolute)
    (byte) 0x02, // Report size (5)
    (byte) 0x75, // Report size (5)
    (byte) 0x05, // Report count (1)
    (byte) 0x95, // Report count (1)
    (byte) 0x01, // Input (constant)                 ; 5 bit padding
    (byte) 0x81, // Input (constant)                 ; 5 bit padding
    (byte) 0x01, // Usage page (Generic Desktop)
    (byte) 0x05, // Usage page (Generic Desktop)
    (byte) 0x01, // Usage (X)
    (byte) 0x09, // Usage (X)
    (byte) 0x30, // Usage (Y)
    (byte) 0x09, // Usage (Y)
    (byte) 0x31, // Usage (Wheel)
    (byte) 0x09, // Usage (Wheel)
    (byte) 0x38, // Logical minimum (-127)
    (byte) 0x15, // Logical minimum (-127)
    (byte) 0x81, // Logical maximum (127)
    (byte) 0x25, // Logical maximum (127)
    (byte) 0x7F, // Report size (8)
    (byte) 0x75, // Report size (8)
    (byte) 0x08, // Report count (3)
    (byte) 0x95, // Report count (3)
    (byte) 0x03, // Input (Data, Variable, Relative)
    (byte) 0x81, // Input (Data, Variable, Relative)
    (byte) 0x06, // End Collection
    (byte) 0xC0, // End Collection
    (byte) 0xC0, // Battery
    // Usage page (Consumer)
    (byte) 0x05, // Usage page (Consumer)
    (byte) 0x0C, // Usage (Consumer Control)
    (byte) 0x09, // Usage (Consumer Control)
    (byte) 0x01, // Collection (Application)
    (byte) 0xA1, // Collection (Application)
    (byte) 0x01, // Report ID
    (byte) 0x85, // Report ID
    ID_BATTERY, // Usage page (Generic Desktop)
    (byte) 0x05, // Usage page (Generic Desktop)
    (byte) 0x01, // Usage (Keyboard)
    (byte) 0x09, // Usage (Keyboard)
    (byte) 0x06, // Collection (Logical)
    (byte) 0xA1, // Collection (Logical)
    (byte) 0x02, // Usage page (Generic Device Controls)
    (byte) 0x05, // Usage page (Generic Device Controls)
    (byte) 0x06, // Usage (Battery Strength)
    (byte) 0x09, // Usage (Battery Strength)
    (byte) 0x20, // Logical minimum (0)
    (byte) 0x15, // Logical minimum (0)
    (byte) 0x00, // Logical maximum (255)
    (byte) 0x26, // Logical maximum (255)
    (byte) 0xff, // Logical maximum (255)
    (byte) 0x00, // Report size (8)
    (byte) 0x75, // Report size (8)
    (byte) 0x08, // Report count (3)
    (byte) 0x95, // Report count (3)
    (byte) 0x01, // Input (Data, Variable, Absolute)
    (byte) 0x81, // Input (Data, Variable, Absolute)
    (byte) 0x02, // End Collection
    (byte) 0xC0, // End Collection
    (byte) 0xC0 };

    private static final String SDP_NAME = "Wear Input";

    private static final String SDP_DESCRIPTION = "Wear OS HID Device";

    private static final String SDP_PROVIDER = "Google Inc.";

    // 9 bytes * 1000000 us / 11250 us
    private static final int QOS_TOKEN_RATE = 800;

    private static final int QOS_TOKEN_BUCKET_SIZE = 9;

    private static final int QOS_PEAK_BANDWIDTH = 0;

    private static final int QOS_LATENCY = 11250;

    static final BluetoothHidDeviceAppSdpSettings SDP_RECORD = new BluetoothHidDeviceAppSdpSettings(Constants.SDP_NAME, Constants.SDP_DESCRIPTION, Constants.SDP_PROVIDER, BluetoothHidDevice.SUBCLreplaced1_COMBO, Constants.HIDD_REPORT_DESC);

    static final BluetoothHidDeviceAppQosSettings QOS_OUT = new BluetoothHidDeviceAppQosSettings(BluetoothHidDeviceAppQosSettings.SERVICE_BEST_EFFORT, Constants.QOS_TOKEN_RATE, Constants.QOS_TOKEN_BUCKET_SIZE, Constants.QOS_PEAK_BANDWIDTH, Constants.QOS_LATENCY, BluetoothHidDeviceAppQosSettings.MAX);
}