> The description of ServiceRecord.setAttributeValue states:
>
> "[...] In order for any changes made by this method to be reflected in
> the SDDB, a call must be made to the acceptAndOpen() method of the
> associated notifier to add this ServiceRecord to the SDDB for the first
> time [...]"
>
> In the implementation however the service is registered in the
> constructor of BluetoothStreamConnectionNotifier instead of in its
> acceptAndOpen() method. This means that changes to the ServiceRecord
> made after creating the notifier but before calling acceptAndOpen for
> the first time, will not be reflected in the SDDB. Since updateRecord is
> unimplemented (for now) this seems unwanted.
>
> Proposed changes:
> 1) remove the registerService call from the constructor
> 2) move it to acceptAndOpen:
>
> public StreamConnection acceptAndOpen() throws IOException {
> BluetoothPeer peer =
((LocalDevice)LocalDevice.getLocalDevice()).getBluetoothPeer();
> if ((handle == 0) && (!closed)) {
> /* register service */
> handle = peer.registerService(((ServiceRecordImpl)
serviceRecord).toByteArray());
> }
> return new BluetoothConnection(peer.accept(socket));
> }
>
> 3) check if handle != 0 in the close method, before calling
> unregisterService
Original issue reported on code.google.com by paul.tot...@gmail.com on 19 Aug 2006 at 1:28
Original issue reported on code.google.com by
paul.tot...@gmail.com
on 19 Aug 2006 at 1:28