Help needed for using Bluetooth BLE Boot Mouse Input Report

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;
    }
   
    // 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.

The project link below is to a BLE mouse to USB joystick converter for ESP32-S3. This may work if the wheelchair joystick emulates a BLE mouse. It must be modified if you want USB keyboard output instead. I am interested in which wheelchairs can connect to the ESP32-S3.

THanks a lot. I will delve into it. It look like I could learn a lot from it.

It looks great and fits almost exactly my needs. It is a pity that NimbLE is not available on Arduino R4. However, it is worthwhile moving to an AtomS3.
Thanks a lot.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.