19#include <radio_tool/fw/yaesu_fw.hpp>
20#include <radio_tool/util.hpp>
26 auto i = std::ifstream(file, std::ios_base::binary);
30 i.seekg(0, std::ios_base::end);
31 auto binarySize = i.tellg();
35 data.resize(binarySize);
36 i.read((
char*)data.data(), binarySize);
39 data.resize(binarySize + ((1024 - binarySize % 1024) % 1024), 0xFF);
46 std::ofstream fout(file, std::ios_base::binary);
50 fout.write((
char*)data.data(), data.size());
57 std::stringstream out;
58 out <<
"== Yaesu Firmware == " << std::endl
59 <<
"Size: " << radio_tool::FormatBytes(
data.size()) << std::endl;
74 i.open(file, i.binary);
81 throw std::runtime_error(
"Can't open firmware file");
92 if (
typeid(Other) !=
typeid(
this)) {
96 auto afw =
dynamic_cast<const YaesuFW*
>(Other);
97 return afw->radio_model == radio_model;