summaryrefslogtreecommitdiff
path: root/include/mts/MTS_IO_ICellularRadio.h
diff options
context:
space:
mode:
authorMaksym Telychko <maksym.telychko@globallogic.com>2019-06-06 18:06:43 +0300
committerMaksym Telychko <maksym.telychko@globallogic.com>2019-06-06 18:07:22 +0300
commit417049f51180b3b4be84fbc0d86a3c690972fb3b (patch)
tree0b84cd375f94748b888f76096ac648322cc65a7d /include/mts/MTS_IO_ICellularRadio.h
parentdfdac48418b57fd5e3393d5a53dd3d9fbd16822e (diff)
downloadlibmts-io-417049f51180b3b4be84fbc0d86a3c690972fb3b.tar.gz
libmts-io-417049f51180b3b4be84fbc0d86a3c690972fb3b.tar.bz2
libmts-io-417049f51180b3b4be84fbc0d86a3c690972fb3b.zip
[MTS-MTQ] refactoring: moved common consts and static methods to ICellularRadio
Diffstat (limited to 'include/mts/MTS_IO_ICellularRadio.h')
-rw-r--r--include/mts/MTS_IO_ICellularRadio.h257
1 files changed, 120 insertions, 137 deletions
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<std::string> DEFAULT_BAIL_STRINGS;
-
- typedef std::function<bool(const std::string&/*iterationData*/, const std::string&/*allData*/)> IsNeedMoreData;
- typedef std::function<void(const Json::Value&)> 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<MTS::IO::Connection>& apIo,
- const std::string& sCmd,
- IsNeedMoreData& isNeedMoreData,
- int32_t timeoutMillis = 100,
- const char& ESC = CR);
-
- std::string sendCommand(MTS::AutoPtr<MTS::IO::Connection>& apIo,
- const std::string& sCmd,
- const std::vector<std::string>& vBail = DEFAULT_BAIL_STRINGS,
- int32_t timeoutMillis = 100,
- const char& ESC = CR);
- CODE test(MTS::AutoPtr<MTS::IO::Connection>& apIo, uint32_t timeoutSeconds = 30);
-
- std::string extractModelFromResult(const std::string& sResult);
- std::string getCodeAsString(CODE code);
- */
-
- }
class ICellularRadio
{
public:
+ typedef std::function<bool(const std::string&/*iterationData*/, const std::string&/*allData*/)> IsNeedMoreData;
+ typedef std::function<void(const Json::Value&)> 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<std::string> 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;
+ */
};
}