File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -176,9 +176,14 @@ class DeviceScreen extends StatelessWidget {
176176 (c) => CharacteristicTile (
177177 characteristic: c,
178178 onReadPressed: () => c.read (),
179- onWritePressed: () => c.write (_getRandomBytes ()),
180- onNotificationPressed: () =>
181- c.setNotifyValue (! c.isNotifying),
179+ onWritePressed: () async {
180+ await c.write (_getRandomBytes (), withoutResponse: true );
181+ await c.read ();
182+ },
183+ onNotificationPressed: () async {
184+ await c.setNotifyValue (! c.isNotifying);
185+ await c.read ();
186+ },
182187 descriptorTiles: c.descriptors
183188 .map (
184189 (d) => DescriptorTile (
Original file line number Diff line number Diff line change @@ -54,8 +54,6 @@ class BluetoothCharacteristic {
5454 .map ((c) {
5555 // Update the characteristic with the new values
5656 _updateDescriptors (c.descriptors);
57- // _value.add(c.lastValue);
58- // print('c.lastValue: ${c.lastValue}');
5957 return c;
6058 });
6159
@@ -123,7 +121,6 @@ class BluetoothCharacteristic {
123121 .invokeMethod ('writeCharacteristic' , request.writeToBuffer ());
124122
125123 if (type == CharacteristicWriteType .withoutResponse) {
126- _value.add (value);
127124 return result;
128125 }
129126
@@ -141,7 +138,6 @@ class BluetoothCharacteristic {
141138 .then ((success) => (! success)
142139 ? throw new Exception ('Failed to write the characteristic' )
143140 : null )
144- .then ((_) => _value.add (value))
145141 .then ((_) => null );
146142 }
147143
@@ -168,7 +164,6 @@ class BluetoothCharacteristic {
168164 .then ((p) => new BluetoothCharacteristic .fromProto (p.characteristic))
169165 .then ((c) {
170166 _updateDescriptors (c.descriptors);
171- _value.add (c.lastValue);
172167 return (c.isNotifying == notify);
173168 });
174169 }
You can’t perform that action at this time.
0 commit comments