()
| 50 | } |
| 51 | |
| 52 | function onWriteButtonClick() { |
| 53 | if (!myDescriptor) { |
| 54 | return; |
| 55 | } |
| 56 | let encoder = new TextEncoder('utf-8'); |
| 57 | let value = document.querySelector('#description').value; |
| 58 | log('Setting Characteristic User Description...'); |
| 59 | myDescriptor.writeValue(encoder.encode(value)) |
| 60 | .then(_ => { |
| 61 | log('> Characteristic User Description changed to: ' + value); |
| 62 | }) |
| 63 | .catch(error => { |
| 64 | log('Argh! ' + error); |
| 65 | }); |
| 66 | } |