+static
+void notify_new_stream(struct bt_notif_iter *notit,
+ struct bt_notification **notification)
+{
+ struct bt_notification *ret = NULL;
+ int iret;
+
+ /* Ask the user for the stream */
+ iret = set_stream(notit);
+ if (iret) {
+ goto end;
+ }
+
+ BT_ASSERT(notit->stream);
+ ret = bt_notification_stream_begin_create(notit->stream);
+ if (!ret) {
+ BT_LOGE("Cannot create stream beginning notification: "
+ "notit-addr=%p, stream-addr=%p",
+ notit, notit->stream);
+ return;
+ }
+
+end:
+ *notification = ret;
+}
+
+static
+void notify_end_of_stream(struct bt_notif_iter *notit,
+ struct bt_notification **notification)
+{
+ struct bt_notification *ret;
+
+ if (!notit->stream) {
+ BT_LOGE("Cannot create stream for stream notification: "
+ "notit-addr=%p", notit);
+ return;
+ }
+
+ ret = bt_notification_stream_end_create(notit->stream);
+ if (!ret) {
+ BT_LOGE("Cannot create stream beginning notification: "
+ "notit-addr=%p, stream-addr=%p",
+ notit, notit->stream);
+ return;
+ }
+ *notification = ret;
+}
+