arduino-libraries/ArduinoBLE

cannot subscribe BOOT_MOUSE_INPUT_REPORT

henry63 opened this issue · 1 comments

In a project for disabled persons, I am trying to read the values send by a bluetooth mouse.
(the aim of the project is to convert the electronic wheelchair integrated joystick - behaving like a mouse - to directional keys , for a specific app)

I connect to a bluetooth mouse and try to put in BOOT Mouse Input protocol mode and subscribe to BOOT_MOUSE_INPUT_REPORT characteristic (uuid 2a33) to get the 4 bytes packet describing the mouse movements.

In the mail loop:

if (peripheral.discoverAttributes()) {
      Serial.println("Attributes discovered");
    } else {
      Serial.println("Attribute discovery failed!");
      peripheral.disconnect();
      return;
    }
    //explorerPeripheral(peripheral);
    rif (peripheral.discoverAttributes()) {
      Serial.println("Attributes discovered");
    } else {
      Serial.println("Attribute discovery failed!");
      peripheral.disconnect();
      return;
    }
    /readXXX writeXX subscribeXXX are functions that wrap the neccesary code
    readCharacteristic(peripheral, SERVICE_UUID_BATTERY, CHARACTERISTIC_UUID_BATTERY_LEVEL);
    writeCharacteristic(peripheral, SERVICE_UUID_HUMAN_INTERFACE_DEVICE, CHARACTERISTIC_UUID_PROTOCOL_MODE, (byte)0x00);
    BLECharacteristic bootCharacteristic = subscribeCharacteristic(peripheral, SERVICE_UUID_HUMAN_INTERFACE_DEVICE, CHARACTERISTIC_UUID_BOOT_MOUSE_INPUT_REPORT);
    bootCharacteristic.setEventHandler(BLEWritten, characteristicEventHandler);

and I have an event handler :

void characteristicEventHandler(BLEDevice central, BLECharacteristic characteristic) {
  Serial.print("Characteristic event, written: ");
  printData(characteristic.value(), characteristic.valueLength());
}

So far, nothing happens.
I must admit I am completely lost. I am lacking an example of such code, and the documentation is terse on that issue.

Hi @henry63. Thanks for your interest in this open source project. This issue tracker is only to be used to report bugs or feature requests specific to the project. This topic is more appropriate for the Arduino Forum. I'm sure we will be able to help you out over there:

https://forum.arduino.cc/