diff options
| author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2019-06-13 10:47:10 +0300 | 
|---|---|---|
| committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2019-06-13 10:47:10 +0300 | 
| commit | 4220543c5e64d36eb94b8137f46079d1a2cb1d28 (patch) | |
| tree | 41b68f511b4609a22c0618bf24e847c43ad04f4b /src | |
| parent | c0e937f5a2a31b09f2736f1aeda782ba4ad121e2 (diff) | |
| download | libmts-io-4220543c5e64d36eb94b8137f46079d1a2cb1d28.tar.gz libmts-io-4220543c5e64d36eb94b8137f46079d1a2cb1d28.tar.bz2 libmts-io-4220543c5e64d36eb94b8137f46079d1a2cb1d28.zip | |
[MTS-MTQ] refactoring: using full qualified names for consts [2]
Made the same changes for QuectelRadio as for the whole project
Diffstat (limited to 'src')
| -rw-r--r-- | src/MTS_IO_QuectelRadio.cpp | 98 | 
1 files changed, 49 insertions, 49 deletions
| diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index af7fc7c..5c7ceb7 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -72,10 +72,10 @@ CellularRadio::CODE QuectelRadio::getModel(std::string& sModel) {  CellularRadio::CODE QuectelRadio::getIccid(std::string& sIccid) {      printTrace("%s| Get ICCID", getName().c_str()); -    sIccid = VALUE_NOT_SUPPORTED; +    sIccid = ICellularRadio::VALUE_NOT_SUPPORTED;      std::string sCmd("AT+QCCID"); -    std::string sResult = CellularRadio::sendCommand(sCmd); -    size_t end = sResult.find(RSP_OK); +    std::string sResult = sendCommand(sCmd); +    size_t end = sResult.find(ICellularRadio::RSP_OK);      if (end == std::string::npos) {          printWarning("%s| Unable to get ICCID from radio using command [%s]", getName().c_str(), sCmd.c_str());          return FAILURE; @@ -95,10 +95,10 @@ CellularRadio::CODE QuectelRadio::getIccid(std::string& sIccid) {  CellularRadio::CODE QuectelRadio::getService(std::string& sService) {      printTrace("%s| Get Service", getName().c_str()); -    sService = VALUE_NOT_SUPPORTED; +    sService = ICellularRadio::VALUE_NOT_SUPPORTED;      std::string sCmd("AT+COPS?"); -    std::string sResult = CellularRadio::sendCommand(sCmd); -    size_t end = sResult.find(RSP_OK); +    std::string sResult = sendCommand(sCmd); +    size_t end = sResult.find(ICellularRadio::RSP_OK);      if (end == std::string::npos) {          printWarning("%s| Unable to get Service from radio using command [%s]", getName().c_str(), sCmd.c_str());          return FAILURE; @@ -125,7 +125,7 @@ CellularRadio::CODE QuectelRadio::getService(std::string& sService) {          case   7 : sService = "LTE"   ; break;  // E-UTRAN          case 100 : sService = "CDMA"  ; break;  // CDMA -        default: sService = VALUE_UNKNOWN; break; +        default: sService = ICellularRadio::VALUE_UNKNOWN; break;      }      printDebug("%s| Service ID: [%d][%s]", getName().c_str(), iAccessTechnology, sService.c_str()); @@ -147,10 +147,10 @@ CellularRadio::CODE QuectelRadio::getNetwork(std::string& sNetwork) {       * of a currently selected operator (AT+COPS).       */      printTrace("%s| Get Network", getName().c_str()); -    sNetwork = VALUE_NOT_SUPPORTED; +    sNetwork = ICellularRadio::VALUE_NOT_SUPPORTED;      std::string sCmd("AT+COPS?"); -    std::string sResult = CellularRadio::sendCommand(sCmd); -    size_t end = sResult.find(RSP_OK); +    std::string sResult = sendCommand(sCmd); +    size_t end = sResult.find(ICellularRadio::RSP_OK);      if (end == std::string::npos) {          printWarning("%s| Unable to get network name from radio using command [%s]", getName().c_str(), sCmd.c_str()); @@ -222,13 +222,13 @@ CellularRadio::CODE QuectelRadio::getNetworkStatus(Json::Value& jData) {      // IMSI is not provided by AT+QENG. Fetch it separately to keep the same interface      if (getImsi(sValue) == SUCCESS) { -        jData[KEY_IMSI] = sValue; +        jData[ICellularRadio::KEY_IMSI] = sValue;      }      // Network Name is not explicitly provided by AT+QENG. Fetch it separately to keep the same interface      // TODO: Replace with lookup by MCC and MNC once MccMncTable is fixed.      if (getNetwork(sValue) == SUCCESS) { -        jData[KEY_NETWORK] = sValue; +        jData[ICellularRadio::KEY_NETWORK] = sValue;      }      std::string sCmd; @@ -243,7 +243,7 @@ CellularRadio::CODE QuectelRadio::getNetworkStatus(Json::Value& jData) {      }      size_t start = sResult.find(":") + 1; //Position right after "+QENG:" -    size_t end = sResult.rfind(RSP_OK); +    size_t end = sResult.rfind(ICellularRadio::RSP_OK);      std::vector<std::string> vParts = MTS::Text::split(MTS::Text::trim(sResult.substr(start, end-start)), ",");      Json::Value jDebug;      Json::Value jQuectelDebug; @@ -262,19 +262,19 @@ CellularRadio::CODE QuectelRadio::getNetworkStatus(Json::Value& jData) {      // +QENG:           [0],    [1],  [2],  [3],  [4],  [5],     [6],   [7],    [8],   [9],   [10], [11], [12], [13],[14],[15],  [16], [17],[18],[19],  [20], [21],      [22],       [23],       [24],        [25],        [26]      if (vParts.size() == GSM_NETWORK_FORMAT ) {          //Parse as GSM Network Format -        jData[KEY_MCC] = vParts[3]; -        jData[KEY_MNC] = vParts[4]; -        jData[KEY_LAC] = vParts[5]; -        jData[KEY_CID] = vParts[6]; +        jData[ICellularRadio::KEY_MCC] = vParts[3]; +        jData[ICellularRadio::KEY_MNC] = vParts[4]; +        jData[ICellularRadio::KEY_LAC] = vParts[5]; +        jData[ICellularRadio::KEY_CID] = vParts[6];          jQuectelDebug["bsic"] = vParts[7]; -        jData[KEY_CHANNEL] = vParts[8]; +        jData[ICellularRadio::KEY_CHANNEL] = vParts[8];          if (convertToActiveBand(vParts[9], abnd) == SUCCESS && convertActiveBandToString(abnd, sValue) == SUCCESS) { -            jData[KEY_ABND] = sValue; +            jData[ICellularRadio::KEY_ABND] = sValue;          } -        jData[KEY_RSSIDBM] = vParts[10];  // Values already negative. No need to substract 111 as stated in a datasheet -        jData[KEY_TXPWR] = vParts[11]; +        jData[ICellularRadio::KEY_RSSIDBM] = vParts[10];  // Values already negative. No need to substract 111 as stated in a datasheet +        jData[ICellularRadio::KEY_TXPWR] = vParts[11];          jQuectelDebug["rla"] = vParts[12];          jQuectelDebug["drx"] = vParts[13];          jQuectelDebug["c1"] = vParts[14]; @@ -293,7 +293,7 @@ CellularRadio::CODE QuectelRadio::getNetworkStatus(Json::Value& jData) {          // Service Domain is not provided by AT+QENG. Fetch it separately to keep the same interface          if (getServiceDomain(sd) == SUCCESS && convertServiceDomainToString(sd, sValue) == SUCCESS) { -            jData[KEY_SD] = sValue; +            jData[ICellularRadio::KEY_SD] = sValue;          }          // The following fields can NOT be fetched for Quectel in GSM mode: RAC, MM, RR, NOM @@ -305,15 +305,15 @@ CellularRadio::CODE QuectelRadio::getNetworkStatus(Json::Value& jData) {      // +QENG:          [0],    [1],    [2],  [3],  [4],  [5],     [6],     [7],  [8],  [9],  [10],  [11],   [12],[13],  [14],         [15],    [16]      else if((vParts.size() == WCDMA_NETWORK_FORMAT)) {          //Parse as WCDMA Network Format -        jData[KEY_MCC] = vParts[3]; -        jData[KEY_MNC] = vParts[4]; -        jData[KEY_LAC] = vParts[5]; -        jData[KEY_CID] = vParts[6]; -        jData[KEY_CHANNEL] = vParts[7]; -        jDebug[KEY_PSC] = vParts[8]; -        jData[KEY_RAC] = vParts[9]; -        jDebug[KEY_RSCP] = vParts[10]; -        jDebug[KEY_ECIO] = vParts[11]; +        jData[ICellularRadio::KEY_MCC] = vParts[3]; +        jData[ICellularRadio::KEY_MNC] = vParts[4]; +        jData[ICellularRadio::KEY_LAC] = vParts[5]; +        jData[ICellularRadio::KEY_CID] = vParts[6]; +        jData[ICellularRadio::KEY_CHANNEL] = vParts[7]; +        jDebug[ICellularRadio::KEY_PSC] = vParts[8]; +        jData[ICellularRadio::KEY_RAC] = vParts[9]; +        jDebug[ICellularRadio::KEY_RSCP] = vParts[10]; +        jDebug[ICellularRadio::KEY_ECIO] = vParts[11];          jQuectelDebug["phych"] = vParts[12];          jQuectelDebug["sf"] = vParts[13];          jQuectelDebug["slot"] = vParts[14]; @@ -326,18 +326,18 @@ CellularRadio::CODE QuectelRadio::getNetworkStatus(Json::Value& jData) {          // Service Domain is not provided by AT+QENG. Fetch it separately to keep the same interface          if (getServiceDomain(sd) == SUCCESS && convertServiceDomainToString(sd, sValue) == SUCCESS) { -            jDebug[KEY_SD] = sValue; +            jDebug[ICellularRadio::KEY_SD] = sValue;          }          // BLER is not provided by AT+QENG. Set to constant -        jDebug[KEY_BLER] = "000"; +        jDebug[ICellularRadio::KEY_BLER] = "000";          // Get the radio band given the channel (UARFCN) -        RadioBandMap radioBandMap(vParts[7], CellularRadio::VALUE_TYPE_CDMA); -        jData[KEY_ABND] = radioBandMap.getRadioBandName(); +        RadioBandMap radioBandMap(vParts[7], ICellularRadio::VALUE_TYPE_CDMA); +        jData[ICellularRadio::KEY_ABND] = radioBandMap.getRadioBandName();          jData["quectelDebug"] = jQuectelDebug; -        jData[KEY_DEBUG] = jDebug; +        jData[ICellularRadio::KEY_DEBUG] = jDebug;      }      // +QENG:"servingcell",<state>,"LTE",<is_tdd>,<mcc>,<mnc>,<cellid>,<pcid>,<earfcn>,<freq_band_ind>,<ul_bandwidth>,<dl_bandwidth>,<tac>,<rsrp>,<rsrq>,<rssi>,<sinr>,<srxlev> @@ -345,35 +345,35 @@ CellularRadio::CODE QuectelRadio::getNetworkStatus(Json::Value& jData) {      else if(vParts.size() == LTE_NETWORK_FORMAT) {          //Parse as LTE Network Format          jQuectelDebug["isTdd"] = vParts[3]; -        jData[KEY_MCC] = vParts[4]; -        jData[KEY_MNC] = vParts[5]; -        jData[KEY_CID] = vParts[6]; +        jData[ICellularRadio::KEY_MCC] = vParts[4]; +        jData[ICellularRadio::KEY_MNC] = vParts[5]; +        jData[ICellularRadio::KEY_CID] = vParts[6];          jQuectelDebug["pcid"] = vParts[7]; -        jData[KEY_CHANNEL] = vParts[8]; +        jData[ICellularRadio::KEY_CHANNEL] = vParts[8];          jQuectelDebug["freqBandInd"] = vParts[9];          jQuectelDebug["ulBandwidth"] = vParts[10];          jQuectelDebug["dlBandwidth"] = vParts[11];          jData["tac"] = vParts[12];          jDebug["rsrp"] = vParts[13];          jDebug["rsrq"] = vParts[14]; -        jData[KEY_RSSIDBM] = vParts[15]; +        jData[ICellularRadio::KEY_RSSIDBM] = vParts[15];          jQuectelDebug["sinr"] = vParts[16];          jQuectelDebug["srxlev"] = vParts[17];          // Get the radio band given the channel (EARFCN) -        RadioBandMap radioBandMap(vParts[8], CellularRadio::VALUE_TYPE_LTE); -        jData[KEY_ABND] = radioBandMap.getRadioBandName(); +        RadioBandMap radioBandMap(vParts[8], ICellularRadio::VALUE_TYPE_LTE); +        jData[ICellularRadio::KEY_ABND] = radioBandMap.getRadioBandName();          // Service Domain is not provided by AT+QENG. Fetch it separately to keep the same interface          if (getServiceDomain(sd) == SUCCESS && convertServiceDomainToString(sd, sValue) == SUCCESS) { -            jDebug[KEY_SD] = sValue; +            jDebug[ICellularRadio::KEY_SD] = sValue;          }          // LAC is not provided by AT+QENG in WCDMA mode. Use another command instead -        jData[KEY_LAC] = queryLteLac(); +        jData[ICellularRadio::KEY_LAC] = queryLteLac();          jData["quectelDebug"] = jQuectelDebug; -        jData[KEY_DEBUG] = jDebug; +        jData[ICellularRadio::KEY_DEBUG] = jDebug;      }      printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str()); @@ -428,11 +428,11 @@ CellularRadio::CODE QuectelRadio::setMdn(const Json::Value& jArgs) {      return NOT_APPLICABLE;  } -CellularRadio::CODE QuectelRadio::getServiceDomain(CellularRadio::SERVICEDOMAIN& sd) { +CellularRadio::CODE QuectelRadio::getServiceDomain(ICellularRadio::SERVICEDOMAIN& sd) {      printTrace("%s| Get Service Domain", getName().c_str());      std::string sCmd("AT+QCFG=\"servicedomain\""); -    std::string sResult = CellularRadio::sendCommand(sCmd); +    std::string sResult = sendCommand(sCmd);      size_t end = sResult.find(RSP_OK);      if (end == std::string::npos) { @@ -478,7 +478,7 @@ bool QuectelRadio::getHardwareVersionFromFirmware(const std::string& sFirmware,      return false;  } -CellularRadio::CODE QuectelRadio::convertToActiveBand(const std::string& sQuectelBand, CellularRadio::ACTIVEBAND& band) { +CellularRadio::CODE QuectelRadio::convertToActiveBand(const std::string& sQuectelBand, ICellularRadio::ACTIVEBAND& band) {      int iQuectelBand = -1;      if (!MTS::Text::parse(iQuectelBand, sQuectelBand)) { | 
