From f893ca8fa467d3f7bee90bc1f42ccb2065bf2f60 Mon Sep 17 00:00:00 2001 From: Alek Rudnik Date: Mon, 22 Mar 2021 09:39:38 +0100 Subject: [PATCH] [EGD-6455] Fix modem AT command timeouts Fix modem AT command timeouts and make sure they are at least bigger than the ones defined in Quectel specs. --- module-cellular/at/Cmd.hpp | 2 +- module-cellular/at/Constants.hpp | 8 +- module-cellular/at/src/ATFactory.cpp | 120 +++++++++--------- .../service-cellular/ServiceCellular.cpp | 2 +- .../requests/CallBarringRequest.cpp | 2 +- .../requests/CallForwardingRequest.cpp | 2 +- .../service-cellular/requests/CallRequest.cpp | 3 +- .../requests/CallWaitingRequest.cpp | 2 +- .../service-cellular/requests/ClipRequest.cpp | 3 +- .../service-cellular/requests/ClirRequest.cpp | 14 +- .../service-cellular/requests/ColpRequest.cpp | 14 +- .../requests/PinChangeRequest.cpp | 14 +- .../service-cellular/requests/Request.cpp | 12 +- .../service-cellular/requests/Request.hpp | 2 +- 14 files changed, 96 insertions(+), 104 deletions(-) diff --git a/module-cellular/at/Cmd.hpp b/module-cellular/at/Cmd.hpp index 667a47312a63b42404a69ef35b0af1de1bf25868..74f8168c43cf0dbe6260dee0fa63ad3538ed7b2f 100644 --- a/module-cellular/at/Cmd.hpp +++ b/module-cellular/at/Cmd.hpp @@ -28,7 +28,7 @@ namespace at { private: std::string cmd; /// command head to run (AT, CLCC etc...) - std::chrono::milliseconds timeout = default_doc_timeout; /// timeout for this command + std::chrono::milliseconds timeout = default_timeout; /// timeout for this command void split(const std::string &str, Result &result) const; protected: diff --git a/module-cellular/at/Constants.hpp b/module-cellular/at/Constants.hpp index d21a537269979ec9a88640517df9e1fe38bf71a7..f9d045ca65c14ae916f5b1b0dcc3e5f92923c9cd 100644 --- a/module-cellular/at/Constants.hpp +++ b/module-cellular/at/Constants.hpp @@ -7,7 +7,9 @@ namespace at { - constexpr std::chrono::milliseconds default_timeout{300}; /// if you've checked that it's ok - constexpr std::chrono::milliseconds default_doc_timeout{5000}; /// if unsure - take this - constexpr std::chrono::milliseconds default_long_doc_timeout{15000}; /// long timeout from docs + constexpr std::chrono::milliseconds default_timeout{ + 5000}; /// applies for all timeout values smaller than itself - docs timeout < default_timeout + constexpr std::chrono::milliseconds default_long_timeout{ + 18000}; /// applies for all timeout values between default_timeout and istelf - default_timeout <= docs timout < + /// default_long_timeout } // namespace at diff --git a/module-cellular/at/src/ATFactory.cpp b/module-cellular/at/src/ATFactory.cpp index d9e61175d83bc25cc9ac62629a913e60f8ac4395..36244713c2397f2a04dd6aab741e62a22ffc82ba 100644 --- a/module-cellular/at/src/ATFactory.cpp +++ b/module-cellular/at/src/ATFactory.cpp @@ -9,12 +9,12 @@ namespace at using namespace std::chrono_literals; std::initializer_list> initializer = { - {AT::AT, {"AT", 100ms}}, + {AT::AT, {"AT"}}, {AT::ECHO_OFF, {"ATE0"}}, {AT::FACTORY_RESET, {"AT&F"}}, - {AT::SW_INFO, {"ATI\r", default_doc_timeout}}, - {AT::FLOW_CTRL_ON, {"AT+IFC=2,2\r\n", 500ms}}, - {AT::FLOW_CTRL_OFF, {"AT+IFC=0,0", 500ms}}, + {AT::SW_INFO, {"ATI\r"}}, + {AT::FLOW_CTRL_ON, {"AT+IFC=2,2\r\n"}}, + {AT::FLOW_CTRL_OFF, {"AT+IFC=0,0"}}, {AT::URC_NOTIF_CHANNEL, {"AT+QCFG=\"cmux/urcport\",1"}}, {AT::RI_PIN_AUTO_CALL, {"AT+QCFG=\"urc/ri/ring\",\"auto\""}}, {AT::RI_PIN_OFF_CALL, {"AT+QCFG=\"urc/ri/ring\",\"off\""}}, @@ -26,35 +26,35 @@ namespace at {AT::AT_PIN_READY_LOGIC, {"AT+QCFG=\"apready\",1,1,200"}}, {AT::URC_NOTIF_SIGNAL, {"AT+QINDCFG=\"csq\",1"}}, {AT::CRC_ON, {"AT+CRC=1"}}, - {AT::CALLER_NUMBER_PRESENTATION, {"AT+CLIP=1", 18000ms}}, + {AT::CALLER_NUMBER_PRESENTATION, {"AT+CLIP=1", default_long_timeout}}, {AT::SMS_TEXT_FORMAT, {"AT+CMGF=1"}}, {AT::SMS_UCSC2, {"AT+CSCS=\"UCS2\""}}, {AT::SMS_GSM, {"AT+CSCS=\"GSM\""}}, - {AT::QSCLK_ON, {"AT+QSCLK=1", 3000ms}}, + {AT::QSCLK_ON, {"AT+QSCLK=1"}}, {AT::QDAI, {"AT+QDAI?"}}, {AT::QDAI_INIT, {"AT+QDAI=1,0,0,3,0,1,1,1"}}, - {AT::SET_URC_CHANNEL, {"AT+QCFG=\"cmux/urcport\",2", default_doc_timeout}}, - {AT::CSQ, {"AT+CSQ", default_doc_timeout}}, - {AT::CLCC, {"AT+CLCC", default_doc_timeout}}, - {AT::CMGD, {"AT+CMGD=", default_doc_timeout}}, + {AT::SET_URC_CHANNEL, {"AT+QCFG=\"cmux/urcport\",2"}}, + {AT::CSQ, {"AT+CSQ"}}, + {AT::CLCC, {"AT+CLCC"}}, + {AT::CMGD, {"AT+CMGD="}}, {AT::CNUM, {"AT+CNUM"}}, {AT::CIMI, {"AT+CIMI"}}, - {AT::QCMGR, {"AT+QCMGR=", 2000ms}}, - {AT::ATH, {"ATH", 90000ms}}, - {AT::ATA, {"ATA", 90000ms}}, - {AT::ATD, {"ATD"}}, + {AT::QCMGR, {"AT+QCMGR=", 12s}}, + {AT::ATH, {"ATH", 90s}}, + {AT::ATA, {"ATA", 90s}}, + {AT::ATD, {"ATD", 6s}}, {AT::IPR, {"AT+IPR="}}, {AT::CMUX, {"AT+CMUX="}}, - {AT::CFUN, {"AT+CFUN=", default_long_doc_timeout}}, - {AT::CFUN_RESET, {"AT+CFUN=1,1", default_long_doc_timeout}}, - {AT::CFUN_MIN_FUNCTIONALITY, {"AT+CFUN=0", default_long_doc_timeout}}, - {AT::CFUN_FULL_FUNCTIONALITY, {"AT+CFUN=1", default_long_doc_timeout}}, - {AT::CFUN_DISABLE_TRANSMITTING, {"AT+CFUN=4", default_long_doc_timeout}}, + {AT::CFUN, {"AT+CFUN=", default_long_timeout}}, + {AT::CFUN_RESET, {"AT+CFUN=1,1", default_long_timeout}}, + {AT::CFUN_MIN_FUNCTIONALITY, {"AT+CFUN=0", default_long_timeout}}, + {AT::CFUN_FULL_FUNCTIONALITY, {"AT+CFUN=1", default_long_timeout}}, + {AT::CFUN_DISABLE_TRANSMITTING, {"AT+CFUN=4", default_long_timeout}}, {AT::CMGS, {"AT+CMGS=\"", 120s}}, // verified in docs {AT::QCMGS, {"AT+QCMGS=\"", 120s}}, // verified in docs - {AT::CREG, {"AT+CREG?", default_doc_timeout}}, + {AT::CREG, {"AT+CREG?"}}, {AT::QNWINFO, {"AT+QNWINFO"}}, - {AT::COPS, {"AT+COPS", 180000ms}}, + {AT::COPS, {"AT+COPS", 180s}}, {AT::QSIMSTAT, {"AT+QSIMSTAT?"}}, {AT::SIM_DET, {"AT+QSIMDET?"}}, {AT::SIM_DET_ON, {"AT+QSIMDET=1,0"}}, @@ -65,52 +65,52 @@ namespace at {AT::STORE_SETTINGS_ATW, {"AT&W"}}, {AT::CEER, {"AT+CEER"}}, {AT::QIGETERROR, {"AT+QIGETERROR"}}, - {AT::VTS, {"AT+VTS="}}, + {AT::VTS, {"AT+VTS=", default_long_timeout}}, {AT::QLDTMF, {"AT+QLDTMF=1,"}}, - {AT::CUSD_OPEN_SESSION, {"AT+CUSD=1"}}, - {AT::CUSD_CLOSE_SESSION, {"AT+CUSD=2"}}, - {AT::CUSD_SEND, {"AT+CUSD=1,"}}, - {AT::SET_SMS_STORAGE, {"AT+CPMS=\"SM\",\"SM\",\"SM\"", 300ms}}, - {AT::CPIN, {"AT+CPIN=", default_timeout}}, - {AT::GET_CPIN, {"AT+CPIN?", default_timeout}}, - {AT::QPINC, {"AT+QPINC=", default_timeout}}, - {AT::CLCK, {"AT+CLCK=", default_timeout}}, - {AT::CPWD, {"AT+CPWD=", default_timeout}}, + {AT::CUSD_OPEN_SESSION, {"AT+CUSD=1", 120s}}, + {AT::CUSD_CLOSE_SESSION, {"AT+CUSD=2", 120s}}, + {AT::CUSD_SEND, {"AT+CUSD=1,", 120s}}, + {AT::SET_SMS_STORAGE, {"AT+CPMS=\"SM\",\"SM\",\"SM\""}}, + {AT::CPIN, {"AT+CPIN=", default_long_timeout}}, + {AT::GET_CPIN, {"AT+CPIN?", default_long_timeout}}, + {AT::QPINC, {"AT+QPINC=", default_long_timeout}}, + {AT::CLCK, {"AT+CLCK=", default_long_timeout}}, + {AT::CPWD, {"AT+CPWD=", default_long_timeout}}, {AT::ENABLE_TIME_ZONE_UPDATE, {"AT+CTZU=3"}}, {AT::SET_TIME_ZONE_REPORTING, {"AT+CTZR=2"}}, {AT::DISABLE_TIME_ZONE_UPDATE, {"AT+CTZU=0"}}, {AT::DISABLE_TIME_ZONE_REPORTING, {"AT+CTZR=0"}}, {AT::ENABLE_NETWORK_REGISTRATION_URC, {"AT+CREG=2"}}, {AT::SET_SMS_TEXT_MODE_UCS2, {"AT+CSMP=17,167,0,8"}}, - {AT::LIST_MESSAGES, {"AT+CMGL=\"ALL\"", default_doc_timeout}}, - {AT::GET_IMEI, {"AT+GSN", default_doc_timeout}}, - {AT::CCFC, {"AT+CCFC=", default_doc_timeout}}, - {AT::CCWA, {"AT+CCWA=", default_doc_timeout}}, - {AT::CCWA_GET, {"AT+CCWA?", default_doc_timeout}}, - {AT::CHLD, {"AT+CHLD=\"", default_doc_timeout}}, - {AT::CLIP, {"AT+CLIP=", default_long_doc_timeout}}, - {AT::CLIP_GET, {"AT+CLIP?", default_long_doc_timeout}}, - {AT::CLIR, {"AT+CLIR=", default_long_doc_timeout}}, - {AT::CLIR_GET, {"AT+CLIR?", default_long_doc_timeout}}, - {AT::CLIR_RESET, {"AT+CLIR=0", default_long_doc_timeout}}, - {AT::CLIR_ENABLE, {"AT+CLIR=1", default_long_doc_timeout}}, - {AT::CLIR_DISABLE, {"AT+CLIR=2", default_long_doc_timeout}}, - {AT::COLP, {"AT+COLP", default_long_doc_timeout}}, - {AT::COLP_GET, {"AT+COLP?", default_long_doc_timeout}}, - {AT::COLP_ENABLE, {"AT+COLP=1", default_long_doc_timeout}}, - {AT::COLP_DISABLE, {"AT+COLP=0", default_long_doc_timeout}}, - {AT::CSSN, {"AT+CSSN=\"", default_doc_timeout}}, - {AT::QICSGP, {"AT+QICSGP", default_timeout}}, - {AT::QIACT, {"AT+QIACT", 150000ms}}, - {AT::QIDEACT, {"AT+QIDEACT", 40000ms}}, - {AT::QRXGAIN, {"AT+QRXGAIN=40000", default_timeout}}, - {AT::CLVL, {"AT+CLVL=3", default_timeout}}, - {AT::QMIC, {"AT+QMIC=15000,15000", default_timeout}}, - {AT::QEEC, {"AT+QEEC=", 3000ms}}, - {AT::QNVFR, {"AT+QNVFR=", default_long_doc_timeout}}, - {AT::QNVFW, {"AT+QNVFW=", default_long_doc_timeout}}, - {AT::QMBNCFG, {"AT+QMBNCFG=", default_long_doc_timeout}}, - {AT::QCFG_IMS, {"AT+QCFG=\"ims\"", default_timeout}}}; + {AT::LIST_MESSAGES, {"AT+CMGL=\"ALL\""}}, + {AT::GET_IMEI, {"AT+GSN"}}, + {AT::CCFC, {"AT+CCFC="}}, + {AT::CCWA, {"AT+CCWA="}}, + {AT::CCWA_GET, {"AT+CCWA?"}}, + {AT::CHLD, {"AT+CHLD=\""}}, + {AT::CLIP, {"AT+CLIP=", default_long_timeout}}, + {AT::CLIP_GET, {"AT+CLIP?", default_long_timeout}}, + {AT::CLIR, {"AT+CLIR=", default_long_timeout}}, + {AT::CLIR_GET, {"AT+CLIR?", default_long_timeout}}, + {AT::CLIR_RESET, {"AT+CLIR=0", default_long_timeout}}, + {AT::CLIR_ENABLE, {"AT+CLIR=1", default_long_timeout}}, + {AT::CLIR_DISABLE, {"AT+CLIR=2", default_long_timeout}}, + {AT::COLP, {"AT+COLP", default_long_timeout}}, + {AT::COLP_GET, {"AT+COLP?", default_long_timeout}}, + {AT::COLP_ENABLE, {"AT+COLP=1", default_long_timeout}}, + {AT::COLP_DISABLE, {"AT+COLP=0", default_long_timeout}}, + {AT::CSSN, {"AT+CSSN=\""}}, + {AT::QICSGP, {"AT+QICSGP"}}, + {AT::QIACT, {"AT+QIACT", 150s}}, + {AT::QIDEACT, {"AT+QIDEACT", 40s}}, + {AT::QRXGAIN, {"AT+QRXGAIN=40000"}}, + {AT::CLVL, {"AT+CLVL=3"}}, + {AT::QMIC, {"AT+QMIC=15000,15000"}}, + {AT::QEEC, {"AT+QEEC="}}, + {AT::QNVFR, {"AT+QNVFR=", default_long_timeout}}, + {AT::QNVFW, {"AT+QNVFW=", default_long_timeout}}, + {AT::QMBNCFG, {"AT+QMBNCFG=", default_long_timeout}}, + {AT::QCFG_IMS, {"AT+QCFG=\"ims\""}}}; auto factory(AT at) -> const Cmd & { diff --git a/module-services/service-cellular/ServiceCellular.cpp b/module-services/service-cellular/ServiceCellular.cpp index 9017d4376988af0ad7faaa6712adc225b81f27d5..0cfb8aebcecbc10967452f83fec69b3044a8af54 100644 --- a/module-services/service-cellular/ServiceCellular.cpp +++ b/module-services/service-cellular/ServiceCellular.cpp @@ -2189,7 +2189,7 @@ auto ServiceCellular::handleCellularCallRequestMessage(CellularCallRequestMessag auto request = factory.create(); CellularRequestHandler handler(*this); - auto result = channel->cmd(request->command(), at::default_doc_timeout); + auto result = channel->cmd(request->command()); request->handle(handler, result); return std::make_shared(request->isHandled()); } diff --git a/module-services/service-cellular/requests/CallBarringRequest.cpp b/module-services/service-cellular/requests/CallBarringRequest.cpp index e0ea9a6fe265df91f0be2f10154807b45d36d7f9..a2f9deb37bc67dc82af33db55efff5c5bdecc303 100644 --- a/module-services/service-cellular/requests/CallBarringRequest.cpp +++ b/module-services/service-cellular/requests/CallBarringRequest.cpp @@ -34,7 +34,7 @@ namespace cellular [this]() { return getCommandClass(); }, }; - return at::Cmd(buildCommand(at::AT::CLCK, commandParts), at::default_doc_timeout); + return buildCommand(at::AT::CLCK, commandParts); } auto CallBarringRequest::getCommandFacility() const -> std::string diff --git a/module-services/service-cellular/requests/CallForwardingRequest.cpp b/module-services/service-cellular/requests/CallForwardingRequest.cpp index fb54390306db2f72e0114c5ec766d62e91f2c23d..01e8678e61db5deb39b50762eafc1d261090d06e 100644 --- a/module-services/service-cellular/requests/CallForwardingRequest.cpp +++ b/module-services/service-cellular/requests/CallForwardingRequest.cpp @@ -57,7 +57,7 @@ namespace cellular trimEmpty = false; } - return at::Cmd(buildCommand(at::AT::CCFC, commandParts, trimEmpty), at::default_doc_timeout); + return buildCommand(at::AT::CCFC, commandParts, trimEmpty); } auto CallForwardingRequest::getCommandReason() const -> std::string diff --git a/module-services/service-cellular/requests/CallRequest.cpp b/module-services/service-cellular/requests/CallRequest.cpp index 330f42c61aba5a72fbfba35b50f73daddb40381f..2a62c68c606ea239079d397e2e65e51826f5b680 100644 --- a/module-services/service-cellular/requests/CallRequest.cpp +++ b/module-services/service-cellular/requests/CallRequest.cpp @@ -14,7 +14,8 @@ namespace cellular { at::Cmd CallRequest::command() { - return at::Cmd(std::string(at::factory(at::AT::ATD) + request + ";"), at::default_doc_timeout); + auto cmd = at::factory(at::AT::ATD); + return cmd + request + ";"; } void CallRequest::handle(RequestHandler &h, at::Result &result) diff --git a/module-services/service-cellular/requests/CallWaitingRequest.cpp b/module-services/service-cellular/requests/CallWaitingRequest.cpp index 9925d83c010990afc11e6e9f88fb6c6804aa8664..0664e314aa5f6dca3ce9a558ac10cca83339fcd6 100644 --- a/module-services/service-cellular/requests/CallWaitingRequest.cpp +++ b/module-services/service-cellular/requests/CallWaitingRequest.cpp @@ -32,7 +32,7 @@ namespace cellular [this]() { return getCommandClass(); }, }; - return at::Cmd(buildCommand(at::AT::CCWA, commandParts), at::default_doc_timeout); + return buildCommand(at::AT::CCWA, commandParts); } auto CallWaitingRequest::getCommandPresentation() const noexcept -> std::string diff --git a/module-services/service-cellular/requests/ClipRequest.cpp b/module-services/service-cellular/requests/ClipRequest.cpp index 9611f445aeed72b7e568f213c85fde4c309b90c1..36a68c601ecbe7ffb4619031adbbe701b95cb311 100644 --- a/module-services/service-cellular/requests/ClipRequest.cpp +++ b/module-services/service-cellular/requests/ClipRequest.cpp @@ -26,8 +26,7 @@ namespace cellular auto ClipRequest::command() -> at::Cmd { - return at::Cmd(isValid() ? std::string(at::factory(at::AT::CLIP_GET)) : std::string(), - at::default_long_doc_timeout); + return isValid() ? at::factory(at::AT::CLIP_GET) : at::Cmd(""); } auto ClipRequest::isValid() const noexcept -> bool diff --git a/module-services/service-cellular/requests/ClirRequest.cpp b/module-services/service-cellular/requests/ClirRequest.cpp index b0b46b52c1454015b2c90078a6b9f599a653d569..7193a6298590500e592e17bc223dece8cebe0e63 100644 --- a/module-services/service-cellular/requests/ClirRequest.cpp +++ b/module-services/service-cellular/requests/ClirRequest.cpp @@ -26,25 +26,19 @@ namespace cellular auto ClirRequest::command() -> at::Cmd { - std::string body; switch (procedureType) { case ProcedureType::Deactivation: - body = at::factory(at::AT::CLIR_DISABLE); - break; + return at::factory(at::AT::CLIR_DISABLE); case ProcedureType::Activation: - body = at::factory(at::AT::CLIR_ENABLE); - break; + return at::factory(at::AT::CLIR_ENABLE); case ProcedureType::Interrogation: - body = at::factory(at::AT::CLIR_GET); - break; + return at::factory(at::AT::CLIR_GET); case ProcedureType::Registration: - // not supported - break; case ProcedureType::Erasure: // not supported break; } - return at::Cmd(body, at::default_long_doc_timeout); + return at::Cmd(""); } void ClirRequest::handle(RequestHandler &h, at::Result &result) diff --git a/module-services/service-cellular/requests/ColpRequest.cpp b/module-services/service-cellular/requests/ColpRequest.cpp index e17b63531ced09d8fd0b3248834847bd32a70086..ff72e8f5e947ceceb80278bfbabd438209a5e51a 100644 --- a/module-services/service-cellular/requests/ColpRequest.cpp +++ b/module-services/service-cellular/requests/ColpRequest.cpp @@ -26,25 +26,19 @@ namespace cellular auto ColpRequest::command() -> at::Cmd { - std::string body; switch (procedureType) { case ProcedureType::Deactivation: - body = at::factory(at::AT::COLP_DISABLE); - break; + return at::factory(at::AT::COLP_DISABLE); case ProcedureType::Activation: - body = at::factory(at::AT::COLP_ENABLE); - break; + return at::factory(at::AT::COLP_ENABLE); case ProcedureType::Interrogation: - body = at::factory(at::AT::COLP_GET); - break; + return at::factory(at::AT::COLP_GET); case ProcedureType::Registration: - // not supported - break; case ProcedureType::Erasure: // not supported break; } - return at::Cmd(body, at::default_long_doc_timeout); + return at::Cmd(""); } void ColpRequest::handle(RequestHandler &h, at::Result &result) diff --git a/module-services/service-cellular/requests/PinChangeRequest.cpp b/module-services/service-cellular/requests/PinChangeRequest.cpp index ff8126b49fe11a6e2df564f3c274f485cc1e70f5..34d8e04535f0e19ae5f2f15208d65bbeacbd42a5 100644 --- a/module-services/service-cellular/requests/PinChangeRequest.cpp +++ b/module-services/service-cellular/requests/PinChangeRequest.cpp @@ -55,24 +55,26 @@ namespace cellular return at::Cmd(std::string()); } - std::string cmd; + at::Cmd cmd(""); switch (passChangeType) { case PassChangeType::ChangePin: - cmd.append(at::factory(at::AT::CPWD) + "\"SC\","); + cmd = at::factory(at::AT::CPWD); + cmd = cmd + "\"SC\","; break; case PassChangeType::ChangePin2: - cmd.append(at::factory(at::AT::CPWD) + "\"P2\","); + cmd = at::factory(at::AT::CPWD); + cmd = cmd + "\"P2\","; break; case PassChangeType::ChangePinByPuk: - cmd.append(at::factory(at::AT::CPIN)); + cmd = at::factory(at::AT::CPIN); break; }; for (auto &cmdPart : commandParts) { - cmd.append(cmdPart()); + cmd = cmd + cmdPart(); } - return at::Cmd(cmd, at::default_doc_timeout); + return cmd; } auto PinChangeRequest::getOldPinOrPuk() const noexcept -> std::string diff --git a/module-services/service-cellular/requests/Request.cpp b/module-services/service-cellular/requests/Request.cpp index 2f45a236e8428f7f186053b0b92967951a505a75..75d7e6520eaf1f353fa14fcd362a385fbf89bac0 100644 --- a/module-services/service-cellular/requests/Request.cpp +++ b/module-services/service-cellular/requests/Request.cpp @@ -32,15 +32,15 @@ namespace cellular return true; } - std::string Request::buildCommand(at::AT atCommand, - const std::vector &builderFunctions, - bool trim) const + at::Cmd Request::buildCommand(at::AT atCommand, + const std::vector &builderFunctions, + bool trim) const { if (!isValid()) { - return std::string(); + return at::Cmd(""); } - std::string cmd(at::factory(atCommand)); + auto cmd = at::factory(atCommand); auto formatFirst = true; for (auto &cmdPart : builderFunctions) { @@ -48,7 +48,7 @@ namespace cellular if (partStr.empty() && trim) { break; } - cmd.append(formatFirst ? partStr : "," + partStr); + cmd = cmd + (formatFirst ? partStr : "," + partStr); formatFirst = false; } diff --git a/module-services/service-cellular/service-cellular/requests/Request.hpp b/module-services/service-cellular/service-cellular/requests/Request.hpp index 1ffca208f22efba25762927a02460098bd629b64..3024565f3807448264858e49daa05b9b08f4850f 100644 --- a/module-services/service-cellular/service-cellular/requests/Request.hpp +++ b/module-services/service-cellular/service-cellular/requests/Request.hpp @@ -46,7 +46,7 @@ namespace cellular */ auto buildCommand(at::AT atCommand, const std::vector &builderFunctions, - bool trim = true) const -> std::string; + bool trim = true) const -> at::Cmd; bool isRequestHandled = false; std::string request; };