summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2015-04-20 17:14:31 -0500
committerJesse Gilles <jgilles@multitech.com>2015-04-20 17:14:31 -0500
commitd84d880627bcc1e1898a8f96b861bc25863ec86c (patch)
treee7db4eef6a8e8254eaa6ba0c7e5d56098af19d16 /include
downloadlibmts-io-d84d880627bcc1e1898a8f96b861bc25863ec86c.tar.gz
libmts-io-d84d880627bcc1e1898a8f96b861bc25863ec86c.tar.bz2
libmts-io-d84d880627bcc1e1898a8f96b861bc25863ec86c.zip
initial commit
Diffstat (limited to 'include')
-rw-r--r--include/mts/MTS_IO_CE910Radio.h56
-rw-r--r--include/mts/MTS_IO_CdmaRadio.h92
-rw-r--r--include/mts/MTS_IO_CellularRadio.h433
-rw-r--r--include/mts/MTS_IO_CellularRadioFactory.h76
-rw-r--r--include/mts/MTS_IO_Connection.h113
-rw-r--r--include/mts/MTS_IO_DE910Radio.h55
-rw-r--r--include/mts/MTS_IO_GE910Radio.h57
-rw-r--r--include/mts/MTS_IO_HE910DRadio.h56
-rw-r--r--include/mts/MTS_IO_HE910EUDRadio.h55
-rw-r--r--include/mts/MTS_IO_HE910Radio.h52
-rw-r--r--include/mts/MTS_IO_LE910EUGRadio.h53
-rw-r--r--include/mts/MTS_IO_LE910NAGRadio.h55
-rw-r--r--include/mts/MTS_IO_LE910Radio.h57
-rw-r--r--include/mts/MTS_IO_LE910SVGRadio.h55
-rw-r--r--include/mts/MTS_IO_LockFile.h59
-rw-r--r--include/mts/MTS_IO_MccMncTable.h62
-rw-r--r--include/mts/MTS_IO_SerialConnection.h181
17 files changed, 1567 insertions, 0 deletions
diff --git a/include/mts/MTS_IO_CE910Radio.h b/include/mts/MTS_IO_CE910Radio.h
new file mode 100644
index 0000000..9719c7a
--- /dev/null
+++ b/include/mts/MTS_IO_CE910Radio.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_CE910Radio.h
+ \brief A brief description
+ \date Nov 5, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_CE910RADIO_H_
+#define MTS_IO_CE910RADIO_H_
+
+#include <mts/MTS_IO_CdmaRadio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class CE910Radio : public CdmaRadio {
+
+ public:
+ static const std::string MODEL_NAME;
+
+ CE910Radio(const std::string& sPort);
+ virtual ~CE910Radio(){};
+
+ protected:
+
+ private:
+
+ };
+ }
+}
+
+
+
+
+#endif /* MTS_IO_CE910RADIO_H_ */
diff --git a/include/mts/MTS_IO_CdmaRadio.h b/include/mts/MTS_IO_CdmaRadio.h
new file mode 100644
index 0000000..146034b
--- /dev/null
+++ b/include/mts/MTS_IO_CdmaRadio.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_CdmaRadio.h
+ \brief A brief description
+ \date Nov 19, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_CDMARADIO_H_
+#define MTS_IO_CDMARADIO_H_
+
+#include <mts/MTS_IO_CellularRadio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class CdmaRadio : public CellularRadio {
+
+ public:
+ virtual ~CdmaRadio();
+
+ virtual CODE getHardware(std::string& sHardware);
+ virtual CODE getMdn(std::string& sMdn);
+ virtual CODE getImei(std::string& sImei);
+ virtual CODE getMeid(std::string& sMeid);
+ virtual CODE getMsid(std::string& sMsid);
+ virtual CODE getCarrier(std::string& sCarrier);
+ virtual CODE getNetwork(std::string& sNetwork);
+ virtual CODE getSimStatus(std::string& sSimStatus);
+ virtual CODE getIccid(std::string& sIccid);
+ virtual CODE getLac(std::string& sLac);
+ virtual CODE getService(std::string& sService);
+
+ virtual CODE validateMsl(const Json::Value& jArgs);
+ virtual CODE setMdn(const Json::Value& jArgs);
+ virtual CODE setMsid(const Json::Value& jArgs);
+
+ virtual CODE getMipProfile(Json::Value& jMipProfile);
+ virtual CODE setMipActiveProfile(const Json::Value& jArgs);
+ virtual CODE setMipNai(const Json::Value& jArgs);
+ virtual CODE setMipHomeIp(const Json::Value& jArgs);
+ virtual CODE setMipPrimaryHa(const Json::Value& jArgs);
+ virtual CODE setMipSecondaryHa(const Json::Value& jArgs);
+ virtual CODE setMipMnAaaSpi(const Json::Value& jArgs);
+ virtual CODE setMipMnHaSpi(const Json::Value& jArgs);
+ virtual CODE setMipRevTun(const Json::Value& jArgs);
+ virtual CODE setMipMnAaaSs(const Json::Value& jArgs);
+ virtual CODE setMipMnHaSs(const Json::Value& jArgs);
+
+ virtual CODE updateDc(const Json::Value& jArgs, UpdateCb& stepCb);
+ virtual CODE updatePrl(const Json::Value& jArgs, UpdateCb& stepCb);
+ virtual CODE updateFumo(const Json::Value& jArgs, UpdateCb& stepCb);
+ virtual CODE resetHfa(const Json::Value& jArgs, UpdateCb& stepCb);
+ virtual CODE activate(const Json::Value& jArgs, UpdateCb& stepCb);
+
+ virtual CODE getNetworkStatus(Json::Value& jData);
+
+ protected:
+ CdmaRadio(const std::string& sName, const std::string& sRadioPort);
+
+ std::string getMeidLastSix();
+
+ private:
+ std::string m_sCarrier;
+ };
+ }
+}
+
+
+
+
+#endif /* MTS_IO_CDMARADIO_H_ */
diff --git a/include/mts/MTS_IO_CellularRadio.h b/include/mts/MTS_IO_CellularRadio.h
new file mode 100644
index 0000000..b253c80
--- /dev/null
+++ b/include/mts/MTS_IO_CellularRadio.h
@@ -0,0 +1,433 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_CellularRadio.h
+ \brief A brief description
+ \date Nov 5, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_CELLULARRADIO_H_
+#define MTS_IO_CELLULARRADIO_H_
+
+#include <mts/MTS_IO_SerialConnection.h>
+#include <mts/MTS_NonCopyable.h>
+#include <mts/MTS_AutoPtr.h>
+#include <mts/MTS_Lock.h>
+#include <mts/MTS_Stdint.h>
+#include <json/json.h>
+#include <string>
+#include <vector>
+#include <functional>
+
+namespace MTS {
+ namespace IO {
+
+ class CellularRadio : NonCopyable {
+
+ public:
+ 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;
+
+ //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
+ };
+
+ 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_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_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_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;
+
+ virtual ~CellularRadio();
+
+ virtual bool initialize(uint32_t iTimeoutMillis = 5000);
+ virtual bool resetRadio(uint32_t iTimeoutMillis = 5000);
+ virtual bool resetConnection(uint32_t iTimeoutMillis = 5000);
+ virtual void shutdown();
+
+ const std::string& getName() const;
+
+ virtual CODE getModel(std::string& sModel);
+ static CODE convertModelToType(const std::string& sModel, std::string& sType);
+ static CODE convertModelToMtsShortCode(const std::string& sModel, std::string& sCode);
+ static CODE convertServiceDomainToString(SERVICEDOMAIN eSd, std::string& sSd);
+ static CODE convertActiveBandToString(ACTIVEBAND eBand, std::string& sBand);
+
+ virtual CODE getFirmware(std::string& sFirmware);
+ virtual CODE getHardware(std::string& sHardware);
+ virtual CODE getManufacturer(std::string& sManufacturer);
+ virtual CODE getImei(std::string& sImei);
+ virtual CODE getMeid(std::string& sMeid);
+ virtual CODE getImsi(std::string& sImsi);
+ virtual CODE getSimStatus(std::string& sSimStatus);
+ virtual CODE getIccid(std::string& sIccid);
+ virtual CODE getService(std::string& sService);
+ virtual CODE getLac(std::string& sLac);
+ virtual CODE getMdn(std::string& sMdn);
+ virtual CODE getMsid(std::string& sMsid);
+ virtual CODE getType(std::string& sType);
+ virtual CODE getCarrier(std::string& sCarrier);
+ virtual CODE getNetwork(std::string& sNetwork);
+ virtual CODE getTower(std::string& sTower);
+ virtual CODE getTime(std::string& sDate, std::string& sTime, std::string& sTimeZone);
+ virtual CODE getRoaming(bool& bRoaming);
+
+ virtual CODE getSignalStrength(int32_t& iRssi);
+ virtual CODE convertSignalStrengthTodBm(const int32_t& iRssi, int32_t& dBm);
+ virtual CODE convertdBmToSignalStrength(const int32_t& dBm, int32_t& iRssi);
+
+ virtual CODE getRegistration(REGISTRATION& eRegistration);
+ virtual CODE convertRegistrationToString(REGISTRATION eRegistration, std::string& sRegistration);
+
+ //! 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);
+
+ /*
+ * jArgs = {
+ * "msl" : "Master Subsidy Lock (Aeris, Sprint): STRING"
+ * }
+ */
+ virtual CODE validateMsl(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "mdn" : "Mobile Directory Number : STRING",
+ * "msl" : "[OPTIONAL] Master Subsidy Lock (Aeris, Sprint): STRING"
+ * }
+ */
+ virtual CODE setMdn(const Json::Value& jArgs);
+
+ /*
+ * 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);
+
+ /*
+ * jArgs = {
+ * "activeProfile" : "Set active profile: STRING"
+ * }
+ */
+ virtual CODE setMipActiveProfile(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "nai" : "Network Access Identifier : STRING"
+ * }
+ */
+ virtual CODE setMipNai(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "homeIp" : "Home Address : STRING"
+ * }
+ */
+ virtual CODE setMipHomeIp(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "primaryHa" : "Primary Home Agent : STRING"
+ * }
+ */
+ virtual CODE setMipPrimaryHa(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "secondaryHa" : "Secondary Home Agent : STRING"
+ * }
+ */
+ virtual CODE setMipSecondaryHa(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "mnAaaSpi" : "Mobile Node Authentication, Authorization, and Accounting Server Security Parameter Index : STRING"
+ * }
+ */
+ virtual CODE setMipMnAaaSpi(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "mnHaSpi" : "Mobile Node Home Agent Security Server Parameter Index : STRING"
+ * }
+ */
+ virtual CODE setMipMnHaSpi(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "revTun" : "[DESCRIPTION] : STRING"
+ * }
+ */
+ virtual CODE setMipRevTun(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "mnAaaSs" : "Mobile Node Authentication, Authorization, and Accounting Server Shared Secret : STRING"
+ * }
+ */
+ virtual CODE setMipMnAaaSs(const Json::Value& jArgs);
+
+ /*
+ * jArgs = {
+ * "mnHaSs" : "Mobile Node Home Agent Shared Secret : STRING"
+ * }
+ */
+ virtual CODE setMipMnHaSs(const Json::Value& jArgs);
+
+ /*
+ * jArgs = null
+ */
+ virtual CODE updateDc(const Json::Value& jArgs, UpdateCb& stepCb);
+
+ /*
+ * jArgs = null
+ */
+ virtual CODE updatePrl(const Json::Value& jArgs, UpdateCb& stepCb);
+
+ /*
+ * jArgs = null
+ */
+ virtual CODE updateFumo(const Json::Value& jArgs, UpdateCb& stepCb);
+
+ /*
+ * jArgs = {
+ * "msl" : "Master Subsidy Lock (Sprint): STRING"
+ * }
+ */
+ virtual CODE resetHfa(const Json::Value& jArgs, UpdateCb& stepCb);
+
+ /*
+ * jArgs = {
+ * "mdn" : "Mobile Directory Number (Aeris): STRING"
+ * "msid" : "Mobile Station ID (Aeris): STRING"
+ * }
+ */
+ virtual CODE activate(const Json::Value& jArgs, UpdateCb& stepCb);
+
+ virtual CODE getEcho(bool& bEnabled);
+ virtual CODE setEcho(bool bEnabled = true);
+
+ virtual CODE getStaticInformation(Json::Value& jData);
+ virtual CODE getNetworkStatus(Json::Value& jData);
+
+ virtual CODE sendBasicCommand(const std::string& sCmd, int32_t timeoutMillis = 100, const char& ESC = CR);
+
+ virtual std::string sendCommand(const std::string& sCmd,
+ const std::vector<std::string>& vBail = DEFAULT_BAIL_STRINGS,
+ int32_t timeoutMillis = 100,
+ const char& ESC = CR);
+
+
+ static 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);
+
+ virtual std::string sendCommand(const std::string& sCmd,
+ IsNeedMoreData& isNeedMoreData,
+ int32_t timeoutMillis = 100,
+ const char& ESC = CR);
+
+ static std::string sendCommand(MTS::AutoPtr<MTS::IO::Connection>& apIo,
+ const std::string& sCmd,
+ IsNeedMoreData& isNeedMoreData,
+ int32_t timeoutMillis = 100,
+ const char& ESC = CR);
+
+ static CODE test(MTS::AutoPtr<MTS::IO::Connection>& apIo, uint32_t timeoutSeconds = 30);
+
+ static std::string extractModelFromResult(const std::string& sResult);
+ static std::string getCodeAsString(CODE code);
+
+ protected:
+
+ CellularRadio(const std::string& sName, const std::string& sRadioPort);
+
+ virtual bool getCarrierFromFirmware(const std::string& sFirmware, std::string& sCarrier);
+ virtual bool getHardwareVersionFromFirmware(const std::string& sFirmware, std::string& sHardware);
+
+ virtual void getCommonNetworkStats(Json::Value& jData);
+
+ 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);
+
+
+
+ private:
+ std::string m_sName;
+ std::string m_sRadioPort;
+ std::string m_sFirmware;
+ std::string m_sCarrier;
+ MTS::AutoPtr<MTS::IO::Connection> m_apIo;
+
+ bool m_bEchoEnabled;
+ bool m_bEnableEchoOnClose;
+
+ };
+ }
+}
+
+
+
+#endif /* MTS_IO_CELLULARRADIO_H_ */
diff --git a/include/mts/MTS_IO_CellularRadioFactory.h b/include/mts/MTS_IO_CellularRadioFactory.h
new file mode 100644
index 0000000..5fa44d7
--- /dev/null
+++ b/include/mts/MTS_IO_CellularRadioFactory.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_CellularRadioFactory.h
+ \brief A brief description
+ \date Nov 5, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_CELLULARRADIOFACTORY_H_
+#define MTS_IO_CELLULARRADIOFACTORY_H_
+
+#include <mts/MTS_IO_CellularRadio.h>
+#include <string>
+#include <map>
+
+namespace MTS {
+ namespace IO {
+
+ class HE910Radio;
+ class GE910Radio;
+ class DE910Radio;
+ class CE910Radio;
+ class CellularRadioFactory {
+
+ public:
+
+ CellularRadioFactory();
+ virtual ~CellularRadioFactory() {};
+
+ virtual CellularRadio* create(const std::string& sModel, const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT);
+
+ virtual CellularRadio* createHE910D(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT);
+ virtual CellularRadio* createHE910EUD(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT);
+ virtual CellularRadio* createLE910NAG(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT);
+ virtual CellularRadio* createLE910SVG(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT);
+ virtual CellularRadio* createLE910EUG(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT);
+ virtual CellularRadio* createGE910(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT);
+ virtual CellularRadio* createDE910(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT);
+ virtual CellularRadio* createCE910(const std::string& sPort = CellularRadio::DEFAULT_RADIO_PORT);
+
+ protected:
+ typedef MTS::IO::CellularRadio* (CellularRadioFactory::*CREATEFUNCPTR)(const std::string& sPort);
+ std::map< std::string, CREATEFUNCPTR > m_mCreationMap;
+
+ virtual std::string identifyRadio(const std::string& sPort);
+
+ private:
+
+
+ };
+ }
+}
+
+
+
+#endif /* MTS_IO_CELLULARRADIOFACTORY_H_ */
diff --git a/include/mts/MTS_IO_Connection.h b/include/mts/MTS_IO_Connection.h
new file mode 100644
index 0000000..bd4b32f
--- /dev/null
+++ b/include/mts/MTS_IO_Connection.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_Connection.h
+ \brief A brief description
+ \date Jan 15, 2013
+ \author sgodinez
+
+ A more elaborate description
+*/
+
+#ifndef MTS_IO_CONNECTION_H_
+#define MTS_IO_CONNECTION_H_
+
+#include <mts/MTS_AutoPtr.h>
+#include <mts/MTS_Lock.h>
+#include <mts/MTS_NonCopyable.h>
+#include <string>
+
+namespace MTS {
+
+ class Buffer;
+
+ namespace IO {
+ class Connection : public MTS::NonCopyable {
+
+ private:
+ static int32_t BLOCKING;
+
+ public:
+
+ virtual ~Connection();
+
+ const std::string& getName() const;
+
+ bool open(const int32_t& timeoutMillis = 1000);
+ void close();
+ bool isClosed() const;
+
+ void setCloseable(bool bCloseable);
+ bool isCloseable() const;
+
+ int read(char* pBuffer, const uint32_t& iSize, int32_t& timeoutMillis = BLOCKING);
+ int read(std::string& sBuffer, const uint32_t& iSize, int32_t& timeoutMillis = BLOCKING);
+ int read(Buffer& oBuffer, const uint32_t& iSize, int32_t& timeoutMillis = BLOCKING);
+
+ int write(const char* pBuffer, const uint32_t& iSize, int32_t& timeoutMillis = BLOCKING);
+ int write(const std::string& sBuffer, const uint32_t& iSize, int32_t& timeoutMillis = BLOCKING);
+ int write(const Buffer& oBuffer, const uint32_t& iSize, int32_t& timeoutMillis = BLOCKING);
+
+
+
+ protected:
+ explicit Connection(const std::string& sName);
+
+ private:
+ const std::string m_sName;
+ bool m_bClosed;
+ bool m_bCloseable;
+ AutoPtr<Lock> m_apLock;
+ AutoPtr<Lock> m_apReadLock;
+ AutoPtr<Lock> m_apWriteLock;
+
+ /*! Opens the connection
+ * \return true if the connection has been opened, false otherwise
+ */
+ virtual bool doOpen(const int32_t& timeoutMillis) = 0;
+
+ /*! Closes the connection
+ */
+ virtual void doClose() = 0;
+
+ /*! Perform read from connection
+ * \param pBuffer the buffer allocated for read bytes
+ * \param iSize the number of bytes to be read. the size allocated for pBuffer must be greater or equal to iSize
+ * \param timeoutMillis the amount of time to attempt to read iSize bytes. less than zero will block until iSize bytes has been read
+ * \return the number of bytes read. -1 for error
+ */
+ virtual int doRead(char* pBuffer, const uint32_t& iSize, int32_t& timeoutMillis) = 0;
+
+ /*! Perform write to connection
+ * \param pBuffer the buffer that contains the data to be written
+ * \param iSize the number of bytes to be written
+ * \param timeoutMillis the amount of time to attempt to write iSize bytes. less than zero will block until iSize bytes has been written
+ * \return the number of bytes written. -1 for error
+ */
+ virtual int doWrite(const char* pBuffer, const uint32_t& iSize, int32_t& timeoutMillis) = 0;
+
+ };
+ }
+}
+
+
+
+#endif /* MTS_IO_CONNECTION_H_ */
diff --git a/include/mts/MTS_IO_DE910Radio.h b/include/mts/MTS_IO_DE910Radio.h
new file mode 100644
index 0000000..40dc132
--- /dev/null
+++ b/include/mts/MTS_IO_DE910Radio.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_DE910Radio.h
+ \brief A brief description
+ \date Nov 5, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_DE910RADIO_H_
+#define MTS_IO_DE910RADIO_H_
+
+#include <mts/MTS_IO_CdmaRadio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class DE910Radio : public CdmaRadio {
+
+ public:
+ static const std::string MODEL_NAME;
+
+ DE910Radio(const std::string& sPort);
+ virtual ~DE910Radio(){};
+
+ protected:
+
+ private:
+
+ };
+ }
+}
+
+
+
+#endif /* MTS_IO_DE910RADIO_H_ */
diff --git a/include/mts/MTS_IO_GE910Radio.h b/include/mts/MTS_IO_GE910Radio.h
new file mode 100644
index 0000000..079765d
--- /dev/null
+++ b/include/mts/MTS_IO_GE910Radio.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_GE910Radio.h
+ \brief A brief description
+ \date Nov 5, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_GE910RADIO_H_
+#define MTS_IO_GE910RADIO_H_
+
+#include <mts/MTS_IO_CellularRadio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class GE910Radio : public CellularRadio {
+
+ public:
+ static const std::string MODEL_NAME;
+
+ GE910Radio(const std::string& sPort);
+ virtual ~GE910Radio(){};
+
+ protected:
+
+ private:
+
+
+ };
+ }
+}
+
+
+
+
+#endif /* MTS_IO_GE910RADIO_H_ */
diff --git a/include/mts/MTS_IO_HE910DRadio.h b/include/mts/MTS_IO_HE910DRadio.h
new file mode 100644
index 0000000..2fd648e
--- /dev/null
+++ b/include/mts/MTS_IO_HE910DRadio.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_HE910DRadio.h
+ \brief A brief description
+ \date Nov 6, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_HE910DRADIO_H_
+#define MTS_IO_HE910DRADIO_H_
+
+#include <mts/MTS_IO_HE910Radio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class HE910DRadio : public HE910Radio {
+
+ public:
+ static const std::string MODEL_NAME;
+
+ HE910DRadio(const std::string& sPort);
+ virtual ~HE910DRadio(){};
+
+ protected:
+
+ private:
+
+ };
+ }
+}
+
+
+
+
+#endif /* MTS_IO_HE910DRADIO_H_ */
diff --git a/include/mts/MTS_IO_HE910EUDRadio.h b/include/mts/MTS_IO_HE910EUDRadio.h
new file mode 100644
index 0000000..96353f2
--- /dev/null
+++ b/include/mts/MTS_IO_HE910EUDRadio.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_HE910EUDRadio.h
+ \brief A brief description
+ \date Nov 6, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_HE910EUDRADIO_H_
+#define MTS_IO_HE910EUDRADIO_H_
+
+
+#include <mts/MTS_IO_HE910Radio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class HE910EUDRadio : public HE910Radio {
+
+ public:
+ static const std::string MODEL_NAME;
+
+ HE910EUDRadio(const std::string& sPort);
+ virtual ~HE910EUDRadio(){};
+
+ protected:
+
+ private:
+
+ };
+ }
+}
+
+
+#endif /* MTS_IO_HE910EUDRADIO_H_ */
diff --git a/include/mts/MTS_IO_HE910Radio.h b/include/mts/MTS_IO_HE910Radio.h
new file mode 100644
index 0000000..ee8e1e7
--- /dev/null
+++ b/include/mts/MTS_IO_HE910Radio.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_HE910Radio.h
+ \brief A brief description
+ \date Nov 5, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_HE910RADIO_H_
+#define MTS_IO_HE910RADIO_H_
+
+#include <mts/MTS_IO_CellularRadio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class HE910Radio : public CellularRadio {
+
+ public:
+
+ virtual ~HE910Radio(){};
+
+ protected:
+ HE910Radio(const std::string& sHE910Model, const std::string& sPort);
+ private:
+
+ };
+ }
+}
+
+
+#endif /* MTS_IO_HE910RADIO_H_ */
diff --git a/include/mts/MTS_IO_LE910EUGRadio.h b/include/mts/MTS_IO_LE910EUGRadio.h
new file mode 100644
index 0000000..d0607e2
--- /dev/null
+++ b/include/mts/MTS_IO_LE910EUGRadio.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_LE910EUGRadio.h
+ \brief A brief description
+ \date Jan 19, 2015
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_LE910EUGRADIO_H_
+#define MTS_IO_LE910EUGRADIO_H_
+
+#include <mts/MTS_IO_LE910Radio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class LE910EUGRadio : public LE910Radio {
+
+ public:
+ static const std::string MODEL_NAME;
+
+ LE910EUGRadio(const std::string& sPort);
+ virtual ~LE910EUGRadio(){};
+
+ protected:
+
+ private:
+
+ };
+ }
+}
+
+#endif /* MTS_IO_LE910EUGRADIO_H_ */
diff --git a/include/mts/MTS_IO_LE910NAGRadio.h b/include/mts/MTS_IO_LE910NAGRadio.h
new file mode 100644
index 0000000..a05a311
--- /dev/null
+++ b/include/mts/MTS_IO_LE910NAGRadio.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_LE910NAGRadio.h
+ \brief A brief description
+ \date Jan 19, 2015
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_LE910NAGRADIO_H_
+#define MTS_IO_LE910NAGRADIO_H_
+
+#include <mts/MTS_IO_LE910Radio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class LE910NAGRadio : public LE910Radio {
+
+ public:
+ static const std::string MODEL_NAME;
+
+ LE910NAGRadio(const std::string& sPort);
+ virtual ~LE910NAGRadio(){};
+
+ virtual CODE getCarrier(std::string& sCarrier);
+
+ protected:
+
+ private:
+
+ };
+ }
+}
+
+#endif /* MTS_IO_LE910NAGRADIO_H_ */
diff --git a/include/mts/MTS_IO_LE910Radio.h b/include/mts/MTS_IO_LE910Radio.h
new file mode 100644
index 0000000..e2f4c12
--- /dev/null
+++ b/include/mts/MTS_IO_LE910Radio.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_LE910Radio.h
+ \brief A brief description
+ \date Nov 5, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_LE910RADIO_H_
+#define MTS_IO_LE910RADIO_H_
+
+#include <mts/MTS_IO_CellularRadio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class LE910Radio : public CellularRadio {
+
+ public:
+ static const std::string MODEL_NAME;
+
+ LE910Radio(const std::string& sLE910Model, const std::string& sPort);
+ virtual ~LE910Radio(){};
+
+ protected:
+
+ private:
+
+
+ };
+ }
+}
+
+
+
+
+#endif /* MTS_IO_LE910RADIO_H_ */
diff --git a/include/mts/MTS_IO_LE910SVGRadio.h b/include/mts/MTS_IO_LE910SVGRadio.h
new file mode 100644
index 0000000..d92f877
--- /dev/null
+++ b/include/mts/MTS_IO_LE910SVGRadio.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_LE910SVGRadio.h
+ \brief A brief description
+ \date Jan 19, 2015
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_LE910SVGRADIO_H_
+#define MTS_IO_LE910SVGRADIO_H_
+
+#include <mts/MTS_IO_LE910Radio.h>
+
+namespace MTS {
+ namespace IO {
+
+ class LE910SVGRadio : public LE910Radio {
+
+ public:
+ static const std::string MODEL_NAME;
+
+ LE910SVGRadio(const std::string& sPort);
+ virtual ~LE910SVGRadio(){};
+
+ virtual CODE getCarrier(std::string& sCarrier);
+
+ protected:
+
+ private:
+
+ };
+ }
+}
+
+#endif /* MTS_IO_LE910SVGRADIO_H_ */
diff --git a/include/mts/MTS_IO_LockFile.h b/include/mts/MTS_IO_LockFile.h
new file mode 100644
index 0000000..dcfb9ae
--- /dev/null
+++ b/include/mts/MTS_IO_LockFile.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_LockFile.h
+ \brief A brief description
+ \date Oct 8, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_LOCKFILE_H_
+#define MTS_IO_LOCKFILE_H_
+
+#include <mts/MTS_NonCopyable.h>
+#include <string>
+
+namespace MTS {
+ namespace IO {
+
+ class LockFile : MTS::NonCopyable {
+
+ public:
+
+ LockFile(const std::string& sFilePath);
+ virtual ~LockFile();
+
+ bool lock(uint32_t tryMillis);
+ void unlock();
+ bool isLocked();
+
+ protected:
+
+ private:
+ std::string m_sFile;
+ int m_iLockFd;
+ };
+
+ }
+}
+
+#endif /* MTS_IO_LOCKFILE_H_ */
diff --git a/include/mts/MTS_IO_MccMncTable.h b/include/mts/MTS_IO_MccMncTable.h
new file mode 100644
index 0000000..7772258
--- /dev/null
+++ b/include/mts/MTS_IO_MccMncTable.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_MccMncTable.h
+ \brief A brief description
+ \date Dec 11, 2014
+ \author sgodinez
+
+ A more elaborate description
+*/
+#ifndef MTS_IO_MCCMNCTABLE_H_
+#define MTS_IO_MCCMNCTABLE_H_
+
+#include <mts/MTS_AutoPtr.h>
+#include <mts/MTS_Lock.h>
+#include <json/json.h>
+#include <map>
+#include <string>
+
+namespace MTS {
+ namespace IO {
+
+ class MccMncTable {
+ public:
+ static MccMncTable* getInstance();
+
+ Json::Value lookup(const std::string& sMcc, const std::string& sMnc);
+
+ private:
+ static MccMncTable* m_pInstance;
+ static MTS::AutoPtr<MTS::Lock> m_apLock;
+
+ std::map<uint32_t, std::map<uint32_t, std::string> > m_mTable;
+
+ MccMncTable();
+ void createTable();
+ };
+
+ }
+}
+
+
+
+#endif /* MTS_IO_MCCMNCTABLE_H_ */
diff --git a/include/mts/MTS_IO_SerialConnection.h b/include/mts/MTS_IO_SerialConnection.h
new file mode 100644
index 0000000..b4bb61f
--- /dev/null
+++ b/include/mts/MTS_IO_SerialConnection.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2015 by Multi-Tech Systems
+ *
+ * This file is part of libmts_io.
+ *
+ * libmts_io is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libmts_io is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with libmts_io. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*!
+ \file MTS_IO_SerialConnection.h
+ \brief A brief description
+ \date Jan 15, 2013
+ \author sgodinez
+
+ A more elaborate description
+*/
+
+#ifndef MTS_IO_SERIALCONNECTION_H_
+#define MTS_IO_SERIALCONNECTION_H_
+
+#include <mts/MTS_IO_Connection.h>
+#include <mts/MTS_IO_LockFile.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+
+namespace MTS {
+ namespace IO {
+
+ class SerialConnection : public Connection {
+
+ public:
+
+ enum ETYPE {
+ RS232,
+ RS422,
+ RS485
+ };
+
+ enum EPARITY {
+ OFF,
+ ODD,
+ EVEN
+ };
+
+ enum EDATABITS {
+ B5,
+ B6,
+ B7,
+ B8
+ };
+
+ enum ESTOPBITS {
+ B1,
+ B2
+ };
+
+ enum IOCTL {
+ LE = TIOCM_LE,
+ DTR = TIOCM_DTR,
+ RTS = TIOCM_RTS,
+ ST = TIOCM_ST,
+ SR = TIOCM_SR,
+ CTS = TIOCM_CTS,
+ CAR = TIOCM_CAR,
+ CD = TIOCM_CD,
+ RNG = TIOCM_RNG,
+ RI = TIOCM_RI,
+ DSR = TIOCM_DSR
+ };
+
+ enum FLOW_CONTROL {
+ NONE,
+ RTS_CTS
+ };
+
+ class Builder {
+ public:
+ Builder(const std::string& sPortName);
+
+ Builder& type(const ETYPE& eType);
+ Builder& rs232();
+ Builder& rs422();
+ Builder& rs485();
+
+ Builder& parity(const EPARITY& eParity);
+ Builder& parityOff();
+ Builder& parityOdd();
+ Builder& parityEven();
+
+ Builder& dataBits(const EDATABITS& eDataLength);
+ Builder& fiveDataBits();
+ Builder& sixDataBits();
+ Builder& sevenDataBits();
+ Builder& eightDataBits();
+
+ Builder& stopBits(const ESTOPBITS& eStopBits);
+ Builder& oneStopBit();
+ Builder& twoStopBits();
+
+ Builder& useLockFile(bool enabled = true);
+ Builder& flowControl(const FLOW_CONTROL& eFlowControl);
+ Builder& baudRate(uint32_t iBaud);
+
+ Builder& build();
+
+ const std::string& getPortName() const;
+ const uint32_t& getBaudRate() const;
+ ETYPE getType() const;
+ EPARITY getParity() const;
+ EDATABITS getDataBits() const;
+ ESTOPBITS getStopBits() const;
+ FLOW_CONTROL getFlowControl() const;
+ std::string getTypeAsString() const;
+ bool isUsingLockFile() const;
+ bool isBuilt() const;
+
+ private:
+ std::string m_sPortName;
+ uint32_t m_iBaudRate;
+ ETYPE m_eType;
+ EPARITY m_eParity;
+ EDATABITS m_eDataBits;
+ ESTOPBITS m_eStopBits;
+ FLOW_CONTROL m_eFlowControl;
+ bool m_bLockFile;
+ bool m_bBuilt;
+ };
+
+ SerialConnection(const Builder& oBuilder);
+ virtual ~SerialConnection();
+
+ const std::string& getPortName() const;
+ uint32_t getBaudRate() const;
+
+ void flush();
+ void drain();
+ protected:
+ virtual int getFileDescriptor();
+
+ private:
+ const std::string m_sPortName;
+ uint32_t m_iBaudRate;
+ ETYPE m_eType;
+ EPARITY m_eParity;
+ EDATABITS m_eDataBits;
+ ESTOPBITS m_eStopBits;
+ FLOW_CONTROL m_eFlowControl;
+ AutoPtr<LockFile> m_apLockFile;
+
+ AutoPtr<Lock> m_apHandleLock;
+#ifdef WIN32
+ HANDLE m_iHandle;
+#else
+ int m_iHandle;
+ termios m_stPrevOptions;
+#endif
+
+ virtual bool doOpen(const int32_t& timeoutMillis);
+ virtual void doClose();
+ virtual int doRead(char* pBuffer, const uint32_t& iSize, int32_t& timeoutMillis);
+ virtual int doWrite(const char* pBuffer, const uint32_t& iSize, int32_t& timeoutMillis);
+
+ void cleanup();
+ };
+ }
+}
+
+
+#endif /* MTS_IO_SERIALCONNECTION_H_ */