// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace at::urc; std::unique_ptr UrcFactory::Create(const std::string &urcMessage) { if (urcMessage.empty()) { return std::make_unique(std::string()); } const auto headDelimiter = ':'; const auto it = std::find(urcMessage.begin(), urcMessage.end(), headDelimiter); const auto &head = utils::trim(std::string(urcMessage.begin(), it)); const auto &body = std::string(it == urcMessage.end() ? urcMessage.begin() : it + 1, urcMessage.end()); if (Ctze::isURC(head)) { return std::make_unique(body); } else if (Creg::isURC(head)) { return std::make_unique(body); } else if (Qind::isURC(head)) { return std::make_unique(body); } else if (Cusd::isURC(head)) { return std::make_unique(body); } else if (Cmti::isURC(head)) { return std::make_unique(body); } else if (Clip::isURC(head)) { return std::make_unique(body); } else if (Cpin::isURC(head)) { return std::make_unique(body); } else if (PoweredDown::isURC(head)) { return std::make_unique(body); } else if (Ring::isURC(head)) { return std::make_unique(body); } else if (auto type = UrcResponse::isURC(head)) { return std::make_unique(type.value()); } else if (Qiurc::isURC(head)) { return std::make_unique(body); } else if (QSimstat::isURC(head)) { return std::make_unique(body); } return std::make_unique(body, head); }