Skip to content

Commit

Permalink
Merge pull request #501 from doudar/IC4_BLE_SCANNER_FIX
Browse files Browse the repository at this point in the history
Fixes #500
  • Loading branch information
doudar authored Dec 5, 2023
2 parents ebc2d08 + 604f28c commit a1b02da
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated kit purchasing links.
- MIN_ERG_CADENCE created and changed from 20 to 30.
- Fixed DNS server in AP mode.
- Fixed an issue with IC4 and variants not displaying device name in Bluetooth scanner. Fixes #500

### Hardware
- Wire diameter reduced from 7.2mm to 6.0mm on the window passthrough to accommodate the latest batch of cables.
Expand Down
2 changes: 1 addition & 1 deletion data/bluetoothscanner.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ <h2>
else if (t_obj[key].address) {
optionRemote.text = t_obj[key].address;
}
optionRemote.selected;
remoteDropdown.add(optionRemote);
}
}
Expand All @@ -202,6 +201,7 @@ <h2>
let noneOptionHR = document.createElement('option');
noneOptionHR.text = 'none';
let noneOptionRemote = document.createElement('option');
noneOptionRemote.selected;
noneOptionRemote.text = 'none';
PMDropdown.add(noneOptionPM);
HRDropdown.add(noneOptionHR);
Expand Down
41 changes: 22 additions & 19 deletions lib/SS2K/include/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
#define SMARTSPIN2K_SERVICE_UUID NimBLEUUID("77776277-7877-7774-4466-896665500000")
#define SMARTSPIN2K_CHARACTERISTIC_UUID NimBLEUUID("77776277-7877-7774-4466-896665500001")

// Device Information Service
#define DEVICEINFORMATIONSERVICE_UUID NimBLEUUID((uint16_t)0x180A)

// Heart Service
#define HEARTSERVICE_UUID NimBLEUUID((uint16_t)0x180D)
#define HEARTCHARACTERISTIC_UUID NimBLEUUID((uint16_t)0x2A37)

//BatteryLevel Service
#define BATTERYSERVICE_UUID NimBLEUUID((uint16_t)0x180F) // heart rate sensor service uuid, as defined in gatt specifications
#define BATTERYCHARACTERISTIC_UUID NimBLEUUID ((uint16_t)0x2A19)
// BatteryLevel Service
#define BATTERYSERVICE_UUID NimBLEUUID((uint16_t)0x180F) // heart rate sensor service uuid, as defined in gatt specifications
#define BATTERYCHARACTERISTIC_UUID NimBLEUUID((uint16_t)0x2A19)

// Cycling Power Service
#define CSCSERVICE_UUID NimBLEUUID((uint16_t)0x1816)
Expand Down Expand Up @@ -66,21 +69,21 @@
#define PELOTON_REQ_POS 1
#define PELOTON_CHECKSUM_POS 2

//BLE HID
#define APPEARANCE_HID_GENERIC_UUID NimBLEUUID((uint16_t)0x3C0)
#define APPEARANCE_HID_KEYBOARD_UUID NimBLEUUID((uint16_t)0x3C1)
#define APPEARANCE_HID_MOUSE_UUID NimBLEUUID((uint16_t) 0x3C2)
#define APPEARANCE_HID_JOYSTICK_UUID NimBLEUUID((uint16_t)0x3C3)
#define APPEARANCE_HID_GAMEPAD_UUID NimBLEUUID((uint16_t)0x3C4)
#define APPEARANCE_HID_DIGITIZER_TABLET_UUID NimBLEUUID((uint16_t)0x3C5)
#define APPEARANCE_HID_CARD_READER_UUID NimBLEUUID((uint16_t)0x3C6)
#define APPEARANCE_HID_DIGITAL_PEN_UUID NimBLEUUID((uint16_t)0x3C7)
#define APPEARANCE_HID_BARCODE_SCANNER_UUID NimBLEUUID((uint16_t)0x3C8)
#define APPEARANCE_HID_TOUCHPAD_UUID NimBLEUUID((uint16_t)0x3C9)
#define APPEARANCE_HID_PRESENTATION_REMOTE_UUID NimBLEUUID((uint16_t)0x3CA)
// BLE HID
#define APPEARANCE_HID_GENERIC_UUID NimBLEUUID((uint16_t)0x3C0)
#define APPEARANCE_HID_KEYBOARD_UUID NimBLEUUID((uint16_t)0x3C1)
#define APPEARANCE_HID_MOUSE_UUID NimBLEUUID((uint16_t)0x3C2)
#define APPEARANCE_HID_JOYSTICK_UUID NimBLEUUID((uint16_t)0x3C3)
#define APPEARANCE_HID_GAMEPAD_UUID NimBLEUUID((uint16_t)0x3C4)
#define APPEARANCE_HID_DIGITIZER_TABLET_UUID NimBLEUUID((uint16_t)0x3C5)
#define APPEARANCE_HID_CARD_READER_UUID NimBLEUUID((uint16_t)0x3C6)
#define APPEARANCE_HID_DIGITAL_PEN_UUID NimBLEUUID((uint16_t)0x3C7)
#define APPEARANCE_HID_BARCODE_SCANNER_UUID NimBLEUUID((uint16_t)0x3C8)
#define APPEARANCE_HID_TOUCHPAD_UUID NimBLEUUID((uint16_t)0x3C9)
#define APPEARANCE_HID_PRESENTATION_REMOTE_UUID NimBLEUUID((uint16_t)0x3CA)

#define HID_SERVICE_UUID NimBLEUUID((uint16_t)0x1812)
#define HID_INFORMATION_UUID NimBLEUUID((uint16_t)0x2A4A)
#define HID_REPORT_MAP_UUID NimBLEUUID((uint16_t)0x2A4B)
#define HID_SERVICE_UUID NimBLEUUID((uint16_t)0x1812)
#define HID_INFORMATION_UUID NimBLEUUID((uint16_t)0x2A4A)
#define HID_REPORT_MAP_UUID NimBLEUUID((uint16_t)0x2A4B)
#define HID_CONTROL_POINT_UUID NimBLEUUID((uint16_t)0x2A4C)
#define HID_REPORT_DATA_UUID NimBLEUUID((uint16_t)0x2A4D)
#define HID_REPORT_DATA_UUID NimBLEUUID((uint16_t)0x2A4D)
10 changes: 9 additions & 1 deletion src/BLE_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,14 @@ void SpinBLEClient::scanProcess(int duration) {
}

if (d.haveServiceUUID()) {
devices[device]["UUID"] = d.getServiceUUID().toString();
// Workaround for IC4 advertising this service first instead of FTMS.
// Potentially others may need to be added in the future.
// The symptom was the bike name not showing up in the HTML.
if (d.getServiceUUID() == DEVICEINFORMATIONSERVICE_UUID) {
devices[device]["UUID"] = FITNESSMACHINESERVICE_UUID.toString();
} else {
devices[device]["UUID"] = d.getServiceUUID().toString();
}
}
}
}
Expand Down Expand Up @@ -532,6 +539,7 @@ void SpinBLEClient::resetDevices(NimBLEClient *pClient) {
}
}

// Control a connected FTMS trainer. If no args are passed, treat it like an external stepper motor.
void SpinBLEClient::FTMSControlPointWrite(const uint8_t *pData, int length) {
NimBLEClient *pClient = nullptr;
for (int i = 0; i < NUM_BLE_DEVICES; i++) {
Expand Down

0 comments on commit a1b02da

Please sign in to comment.