Skip to content

Commit a1b02da

Browse files
authored
Merge pull request #501 from doudar/IC4_BLE_SCANNER_FIX
Fixes #500
2 parents ebc2d08 + 604f28c commit a1b02da

File tree

4 files changed

+33
-21
lines changed

4 files changed

+33
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Updated kit purchasing links.
1212
- MIN_ERG_CADENCE created and changed from 20 to 30.
1313
- Fixed DNS server in AP mode.
14+
- Fixed an issue with IC4 and variants not displaying device name in Bluetooth scanner. Fixes #500
1415

1516
### Hardware
1617
- Wire diameter reduced from 7.2mm to 6.0mm on the window passthrough to accommodate the latest batch of cables.

data/bluetoothscanner.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ <h2>
177177
else if (t_obj[key].address) {
178178
optionRemote.text = t_obj[key].address;
179179
}
180-
optionRemote.selected;
181180
remoteDropdown.add(optionRemote);
182181
}
183182
}
@@ -202,6 +201,7 @@ <h2>
202201
let noneOptionHR = document.createElement('option');
203202
noneOptionHR.text = 'none';
204203
let noneOptionRemote = document.createElement('option');
204+
noneOptionRemote.selected;
205205
noneOptionRemote.text = 'none';
206206
PMDropdown.add(noneOptionPM);
207207
HRDropdown.add(noneOptionHR);

lib/SS2K/include/Constants.h

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
#define SMARTSPIN2K_SERVICE_UUID NimBLEUUID("77776277-7877-7774-4466-896665500000")
1414
#define SMARTSPIN2K_CHARACTERISTIC_UUID NimBLEUUID("77776277-7877-7774-4466-896665500001")
1515

16+
// Device Information Service
17+
#define DEVICEINFORMATIONSERVICE_UUID NimBLEUUID((uint16_t)0x180A)
18+
1619
// Heart Service
1720
#define HEARTSERVICE_UUID NimBLEUUID((uint16_t)0x180D)
1821
#define HEARTCHARACTERISTIC_UUID NimBLEUUID((uint16_t)0x2A37)
1922

20-
//BatteryLevel Service
21-
#define BATTERYSERVICE_UUID NimBLEUUID((uint16_t)0x180F) // heart rate sensor service uuid, as defined in gatt specifications
22-
#define BATTERYCHARACTERISTIC_UUID NimBLEUUID ((uint16_t)0x2A19)
23+
// BatteryLevel Service
24+
#define BATTERYSERVICE_UUID NimBLEUUID((uint16_t)0x180F) // heart rate sensor service uuid, as defined in gatt specifications
25+
#define BATTERYCHARACTERISTIC_UUID NimBLEUUID((uint16_t)0x2A19)
2326

2427
// Cycling Power Service
2528
#define CSCSERVICE_UUID NimBLEUUID((uint16_t)0x1816)
@@ -66,21 +69,21 @@
6669
#define PELOTON_REQ_POS 1
6770
#define PELOTON_CHECKSUM_POS 2
6871

