From da563a985ccb0b5f316b44e35aabd511687ff4bf Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Thu, 6 Jun 2019 16:03:44 +0300 Subject: [MTS-MTQ] refactoring: added quectel empty classes, CellularRadio moved to TelitRadio --- include/mts/MTS_IO_ICellularRadio.h | 399 ++++++++++++++++++++++++++++++++++++ 1 file changed, 399 insertions(+) create mode 100644 include/mts/MTS_IO_ICellularRadio.h (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h new file mode 100644 index 0000000..da86946 --- /dev/null +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -0,0 +1,399 @@ +#ifndef MTS_IO_ICELLULARRADIO_H +#define MTS_IO_ICELLULARRADIO_H + +#include +#include +#include + +#include + +#include +#include + +namespace MTS { + namespace IO { + class ICellularRadio; + namespace { + + static const std::string DEFAULT_RADIO_PORT; + static const std::string DEFAULT_RADIO_DIR; + + static const std::string VALUE_UNKNOWN; + static const std::string VALUE_UNAVAILABLE; + static const std::string VALUE_NOT_SUPPORTED; + + //Special Payload Characters + static const char ETX = 0; //Ends socket connection + static const char DLE = 0; //Escapes ETX and DLE within Payload + static const char CR = 0; + static const char NL = 0; + static const char CTRL_Z = 0; + + static const std::string RSP_OK; + static const std::string RSP_ERROR; + + static const std::string VALUE_NOT_REGISTERED; + static const std::string VALUE_REGISTERED; + static const std::string VALUE_SEARCHING; + static const std::string VALUE_DENIED; + static const std::string VALUE_ROAMING; + + //Static Data + static const std::string KEY_TYPE; //!< GSM or CDMA + static const std::string KEY_CODE; //!< Product Code : H5, H6, C2, EV3, G3 + static const std::string KEY_MODEL; //!< Model : HE910, CE910, DE910, GE910 + static const std::string KEY_MANUFACTURER; //!< Manufacturer: Telit + static const std::string KEY_HARDWARE; //!< Radio Hardware Version + static const std::string KEY_FIRMWARE; //!< Radio Firmware Version + static const std::string KEY_FIRMWARE_BUILD;//!< Radio Firmware Build + static const std::string KEY_IMEI; //!< International Mobile Station Equipment Identity + static const std::string KEY_MEID; //!< Mobile Equipment Identifier + static const std::string KEY_IMSI; //!< International Mobile Subscriber Identity + static const std::string KEY_MSID; //!< Mobil Station ID (MSID) aka MIN aka MSIN aka Last few digits of IMSI + static const std::string KEY_MDN; //!< Mobile Directory Number : Actual phone number dialed to reach radio + static const std::string KEY_CARRIER; //!< Cellular Service Provider (Home Network) + static const std::string KEY_ICCID; //!< Integrated Circuit Card Identifier + static const std::string KEY_MSL; //!< Master Subsidy Lock + + + //Network Status Data + static const std::string KEY_ROAMING; //!< Indicates whether or not using Home Network + static const std::string KEY_DATETIME; //!< Date and Time from tower + static const std::string KEY_SERVICE; //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] + static const std::string KEY_NETWORK; //!< Cellular Service Provider + static const std::string KEY_NETWORK_REG; //!< Network Registration + static const std::string KEY_CID; //!< Cellular ID (Tower) in HEX + static const std::string KEY_LAC; //!< Location Area Code in HEX + static const std::string KEY_RAC; //!< Routing Area Code in HEX + static const std::string KEY_RSSI; //!< Received Signal Strength Indication + static const std::string KEY_RSSIDBM; //!< Received Signal Strength Indication in dBm + static const std::string KEY_MCC; //!< Mobile Country Code + static const std::string KEY_MNC; //!< Mobile Network (Operator) Code + static const std::string KEY_CHANNEL; //!< ARFCN or UARFCN Assigned Radio Channel + static const std::string KEY_TXPWR; //!< Transmit Power + static const std::string KEY_PSC; //!< Active Primary Synchronization Code (PSC) + static const std::string KEY_ECIO; //!< Active Ec/Io (chip energy per total wideband power in dBm) + static const std::string KEY_RSCP; //!< Active RSCP (Received Signal Code Power in dBm) + static const std::string KEY_DRX; //!< Discontinuous reception cycle length (ms) + static const std::string KEY_MM; //!< Mobility Management State + static const std::string KEY_RR; //!< Radio Resource State + static const std::string KEY_NOM; //!< Network Operator Mode + static const std::string KEY_ABND; //!< Active Band + static const std::string KEY_BLER; //!< Block Error Rate (percentage) + static const std::string KEY_SD; //!< Service Domain + static const std::string KEY_DEBUG; //!< Debug Information + + static const std::string KEY_MIP; //!< Mobile IP Information + static const std::string KEY_MIP_ID; //!< MIP Profile ID + static const std::string KEY_MIP_ENABLED; //!< MIP Profile Enabled/Disabled + static const std::string KEY_MIP_NAI; //!< Network Access Identifier + static const std::string KEY_MIP_HOMEADDRESS; //!< Home Address + static const std::string KEY_MIP_PRIMARYHA; //!< Primary Home Agent + static const std::string KEY_MIP_SECONDARYHA; //!< Secondary Home Agent + static const std::string KEY_MIP_MNAAASPI; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index + static const std::string KEY_MIP_MNHASPI; //!< Mobile Node Home Agent Security Server Parameter Index + static const std::string KEY_MIP_REVTUN; //!< Reverse Tunneling Enabled + static const std::string KEY_MIP_MNAAASS; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret + static const std::string KEY_MIP_MNHASS; //!< Mobile Node Home Agent Shared Secret + + + //Values - Type + static const std::string VALUE_TYPE_LTE; + static const std::string VALUE_TYPE_GSM; + static const std::string VALUE_TYPE_CDMA; + + //Values - Carrier + static const std::string VALUE_CARRIER_VERIZON; + static const std::string VALUE_CARRIER_AERIS; + static const std::string VALUE_CARRIER_SPRINT; + static const std::string VALUE_CARRIER_USCELLULAR; + static const std::string VALUE_CARRIER_ATT; + static const std::string VALUE_CARRIER_TMOBILE; + + static const std::string VALUE_SD_NO_SERVICE; + static const std::string VALUE_SD_CS_ONLY; + static const std::string VALUE_SD_PS_ONLY; + static const std::string VALUE_SD_CSPS; + + static const std::string VALUE_ABND_GSM_850; + static const std::string VALUE_ABND_GSM_900; + static const std::string VALUE_ABND_DCS_1800; + static const std::string VALUE_ABND_PCS_1900; + + static const std::vector DEFAULT_BAIL_STRINGS; + + typedef std::function IsNeedMoreData; + typedef std::function UpdateCb; + + /* + CODE convertModelToType(const std::string& sModel, std::string& sType); + CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, ICellularRadio *radioObj = NULL); + CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd); + CODE convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand); + + std::string sendCommand(MTS::AutoPtr& apIo, + const std::string& sCmd, + IsNeedMoreData& isNeedMoreData, + int32_t timeoutMillis = 100, + const char& ESC = CR); + + std::string sendCommand(MTS::AutoPtr& apIo, + const std::string& sCmd, + const std::vector& vBail = DEFAULT_BAIL_STRINGS, + int32_t timeoutMillis = 100, + const char& ESC = CR); + CODE test(MTS::AutoPtr& apIo, uint32_t timeoutSeconds = 30); + + std::string extractModelFromResult(const std::string& sResult); + std::string getCodeAsString(CODE code); + */ + + } + class ICellularRadio + { + public: + //Registration Values + enum REGISTRATION : uint8_t { + NOT_REGISTERED = 0, + REGISTERED = 1, + SEARCHING=2, + DENIED=3, + UNKNOWN=4, + ROAMING=5 + }; + + enum SERVICEDOMAIN : uint8_t { + NO_SERVICE = 0, + CS_ONLY = 1, + PS_ONLY = 2, + CSPS = 3 + }; + + enum ACTIVEBAND : uint8_t { + GSM_850 = 0, + GSM_900 = 1, + DCS_1800 = 2, + PCS_1900 = 3 + }; + + enum CODE : uint8_t { + SUCCESS = 0, + ERROR, + FAILURE, + NO_RESPONSE, + NOT_APPLICABLE, + INVALID_ARGS + }; + + enum SIMSTATUS : uint8_t { + READY = 0, + LOCKED, + BLOCKED, + NOT_INSERTED + }; + virtual ~ICellularRadio() = 0; + + virtual bool initialize(uint32_t iTimeoutMillis = 5000) = 0; + virtual bool resetRadio(uint32_t iTimeoutMillis = 5000) = 0; + virtual bool resetConnection(uint32_t iTimeoutMillis = 5000) = 0; + virtual void shutdown() = 0; + + virtual const std::string& getName() const = 0; + + virtual CODE getModel(std::string& sModel) = 0; + + virtual CODE getFirmware(std::string& sFirmware) = 0; + virtual CODE getFirmwareBuild(std::string& sFirmwareBuild) = 0; + virtual CODE getHardware(std::string& sHardware) = 0; + virtual CODE getManufacturer(std::string& sManufacturer) = 0; + virtual CODE getImei(std::string& sImei) = 0; + virtual CODE getMeid(std::string& sMeid) = 0; + virtual CODE getImsi(std::string& sImsi) = 0; + virtual CODE getSimStatus(std::string& sSimStatus) = 0; + virtual CODE getIccid(std::string& sIccid) = 0; + virtual CODE getService(std::string& sService) = 0; + virtual CODE getLac(std::string& sLac) = 0; + virtual CODE getMdn(std::string& sMdn) = 0; + virtual CODE getMsid(std::string& sMsid) = 0; + virtual CODE getType(std::string& sType) = 0; + virtual CODE getCarrier(std::string& sCarrier) = 0; + virtual CODE getNetwork(std::string& sNetwork) = 0; + virtual CODE getTower(std::string& sTower) = 0; + virtual CODE getTime(std::string& sDate, std::string& sTime, std::string& sTimeZone) = 0; + virtual CODE getRoaming(bool& bRoaming) = 0; + + virtual CODE getSignalStrength(int32_t& iRssi) = 0; + virtual CODE getModemLocation(std::string& sLocation) = 0; + virtual CODE convertSignalStrengthTodBm(const int32_t& iRssi, int32_t& dBm) = 0; + virtual CODE convertdBmToSignalStrength(const int32_t& dBm, int32_t& iRssi) = 0; + + virtual CODE getRegistration(REGISTRATION& eRegistration) = 0; + virtual CODE convertRegistrationToString(REGISTRATION eRegistration, std::string& sRegistration) = 0; + + //! Gather details of the radio's Mobile IP Profile + /*! + \param Json::Value object that will be populated with MIP data + \return Returns result code of gathering MIP + */ + virtual CODE getMipProfile(Json::Value& jMipProfile) = 0; + + /* + * jArgs = { + * "msl" : "Master Subsidy Lock (Aeris, Sprint): STRING" + * } + */ + virtual CODE validateMsl(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "mdn" : "Mobile Directory Number : STRING", + * "msl" : "[OPTIONAL] Master Subsidy Lock (Aeris, Sprint): STRING" + * } + */ + virtual CODE setMdn(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "msid" : "Mobil Station ID (MSID) aka MIN aka MSIN : STRING", + * "msl" : "[OPTIONAL] Master Subsidy Lock (Aeris, Sprint): STRING" + * } + */ + virtual CODE setMsid(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "activeProfile" : "Set active profile: STRING" + * } + */ + virtual CODE setMipActiveProfile(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "nai" : "Network Access Identifier : STRING" + * } + */ + virtual CODE setMipNai(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "homeIp" : "Home Address : STRING" + * } + */ + virtual CODE setMipHomeIp(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "primaryHa" : "Primary Home Agent : STRING" + * } + */ + virtual CODE setMipPrimaryHa(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "secondaryHa" : "Secondary Home Agent : STRING" + * } + */ + virtual CODE setMipSecondaryHa(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "mnAaaSpi" : "Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index : STRING" + * } + */ + virtual CODE setMipMnAaaSpi(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "mnHaSpi" : "Mobile Node Home Agent Security Server Parameter Index : STRING" + * } + */ + virtual CODE setMipMnHaSpi(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "revTun" : "[DESCRIPTION] : STRING" + * } + */ + virtual CODE setMipRevTun(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "mnAaaSs" : "Mobile Node Authentication, Authorization, and Accounting Server Shared Secret : STRING" + * } + */ + virtual CODE setMipMnAaaSs(const Json::Value& jArgs) = 0; + + /* + * jArgs = { + * "mnHaSs" : "Mobile Node Home Agent Shared Secret : STRING" + * } + */ + virtual CODE setMipMnHaSs(const Json::Value& jArgs) = 0; + + /* + * jArgs = null + */ + virtual CODE updateDc(const Json::Value& jArgs, UpdateCb& stepCb) = 0; + + /* + * jArgs = null + */ + virtual CODE updatePrl(const Json::Value& jArgs, UpdateCb& stepCb) = 0; + + /* + * jArgs = null + */ + virtual CODE updateFumo(const Json::Value& jArgs, UpdateCb& stepCb) = 0; + + /* + * jArgs = { + * "msl" : "Master Subsidy Lock (Sprint): STRING" + * } + */ + virtual CODE resetHfa(const Json::Value& jArgs, UpdateCb& stepCb) = 0; + + /* + * jArgs = { + * "mdn" : "Mobile Directory Number (Aeris): STRING" + * "msid" : "Mobile Station ID (Aeris): STRING" + * } + */ + virtual CODE activate(const Json::Value& jArgs, UpdateCb& stepCb) = 0; + + /* + * jArgs = { + * "enabled" : "RX Diversity Enabled ("0" or "1"): STRING" + * } + */ + virtual CODE setRxDiversity(const Json::Value& jArgs) = 0; + /* + * jArgs = { + * "fwid" : "Firmware Image To Be Enabled: STRING" + * } + */ + virtual CODE setActiveFirmware(const Json::Value& jArgs) = 0; + virtual CODE getActiveFirmware(std::string& sFwId) = 0; + + virtual CODE getEcho(bool& bEnabled) = 0; + virtual CODE setEcho(bool bEnabled = true) = 0; + + virtual CODE getStaticInformation(Json::Value& jData) = 0; + virtual CODE getNetworkStatus(Json::Value& jData) = 0; + + virtual CODE sendBasicCommand(const std::string& sCmd, int32_t timeoutMillis = 100, const char& ESC = CR) = 0; + + virtual std::string sendCommand(const std::string& sCmd, + const std::vector& vBail = DEFAULT_BAIL_STRINGS, + int32_t timeoutMillis = 100, + const char& ESC = CR) = 0; + + virtual std::string sendCommand(const std::string& sCmd, + IsNeedMoreData& isNeedMoreData, + int32_t timeoutMillis = 100, + const char& ESC = CR) = 0; + + }; + } +} + +#endif -- cgit v1.2.3 From 417049f51180b3b4be84fbc0d86a3c690972fb3b Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Thu, 6 Jun 2019 18:06:43 +0300 Subject: [MTS-MTQ] refactoring: moved common consts and static methods to ICellularRadio --- include/mts/MTS_IO_ICellularRadio.h | 257 +++++++++++++++++------------------- 1 file changed, 120 insertions(+), 137 deletions(-) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index da86946..257ed00 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -12,146 +12,12 @@ namespace MTS { namespace IO { - class ICellularRadio; - namespace { - - static const std::string DEFAULT_RADIO_PORT; - static const std::string DEFAULT_RADIO_DIR; - - static const std::string VALUE_UNKNOWN; - static const std::string VALUE_UNAVAILABLE; - static const std::string VALUE_NOT_SUPPORTED; - - //Special Payload Characters - static const char ETX = 0; //Ends socket connection - static const char DLE = 0; //Escapes ETX and DLE within Payload - static const char CR = 0; - static const char NL = 0; - static const char CTRL_Z = 0; - - static const std::string RSP_OK; - static const std::string RSP_ERROR; - - static const std::string VALUE_NOT_REGISTERED; - static const std::string VALUE_REGISTERED; - static const std::string VALUE_SEARCHING; - static const std::string VALUE_DENIED; - static const std::string VALUE_ROAMING; - - //Static Data - static const std::string KEY_TYPE; //!< GSM or CDMA - static const std::string KEY_CODE; //!< Product Code : H5, H6, C2, EV3, G3 - static const std::string KEY_MODEL; //!< Model : HE910, CE910, DE910, GE910 - static const std::string KEY_MANUFACTURER; //!< Manufacturer: Telit - static const std::string KEY_HARDWARE; //!< Radio Hardware Version - static const std::string KEY_FIRMWARE; //!< Radio Firmware Version - static const std::string KEY_FIRMWARE_BUILD;//!< Radio Firmware Build - static const std::string KEY_IMEI; //!< International Mobile Station Equipment Identity - static const std::string KEY_MEID; //!< Mobile Equipment Identifier - static const std::string KEY_IMSI; //!< International Mobile Subscriber Identity - static const std::string KEY_MSID; //!< Mobil Station ID (MSID) aka MIN aka MSIN aka Last few digits of IMSI - static const std::string KEY_MDN; //!< Mobile Directory Number : Actual phone number dialed to reach radio - static const std::string KEY_CARRIER; //!< Cellular Service Provider (Home Network) - static const std::string KEY_ICCID; //!< Integrated Circuit Card Identifier - static const std::string KEY_MSL; //!< Master Subsidy Lock - - - //Network Status Data - static const std::string KEY_ROAMING; //!< Indicates whether or not using Home Network - static const std::string KEY_DATETIME; //!< Date and Time from tower - static const std::string KEY_SERVICE; //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] - static const std::string KEY_NETWORK; //!< Cellular Service Provider - static const std::string KEY_NETWORK_REG; //!< Network Registration - static const std::string KEY_CID; //!< Cellular ID (Tower) in HEX - static const std::string KEY_LAC; //!< Location Area Code in HEX - static const std::string KEY_RAC; //!< Routing Area Code in HEX - static const std::string KEY_RSSI; //!< Received Signal Strength Indication - static const std::string KEY_RSSIDBM; //!< Received Signal Strength Indication in dBm - static const std::string KEY_MCC; //!< Mobile Country Code - static const std::string KEY_MNC; //!< Mobile Network (Operator) Code - static const std::string KEY_CHANNEL; //!< ARFCN or UARFCN Assigned Radio Channel - static const std::string KEY_TXPWR; //!< Transmit Power - static const std::string KEY_PSC; //!< Active Primary Synchronization Code (PSC) - static const std::string KEY_ECIO; //!< Active Ec/Io (chip energy per total wideband power in dBm) - static const std::string KEY_RSCP; //!< Active RSCP (Received Signal Code Power in dBm) - static const std::string KEY_DRX; //!< Discontinuous reception cycle length (ms) - static const std::string KEY_MM; //!< Mobility Management State - static const std::string KEY_RR; //!< Radio Resource State - static const std::string KEY_NOM; //!< Network Operator Mode - static const std::string KEY_ABND; //!< Active Band - static const std::string KEY_BLER; //!< Block Error Rate (percentage) - static const std::string KEY_SD; //!< Service Domain - static const std::string KEY_DEBUG; //!< Debug Information - - static const std::string KEY_MIP; //!< Mobile IP Information - static const std::string KEY_MIP_ID; //!< MIP Profile ID - static const std::string KEY_MIP_ENABLED; //!< MIP Profile Enabled/Disabled - static const std::string KEY_MIP_NAI; //!< Network Access Identifier - static const std::string KEY_MIP_HOMEADDRESS; //!< Home Address - static const std::string KEY_MIP_PRIMARYHA; //!< Primary Home Agent - static const std::string KEY_MIP_SECONDARYHA; //!< Secondary Home Agent - static const std::string KEY_MIP_MNAAASPI; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index - static const std::string KEY_MIP_MNHASPI; //!< Mobile Node Home Agent Security Server Parameter Index - static const std::string KEY_MIP_REVTUN; //!< Reverse Tunneling Enabled - static const std::string KEY_MIP_MNAAASS; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret - static const std::string KEY_MIP_MNHASS; //!< Mobile Node Home Agent Shared Secret - - - //Values - Type - static const std::string VALUE_TYPE_LTE; - static const std::string VALUE_TYPE_GSM; - static const std::string VALUE_TYPE_CDMA; - - //Values - Carrier - static const std::string VALUE_CARRIER_VERIZON; - static const std::string VALUE_CARRIER_AERIS; - static const std::string VALUE_CARRIER_SPRINT; - static const std::string VALUE_CARRIER_USCELLULAR; - static const std::string VALUE_CARRIER_ATT; - static const std::string VALUE_CARRIER_TMOBILE; - - static const std::string VALUE_SD_NO_SERVICE; - static const std::string VALUE_SD_CS_ONLY; - static const std::string VALUE_SD_PS_ONLY; - static const std::string VALUE_SD_CSPS; - - static const std::string VALUE_ABND_GSM_850; - static const std::string VALUE_ABND_GSM_900; - static const std::string VALUE_ABND_DCS_1800; - static const std::string VALUE_ABND_PCS_1900; - - static const std::vector DEFAULT_BAIL_STRINGS; - - typedef std::function IsNeedMoreData; - typedef std::function UpdateCb; - - /* - CODE convertModelToType(const std::string& sModel, std::string& sType); - CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, ICellularRadio *radioObj = NULL); - CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd); - CODE convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand); - - std::string sendCommand(MTS::AutoPtr& apIo, - const std::string& sCmd, - IsNeedMoreData& isNeedMoreData, - int32_t timeoutMillis = 100, - const char& ESC = CR); - - std::string sendCommand(MTS::AutoPtr& apIo, - const std::string& sCmd, - const std::vector& vBail = DEFAULT_BAIL_STRINGS, - int32_t timeoutMillis = 100, - const char& ESC = CR); - CODE test(MTS::AutoPtr& apIo, uint32_t timeoutSeconds = 30); - - std::string extractModelFromResult(const std::string& sResult); - std::string getCodeAsString(CODE code); - */ - - } class ICellularRadio { public: + typedef std::function IsNeedMoreData; + typedef std::function UpdateCb; + //Registration Values enum REGISTRATION : uint8_t { NOT_REGISTERED = 0, @@ -191,6 +57,121 @@ namespace MTS { BLOCKED, NOT_INSERTED }; + + // TODO: convert functions + static CODE convertModelToType(const std::string& sModel, std::string& sType); + static CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, ICellularRadio *radioObj = NULL); + static CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd); + static CODE convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand); + // XXX + + static const std::string DEFAULT_RADIO_PORT; + static const std::string DEFAULT_RADIO_DIR; + + static const std::string VALUE_UNKNOWN; + static const std::string VALUE_UNAVAILABLE; + static const std::string VALUE_NOT_SUPPORTED; + + //Special Payload Characters + static const char ETX; //Ends socket connection + static const char DLE; //Escapes ETX and DLE within Payload + static const char CR; + static const char NL; + static const char CTRL_Z; + + static const std::string RSP_OK; + static const std::string RSP_ERROR; + + static const std::string VALUE_NOT_REGISTERED; + static const std::string VALUE_REGISTERED; + static const std::string VALUE_SEARCHING; + static const std::string VALUE_DENIED; + static const std::string VALUE_ROAMING; + + //Static Data + static const std::string KEY_TYPE; //!< GSM or CDMA + static const std::string KEY_CODE; //!< Product Code : H5, H6, C2, EV3, G3 + static const std::string KEY_MODEL; //!< Model : HE910, CE910, DE910, GE910 + static const std::string KEY_MANUFACTURER; //!< Manufacturer: Telit + static const std::string KEY_HARDWARE; //!< Radio Hardware Version + static const std::string KEY_FIRMWARE; //!< Radio Firmware Version + static const std::string KEY_FIRMWARE_BUILD;//!< Radio Firmware Build + static const std::string KEY_IMEI; //!< International Mobile Station Equipment Identity + static const std::string KEY_MEID; //!< Mobile Equipment Identifier + static const std::string KEY_IMSI; //!< International Mobile Subscriber Identity + static const std::string KEY_MSID; //!< Mobil Station ID (MSID) aka MIN aka MSIN aka Last few digits of IMSI + static const std::string KEY_MDN; //!< Mobile Directory Number : Actual phone number dialed to reach radio + static const std::string KEY_CARRIER; //!< Cellular Service Provider (Home Network) + static const std::string KEY_ICCID; //!< Integrated Circuit Card Identifier + static const std::string KEY_MSL; //!< Master Subsidy Lock + + + //Network Status Data + static const std::string KEY_ROAMING; //!< Indicates whether or not using Home Network + static const std::string KEY_DATETIME; //!< Date and Time from tower + static const std::string KEY_SERVICE; //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] + static const std::string KEY_NETWORK; //!< Cellular Service Provider + static const std::string KEY_NETWORK_REG; //!< Network Registration + static const std::string KEY_CID; //!< Cellular ID (Tower) in HEX + static const std::string KEY_LAC; //!< Location Area Code in HEX + static const std::string KEY_RAC; //!< Routing Area Code in HEX + static const std::string KEY_RSSI; //!< Received Signal Strength Indication + static const std::string KEY_RSSIDBM; //!< Received Signal Strength Indication in dBm + static const std::string KEY_MCC; //!< Mobile Country Code + static const std::string KEY_MNC; //!< Mobile Network (Operator) Code + static const std::string KEY_CHANNEL; //!< ARFCN or UARFCN Assigned Radio Channel + static const std::string KEY_TXPWR; //!< Transmit Power + static const std::string KEY_PSC; //!< Active Primary Synchronization Code (PSC) + static const std::string KEY_ECIO; //!< Active Ec/Io (chip energy per total wideband power in dBm) + static const std::string KEY_RSCP; //!< Active RSCP (Received Signal Code Power in dBm) + static const std::string KEY_DRX; //!< Discontinuous reception cycle length (ms) + static const std::string KEY_MM; //!< Mobility Management State + static const std::string KEY_RR; //!< Radio Resource State + static const std::string KEY_NOM; //!< Network Operator Mode + static const std::string KEY_ABND; //!< Active Band + static const std::string KEY_BLER; //!< Block Error Rate (percentage) + static const std::string KEY_SD; //!< Service Domain + static const std::string KEY_DEBUG; //!< Debug Information + + static const std::string KEY_MIP; //!< Mobile IP Information + static const std::string KEY_MIP_ID; //!< MIP Profile ID + static const std::string KEY_MIP_ENABLED; //!< MIP Profile Enabled/Disabled + static const std::string KEY_MIP_NAI; //!< Network Access Identifier + static const std::string KEY_MIP_HOMEADDRESS; //!< Home Address + static const std::string KEY_MIP_PRIMARYHA; //!< Primary Home Agent + static const std::string KEY_MIP_SECONDARYHA; //!< Secondary Home Agent + static const std::string KEY_MIP_MNAAASPI; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index + static const std::string KEY_MIP_MNHASPI; //!< Mobile Node Home Agent Security Server Parameter Index + static const std::string KEY_MIP_REVTUN; //!< Reverse Tunneling Enabled + static const std::string KEY_MIP_MNAAASS; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret + static const std::string KEY_MIP_MNHASS; //!< Mobile Node Home Agent Shared Secret + + + //Values - Type + static const std::string VALUE_TYPE_LTE; + static const std::string VALUE_TYPE_GSM; + static const std::string VALUE_TYPE_CDMA; + + //Values - Carrier + static const std::string VALUE_CARRIER_VERIZON; + static const std::string VALUE_CARRIER_AERIS; + static const std::string VALUE_CARRIER_SPRINT; + static const std::string VALUE_CARRIER_USCELLULAR; + static const std::string VALUE_CARRIER_ATT; + static const std::string VALUE_CARRIER_TMOBILE; + + static const std::string VALUE_SD_NO_SERVICE; + static const std::string VALUE_SD_CS_ONLY; + static const std::string VALUE_SD_PS_ONLY; + static const std::string VALUE_SD_CSPS; + + static const std::string VALUE_ABND_GSM_850; + static const std::string VALUE_ABND_GSM_900; + static const std::string VALUE_ABND_DCS_1800; + static const std::string VALUE_ABND_PCS_1900; + + static const std::vector DEFAULT_BAIL_STRINGS; + virtual ~ICellularRadio() = 0; virtual bool initialize(uint32_t iTimeoutMillis = 5000) = 0; @@ -380,6 +361,7 @@ namespace MTS { virtual CODE getStaticInformation(Json::Value& jData) = 0; virtual CODE getNetworkStatus(Json::Value& jData) = 0; + /* virtual CODE sendBasicCommand(const std::string& sCmd, int32_t timeoutMillis = 100, const char& ESC = CR) = 0; virtual std::string sendCommand(const std::string& sCmd, @@ -391,6 +373,7 @@ namespace MTS { IsNeedMoreData& isNeedMoreData, int32_t timeoutMillis = 100, const char& ESC = CR) = 0; + */ }; } -- cgit v1.2.3 From 55c18e47596b6be9f19b33deb6c5cd0e798decd8 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Fri, 7 Jun 2019 12:38:11 +0300 Subject: [MTS-MTQ] refactoring: public symbols visibility Make exported ICellularRadio and CellularRadioFactory only --- include/mts/MTS_IO_ICellularRadio.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index 257ed00..d954a24 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -7,12 +7,11 @@ #include -#include -#include +#define EXPORT __attribute__((visibility("default"))) namespace MTS { namespace IO { - class ICellularRadio + class EXPORT ICellularRadio { public: typedef std::function IsNeedMoreData; -- cgit v1.2.3 From 596f8f8393bf837d73e0a62c87d52557d9191f96 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Sat, 8 Jun 2019 00:23:57 +0300 Subject: [MTS-MTQ] refactoring: telit radio implementation leave telit specific code in telit class. move common code to cellular radio class. --- include/mts/MTS_IO_ICellularRadio.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index d954a24..ff8383c 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -360,7 +360,6 @@ namespace MTS { virtual CODE getStaticInformation(Json::Value& jData) = 0; virtual CODE getNetworkStatus(Json::Value& jData) = 0; - /* virtual CODE sendBasicCommand(const std::string& sCmd, int32_t timeoutMillis = 100, const char& ESC = CR) = 0; virtual std::string sendCommand(const std::string& sCmd, @@ -372,7 +371,6 @@ namespace MTS { IsNeedMoreData& isNeedMoreData, int32_t timeoutMillis = 100, const char& ESC = CR) = 0; - */ }; } -- cgit v1.2.3 From 5a7d8772ea898b3567685431b5a6be13015e5887 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Mon, 10 Jun 2019 11:27:27 +0300 Subject: [MTS-MTQ] refactoring: static function moved to ICellularRadio --- include/mts/MTS_IO_ICellularRadio.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index ff8383c..3ab8b7e 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -7,6 +7,9 @@ #include +#include +#include + #define EXPORT __attribute__((visibility("default"))) namespace MTS { @@ -62,6 +65,20 @@ namespace MTS { static CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, ICellularRadio *radioObj = NULL); static CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd); static CODE convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand); + + static std::string sendCommand(MTS::AutoPtr& apIo, + const std::string& sCmd, + IsNeedMoreData& isNeedMoreData, + int32_t timeoutMillis = 100, + const char& ESC = CR); + static std::string sendCommand(MTS::AutoPtr& apIo, + const std::string& sCmd, + const std::vector& vBail = DEFAULT_BAIL_STRINGS, + int32_t timeoutMillis = 100, + const char& ESC = CR); + static CODE test(MTS::AutoPtr& apIo, uint32_t timeoutSeconds = 30); + static std::string extractModelFromResult(const std::string& sResult); + static std::string getCodeAsString(CODE code); // XXX static const std::string DEFAULT_RADIO_PORT; -- cgit v1.2.3 From 07b7b63b15bf5f7cb94f32a5fb45acdf1cb3edfc Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 11 Jun 2019 11:20:50 +0300 Subject: [MTS-MTQ] refactoring: performance optimization strings replaced by const-char pointer --- include/mts/MTS_IO_ICellularRadio.h | 168 ++++++++++++++++++------------------ 1 file changed, 84 insertions(+), 84 deletions(-) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index 3ab8b7e..11ad193 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -81,12 +81,12 @@ namespace MTS { static std::string getCodeAsString(CODE code); // XXX - static const std::string DEFAULT_RADIO_PORT; - static const std::string DEFAULT_RADIO_DIR; + static const char *DEFAULT_RADIO_PORT; + static const char *DEFAULT_RADIO_DIR; - static const std::string VALUE_UNKNOWN; - static const std::string VALUE_UNAVAILABLE; - static const std::string VALUE_NOT_SUPPORTED; + static const char *VALUE_UNKNOWN; + static const char *VALUE_UNAVAILABLE; + static const char *VALUE_NOT_SUPPORTED; //Special Payload Characters static const char ETX; //Ends socket connection @@ -95,96 +95,96 @@ namespace MTS { static const char NL; static const char CTRL_Z; - static const std::string RSP_OK; - static const std::string RSP_ERROR; + static const char *RSP_OK; + static const char *RSP_ERROR; - static const std::string VALUE_NOT_REGISTERED; - static const std::string VALUE_REGISTERED; - static const std::string VALUE_SEARCHING; - static const std::string VALUE_DENIED; - static const std::string VALUE_ROAMING; + static const char *VALUE_NOT_REGISTERED; + static const char *VALUE_REGISTERED; + static const char *VALUE_SEARCHING; + static const char *VALUE_DENIED; + static const char *VALUE_ROAMING; //Static Data - static const std::string KEY_TYPE; //!< GSM or CDMA - static const std::string KEY_CODE; //!< Product Code : H5, H6, C2, EV3, G3 - static const std::string KEY_MODEL; //!< Model : HE910, CE910, DE910, GE910 - static const std::string KEY_MANUFACTURER; //!< Manufacturer: Telit - static const std::string KEY_HARDWARE; //!< Radio Hardware Version - static const std::string KEY_FIRMWARE; //!< Radio Firmware Version - static const std::string KEY_FIRMWARE_BUILD;//!< Radio Firmware Build - static const std::string KEY_IMEI; //!< International Mobile Station Equipment Identity - static const std::string KEY_MEID; //!< Mobile Equipment Identifier - static const std::string KEY_IMSI; //!< International Mobile Subscriber Identity - static const std::string KEY_MSID; //!< Mobil Station ID (MSID) aka MIN aka MSIN aka Last few digits of IMSI - static const std::string KEY_MDN; //!< Mobile Directory Number : Actual phone number dialed to reach radio - static const std::string KEY_CARRIER; //!< Cellular Service Provider (Home Network) - static const std::string KEY_ICCID; //!< Integrated Circuit Card Identifier - static const std::string KEY_MSL; //!< Master Subsidy Lock + static const char *KEY_TYPE; //!< GSM or CDMA + static const char *KEY_CODE; //!< Product Code : H5, H6, C2, EV3, G3 + static const char *KEY_MODEL; //!< Model : HE910, CE910, DE910, GE910 + static const char *KEY_MANUFACTURER; //!< Manufacturer: Telit + static const char *KEY_HARDWARE; //!< Radio Hardware Version + static const char *KEY_FIRMWARE; //!< Radio Firmware Version + static const char *KEY_FIRMWARE_BUILD;//!< Radio Firmware Build + static const char *KEY_IMEI; //!< International Mobile Station Equipment Identity + static const char *KEY_MEID; //!< Mobile Equipment Identifier + static const char *KEY_IMSI; //!< International Mobile Subscriber Identity + static const char *KEY_MSID; //!< Mobil Station ID (MSID) aka MIN aka MSIN aka Last few digits of IMSI + static const char *KEY_MDN; //!< Mobile Directory Number : Actual phone number dialed to reach radio + static const char *KEY_CARRIER; //!< Cellular Service Provider (Home Network) + static const char *KEY_ICCID; //!< Integrated Circuit Card Identifier + static const char *KEY_MSL; //!< Master Subsidy Lock //Network Status Data - static const std::string KEY_ROAMING; //!< Indicates whether or not using Home Network - static const std::string KEY_DATETIME; //!< Date and Time from tower - static const std::string KEY_SERVICE; //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] - static const std::string KEY_NETWORK; //!< Cellular Service Provider - static const std::string KEY_NETWORK_REG; //!< Network Registration - static const std::string KEY_CID; //!< Cellular ID (Tower) in HEX - static const std::string KEY_LAC; //!< Location Area Code in HEX - static const std::string KEY_RAC; //!< Routing Area Code in HEX - static const std::string KEY_RSSI; //!< Received Signal Strength Indication - static const std::string KEY_RSSIDBM; //!< Received Signal Strength Indication in dBm - static const std::string KEY_MCC; //!< Mobile Country Code - static const std::string KEY_MNC; //!< Mobile Network (Operator) Code - static const std::string KEY_CHANNEL; //!< ARFCN or UARFCN Assigned Radio Channel - static const std::string KEY_TXPWR; //!< Transmit Power - static const std::string KEY_PSC; //!< Active Primary Synchronization Code (PSC) - static const std::string KEY_ECIO; //!< Active Ec/Io (chip energy per total wideband power in dBm) - static const std::string KEY_RSCP; //!< Active RSCP (Received Signal Code Power in dBm) - static const std::string KEY_DRX; //!< Discontinuous reception cycle length (ms) - static const std::string KEY_MM; //!< Mobility Management State - static const std::string KEY_RR; //!< Radio Resource State - static const std::string KEY_NOM; //!< Network Operator Mode - static const std::string KEY_ABND; //!< Active Band - static const std::string KEY_BLER; //!< Block Error Rate (percentage) - static const std::string KEY_SD; //!< Service Domain - static const std::string KEY_DEBUG; //!< Debug Information - - static const std::string KEY_MIP; //!< Mobile IP Information - static const std::string KEY_MIP_ID; //!< MIP Profile ID - static const std::string KEY_MIP_ENABLED; //!< MIP Profile Enabled/Disabled - static const std::string KEY_MIP_NAI; //!< Network Access Identifier - static const std::string KEY_MIP_HOMEADDRESS; //!< Home Address - static const std::string KEY_MIP_PRIMARYHA; //!< Primary Home Agent - static const std::string KEY_MIP_SECONDARYHA; //!< Secondary Home Agent - static const std::string KEY_MIP_MNAAASPI; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index - static const std::string KEY_MIP_MNHASPI; //!< Mobile Node Home Agent Security Server Parameter Index - static const std::string KEY_MIP_REVTUN; //!< Reverse Tunneling Enabled - static const std::string KEY_MIP_MNAAASS; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret - static const std::string KEY_MIP_MNHASS; //!< Mobile Node Home Agent Shared Secret + static const char *KEY_ROAMING; //!< Indicates whether or not using Home Network + static const char *KEY_DATETIME; //!< Date and Time from tower + static const char *KEY_SERVICE; //!< Service Connection Type [GPRS, EGPRS, WCDMA, HSDPA, 1xRTT, EVDO] + static const char *KEY_NETWORK; //!< Cellular Service Provider + static const char *KEY_NETWORK_REG; //!< Network Registration + static const char *KEY_CID; //!< Cellular ID (Tower) in HEX + static const char *KEY_LAC; //!< Location Area Code in HEX + static const char *KEY_RAC; //!< Routing Area Code in HEX + static const char *KEY_RSSI; //!< Received Signal Strength Indication + static const char *KEY_RSSIDBM; //!< Received Signal Strength Indication in dBm + static const char *KEY_MCC; //!< Mobile Country Code + static const char *KEY_MNC; //!< Mobile Network (Operator) Code + static const char *KEY_CHANNEL; //!< ARFCN or UARFCN Assigned Radio Channel + static const char *KEY_TXPWR; //!< Transmit Power + static const char *KEY_PSC; //!< Active Primary Synchronization Code (PSC) + static const char *KEY_ECIO; //!< Active Ec/Io (chip energy per total wideband power in dBm) + static const char *KEY_RSCP; //!< Active RSCP (Received Signal Code Power in dBm) + static const char *KEY_DRX; //!< Discontinuous reception cycle length (ms) + static const char *KEY_MM; //!< Mobility Management State + static const char *KEY_RR; //!< Radio Resource State + static const char *KEY_NOM; //!< Network Operator Mode + static const char *KEY_ABND; //!< Active Band + static const char *KEY_BLER; //!< Block Error Rate (percentage) + static const char *KEY_SD; //!< Service Domain + static const char *KEY_DEBUG; //!< Debug Information + + static const char *KEY_MIP; //!< Mobile IP Information + static const char *KEY_MIP_ID; //!< MIP Profile ID + static const char *KEY_MIP_ENABLED; //!< MIP Profile Enabled/Disabled + static const char *KEY_MIP_NAI; //!< Network Access Identifier + static const char *KEY_MIP_HOMEADDRESS; //!< Home Address + static const char *KEY_MIP_PRIMARYHA; //!< Primary Home Agent + static const char *KEY_MIP_SECONDARYHA; //!< Secondary Home Agent + static const char *KEY_MIP_MNAAASPI; //!< Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index + static const char *KEY_MIP_MNHASPI; //!< Mobile Node Home Agent Security Server Parameter Index + static const char *KEY_MIP_REVTUN; //!< Reverse Tunneling Enabled + static const char *KEY_MIP_MNAAASS; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret + static const char *KEY_MIP_MNHASS; //!< Mobile Node Home Agent Shared Secret //Values - Type - static const std::string VALUE_TYPE_LTE; - static const std::string VALUE_TYPE_GSM; - static const std::string VALUE_TYPE_CDMA; + static const char *VALUE_TYPE_LTE; + static const char *VALUE_TYPE_GSM; + static const char *VALUE_TYPE_CDMA; //Values - Carrier - static const std::string VALUE_CARRIER_VERIZON; - static const std::string VALUE_CARRIER_AERIS; - static const std::string VALUE_CARRIER_SPRINT; - static const std::string VALUE_CARRIER_USCELLULAR; - static const std::string VALUE_CARRIER_ATT; - static const std::string VALUE_CARRIER_TMOBILE; - - static const std::string VALUE_SD_NO_SERVICE; - static const std::string VALUE_SD_CS_ONLY; - static const std::string VALUE_SD_PS_ONLY; - static const std::string VALUE_SD_CSPS; - - static const std::string VALUE_ABND_GSM_850; - static const std::string VALUE_ABND_GSM_900; - static const std::string VALUE_ABND_DCS_1800; - static const std::string VALUE_ABND_PCS_1900; + static const char *VALUE_CARRIER_VERIZON; + static const char *VALUE_CARRIER_AERIS; + static const char *VALUE_CARRIER_SPRINT; + static const char *VALUE_CARRIER_USCELLULAR; + static const char *VALUE_CARRIER_ATT; + static const char *VALUE_CARRIER_TMOBILE; + + static const char *VALUE_SD_NO_SERVICE; + static const char *VALUE_SD_CS_ONLY; + static const char *VALUE_SD_PS_ONLY; + static const char *VALUE_SD_CSPS; + + static const char *VALUE_ABND_GSM_850; + static const char *VALUE_ABND_GSM_900; + static const char *VALUE_ABND_DCS_1800; + static const char *VALUE_ABND_PCS_1900; static const std::vector DEFAULT_BAIL_STRINGS; -- cgit v1.2.3 From fe1c1e2e87da96fbbc432a35a903fff40f52713a Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Tue, 11 Jun 2019 16:47:11 +0300 Subject: [MTS-MTQ] refactoring: cellular factory namespaces --- include/mts/MTS_IO_ICellularRadio.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index 11ad193..d74ad15 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -60,7 +60,6 @@ namespace MTS { NOT_INSERTED }; - // TODO: convert functions static CODE convertModelToType(const std::string& sModel, std::string& sType); static CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, ICellularRadio *radioObj = NULL); static CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd); @@ -79,7 +78,6 @@ namespace MTS { static CODE test(MTS::AutoPtr& apIo, uint32_t timeoutSeconds = 30); static std::string extractModelFromResult(const std::string& sResult); static std::string getCodeAsString(CODE code); - // XXX static const char *DEFAULT_RADIO_PORT; static const char *DEFAULT_RADIO_DIR; -- cgit v1.2.3 From 143feb6a4587817d28c77e4df3a1b594b855f5e5 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Fri, 21 Jun 2019 17:19:09 +0300 Subject: [MTS-MTQ] RAT mode switch: implementation for telit and quectel RAT - Radio Access Technology --- include/mts/MTS_IO_ICellularRadio.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index d74ad15..1b95a0d 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -60,6 +60,14 @@ namespace MTS { NOT_INSERTED }; + enum RADIOMODE : uint8_t { + RADIOMODE_UNKNOWN = 0, + RADIOMODE_AUTO, + RADIOMODE_GSM_ONLY, + RADIOMODE_UMTS_ONLY, + RADIOMODE_LTE_ONLY + }; + static CODE convertModelToType(const std::string& sModel, std::string& sType); static CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode, ICellularRadio *radioObj = NULL); static CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd); @@ -225,6 +233,9 @@ namespace MTS { virtual CODE getRegistration(REGISTRATION& eRegistration) = 0; virtual CODE convertRegistrationToString(REGISTRATION eRegistration, std::string& sRegistration) = 0; + virtual CODE getRadioMode(RADIOMODE &mode) = 0; + virtual CODE setRadioMode(RADIOMODE mode) = 0; + //! Gather details of the radio's Mobile IP Profile /*! \param Json::Value object that will be populated with MIP data -- cgit v1.2.3 From 482f5c42c4e0a03b7474d369250121005bc94f3f Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Fri, 21 Jun 2019 18:11:11 +0300 Subject: [MTS-MTQ] SIM status and PIN unlock procedures Declared the interface for SIM status and PIN-related methods --- include/mts/MTS_IO_ICellularRadio.h | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index d74ad15..5d2295b 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -205,6 +205,29 @@ namespace MTS { virtual CODE getMeid(std::string& sMeid) = 0; virtual CODE getImsi(std::string& sImsi) = 0; virtual CODE getSimStatus(std::string& sSimStatus) = 0; + + /** + * @brief getSimStatusSummary - get summary on the SIM card status + * (if there is a SIM card inserted, is it locked, etc). + * See below for the full list of returned fields. + * + * - `isSimInserted` - bool, is the SIM card installed or not; + * - `isSimLocked` - bool, is the SIM card blocked with PIN/PUK or not (or is READY); + * - `lockStatus` - string, either "READY", "SIM PUK", "SIM PIN" or other status as + * returned by "AT+CPIN?" AT command; + * - `attemptsPin` - integer, the number of attempts lef to enter a PIN code; + * - `attemptsPuk` - integer, the number of attempts lef to enter a PUK code. + * + * **Only `isSimInserted` is always present.** All other fields are omitted if + * the SIM card is removed. + * + * @param jData - an object to be filled with data + * @return CODE::SUCCESS on success, + * CODE::NOT_APPLICABLE if not supported by this radio + * and CODE::ERROR otherwise + */ + virtual CODE getSimStatusSummary(Json::Value& jData) = 0; + virtual CODE getIccid(std::string& sIccid) = 0; virtual CODE getService(std::string& sService) = 0; virtual CODE getLac(std::string& sLac) = 0; @@ -225,6 +248,26 @@ namespace MTS { virtual CODE getRegistration(REGISTRATION& eRegistration) = 0; virtual CODE convertRegistrationToString(REGISTRATION eRegistration, std::string& sRegistration) = 0; + /** + * @brief unlockSimCard - unlock the SIM card using PIN code provided + * + * This command does not peform any checks on the number of attempts left. + * Use with caution, verify the SIM status manually before execution. + * + * @param jArgs - a JSON object with the following format: + * + * jArgs = { + * "pin" : "A correct PIN code to unlock the SIM card: STRING" + * } + * + * @return CODE::SUCCESS when SIM card was succeffully unlocked, + * CODE::INVALID_ARGS when passed arguments are invalid, + * CODE::ERROR otherwise (i.e. when modem is not responding, + * when SIM card is removed, when PIN code is not correct + * or on any other error). + */ + virtual CODE unlockSimCard(const Json::Value& jArgs) = 0; + //! Gather details of the radio's Mobile IP Profile /*! \param Json::Value object that will be populated with MIP data -- cgit v1.2.3 From da53c2f6955e748862066f727997965f7b9c6849 Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Sat, 22 Jun 2019 10:51:06 +0300 Subject: [MTS-MTQ] SIM status and PIN unlock procedures Defined the JSON object fields for SIM Status Summary data --- include/mts/MTS_IO_ICellularRadio.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index 5d2295b..531e0e0 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -160,6 +160,12 @@ namespace MTS { static const char *KEY_MIP_MNAAASS; //!< Mobile Node Authentication, Authorization, and Accounting Server Shared Secret static const char *KEY_MIP_MNHASS; //!< Mobile Node Home Agent Shared Secret + //SIM Status Summary data + static const char *KEY_IS_SIM_INSERTED; //!< SIM card insertion indicator. True when a SIM card is inserted + static const char *KEY_IS_SIM_LOCKED; //!< SIM card lock status indicator. True when a SIM card is locked by PIN / PUK / other code + static const char *KEY_SIM_LOCK_STATUS; //!< SIM card lock status string. Either "READY", "SIM PIN", "SIM PUK" or other state + static const char *KEY_ATTEMPTS_PIN; //!< The number of attempts left to unlock the SIM card using PIN code + static const char *KEY_ATTEMPTS_PUK; //!< The number of attempts left to unlock the SIM card using PUK code //Values - Type static const char *VALUE_TYPE_LTE; -- cgit v1.2.3 From 4ef332ec707946a3cf2a55473d05dfc9af3d4b11 Mon Sep 17 00:00:00 2001 From: Maksym Telychko Date: Wed, 26 Jun 2019 13:05:32 +0300 Subject: [MTS-MTQ] network radio mode switch: refactoring method name --- include/mts/MTS_IO_ICellularRadio.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/mts/MTS_IO_ICellularRadio.h') diff --git a/include/mts/MTS_IO_ICellularRadio.h b/include/mts/MTS_IO_ICellularRadio.h index 2d47fcf..e2bf652 100644 --- a/include/mts/MTS_IO_ICellularRadio.h +++ b/include/mts/MTS_IO_ICellularRadio.h @@ -60,12 +60,12 @@ namespace MTS { NOT_INSERTED }; - enum RADIOMODE : uint8_t { - RADIOMODE_UNKNOWN = 0, - RADIOMODE_AUTO, - RADIOMODE_GSM_ONLY, - RADIOMODE_UMTS_ONLY, - RADIOMODE_LTE_ONLY + enum RADIO_NETWORK_MODE : uint8_t { + RADIO_NETWORK_MODE_UNKNOWN = 0, + RADIO_NETWORK_MODE_AUTO, + RADIO_NETWORK_MODE_GSM_ONLY, + RADIO_NETWORK_MODE_UMTS_ONLY, + RADIO_NETWORK_MODE_LTE_ONLY }; static CODE convertModelToType(const std::string& sModel, std::string& sType); @@ -262,8 +262,6 @@ namespace MTS { virtual CODE getRegistration(REGISTRATION& eRegistration) = 0; virtual CODE convertRegistrationToString(REGISTRATION eRegistration, std::string& sRegistration) = 0; - virtual CODE getRadioMode(RADIOMODE &mode) = 0; - virtual CODE setRadioMode(RADIOMODE mode) = 0; /** * @brief unlockSimCard - unlock the SIM card using PIN code provided * @@ -283,6 +281,8 @@ namespace MTS { * or on any other error). */ virtual CODE unlockSimCard(const Json::Value& jArgs) = 0; + virtual CODE getRadioNetworkMode(RADIO_NETWORK_MODE &mode) = 0; + virtual CODE setRadioNetworkMode(RADIO_NETWORK_MODE mode) = 0; //! Gather details of the radio's Mobile IP Profile /*! -- cgit v1.2.3