I'll create an HTML program that attempts to read data from Bluetooth HID devices (mouse and keyboard) using the Web Bluetooth API. However, it's important to note that **Safari has very limited support for Web Bluetooth**, especially for HID devices. This solution will work best in Chrome/Edge browsers.
```html
Bluetooth HID Reader
Bluetooth HID Device Reader
Important: This works best in Chrome/Edge. Safari has limited Bluetooth support.
Not connected
Device Information
Instructions:
Click "Connect Bluetooth Device"
Select your Bluetooth mouse or keyboard when prompted
Move your mouse or press keys to see data
Data will appear in the terminal below
Incoming Data
Waiting for device connection...
```
## Important Notes:
1. **Browser Compatibility**:
- Works best in **Chrome** and **Edge** browsers
- **Safari has very limited support** for Web Bluetooth API
- Firefox doesn't support Web Bluetooth at all
2. **Device Requirements**:
- Devices must support Bluetooth HID (Human Interface Device) profile
- Must be paired with your computer beforehand
- Some devices may require special drivers or configurations
3. **How to Use**:
1. Open in Chrome/Edge browser
2. Click "Connect Bluetooth Device"
3. Select your mouse/keyboard when prompted
4. Move your mouse or press keys to see data
5. Data appears in the terminal with timestamps
4. **Data Interpretation**:
- Shows raw hex data from the device
- Attempts basic interpretation for mouse movement and keyboard keys
- Actual data format depends on the specific device's HID report descriptor
5. **Limitations**:
- Safari users will see a "Web Bluetooth not supported" message
- Some devices may not be discoverable through this API
- Data interpretation is basic - full HID parsing is complex
For Safari users, this solution won't work due to Apple's limited implementation of Web Bluetooth. Alternative solutions would require native app development using Core Bluetooth framework.