From 36d1c638d115caefc042fe7a172cc531bb9e1436 Mon Sep 17 00:00:00 2001 From: David Marcaccini Date: Fri, 8 Mar 2019 13:19:52 -0600 Subject: Add support for the ME910C1-WW Radio --- src/MTS_IO_CellularRadio.cpp | 8 ++++++++ src/MTS_IO_CellularRadioFactory.cpp | 6 ++++++ src/MTS_IO_ME910C1WWRadio.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/MTS_IO_ME910Radio.cpp | 9 +-------- src/MTS_IO_SerialConnection.cpp | 9 ++++++--- 5 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 src/MTS_IO_ME910C1WWRadio.cpp (limited to 'src') diff --git a/src/MTS_IO_CellularRadio.cpp b/src/MTS_IO_CellularRadio.cpp index 4db91cb..46cf61e 100644 --- a/src/MTS_IO_CellularRadio.cpp +++ b/src/MTS_IO_CellularRadio.cpp @@ -312,6 +312,9 @@ CellularRadio::CODE CellularRadio::convertModelToMtsShortCode(const std::string& } else if (sModel.find("ME910C1-NV") == 0) { sCode = "MVW1"; eCode = SUCCESS; + } else if (sModel.find("ME910C1-WW") == 0) { + sCode = "MNG2"; + eCode = SUCCESS; } else if (sModel.find("LE910-EUG") == 0) { sCode = "LEU1"; eCode = SUCCESS; @@ -402,6 +405,9 @@ CellularRadio::CODE CellularRadio::convertModelToType(const std::string& sModel, } else if (sModel.find("ME910C1-NV") == 0) { sType = VALUE_TYPE_LTE; eCode = SUCCESS; + } else if (sModel.find("ME910C1-WW") == 0) { + sType = VALUE_TYPE_LTE; + eCode = SUCCESS; } else if (sModel.find("GE910") == 0) { sType = VALUE_TYPE_GSM; eCode = SUCCESS; @@ -1587,6 +1593,8 @@ std::string CellularRadio::extractModelFromResult(const std::string& sResult) { sModel = "ME910C1-NA"; } else if(sResult.find("ME910C1-NV") != std::string::npos) { sModel = "ME910C1-NV"; + } else if(sResult.find("ME910C1-WW") != std::string::npos) { + sModel = "ME910C1-WW"; } else if(sResult.find("LE910-SVG") != std::string::npos) { sModel = "LE910-SVG"; } else if(sResult.find("LE910-EUG") != std::string::npos) { diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp index bbc2d3f..571797e 100644 --- a/src/MTS_IO_CellularRadioFactory.cpp +++ b/src/MTS_IO_CellularRadioFactory.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,7 @@ CellularRadioFactory::CellularRadioFactory() { m_mCreationMap[LE910C1APRadio::MODEL_NAME] = &CellularRadioFactory::createLE910C1AP; m_mCreationMap[ME910C1NARadio::MODEL_NAME] = &CellularRadioFactory::createME910C1NA; m_mCreationMap[ME910C1NVRadio::MODEL_NAME] = &CellularRadioFactory::createME910C1NV; + m_mCreationMap[ME910C1WWRadio::MODEL_NAME] = &CellularRadioFactory::createME910C1WW; m_mCreationMap[GE910Radio::MODEL_NAME] = &CellularRadioFactory::createGE910; m_mCreationMap[DE910Radio::MODEL_NAME] = &CellularRadioFactory::createDE910; m_mCreationMap[CE910Radio::MODEL_NAME] = &CellularRadioFactory::createCE910; @@ -161,6 +163,10 @@ CellularRadio* CellularRadioFactory::createME910C1NV(const std::string& sPort) { return new ME910C1NVRadio(sPort); } +CellularRadio* CellularRadioFactory::createME910C1WW(const std::string& sPort) { + return new ME910C1WWRadio(sPort); +} + CellularRadio* CellularRadioFactory::createGE910(const std::string& sPort) { return new GE910Radio(sPort); } diff --git a/src/MTS_IO_ME910C1WWRadio.cpp b/src/MTS_IO_ME910C1WWRadio.cpp new file mode 100644 index 0000000..03cb1a4 --- /dev/null +++ b/src/MTS_IO_ME910C1WWRadio.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019 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 . + * + */ + +#include + +using namespace MTS::IO; + +const std::string ME910C1WWRadio::MODEL_NAME("ME910C1-WW"); + +ME910C1WWRadio::ME910C1WWRadio(const std::string& sPort) +: ME910Radio(MODEL_NAME, sPort) +{ + +} + +CellularRadio::CODE ME910C1WWRadio::getCarrier(std::string& sCarrier) { + sCarrier = "AT&T"; + return SUCCESS; +} diff --git a/src/MTS_IO_ME910Radio.cpp b/src/MTS_IO_ME910Radio.cpp index 2e46164..42796e9 100644 --- a/src/MTS_IO_ME910Radio.cpp +++ b/src/MTS_IO_ME910Radio.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 by Multi-Tech Systems + * Copyright (C) 2019 by Multi-Tech Systems * * This file is part of libmts-io. * @@ -18,13 +18,6 @@ * */ -/*! - \file MTS_IO_ME910Radio.cpp - \brief A brief description - - A more elaborate description -*/ - #include #include #include diff --git a/src/MTS_IO_SerialConnection.cpp b/src/MTS_IO_SerialConnection.cpp index 4a7923b..a9f3d6e 100644 --- a/src/MTS_IO_SerialConnection.cpp +++ b/src/MTS_IO_SerialConnection.cpp @@ -272,7 +272,8 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { #else m_iHandle = ::open(m_sPortName.c_str(), O_RDWR | O_NOCTTY ); if (m_iHandle == -1) { - printWarning("SERIAL| Failed to open port [%s] [%d]", m_sPortName.c_str(), errno); + printWarning("SERIAL| Failed to open port [%s] [%d]%s", m_sPortName.c_str(), errno, + errno == 13 ? " (Permission Denied)" : ""); if(!m_apLockFile.isNull()) { m_apLockFile->unlock(); } @@ -282,7 +283,8 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { int result = tcgetattr(m_iHandle, &m_stPrevOptions); if (result == -1) { - printWarning("SERIAL| Failed to get attributes on port [%s] [%d]", m_sPortName.c_str(), errno); + printWarning("SERIAL| Failed to get attributes on port [%s] [%d]%s", m_sPortName.c_str(), errno, + errno == 13 ? " (Permission Denied)" : ""); } termios options = m_stPrevOptions; @@ -413,7 +415,8 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { result = tcsetattr(m_iHandle, TCSANOW, &options); if (result == -1) { - printWarning("SERIAL| Failed to set configurations on port [%s] [%d]", m_sPortName.c_str(), errno); + printWarning("SERIAL| Failed to set configurations on port [%s] [%d]%s", m_sPortName.c_str(), errno, + errno == 13 ? " (Permission Denied)" : ""); goto CLEANUP; } result = tcflush(m_iHandle, TCIOFLUSH); -- cgit v1.2.3