Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

固件一致性判断问题 #82

Open
brook99-x opened this issue Sep 20, 2024 · 0 comments
Open

固件一致性判断问题 #82

brook99-x opened this issue Sep 20, 2024 · 0 comments

Comments

@brook99-x
Copy link

brook99-x commented Sep 20, 2024

com.dji.sample.manage.service.impl.SDKDeviceService#dockFirmwareVersionUpdate 方法如下:

   @Override
    public void dockFirmwareVersionUpdate(TopicStateRequest<DockFirmwareVersion> request, MessageHeaders headers) {
        // If the reported version is empty, it will not be processed to prevent misleading page.
        if (!StringUtils.hasText(request.getData().getFirmwareVersion())) {
            return;
        }
        DeviceDTO device = DeviceDTO.builder()
                .deviceSn(request.getFrom())
                .firmwareVersion(request.getData().getFirmwareVersion())
                // 这里判断是否有问题,为何为 false (不需要一致性升级)时,设置为需要一致性升级 
                // ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
                .firmwareStatus(request.getData().getNeedCompatibleStatus() ?
                        DeviceFirmwareStatusEnum.UNKNOWN : DeviceFirmwareStatusEnum.CONSISTENT_UPGRADE)
                .build();
        boolean isUpd = deviceService.updateDevice(device);
        if (!isUpd) {
            log.error("Data update of firmware version failed. SN: {}", request.getFrom());
        }
    }

其中request.getData().getNeedCompatibleStatus() 为 true 时,是否是表示需要一致性升级,应对应DeviceFirmwareStatusEnum.CONSISTENT_UPGRADE;而为 false 时,则表示不需要一致性升级,应对应DeviceFirmwareStatusEnum.NOT_UPGRADE
源码中判断是否有问题,希望可以得到各位的解答,谢谢~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant