MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / set

Method set

modules/network/ble/hid-client/hidclient.js:291–310  ·  view source on GitHub ↗
(usageID, device, reports)

Source from the content-addressed store, hash-verified

289 }
290 }
291 static set(usageID, device, reports) {
292 const length = 13 + ((1 + 2) * reports.length);
293 let entry = new Uint8Array(length);
294 let index = 0;
295 entry[index++] = length;
296 entry.set(new Uint8Array(device.address), index);
297 index += 6;
298 entry[index++] = device.addressType;
299 entry[index++] = device.services[0].start & 0xFF;
300 entry[index++] = (device.services[0].start >> 8) & 0xFF;
301 entry[index++] = device.services[0].end & 0xFF;
302 entry[index++] = (device.services[0].end >> 8) & 0xFF;
303 entry[index++] = reports.length;
304 reports.forEach(report => {
305 entry[index++] = report.reportType;
306 entry[index++] = report.characteristic.handle & 0xFF;
307 entry[index++] = (report.characteristic.handle >> 8) & 0xFF;
308 });
309 Preference.set(Bonded.PREFERENCE_DOMAIN, Bonded.key(usageID), entry.buffer);
310 }
311 static remove(usageID) {
312 const bonded = Bonded.get(usageID);
313 if (undefined !== bonded)

Callers

nothing calls this directly

Calls 2

setMethod · 0.65
keyMethod · 0.45

Tested by

no test coverage detected