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

Method writeAttributeUUID

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

Source from the content-addressed store, hash-verified

1581 file.line("");
1582 }
1583 writeAttributeUUID(file, attribute, index, prefix) {
1584 let uuid = attribute.uuid;
1585 if (4 == uuid.length)
1586 file.line(`static const uint16_t ${prefix}_uuid${index} = 0x${uuid};`);
1587 else if (36 == uuid.length) {
1588 file.write(`static const uint8_t ${prefix}_uuid${index}[16] = { `);
1589 file.write(buffer2hexlist(uuid128toBuffer(uuid)));
1590 file.write(" };");
1591 file.line("");
1592 }
1593 else
1594 throw new Error("unsupported UUID length");
1595 }
1596 writeAttributeHandle(file, attribute, index, prefix) {
1597 file.line(`static const uint16_t ${prefix}_handle${index};`);
1598 }

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