Lines Matching +full:time +full:- +full:slot
4 * SPDX-License-Identifier: Apache-2.0
61 srv->phase = new_phase; in dfd_phase_set()
63 if (srv->cb && srv->cb->phase) { in dfd_phase_set()
64 srv->cb->phase(srv, srv->phase); in dfd_phase_set()
71 for (int i = 0; i < srv->target_cnt; ++i) { in target_get()
72 if (addr == srv->targets[i].blob.addr) { in target_get()
73 return &srv->targets[i]; in target_get()
82 return srv->phase == BT_MESH_DFD_PHASE_TRANSFER_ACTIVE || in is_busy()
83 srv->phase == BT_MESH_DFD_PHASE_TRANSFER_SUCCESS || in is_busy()
84 srv->phase == BT_MESH_DFD_PHASE_APPLYING_UPDATE; in is_busy()
89 return bt_mesh_blob_srv_is_busy(&srv->upload.blob) || in upload_is_busy()
90 srv->upload.phase == BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ACTIVE; in upload_is_busy()
93 static int slot_del(struct bt_mesh_dfd_srv *srv, const struct bt_mesh_dfu_slot *slot) in slot_del() argument
95 if (srv->cb && srv->cb->del) { in slot_del()
96 srv->cb->del(srv, slot); in slot_del()
99 return bt_mesh_dfu_slot_del(slot); in slot_del()
110 net_buf_simple_add_le16(&buf, srv->target_cnt); in receivers_status_rsp()
112 bt_mesh_model_send(srv->mod, ctx, &buf, NULL, NULL); in receivers_status_rsp()
119 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_receivers_add()
121 if (buf->len % 3) { in handle_receivers_add()
122 return -EINVAL; in handle_receivers_add()
125 if (bt_mesh_dfu_cli_is_busy(&srv->dfu)) { in handle_receivers_add()
131 while (buf->len >= 3 && status == BT_MESH_DFD_SUCCESS) { in handle_receivers_add()
149 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_receivers_delete_all()
159 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_receivers_get()
167 return -EINVAL; in handle_receivers_get()
176 net_buf_simple_add_le16(&rsp, srv->target_cnt); in handle_receivers_get()
179 cnt = MIN(cnt, srv->target_cnt - first); in handle_receivers_get()
180 progress = bt_mesh_dfu_cli_progress(&srv->dfu) / 2; in handle_receivers_get()
183 const struct bt_mesh_dfu_target *t = &srv->targets[i + first]; in handle_receivers_get()
186 &rsp, ((t->blob.addr & BIT_MASK(15)) | in handle_receivers_get()
187 ((t->phase & BIT_MASK(4)) << 15U) | in handle_receivers_get()
188 ((t->status & BIT_MASK(3)) << 19U) | in handle_receivers_get()
189 ((t->blob.status & BIT_MASK(4)) << 22U) | in handle_receivers_get()
191 net_buf_simple_add_u8(&rsp, t->img_idx); in handle_receivers_get()
194 bt_mesh_model_send(srv->mod, ctx, &rsp, NULL, NULL); in handle_receivers_get()
199 static enum bt_mesh_dfu_iter slot_space_cb(const struct bt_mesh_dfu_slot *slot, in slot_space_cb() argument
204 *total += slot->size; in slot_space_cb()
226 net_buf_simple_add_le32(&rsp, CONFIG_BT_MESH_DFD_SRV_SLOT_SPACE - size); in handle_capabilities_get()
229 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_capabilities_get()
231 if (srv->oob_schemes.count > 0) { in handle_capabilities_get()
233 net_buf_simple_add_mem(&rsp, srv->oob_schemes.schemes, in handle_capabilities_get()
234 srv->oob_schemes.count); in handle_capabilities_get()
253 net_buf_simple_add_u8(&rsp, srv->phase); in status_rsp()
255 if (srv->phase == BT_MESH_DFD_PHASE_IDLE || !srv->dfu.xfer.slot) { in status_rsp()
256 bt_mesh_model_send(srv->mod, ctx, &rsp, NULL, NULL); in status_rsp()
260 net_buf_simple_add_le16(&rsp, srv->inputs.group); in status_rsp()
261 net_buf_simple_add_le16(&rsp, srv->inputs.app_idx); in status_rsp()
262 net_buf_simple_add_u8(&rsp, srv->inputs.ttl); in status_rsp()
263 net_buf_simple_add_le16(&rsp, srv->inputs.timeout_base); in status_rsp()
264 net_buf_simple_add_u8(&rsp, ((srv->dfu.xfer.blob.mode & BIT_MASK(2)) | in status_rsp()
265 ((srv->apply & BIT_MASK(1)) << 2))); in status_rsp()
266 net_buf_simple_add_le16(&rsp, srv->slot_idx); in status_rsp()
268 bt_mesh_model_send(srv->mod, ctx, &rsp, NULL, NULL); in status_rsp()
274 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_get()
284 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_start()
296 if (buf->len == 16) { in handle_start()
302 if (buf->len != 2) { in handle_start()
303 return -EINVAL; in handle_start()
317 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_suspend()
327 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_cancel()
337 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_apply()
354 net_buf_simple_add_u8(&rsp, srv->upload.phase); in upload_status_rsp_with_progress()
356 if (srv->upload.phase == BT_MESH_DFD_UPLOAD_PHASE_IDLE || in upload_status_rsp_with_progress()
357 !srv->upload.slot) { in upload_status_rsp_with_progress()
358 bt_mesh_model_send(srv->mod, ctx, &rsp, NULL, NULL); in upload_status_rsp_with_progress()
363 if (srv->upload.is_oob) { in upload_status_rsp_with_progress()
365 net_buf_simple_add_mem(&rsp, srv->upload.oob.current_fwid, in upload_status_rsp_with_progress()
366 srv->upload.oob.current_fwid_len); in upload_status_rsp_with_progress()
371 net_buf_simple_add_mem(&rsp, srv->upload.slot->fwid, in upload_status_rsp_with_progress()
372 srv->upload.slot->fwid_len); in upload_status_rsp_with_progress()
375 bt_mesh_model_send(srv->mod, ctx, &rsp, NULL, NULL); in upload_status_rsp_with_progress()
385 if (srv->upload.is_oob) { in upload_status_rsp()
386 progress = srv->cb->oob_progress_get(srv, srv->upload.slot); in upload_status_rsp()
390 progress = bt_mesh_blob_srv_progress(&srv->upload.blob); in upload_status_rsp()
399 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_upload_get()
409 int err = bt_mesh_dfu_slot_fwid_set(srv->upload.slot, fwid, fwid_len); in set_upload_fwid()
412 case -EFBIG: /* Fwid too long */ in set_upload_fwid()
413 case -EALREADY: /* Other server is in progress with this fwid */ in set_upload_fwid()
414 bt_mesh_dfu_slot_release(srv->upload.slot); in set_upload_fwid()
415 srv->upload.slot = NULL; in set_upload_fwid()
418 case -EEXIST: /* Img with this fwid already is in list */ in set_upload_fwid()
419 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_SUCCESS; in set_upload_fwid()
420 bt_mesh_dfu_slot_release(srv->upload.slot); in set_upload_fwid()
422 err = bt_mesh_dfu_slot_get(fwid, fwid_len, &srv->upload.slot); in set_upload_fwid()
426 srv->upload.slot = NULL; in set_upload_fwid()
431 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ACTIVE; in set_upload_fwid()
433 case -EINVAL: /* Slot in wrong state. */ in set_upload_fwid()
444 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_upload_start()
457 if (buf->len < meta_len) { in handle_upload_start()
458 return -EINVAL; in handle_upload_start()
462 fwid_len = buf->len; in handle_upload_start()
475 if (!srv->upload.slot) { in handle_upload_start()
476 LOG_WRN("Busy with no upload slot"); in handle_upload_start()
481 if (srv->upload.slot->fwid_len == fwid_len && in handle_upload_start()
482 !memcmp(srv->upload.slot->fwid, fwid, fwid_len) && in handle_upload_start()
483 srv->upload.slot->metadata_len == meta_len && in handle_upload_start()
484 !memcmp(srv->upload.slot->metadata, meta, meta_len) && in handle_upload_start()
485 srv->upload.blob.state.xfer.id == blob_id && in handle_upload_start()
486 srv->upload.blob.state.ttl == ttl && in handle_upload_start()
487 srv->upload.blob.state.timeout_base == timeout_base in handle_upload_start()
489 && !srv->upload.is_oob in handle_upload_start()
502 /* This will be a no-op if the slot state isn't RESERVED, which is in handle_upload_start()
505 if (srv->upload.slot) { in handle_upload_start()
506 bt_mesh_dfu_slot_release(srv->upload.slot); in handle_upload_start()
510 srv->upload.is_oob = false; in handle_upload_start()
512 srv->upload.slot = bt_mesh_dfu_slot_reserve(); in handle_upload_start()
514 if (!srv->upload.slot) { in handle_upload_start()
515 LOG_WRN("No space for slot"); in handle_upload_start()
526 err = bt_mesh_dfu_slot_info_set(srv->upload.slot, size, meta, meta_len); in handle_upload_start()
528 case -EFBIG: in handle_upload_start()
537 srv->io = NULL; in handle_upload_start()
538 err = srv->cb->recv(srv, srv->upload.slot, &srv->io); in handle_upload_start()
539 if (err || !srv->io) { in handle_upload_start()
540 LOG_ERR("App rejected upload. err: %d io: %p", err, srv->io); in handle_upload_start()
541 bt_mesh_dfu_slot_release(srv->upload.slot); in handle_upload_start()
546 err = bt_mesh_blob_srv_recv(&srv->upload.blob, blob_id, srv->io, ttl, in handle_upload_start()
550 bt_mesh_dfu_slot_release(srv->upload.slot); in handle_upload_start()
557 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ACTIVE; in handle_upload_start()
566 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_upload_start_oob()
574 if (uri_len > buf->len) { in handle_upload_start_oob()
575 return -EINVAL; in handle_upload_start_oob()
579 fwid_len = buf->len; in handle_upload_start_oob()
588 if (srv->upload.is_oob && in handle_upload_start_oob()
589 uri_len == srv->upload.oob.uri_len && in handle_upload_start_oob()
590 fwid_len == srv->upload.oob.current_fwid_len && in handle_upload_start_oob()
591 !memcmp(uri, srv->upload.oob.uri, uri_len) && in handle_upload_start_oob()
592 !memcmp(fwid, srv->upload.oob.current_fwid, fwid_len)) { in handle_upload_start_oob()
601 } else if (srv->upload.is_oob && srv->upload.is_pending_oob_check) { in handle_upload_start_oob()
614 struct bt_mesh_dfu_slot *slot = bt_mesh_dfu_slot_reserve(); in handle_upload_start_oob() local
616 if (slot == NULL) { in handle_upload_start_oob()
621 /* This will be a no-op if the slot state isn't RESERVED, which is in handle_upload_start_oob()
624 if (srv->upload.slot) { in handle_upload_start_oob()
625 bt_mesh_dfu_slot_release(srv->upload.slot); in handle_upload_start_oob()
628 srv->upload.is_oob = true; in handle_upload_start_oob()
629 srv->upload.slot = slot; in handle_upload_start_oob()
630 memcpy(srv->upload.oob.uri, uri, uri_len); in handle_upload_start_oob()
631 srv->upload.oob.uri_len = uri_len; in handle_upload_start_oob()
632 memcpy(srv->upload.oob.current_fwid, fwid, fwid_len); in handle_upload_start_oob()
633 srv->upload.oob.current_fwid_len = fwid_len; in handle_upload_start_oob()
634 memcpy(&srv->upload.oob.ctx, ctx, sizeof(struct bt_mesh_msg_ctx)); in handle_upload_start_oob()
636 int status = srv->cb->start_oob_upload(srv, srv->upload.slot, srv->upload.oob.uri, in handle_upload_start_oob()
637 srv->upload.oob.uri_len, in handle_upload_start_oob()
638 srv->upload.oob.current_fwid, in handle_upload_start_oob()
639 srv->upload.oob.current_fwid_len); in handle_upload_start_oob()
643 bt_mesh_dfu_slot_release(srv->upload.slot); in handle_upload_start_oob()
645 srv->upload.is_pending_oob_check = true; in handle_upload_start_oob()
657 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_upload_cancel()
659 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_IDLE; in handle_upload_cancel()
661 if (srv->upload.is_oob) { in handle_upload_cancel()
662 srv->cb->cancel_oob_upload(srv, srv->upload.slot); in handle_upload_cancel()
666 (void)bt_mesh_blob_srv_cancel(&srv->upload.blob); in handle_upload_cancel()
690 bt_mesh_model_send(srv->mod, ctx, &rsp, NULL, NULL); in fw_status_rsp()
696 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_fw_get()
697 struct bt_mesh_dfu_slot *slot; in handle_fw_get() local
702 fwid_len = buf->len; in handle_fw_get()
705 idx = bt_mesh_dfu_slot_get(fwid, fwid_len, &slot); in handle_fw_get()
720 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_fw_get_by_index()
721 const struct bt_mesh_dfu_slot *slot; in handle_fw_get_by_index() local
726 slot = bt_mesh_dfu_slot_at(idx); in handle_fw_get_by_index()
727 if (slot) { in handle_fw_get_by_index()
728 fw_status_rsp(srv, ctx, BT_MESH_DFD_SUCCESS, idx, slot->fwid, in handle_fw_get_by_index()
729 slot->fwid_len); in handle_fw_get_by_index()
741 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_fw_delete()
745 fwid_len = buf->len; in handle_fw_delete()
755 static enum bt_mesh_dfu_iter slot_del_cb(const struct bt_mesh_dfu_slot *slot, in slot_del_cb() argument
760 if (srv->cb && srv->cb->del) { in slot_del_cb()
761 srv->cb->del(srv, slot); in slot_del_cb()
770 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in handle_fw_delete_all()
814 LOG_DBG("reason: %u, phase: %u, apply: %u", reason, srv->phase, srv->apply); in dfu_ended()
816 if (srv->phase == BT_MESH_DFD_PHASE_IDLE) { in dfu_ended()
820 if (srv->phase == BT_MESH_DFD_PHASE_CANCELING_UPDATE) { in dfu_ended()
830 if (!srv->apply) { in dfu_ended()
850 if (srv->phase == BT_MESH_DFD_PHASE_CANCELING_UPDATE) { in dfu_applied()
855 if (srv->phase != BT_MESH_DFD_PHASE_APPLYING_UPDATE) { in dfu_applied()
871 if (srv->phase != BT_MESH_DFD_PHASE_APPLYING_UPDATE && in dfu_confirmed()
872 srv->phase != BT_MESH_DFD_PHASE_CANCELING_UPDATE) { in dfu_confirmed()
898 if (srv->upload.phase != BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ACTIVE) { in upload_end()
904 if (success && (bt_mesh_dfu_slot_commit(srv->upload.slot) == 0)) { in upload_end()
905 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_SUCCESS; in upload_end()
909 /* Will delete slot when we start a new upload */ in upload_end()
910 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ERROR; in upload_end()
917 upload_end(b, b->state.xfer.id, false); in upload_timeout()
929 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in dfd_srv_init()
931 srv->mod = mod; in dfd_srv_init()
938 return -EINVAL; in dfd_srv_init()
949 return -EINVAL; in dfd_srv_init()
952 err = bt_mesh_model_extend(mod, srv->upload.blob.mod); in dfd_srv_init()
963 struct bt_mesh_dfd_srv *srv = mod->rt->user_data; in dfd_srv_reset()
966 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_IDLE; in dfd_srv_reset()
968 sys_slist_init(&srv->inputs.targets); in dfd_srv_reset()
969 srv->target_cnt = 0; in dfd_srv_reset()
992 t->img_idx = img_idx; in bt_mesh_dfd_srv_receiver_add()
998 if (srv->target_cnt == ARRAY_SIZE(srv->targets)) { in bt_mesh_dfd_srv_receiver_add()
1002 t = &srv->targets[srv->target_cnt]; in bt_mesh_dfd_srv_receiver_add()
1003 p = &srv->pull_ctxs[srv->target_cnt]; in bt_mesh_dfd_srv_receiver_add()
1004 srv->target_cnt++; in bt_mesh_dfd_srv_receiver_add()
1008 t->blob.addr = addr; in bt_mesh_dfd_srv_receiver_add()
1009 t->blob.pull = p; in bt_mesh_dfd_srv_receiver_add()
1010 t->img_idx = img_idx; in bt_mesh_dfd_srv_receiver_add()
1012 LOG_DBG("Added receiver 0x%04x img: %u", t->blob.addr, in bt_mesh_dfd_srv_receiver_add()
1013 t->img_idx); in bt_mesh_dfd_srv_receiver_add()
1020 if (bt_mesh_dfu_cli_is_busy(&srv->dfu)) { in bt_mesh_dfd_srv_receivers_delete_all()
1024 sys_slist_init(&srv->inputs.targets); in bt_mesh_dfd_srv_receivers_delete_all()
1025 srv->target_cnt = 0; in bt_mesh_dfd_srv_receivers_delete_all()
1036 if (!srv->target_cnt) { in bt_mesh_dfd_srv_start()
1040 if (!bt_mesh_app_key_exists(params->app_idx)) { in bt_mesh_dfd_srv_start()
1044 xfer.mode = params->xfer_mode; in bt_mesh_dfd_srv_start()
1045 xfer.slot = bt_mesh_dfu_slot_at(params->slot_idx); in bt_mesh_dfd_srv_start()
1046 if (!xfer.slot) { in bt_mesh_dfd_srv_start()
1050 if (srv->inputs.app_idx == params->app_idx && in bt_mesh_dfd_srv_start()
1051 srv->inputs.timeout_base == params->timeout_base && in bt_mesh_dfd_srv_start()
1052 srv->inputs.group == params->group && srv->inputs.ttl == params->ttl && in bt_mesh_dfd_srv_start()
1053 srv->dfu.xfer.blob.mode == xfer.mode && srv->apply == params->apply && in bt_mesh_dfd_srv_start()
1054 srv->slot_idx == params->slot_idx) { in bt_mesh_dfd_srv_start()
1056 srv->phase == BT_MESH_DFD_PHASE_COMPLETED) { in bt_mesh_dfd_srv_start()
1059 } else if (srv->phase == BT_MESH_DFD_PHASE_TRANSFER_SUSPENDED) { in bt_mesh_dfd_srv_start()
1060 bt_mesh_dfu_cli_resume(&srv->dfu); in bt_mesh_dfd_srv_start()
1065 srv->phase == BT_MESH_DFD_PHASE_TRANSFER_SUSPENDED) { in bt_mesh_dfd_srv_start()
1070 if (srv->phase == BT_MESH_DFD_PHASE_CANCELING_UPDATE) { in bt_mesh_dfd_srv_start()
1075 srv->io = NULL; in bt_mesh_dfd_srv_start()
1076 err = srv->cb->send(srv, xfer.slot, &srv->io); in bt_mesh_dfd_srv_start()
1077 if (err || !srv->io) { in bt_mesh_dfd_srv_start()
1081 sys_slist_init(&srv->inputs.targets); in bt_mesh_dfd_srv_start()
1082 for (i = 0; i < srv->target_cnt; i++) { in bt_mesh_dfd_srv_start()
1083 uint16_t addr = srv->targets[i].blob.addr; in bt_mesh_dfd_srv_start()
1085 memset(&srv->targets[i].blob, 0, sizeof(struct bt_mesh_blob_target)); in bt_mesh_dfd_srv_start()
1086 memset(&srv->pull_ctxs[i], 0, sizeof(struct bt_mesh_blob_target_pull)); in bt_mesh_dfd_srv_start()
1087 srv->targets[i].blob.addr = addr; in bt_mesh_dfd_srv_start()
1088 srv->targets[i].blob.pull = &srv->pull_ctxs[i]; in bt_mesh_dfd_srv_start()
1090 sys_slist_append(&srv->inputs.targets, &srv->targets[i].blob.n); in bt_mesh_dfd_srv_start()
1093 srv->slot_idx = params->slot_idx; in bt_mesh_dfd_srv_start()
1094 srv->inputs.app_idx = params->app_idx; in bt_mesh_dfd_srv_start()
1095 srv->inputs.timeout_base = params->timeout_base; in bt_mesh_dfd_srv_start()
1096 srv->inputs.group = params->group; in bt_mesh_dfd_srv_start()
1097 srv->inputs.ttl = params->ttl; in bt_mesh_dfd_srv_start()
1098 srv->apply = params->apply; in bt_mesh_dfd_srv_start()
1100 LOG_DBG("Distribution Start: slot: %d, appidx: %d, tb: %d, addr: %04X, ttl: %d, apply: %d", in bt_mesh_dfd_srv_start()
1101 params->slot_idx, params->app_idx, params->timeout_base, params->group, params->ttl, in bt_mesh_dfd_srv_start()
1102 params->apply); in bt_mesh_dfd_srv_start()
1108 err = bt_mesh_dfu_cli_send(&srv->dfu, &srv->inputs, srv->io, &xfer); in bt_mesh_dfd_srv_start()
1121 if (srv->phase == BT_MESH_DFD_PHASE_TRANSFER_SUSPENDED) { in bt_mesh_dfd_srv_suspend()
1125 if (srv->phase != BT_MESH_DFD_PHASE_TRANSFER_ACTIVE) { in bt_mesh_dfd_srv_suspend()
1129 err = bt_mesh_dfu_cli_suspend(&srv->dfu); in bt_mesh_dfd_srv_suspend()
1134 srv->phase = BT_MESH_DFD_PHASE_TRANSFER_SUSPENDED; in bt_mesh_dfd_srv_suspend()
1144 if (srv->phase == BT_MESH_DFD_PHASE_CANCELING_UPDATE || in bt_mesh_dfd_srv_cancel()
1145 srv->phase == BT_MESH_DFD_PHASE_IDLE) { in bt_mesh_dfd_srv_cancel()
1152 if (srv->phase == BT_MESH_DFD_PHASE_COMPLETED || in bt_mesh_dfd_srv_cancel()
1153 srv->phase == BT_MESH_DFD_PHASE_FAILED) { in bt_mesh_dfd_srv_cancel()
1163 prev_phase = srv->phase; in bt_mesh_dfd_srv_cancel()
1165 err = bt_mesh_dfu_cli_cancel(&srv->dfu, NULL); in bt_mesh_dfd_srv_cancel()
1178 ctx->rnd_delay = false; in bt_mesh_dfd_srv_cancel()
1199 if (srv->phase == BT_MESH_DFD_PHASE_IDLE || in bt_mesh_dfd_srv_apply()
1200 srv->phase == BT_MESH_DFD_PHASE_CANCELING_UPDATE || in bt_mesh_dfd_srv_apply()
1201 srv->phase == BT_MESH_DFD_PHASE_TRANSFER_ACTIVE || in bt_mesh_dfd_srv_apply()
1202 srv->phase == BT_MESH_DFD_PHASE_TRANSFER_SUSPENDED || in bt_mesh_dfd_srv_apply()
1203 srv->phase == BT_MESH_DFD_PHASE_FAILED) { in bt_mesh_dfd_srv_apply()
1207 if (srv->phase == BT_MESH_DFD_PHASE_APPLYING_UPDATE || in bt_mesh_dfd_srv_apply()
1208 srv->phase == BT_MESH_DFD_PHASE_COMPLETED) { in bt_mesh_dfd_srv_apply()
1212 err = bt_mesh_dfu_cli_apply(&srv->dfu); in bt_mesh_dfd_srv_apply()
1224 struct bt_mesh_dfu_slot *slot; in bt_mesh_dfd_srv_fw_delete() local
1227 if (srv->phase != BT_MESH_DFD_PHASE_IDLE) { in bt_mesh_dfd_srv_fw_delete()
1233 idx = bt_mesh_dfu_slot_get(*fwid, *fwid_len, &slot); in bt_mesh_dfd_srv_fw_delete()
1238 err = slot_del(srv, slot); in bt_mesh_dfd_srv_fw_delete()
1250 if (srv->phase != BT_MESH_DFD_PHASE_IDLE) { in bt_mesh_dfd_srv_fw_delete_all()
1263 const struct bt_mesh_dfu_slot *slot, int status, in bt_mesh_dfd_srv_oob_check_complete() argument
1268 if (slot != srv->upload.slot || !srv->upload.is_oob || in bt_mesh_dfd_srv_oob_check_complete()
1269 srv->upload.phase == BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ACTIVE || in bt_mesh_dfd_srv_oob_check_complete()
1270 !srv->upload.is_pending_oob_check) { in bt_mesh_dfd_srv_oob_check_complete()
1272 * "wrong" pointer or at a wrong time. in bt_mesh_dfd_srv_oob_check_complete()
1274 return -EINVAL; in bt_mesh_dfd_srv_oob_check_complete()
1277 srv->upload.is_pending_oob_check = false; in bt_mesh_dfd_srv_oob_check_complete()
1280 bt_mesh_dfu_slot_release(srv->upload.slot); in bt_mesh_dfd_srv_oob_check_complete()
1281 upload_status_rsp(srv, &srv->upload.oob.ctx, status); in bt_mesh_dfd_srv_oob_check_complete()
1282 return -ECANCELED; in bt_mesh_dfd_srv_oob_check_complete()
1285 err = set_upload_fwid(srv, &srv->upload.oob.ctx, fwid, fwid_len); in bt_mesh_dfd_srv_oob_check_complete()
1291 upload_status_rsp(srv, &srv->upload.oob.ctx, BT_MESH_DFD_SUCCESS); in bt_mesh_dfd_srv_oob_check_complete()
1296 const struct bt_mesh_dfu_slot *slot, bool success, in bt_mesh_dfd_srv_oob_store_complete() argument
1301 if (srv->upload.phase != BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ACTIVE || in bt_mesh_dfd_srv_oob_store_complete()
1302 srv->upload.slot != slot || !srv->upload.is_oob) { in bt_mesh_dfd_srv_oob_store_complete()
1303 return -EINVAL; in bt_mesh_dfd_srv_oob_store_complete()
1310 err = bt_mesh_dfu_slot_info_set(srv->upload.slot, size, metadata, metadata_len); in bt_mesh_dfd_srv_oob_store_complete()
1315 err = bt_mesh_dfu_slot_commit(srv->upload.slot); in bt_mesh_dfd_srv_oob_store_complete()
1320 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_SUCCESS; in bt_mesh_dfd_srv_oob_store_complete()
1324 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ERROR; in bt_mesh_dfd_srv_oob_store_complete()
1325 bt_mesh_dfu_slot_release(srv->upload.slot); in bt_mesh_dfd_srv_oob_store_complete()