69-
//BLE HID
70-
#define APPEARANCE_HID_GENERIC_UUID NimBLEUUID((uint16_t)0x3C0)
71-
#define APPEARANCE_HID_KEYBOARD_UUID NimBLEUUID((uint16_t)0x3C1)
72-
#define APPEARANCE_HID_MOUSE_UUID NimBLEUUID((uint16_t) 0x3C2)
73-
#define APPEARANCE_HID_JOYSTICK_UUID NimBLEUUID((uint16_t)0x3C3)
74-
#define APPEARANCE_HID_GAMEPAD_UUID NimBLEUUID((uint16_t)0x3C4)
75-
#define APPEARANCE_HID_DIGITIZER_TABLET_UUID NimBLEUUID((uint16_t)0x3C5)
76-
#define APPEARANCE_HID_CARD_READER_UUID NimBLEUUID((uint16_t)0x3C6)
77-
#define APPEARANCE_HID_DIGITAL_PEN_UUID NimBLEUUID((uint16_t)0x3C7)
78-
#define APPEARANCE_HID_BARCODE_SCANNER_UUID NimBLEUUID((uint16_t)0x3C8)
79-
#define APPEARANCE_HID_TOUCHPAD_UUID NimBLEUUID((uint16_t)0x3C9)
80-
#define APPEARANCE_HID_PRESENTATION_REMOTE_UUID NimBLEUUID((uint16_t)0x3CA)
72+
// BLE HID
73+
#define APPEARANCE_HID_GENERIC_UUID NimBLEUUID((uint16_t)0x3C0)
74+
#define APPEARANCE_HID_KEYBOARD_UUID NimBLEUUID((uint16_t)0x3C1)
75+
#define APPEARANCE_HID_MOUSE_UUID NimBLEUUID((uint16_t)0x3C2)
76+
#define APPEARANCE_HID_JOYSTICK_UUID NimBLEUUID((uint16_t)0x3C3)
77+
#define APPEARANCE_HID_GAMEPAD_UUID NimBLEUUID((uint16_t)0x3C4)
78+
#define APPEARANCE_HID_DIGITIZER_TABLET_UUID NimBLEUUID((uint16_t)0x3C5)
79+
#define APPEARANCE_HID_CARD_READER_UUID NimBLEUUID((uint16_t)0x3C6)
80+
#define APPEARANCE_HID_DIGITAL_PEN_UUID NimBLEUUID((uint16_t)0x3C7)
81+
#define APPEARANCE_HID_BARCODE_SCANNER_UUID NimBLEUUID((uint16_t)0x3C8)
82+
#define APPEARANCE_HID_TOUCHPAD_UUID NimBLEUUID((uint16_t)0x3C9)
83+
#define APPEARANCE_HID_PRESENTATION_REMOTE_UUID NimBLEUUID((uint16_t)0x3CA)
8184

82-
#define HID_SERVICE_UUID NimBLEUUID((uint16_t)0x1812)
83-
#define HID_INFORMATION_UUID NimBLEUUID((uint16_t)0x2A4A)
84-
#define HID_REPORT_MAP_UUID NimBLEUUID((uint16_t)0x2A4B)
85+
#define HID_SERVICE_UUID NimBLEUUID((uint16_t)0x1812)
86+
#define HID_INFORMATION_UUID NimBLEUUID((uint16_t)0x2A4A)
87+
#define HID_REPORT_MAP_UUID NimBLEUUID((uint16_t)0x2A4B)
8588
#define HID_CONTROL_POINT_UUID NimBLEUUID((uint16_t)0x2A4C)
86-
#define HID_REPORT_DATA_UUID NimBLEUUID((uint16_t)0x2A4D)
89+
#define HID_REPORT_DATA_UUID NimBLEUUID((uint16_t)0x2A4D)

src/BLE_Client.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,14 @@ void SpinBLEClient::scanProcess(int duration) {
467467
}
468468

469469
if (d.haveServiceUUID()) {
470-
devices[device]["UUID"] = d.getServiceUUID().toString();
470+
// Workaround for IC4 advertising this service first instead of FTMS.
471+
// Potentially others may need to be added in the future.
472+
// The symptom was the bike name not showing up in the HTML.
473+
if (d.getServiceUUID() == DEVICEINFORMATIONSERVICE_UUID) {
474+
devices[device]["UUID"] = FITNESSMACHINESERVICE_UUID.toString();
475+
} else {
476+
devices[device]["UUID"] = d.getServiceUUID().toString();
477+
}
471478
}
472479
}
473480
}
@@ -532,6 +539,7 @@ void SpinBLEClient::resetDevices(NimBLEClient *pClient) {
532539
}
533540
}
534541

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

0 commit comments

Comments
 (0)