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

Method parseProperties

tools/bles2gatt.js:1507–1541  ·  view source on GitHub ↗
(properties)

Source from the content-addressed store, hash-verified

1505 }
1506 }
1507 parseProperties(properties) {
1508 const GATT_CHAR_PROP_BIT_READ = (1 << 1);
1509 const GATT_CHAR_PROP_BIT_WRITE_NR = (1 << 2);
1510 const GATT_CHAR_PROP_BIT_WRITE = (1 << 3);
1511 const GATT_CHAR_PROP_BIT_NOTIFY = (1 << 4);
1512 const GATT_CHAR_PROP_BIT_INDICATE = (1 << 5);
1513 const GATT_CHAR_PROP_BIT_AUTH = (1 << 6);
1514 const GATT_CHAR_PROP_BIT_EXT_PROP = (1 << 7);
1515 let props = 0;
1516 properties.forEach(p => {
1517 switch(p.trim()) {
1518 case "read":
1519 props |= GATT_CHAR_PROP_BIT_READ;
1520 break;
1521 case "write":
1522 props |= GATT_CHAR_PROP_BIT_WRITE;
1523 break;
1524 case "writeNoResponse":
1525 props |= GATT_CHAR_PROP_BIT_WRITE_NR;
1526 break;
1527 case "notify":
1528 props |= GATT_CHAR_PROP_BIT_NOTIFY;
1529 break;
1530 case "indicate":
1531 props |= GATT_CHAR_PROP_BIT_INDICATE;
1532 break;
1533 case "extended":
1534 props |= GATT_CHAR_PROP_BIT_EXT_PROP;
1535 break;
1536 default:
1537 throw new Error("unknown property");
1538 }
1539 });
1540 return props;
1541 }
1542 parsePermissions(permissions) {
1543 let perms = [];
1544 let readPerms = 0;

Callers 1

generateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected