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 {
176
176
(c) => CharacteristicTile (
177
177
characteristic: c,
178
178
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
+ },
182
187
descriptorTiles: c.descriptors
183
188
.map (
184
189
(d) => DescriptorTile (
Original file line number Diff line number Diff line change @@ -54,8 +54,6 @@ class BluetoothCharacteristic {
54
54
.map ((c) {
55
55
// Update the characteristic with the new values
56
56
_updateDescriptors (c.descriptors);
57
- // _value.add(c.lastValue);
58
- // print('c.lastValue: ${c.lastValue}');
59
57
return c;
60
58
});
61
59
@@ -123,7 +121,6 @@ class BluetoothCharacteristic {
123
121
.invokeMethod ('writeCharacteristic' , request.writeToBuffer ());
124
122
125
123
if (type == CharacteristicWriteType .withoutResponse) {
126
- _value.add (value);
127
124
return result;
128
125
}
129
126
@@ -141,7 +138,6 @@ class BluetoothCharacteristic {
141
138
.then ((success) => (! success)
142
139
? throw new Exception ('Failed to write the characteristic' )
143
140
: null )
144
- .then ((_) => _value.add (value))
145
141
.then ((_) => null );
146
142
}
147
143
@@ -168,7 +164,6 @@ class BluetoothCharacteristic {
168
164
.then ((p) => new BluetoothCharacteristic .fromProto (p.characteristic))
169
165
.then ((c) {
170
166
_updateDescriptors (c.descriptors);
171
- _value.add (c.lastValue);
172
167
return (c.isNotifying == notify);
173
168
});
174
169
}
You can’t perform that action at this time.
0 commit comments