Lines Matching refs:upload
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()
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()
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()
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()
409 int err = bt_mesh_dfu_slot_fwid_set(srv->upload.slot, fwid, fwid_len); 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()
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()
475 if (!srv->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()
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()
526 err = bt_mesh_dfu_slot_info_set(srv->upload.slot, size, meta, meta_len); in handle_upload_start()
538 err = srv->cb->recv(srv, srv->upload.slot, &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()
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()
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()
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()
896 CONTAINER_OF(b, struct bt_mesh_dfd_srv, upload.blob); in upload_end()
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()
910 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ERROR; in upload_end()
952 err = bt_mesh_model_extend(mod, srv->upload.blob.mod); in dfd_srv_init()
966 srv->upload.phase = BT_MESH_DFD_UPLOAD_PHASE_IDLE; in dfd_srv_reset()
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()
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()
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()
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()
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()