Bluetooth: services: Do not set current object until selected

Do not make the first object added to the object transfer server the
current (=selected object).  This leads to the server having no
current object until one is selected by the client.

This solves a startup issue where the selected callback is not called
by the server if the first object selected by the client happens to be
the same object as the object that was first added to the server.  In
that case, the user of the OTS does not know which object is selected,
and therefore may not be able to supply the correct data later.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
This commit is contained in:
Asbjørn Sæbø 2021-04-19 12:59:10 +02:00 committed by Carles Cufí
commit 22068d4967

View file

@ -202,11 +202,6 @@ int bt_ots_obj_add(struct bt_ots *ots,
} }
} }
/* Make object the Current Object if this is the first one added. */
if (!ots->cur_obj) {
ots->cur_obj = obj;
}
return 0; return 0;
} }