class GetFirmwareFileResponseMessageProcessor extends OsgpResponseMessageProcessor {

    @Override
    protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device,
            final Serializable response) throws OsgpException {

        if (!(response instanceof ResponseMessage)) {
            throw new ProtocolAdapterException("Invalid response type, expected ResponseMessage object.");
        }

        final ResponseMessage responseMessage = (ResponseMessage) response;

        if (ResponseMessageResultType.OK.equals(responseMessage.getResult())) {
            final FirmwareFileDto firmwareFileDto = (FirmwareFileDto) responseMessage.getDataObject();
            return this.firmwareService.updateFirmware(conn, device, firmwareFileDto);
        } else {
            throw new ProtocolAdapterException("Get Firmware File failed.", responseMessage.getOsgpException());
        }

    }

    protected  GetFirmwareFileResponseMessageProcessor();

}