@@ -100,6 +100,7 @@ func (d *Device) DiscoverServices(filterUUIDs []UUID) ([]DeviceService, error) {
100100 services = append (services , DeviceService {
101101 uuidWrapper : serviceUuid ,
102102 service : srv ,
103+ device : d ,
103104 })
104105 }
105106
@@ -132,6 +133,7 @@ type DeviceService struct {
132133 uuidWrapper
133134
134135 service * genericattributeprofile.GattDeviceService
136+ device * Device
135137}
136138
137139// UUID returns the UUID for this DeviceService.
@@ -180,12 +182,12 @@ func (s *DeviceService) DiscoverCharacteristics(filterUUIDs []UUID) ([]DeviceCha
180182
181183 var characteristics []DeviceCharacteristic
182184 for i := uint32 (0 ); i < characteristicsSize ; i ++ {
183- s , err := charVector .GetAt (i )
185+ c , err := charVector .GetAt (i )
184186 if err != nil {
185187 return nil , err
186188 }
187189
188- characteristic := (* genericattributeprofile .GattCharacteristic )(s )
190+ characteristic := (* genericattributeprofile .GattCharacteristic )(c )
189191 guid , err := characteristic .GetUuid ()
190192 if err != nil {
191193 return nil , err
@@ -215,6 +217,7 @@ func (s *DeviceService) DiscoverCharacteristics(filterUUIDs []UUID) ([]DeviceCha
215217
216218 characteristics = append (characteristics , DeviceCharacteristic {
217219 uuidWrapper : characteristicUUID ,
220+ service : s ,
218221 characteristic : characteristic ,
219222 properties : properties ,
220223 })
@@ -230,6 +233,8 @@ type DeviceCharacteristic struct {
230233
231234 characteristic * genericattributeprofile.GattCharacteristic
232235 properties genericattributeprofile.GattCharacteristicProperties
236+
237+ service * DeviceService
233238}
234239
235240// UUID returns the UUID for this DeviceCharacteristic.
@@ -241,6 +246,11 @@ func (c *DeviceCharacteristic) Properties() uint32 {
241246 return uint32 (c .properties )
242247}
243248
249+ // GetMTU returns the MTU for the characteristic.
250+ func (c * DeviceCharacteristic ) GetMTU () (uint16 , error ) {
251+ return c .service .device .session .GetMaxPduSize ()
252+ }
253+
244254// Write replaces the characteristic value with a new value. The
245255// call will return after all data has been written.
246256func (c DeviceCharacteristic ) Write (p []byte ) (n int , err error ) {
0 commit comments