(uuid, index, prefix)
| 1597 | file.line(`static const uint16_t ${prefix}_handle${index};`); |
| 1598 | } |
| 1599 | addUniqueVendorSpecificUUID(uuid, index, prefix) { |
| 1600 | if (36 !== uuid.length) return; |
| 1601 | let vendorSpecificUUIDs = this.vendorSpecificUUIDs; |
| 1602 | let buffer = new Uint8Array(uuid128toBuffer(uuid)); |
| 1603 | let match; |
| 1604 | if ("service" == prefix) { |
| 1605 | match = vendorSpecificUUIDs.find(entry => { entry.buffer[12] == buffer[12] && entry.buffer[13] == buffer[13] }); |
| 1606 | } |
| 1607 | else { |
| 1608 | match = vendorSpecificUUIDs.find(entry => { |
| 1609 | let equal = true; |
| 1610 | for (let i = 0; equal && (i < 16); ++i) { |
| 1611 | if (12 == i || 13 == i) |
| 1612 | continue; |
| 1613 | equal = entry.buffer[i] == buffer[i]; |
| 1614 | } |
| 1615 | return equal; |
| 1616 | }); |
| 1617 | } |
| 1618 | if (!match) |
| 1619 | vendorSpecificUUIDs.push({ index, prefix, buffer }); |
| 1620 | } |
| 1621 | }; |
| 1622 | |
| 1623 | export default class extends TOOL { |
no test coverage detected