Skip to content

Commit

Permalink
Add getSearchAccessTechnologySequence() and setSearchAccessTechnology…
Browse files Browse the repository at this point in the history
…Sequence()
  • Loading branch information
matsujirushi committed Aug 29, 2024
1 parent 7609cfe commit dd0f1bb
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 17 deletions.
38 changes: 21 additions & 17 deletions examples/cellular/shell/shell.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
55 changes: 55 additions & 0 deletions src/module/Bg770a.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,61 @@ class Bg770a : public AtClient<Bg770a<INTERFACE>> // 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 ネットワーク探索の周波数バンドを取得
Expand Down

0 comments on commit dd0f1bb

Please sign in to comment.