I would like to be able to use BT mouse clicks and wheel scrolls as inputs in my App. I did some testing but I cannot do it without help from someone more experienced.
I know how to connect a BT device to the OS and to my App. I also know how to read and write data to a BT device (other than a mouse) that accepts strings or binary data.
However, when a BT mouse is connected, with App Inventor blocks, there seems to be no way to read the outputs (clicks/scrolls) of a BT mouse. The mouse just acts as a pointer but I cannot read its buttons/wheels states.
Can this be done? Is there maybe an extension that allows for this?
I would also like to know if it is possible for an App to disregard the mouse pointer (the visual pointer) - so that I could read the events like clicks but not see the pointer, its movements and it actions, in my App.
I’m afraid that it will be a bit difficult: you have to search the web about the HID (Human Interface Device) standard and annexed protocol. In particular it seems that the BT mice shall comply with the HoG (HID over GATT). The frame sent by the BT mouse contains several parts (Reports) as Report Descriptor, Input/Output/Feature Report and HID Usage Tables (HUD).
All that seems to be far-far-away from a simple implementation !
Most probably if you are a bit aware of the Arduino world it is simpler to create your own remote puhbuttons box with a Nano ESP32 a 3 VDc battery a little plastic box and two (or how much you need) pushbuttons.
What a shame. I hoped to use a mouse as a sensor rather than have to build my own based on esp.
I was not aware that a BT USB mouse protocol is so far more complex than a wired USB mouse protocol (which is just a plain serial protocol). And I hoped a solution is available, perhaps via an extension or with one of the tricks that experienced App Inventor coders know.
Thank you very much for the explanation and for your response !!
I didn't want to block your project, and what I wrote in my post is what I found on the web, it's not from my direct experience, but BT mice are certainly interfaced by operating systems as HID peripherals, hence the need to implement the same protocol
I agree that a wired mouse could have a simpler interface, but unless your project could allow a wired “sensor” I believe that you shall comply with HID.
My confusion likely came from BT mice often being referred to as ‘BT serial mouse’. But clearly this is not like serial wired signal. Would be very convenient to have an App Inventor plugin that could read a BT mouse giving us blocks for mouse data just like we get with BT server/client blocks for strings and bytes. This would open the door to projects that want to use a BT mouse as input. For there are many things one could read like that (distance, angle, movement, etc.) without building our own sensors based in Arduino hardware.