+
+ for (l = osp_server_list; l; l = g_slist_next(l)) {
+ osp_server = l->data;
+ if (!osp_server)
+ continue;
+ if (g_strcmp0(osp_server->uuid, uuid) == 0) {
+ osp_server_list = g_slist_remove(osp_server_list, osp_server);
+ __bt_free_osp_server(osp_server);
+ break;
+ }
+ }
+
+ return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_unregister_osp_server_in_agent_by_sender(const char *sender)
+{
+ GSList *l;
+ struct osp_server_t *osp_server;
+ retv_if(sender == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
+
+ BT_DBG("Unregister osp server by sender: %s", sender);
+
+ /* App termination case, unregister all osp_server of sender */
+ for (l = osp_server_list; l; ) {
+ osp_server = l->data;
+ l = g_slist_next(l);
+ if (!osp_server)
+ continue;
+ if (g_strcmp0(osp_server->sender, sender) == 0) {
+ if (device_unregister_osp_server(OAL_OSP_SERVER_RFCOMM, osp_server->uuid) != 0)
+ return BLUETOOTH_ERROR_INTERNAL;
+ osp_server_list = g_slist_remove(osp_server_list, osp_server);
+ __bt_free_osp_server(osp_server);
+ }
+ }
+