зеркало из https://github.com/microsoft/jacdac-ts.git
patch: show device number
This commit is contained in:
Родитель
db78cb6fe8
Коммит
392c8776a0
|
@ -50,7 +50,7 @@
|
|||
div.className = "device";
|
||||
devicesDiv.append(div);
|
||||
}
|
||||
div.innerText = `${device.toString()} - ${device.deviceId}: ${jacdac.printServices(device).toLowerCase()}`;
|
||||
div.innerText = `${device.toString()} - ${device.deviceId}: ${jacdac.printServices(device)}`;
|
||||
}
|
||||
|
||||
function disconnect(device) {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
// if the device is a sensor, start streaming
|
||||
const sensor = jacdac.SensorClient.fromFirstServiceClass(d, jacdac.JD_SERVICE_SLIDER);
|
||||
if (sensor) {
|
||||
log(`start streaming ${d}: ${jacdac.printServices(d).toLowerCase()}`)
|
||||
log(`start streaming ${d}: ${jacdac.printServices(d)}`)
|
||||
sensor.setStreamingAsync(true);
|
||||
}
|
||||
})
|
||||
|
|
|
@ -134,7 +134,7 @@ export function printServices(device: Device) {
|
|||
const n = device.serviceLength;
|
||||
for (let i = 0; i < n; ++i) {
|
||||
const id = device.serviceClassAt(i);
|
||||
const name = serviceName(id);
|
||||
const name = `${i}:${serviceName(id)}`;
|
||||
if (i) srv += ", "
|
||||
srv += name;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче