| 1201 | file.line(""); |
| 1202 | } |
| 1203 | parseProperties(properties) { |
| 1204 | const gatt_char_prop_read = 0x02; |
| 1205 | const gatt_char_prop_writenoresp = 0x04; |
| 1206 | const gatt_char_prop_write = 0x08; |
| 1207 | const gatt_char_prop_notify = 0x10; |
| 1208 | const gatt_char_prop_indicate = 0x20; |
| 1209 | const gatt_char_prop_writesign = 0x40; |
| 1210 | const gatt_char_prop_extended = 0x80; |
| 1211 | let props = 0; |
| 1212 | properties.forEach(p => { |
| 1213 | switch(p.trim()) { |
| 1214 | case "read": |
| 1215 | props |= gatt_char_prop_read; |
| 1216 | break; |
| 1217 | case "write": |
| 1218 | props |= gatt_char_prop_write; |
| 1219 | break; |
| 1220 | case "writeNoResponse": |
| 1221 | props |= gatt_char_prop_writenoresp; |
| 1222 | break; |
| 1223 | case "notify": |
| 1224 | props |= gatt_char_prop_notify; |
| 1225 | break; |
| 1226 | case "indicate": |
| 1227 | props |= gatt_char_prop_indicate; |
| 1228 | break; |
| 1229 | case "extended": |
| 1230 | props |= gatt_char_prop_extended; |
| 1231 | break; |
| 1232 | default: |
| 1233 | throw new Error("unknown property"); |
| 1234 | } |
| 1235 | }); |
| 1236 | return props; |
| 1237 | } |
| 1238 | parsePermissions(permissions) { |
| 1239 | const gatt_att_perm_readable = 0x0001; |
| 1240 | const gatt_att_perm_writable = 0x0002; |