franta-hg@18: /**
franta-hg@18: * djm-fix
franta-hg@18: * Copyright © 2025 František Kučera (Frantovo.cz, GlobalCode.info)
franta-hg@18: *
franta-hg@18: * This program is free software: you can redistribute it and/or modify
franta-hg@18: * it under the terms of the GNU General Public License as published by
franta-hg@18: * the Free Software Foundation, version 3 of the License.
franta-hg@18: *
franta-hg@18: * This program is distributed in the hope that it will be useful,
franta-hg@18: * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@18: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@18: * GNU General Public License for more details.
franta-hg@18: *
franta-hg@18: * You should have received a copy of the GNU General Public License
franta-hg@18: * along with this program. If not, see .
franta-hg@18: */
franta-hg@18:
franta-hg@18: #include
franta-hg@18: #include
franta-hg@18:
franta-hg@18: #include "Message.h"
franta-hg@18:
franta-hg@18: std::string Message::toString() const {
franta-hg@18: std::stringstream s;
franta-hg@18: s << "";
franta-hg@18: for (const auto& field : fields) {
franta-hg@18: s << "";
franta-hg@18: for (uint8_t b : field.data) {
franta-hg@18: s << std::hex << std::setw(2) << std::setfill('0') << (int) b;
franta-hg@18: }
franta-hg@18: s << "";
franta-hg@18: }
franta-hg@18: s << "";
franta-hg@18: return s.str();
franta-hg@18: }
franta-hg@18:
franta-hg@18: std::vector Message::findFields(FieldType type) {
franta-hg@18: std::vector found;
franta-hg@18: for (Field f : fields) if (f.type == type) found.push_back(f);
franta-hg@18: return found;
franta-hg@18: }