From 1f7987d546384b6b9ef0079dac5c903148a59210 Mon Sep 17 00:00:00 2001 From: "andrii.davydenko" Date: Tue, 16 Nov 2021 11:51:32 +0200 Subject: Update MODBUS slave feature, Rogers Certification issue --- include/mts/MTS_IO_CellularRadio.h | 27 +++++++++++++++++++++++++++ include/mts/MTS_IO_ICellularRadio.h | 36 ++++++++++++++++++++++++++++++++++++ include/mts/MTS_IO_QuectelRadio.h | 4 ++++ include/mts/MTS_IO_TelitRadio.h | 4 ++++ 4 files changed, 71 insertions(+) (limited to 'include') diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h index 4d1cd12..f32251c 100644 --- a/include/mts/MTS_IO_CellularRadio.h +++ b/include/mts/MTS_IO_CellularRadio.h @@ -72,6 +72,7 @@ namespace MTS { CODE getTime(std::string& sDate, std::string& sTime, std::string& sTimeZone) override; CODE getRoaming(bool& bRoaming) override; CODE getCellularMode(CELLULAR_MODES &networks) override; + CODE getSelectedBandsRaw(std::string& sRawBands) override; CODE getSignalStrength(int32_t& iRssi) override; CODE getModemLocation(std::string& sLocation) override; @@ -223,6 +224,32 @@ namespace MTS { */ virtual CODE getSimMncLength(uint8_t& iLength); + /** + * @brief getCarrierFromSimMccMnc - get a carrier name based on the MCC/MNC values. + * + * @param sCarrier - a string to be filled with carrier based on the MCC/MNC values. + * + * @return CODE::SUCCESS when the read is completed successfully, + * CODE::NOT_APPLICABLE when the modem doesn't support this feature, + * CODE::NO_RESPONSE when the modem doesn't respond, + * CODE::ERROR when the radio returns "ERROR" (SIM card removed, SIM card locked etc), + * CODE::FAILURE otherwise (unexpected response, no data in SIM etc). + */ + virtual CODE getCarrierFromSimMccMnc(std::string& sCarrier); + + /** + * @brief getCarrierFromSimSpn - get a carrier name from SIM EFspn. + * + * @param sCarrier - a string to be filled with carrier obtained from SIM EFspn. + * + * @return CODE::SUCCESS when the read is completed successfully, + * CODE::NOT_APPLICABLE when the modem doesn't support this feature, + * CODE::NO_RESPONSE when the modem doesn't respond, + * CODE::ERROR when the radio returns "ERROR" (SIM card removed, SIM card locked etc), + * CODE::FAILURE otherwise (unexpected response, no data in SIM etc). + */ + virtual CODE getCarrierFromSimSpn(std::string& sCarrier); + void initMipProfile(Json::Value& jData); bool splitAndAssign(const std::string& sLine, const std::string& sKey, Json::Value& jParent, const std::string& sJsonKey, Json::ValueType eType = Json::ValueType::stringValue); diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index e061636..f3e15e2 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -620,6 +620,42 @@ namespace MTS { */ virtual CODE getVoiceSupport(Json::Value& jData) = 0; virtual CODE getVoiceSupport(bool& bVoiceEnabled, bool& bSmsOnly) = 0; + + /** + * @brief getSelectedBandsRaw - get the raw Selected Bands value for the current radio. + * + * This commands sends the query to the radio, selects first 3 values from the response, + * parses the numbers as dec (Telit GSM and WCDMA fiels) or hex (Quectel GW_band and LTE, + * Telit LTE), formats them as comma-separated hex values and saves the result to sRawBands. + * + * WARNING: The response format is radio-dependent. Please consult the AT command manual + * to interpet the resulting values. + * + * For Telit radios: + * + * - command: `AT#BND?`; + * - example radio response: `#BND: 5,15,800C5`; + * - `sRawBands` format: `[,[,]]`; + * - example `sRawBands` content: `5,F,800C5`. + * + * For Quectel radios: + * + * - command: `AT+QCFG="band"`; + * - example radio response: `+QCFG: "band",0x93,0x80800c5,0x0`; + * - `sRawBands` format: `,,`, + * NOTE: the `` value is duplicated for the first two fields; + * - example `sRawBands` content: `93,93,80800c5`. + * + * @param sRawBands - radio-depended string value, shows the currently selected bands. + * + * @return CODE::SUCCESS when fetched successfully, + * CODE::NOT_APPLICABLE when the modem doesn't support this feature, + * CODE::NO_RESPONSE when the modem doesn't respond, + * CODE::ERROR when the radio returns "ERROR", + * CODE::FAILURE otherwise (unexpected response). + */ + virtual CODE getSelectedBandsRaw(std::string& sRawBands) = 0; + }; } } diff --git a/include/mts/MTS_IO_QuectelRadio.h b/include/mts/MTS_IO_QuectelRadio.h index 4e82261..c54e560 100644 --- a/include/mts/MTS_IO_QuectelRadio.h +++ b/include/mts/MTS_IO_QuectelRadio.h @@ -57,6 +57,8 @@ namespace MTS { CODE disableVoiceSupport() override; CODE getVoiceSupport(bool& bVoiceEnabled, bool& bSmsOnly) override; + CODE getSelectedBandsRaw(std::string& sRawBands) override; + protected: enum class UE_USAGE_SETTING : uint8_t { UNKNOWN_MODE = 0, // Unknown mode @@ -79,6 +81,8 @@ namespace MTS { virtual CODE getUeUsageSetting(QuectelRadio::UE_USAGE_SETTING& us); virtual CODE convertToUeUsageSetting(const std::string& sSetting, QuectelRadio::UE_USAGE_SETTING& us); + static bool isContainsSignChar(const std::string& str); + private: // private variable to save old firmware versions during FOTA std::string m_sQuectelFirmware; diff --git a/include/mts/MTS_IO_TelitRadio.h b/include/mts/MTS_IO_TelitRadio.h index ffdddd9..a06da54 100644 --- a/include/mts/MTS_IO_TelitRadio.h +++ b/include/mts/MTS_IO_TelitRadio.h @@ -50,6 +50,8 @@ namespace MTS { CODE fumoLocalInject(int fd, UpdateCb& stepCb) override; CODE fumoLocalApply(UpdateCb& stepCb) override; + CODE getSelectedBandsRaw(std::string& sRawBands) override; + protected: TelitRadio(const std::string& sName, const std::string& sRadioPort); @@ -71,6 +73,8 @@ namespace MTS { virtual CODE fumoWriteGroupsABD(int fd, UpdateCb& stepCb); //virtual CODE fumoWriteGroupC(int fd, UpdateCb& stepCb); + static bool isContainsSignChar(const std::string& str); + private: virtual CODE getSimLockAttempts(int& iAttemptsPin, int& iAttemptsPuk, const std::string& sLockStatus); ICellularRadio::CODE wdsList(std::set &wds); -- cgit v1.2.3