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

Method parseProperties

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

Source from the content-addressed store, hash-verified

247 file.line("");
248 }
249 parseProperties(properties) {
250 const ESP_GATT_CHAR_PROP_BIT_READ = (1 << 1);
251 const ESP_GATT_CHAR_PROP_BIT_WRITE_NR = (1 << 2);
252 const ESP_GATT_CHAR_PROP_BIT_WRITE = (1 << 3);
253 const ESP_GATT_CHAR_PROP_BIT_NOTIFY = (1 << 4);
254 const ESP_GATT_CHAR_PROP_BIT_INDICATE = (1 << 5);
255 const ESP_GATT_CHAR_PROP_BIT_AUTH = (1 << 6);
256 const ESP_GATT_CHAR_PROP_BIT_EXT_PROP = (1 << 7);
257 let props = 0;
258 properties.forEach(p => {
259 switch(p.trim()) {
260 case "read":
261 props |= ESP_GATT_CHAR_PROP_BIT_READ;
262 break;
263 case "write":
264 props |= ESP_GATT_CHAR_PROP_BIT_WRITE;
265 break;
266 case "writeNoResponse":
267 props |= ESP_GATT_CHAR_PROP_BIT_WRITE_NR;
268 break;
269 case "notify":
270 props |= ESP_GATT_CHAR_PROP_BIT_NOTIFY;
271 break;
272 case "indicate":
273 props |= ESP_GATT_CHAR_PROP_BIT_INDICATE;
274 break;
275 case "extended":
276 props |= ESP_GATT_CHAR_PROP_BIT_EXT_PROP;
277 break;
278 default:
279 throw new Error("unknown property");
280 }
281 });
282 return props;
283 }
284 parsePermissions(permissions) {
285 let perms = [];
286 let readPerms = 0;

Callers 1

generateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected