From dd0f1bb7dfc3d1b900ecdc07dacc760ba2eace9c Mon Sep 17 00:00:00 2001 From: MATSUOKA Takashi Date: Thu, 29 Aug 2024 20:28:59 +0900 Subject: [PATCH] Add getSearchAccessTechnologySequence() and setSearchAccessTechnologySequence() --- examples/cellular/shell/shell.ino | 38 +++++++++++---------- src/module/Bg770a.hpp | 55 +++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 17 deletions(-) diff --git a/examples/cellular/shell/shell.ino b/examples/cellular/shell/shell.ino index 4f9198c..5fc93a3 100644 --- a/examples/cellular/shell/shell.ino +++ b/examples/cellular/shell/shell.ino @@ -180,28 +180,32 @@ static int CommandInfo(int argc, char **argv) { WioCellular.getPhoneNumber(&phoneNumber); int searchAct; WioCellular.getSearchAccessTechnology(&searchAct); + std::string searchActSeq; + WioCellular.getSearchAccessTechnologySequence(&searchActSeq); std::string gsmBand; std::string emtcBand; std::string nbiotBand; WioCellular.getSearchFrequencyBand(&gsmBand, &emtcBand, &nbiotBand); - Serial.printf("IMEI: %s\n", imei.c_str()); - Serial.printf("Revision: %s\n", revision.c_str()); - Serial.printf("SIM Inserted: %s\n", simInserted == 0 ? "No" : simInserted == 1 ? "Yes" - : "Unknown"); - Serial.printf("SIM Init: %s\n", simInitStatus == 0 ? "Initial" : simInitStatus == 1 ? "CPIN Ready" - : simInitStatus == 2 ? "SMS Done" - : simInitStatus == 3 ? "CPIN Ready & SMS Done" - : "Unknown"); - Serial.printf("SIM State: %s\n", simState.c_str()); - Serial.printf("IMSI: %s\n", imsi.c_str()); - Serial.printf("ICCID: %s\n", iccid.c_str()); - Serial.printf("Phone Number: %s\n", phoneNumber.c_str()); - Serial.printf("Search Access Technology: %s\n", searchAct == 0 ? "eMTC" : searchAct == 1 ? "NB-IoT" - : searchAct == 2 ? "eMTC and NB-IoT" - : "Unknown"); - Serial.printf("Search Frequency Band - eMTC: %s\n", emtcBand.c_str()); - Serial.printf("Search Frequency Band - NB-IoT: %s\n", nbiotBand.c_str()); + Serial.printf("IMEI: %s\n", imei.c_str()); + Serial.printf("Revision: %s\n", revision.c_str()); + Serial.printf("SIM Inserted: %s\n", simInserted == 0 ? "No" : simInserted == 1 ? "Yes" + : "Unknown"); + Serial.printf("SIM Init: %s\n", simInitStatus == 0 ? "Initial" : simInitStatus == 1 ? "CPIN Ready" + : simInitStatus == 2 ? "SMS Done" + : simInitStatus == 3 ? "CPIN Ready & SMS Done" + : "Unknown"); + Serial.printf("SIM State: %s\n", simState.c_str()); + Serial.printf("IMSI: %s\n", imsi.c_str()); + Serial.printf("ICCID: %s\n", iccid.c_str()); + Serial.printf("Phone Number: %s\n", phoneNumber.c_str()); + Serial.printf("Search ACT: %s\n", searchAct == 0 ? "eMTC" : searchAct == 1 ? "NB-IoT" + : searchAct == 2 ? "eMTC and NB-IoT" + : "Unknown"); + Serial.printf("Search ACT Sequence: %s\n", searchActSeq == "0203" ? "eMTC -> NB-IoT" : searchActSeq == "0302" ? "NB-IoT -> eMTC" + : "Unknown"); + Serial.printf("Search Band - eMTC: %s\n", emtcBand.c_str()); + Serial.printf("Search Band - NB-IoT: %s\n", nbiotBand.c_str()); return 0; } diff --git a/src/module/Bg770a.hpp b/src/module/Bg770a.hpp index dfb2626..103a0a8 100644 --- a/src/module/Bg770a.hpp +++ b/src/module/Bg770a.hpp @@ -1510,6 +1510,61 @@ class Bg770a : public AtClient> // CRTP } } + /** + * @~Japanese + * @brief ネットワーク探索のアクセステクノロジー順序を取得 + * + * @param [out] scanseq 探索するアクセステクノロジー順序 + * @return 実行結果 + * + * ネットワーク探索のアクセステクノロジー順序を取得します。 + * 値を得る必要が無いときはnullptrを指定できます。 + * * scanseq="0203": eMTC->NB-IoT + * * scanseq="0302": NB-IoT->eMTC + * + * > BG77xA-GL&BG95xA-GL QCFG AT Commands Manual @n + * > 2.1.1.3 AT+QCFG="nwscanseq" - Configure RATs Searching Sequence + */ + WioCellularResult getSearchAccessTechnologySequence(std::string *scanseq) + { + if (scanseq) + scanseq->clear(); + + return queryCommand( + "AT+QCFG=\"nwscanseq\"", [scanseq](const std::string &response) -> bool + { + std::string responseParameter; + if (internal::stringStartsWith(response, "+QCFG: \"nwscanseq\",", &responseParameter)) + { + if (scanseq) *scanseq = responseParameter; + return true; + } + return false; }, + 300); + } + + /** + * @~Japanese + * @brief ネットワーク探索のアクセステクノロジー順序を設定 + * + * @param [in] scanseq 探索するアクセステクノロジー順序 + * @return 実行結果 + * + * ネットワーク探索のアクセステクノロジー順序を設定します。 + * * scanseq="00": 自動(eMTC->NB-IoT) + * * scanseq="02": eMTC->NB-IoT + * * scanseq="0203": eMTC->NB-IoT + * * scanseq="03": NB-IoT->eMTC + * * scanseq="0302": NB-IoT->eMTC + * + * > BG77xA-GL&BG95xA-GL QCFG AT Commands Manual @n + * > 2.1.1.3 AT+QCFG="nwscanseq" - Configure RATs Searching Sequence + */ + WioCellularResult setSearchAccessTechnologySequence(const std::string &scanseq) + { + return executeCommand(internal::stringFormat("AT+QCFG=\"nwscanseq\",%s", scanseq.c_str()), 300); + } + /** * @~Japanese * @brief ネットワーク探索の周波数バンドを取得