MCPcopy Index your code
hub / github.com/Moddable-OpenSource/moddable / writeAttributeUUID

Method writeAttributeUUID

tools/bles2gatt.js:325–337  ·  view source on GitHub ↗
(file, attribute, index, prefix)

Source from the content-addressed store, hash-verified

323 file.line("");
324 }
325 writeAttributeUUID(file, attribute, index, prefix) {
326 let uuid = attribute.uuid;
327 if (4 == uuid.length)
328 file.line(`static const uint16_t ${prefix}_uuid${index} = 0x${uuid};`);
329 else if (36 == uuid.length) {
330 file.write(`static const uint8_t ${prefix}_uuid${index}[16] = { `);
331 file.write(buffer2hexlist(uuid128toBuffer(uuid)));
332 file.write(" };");
333 file.line("");
334 }
335 else
336 throw new Error("unsupported UUID length");
337 }
338};
339
340class NimBLEGATTFile extends ESP32GATTFile {

Callers 1

generateMethod · 0.95

Calls 4

buffer2hexlistFunction · 0.85
uuid128toBufferFunction · 0.85
writeMethod · 0.65
lineMethod · 0.45

Tested by

no test coverage detected