|
33 | 33 | import io.runtime.mcumgr.response.UploadResponse;
|
34 | 34 | import io.runtime.mcumgr.response.img.McuMgrCoreLoadResponse;
|
35 | 35 | import io.runtime.mcumgr.response.img.McuMgrImageResponse;
|
| 36 | +import io.runtime.mcumgr.response.img.McuMgrImageSlotResponse; |
36 | 37 | import io.runtime.mcumgr.response.img.McuMgrImageStateResponse;
|
37 | 38 | import io.runtime.mcumgr.response.img.McuMgrImageUploadResponse;
|
38 | 39 | import io.runtime.mcumgr.transfer.Download;
|
@@ -208,7 +209,7 @@ default ImageManager.ReturnCode getImageReturnCode() {
|
208 | 209 | private final static int ID_CORELIST = 3;
|
209 | 210 | private final static int ID_CORELOAD = 4;
|
210 | 211 | private final static int ID_ERASE = 5;
|
211 |
| - private final static int ID_ERASE_STATE = 6; |
| 212 | + private final static int ID_SLOT_INFO = 6; |
212 | 213 |
|
213 | 214 | /**
|
214 | 215 | * Construct an image manager.
|
@@ -513,55 +514,23 @@ public McuMgrImageResponse erase(int slot) throws McuMgrException {
|
513 | 514 | }
|
514 | 515 |
|
515 | 516 | /**
|
516 |
| - * Erase the state of secondary slot of main image (asynchronous). |
| 517 | + * Reads slot information (asynchronous). |
517 | 518 | *
|
518 | 519 | * @param callback the asynchronous callback.
|
519 | 520 | */
|
520 |
| - public void eraseState(@NotNull McuMgrCallback<McuMgrImageResponse> callback) { |
521 |
| - eraseState(0, callback); |
| 521 | + public void slots(@NotNull McuMgrCallback<McuMgrImageSlotResponse> callback) { |
| 522 | + send(OP_READ, ID_SLOT_INFO, null, SHORT_TIMEOUT, McuMgrImageSlotResponse.class, callback); |
522 | 523 | }
|
523 | 524 |
|
524 | 525 | /**
|
525 |
| - * Erase the state of secondary slot of the main image (asynchronous). |
526 |
| - * |
527 |
| - * @param image the image number, default is 0. Use 0 for core0, 1 for core1, etc. |
528 |
| - * @param callback the asynchronous callback. |
529 |
| - */ |
530 |
| - public void eraseState(int image, @NotNull McuMgrCallback<McuMgrImageResponse> callback) { |
531 |
| - HashMap<String, Object> payloadMap = null; |
532 |
| - if (image > 0) { |
533 |
| - payloadMap = new HashMap<>(); |
534 |
| - payloadMap.put("image", image); |
535 |
| - } |
536 |
| - send(OP_WRITE, ID_ERASE_STATE, payloadMap, DEFAULT_TIMEOUT, McuMgrImageResponse.class, callback); |
537 |
| - } |
538 |
| - |
539 |
| - /** |
540 |
| - * Erase the state of secondary slot of the main image (synchronous). |
| 526 | + * Reads slot information (synchronous). |
541 | 527 | *
|
542 | 528 | * @return The response.
|
543 | 529 | * @throws McuMgrException Transport error. See cause.
|
544 | 530 | */
|
545 | 531 | @NotNull
|
546 |
| - public McuMgrImageResponse eraseState() throws McuMgrException { |
547 |
| - return eraseState(0); |
548 |
| - } |
549 |
| - |
550 |
| - /** |
551 |
| - * Erase the state of secondary slot of given image (synchronous). |
552 |
| - * |
553 |
| - * @param image the image number, default is 0. Use 0 for core0, 1 for core1, etc. |
554 |
| - * @return The response. |
555 |
| - * @throws McuMgrException Transport error. See cause. |
556 |
| - */ |
557 |
| - @NotNull |
558 |
| - public McuMgrImageResponse eraseState(int image) throws McuMgrException { |
559 |
| - HashMap<String, Object> payloadMap = null; |
560 |
| - if (image > 0) { |
561 |
| - payloadMap = new HashMap<>(); |
562 |
| - payloadMap.put("image", image); |
563 |
| - } |
564 |
| - return send(OP_WRITE, ID_ERASE_STATE, payloadMap, SHORT_TIMEOUT, McuMgrImageResponse.class); |
| 532 | + public McuMgrImageSlotResponse slots() throws McuMgrException { |
| 533 | + return send(OP_READ, ID_SLOT_INFO, null, SHORT_TIMEOUT, McuMgrImageSlotResponse.class); |
565 | 534 | }
|
566 | 535 |
|
567 | 536 | /**
|
|
0 commit comments