rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* Copyright Statement: |
| 2 | * |
| 3 | * This software/firmware and related documentation ("MediaTek Software") are |
| 4 | * protected under relevant copyright laws. The information contained herein |
| 5 | * is confidential and proprietary to MediaTek Inc. and/or its licensors. |
| 6 | * Without the prior written permission of MediaTek inc. and/or its licensors, |
| 7 | * any reproduction, modification, use or disclosure of MediaTek Software, |
| 8 | * and information contained herein, in whole or in part, shall be strictly prohibited. |
| 9 | * |
| 10 | * MediaTek Inc. (C) 2016. All rights reserved. |
| 11 | * |
| 12 | * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 13 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 14 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON |
| 15 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 18 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 19 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 20 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH |
| 21 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES |
| 22 | * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES |
| 23 | * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK |
| 24 | * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR |
| 25 | * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND |
| 26 | * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 27 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 28 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO |
| 29 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 30 | * |
| 31 | * The following software/firmware and/or related documentation ("MediaTek Software") |
| 32 | * have been modified by MediaTek Inc. All revisions are subject to any receiver's |
| 33 | * applicable license agreements with MediaTek Inc. |
| 34 | */ |
| 35 | |
| 36 | #include <string> |
| 37 | using namespace std; |
| 38 | |
| 39 | #include "rfdesense/RfDesenseRatInfo.h" |
| 40 | #include "rfdesense/RfDesenseTxTest.h" |
| 41 | |
| 42 | RfDesenseRatInfo::RfDesenseRatInfo() { |
| 43 | // TODO Auto-generated constructor stub |
| 44 | |
| 45 | } |
| 46 | |
| 47 | RfDesenseRatInfo::~RfDesenseRatInfo() { |
| 48 | // TODO Auto-generated destructor stub |
| 49 | } |
| 50 | |
| 51 | std::string RfDesenseRatInfo::getRatName() { |
| 52 | return RatName; |
| 53 | } |
| 54 | |
| 55 | void RfDesenseRatInfo::setRatName(std::string mRatname) { |
| 56 | if (!mRatname.empty()) { |
| 57 | RatName = mRatname; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | bool RfDesenseRatInfo::getRatCheckState() { |
| 62 | return RatCheckState; |
| 63 | } |
| 64 | |
| 65 | void RfDesenseRatInfo::setRatCheckState(bool mRatCheckState) { |
| 66 | RatCheckState = mRatCheckState; |
| 67 | } |
| 68 | |
| 69 | bool RfDesenseRatInfo::getRatSendState() { |
| 70 | return RatSendState; |
| 71 | } |
| 72 | |
| 73 | void RfDesenseRatInfo::setRatSendState(bool mRatSendState) { |
| 74 | RatSendState = mRatSendState; |
| 75 | } |
| 76 | |
| 77 | std::string RfDesenseRatInfo::getRatCmdStart() { |
| 78 | return RatCmdStart; |
| 79 | } |
| 80 | |
| 81 | void RfDesenseRatInfo::setRatCmdStart(std::string mRatCmdStart) { |
| 82 | if (!mRatCmdStart.empty()) { |
| 83 | RatCmdStart = mRatCmdStart; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | std::string RfDesenseRatInfo::getRatCmdStop() { |
| 88 | return RatCmdStop; |
| 89 | } |
| 90 | |
| 91 | void RfDesenseRatInfo::setRatCmdStop(std::string mRatCmdStop) { |
| 92 | if (!mRatCmdStop.empty()) { |
| 93 | RatCmdStop = mRatCmdStop; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | std::string RfDesenseRatInfo::getRatCmdSwitch() { |
| 98 | return RatCmdSwitch; |
| 99 | } |
| 100 | |
| 101 | void RfDesenseRatInfo::setRatCmdSwitch(std::string mRatCmdSwitch) { |
| 102 | RatCmdSwitch = mRatCmdSwitch; |
| 103 | } |
| 104 | |
| 105 | std::string RfDesenseRatInfo::getRatCmdPowerRead() { |
| 106 | return RatCmdPowerRead; |
| 107 | } |
| 108 | |
| 109 | void RfDesenseRatInfo::setRatCmdLteBwRb(int ratCmdLteBw, int ratCmdLteRb) { |
| 110 | if (ratCmdLteBw == -1) { |
| 111 | RatCmdLteBw = DEFAULT_BAND_WIDTH; |
| 112 | } else { |
| 113 | RatCmdLteBw = ratCmdLteBw; |
| 114 | } |
| 115 | if (ratCmdLteRb == -1) { |
| 116 | RatCmdLteRb = DEFAULT_VRB_LENGTH; |
| 117 | } else { |
| 118 | RatCmdLteRb = ratCmdLteRb; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | void RfDesenseRatInfo::setRatCmdStart(std::string rat, int channel, int power, |
| 123 | int band) { |
| 124 | std::string command = ""; |
| 125 | if (0 == rat.compare(RfDesenseTxTest::mRatName[0])) { //GSM |
| 126 | command = std::string("AT+ERFTX=2,1,") + std::to_string(channel) + "," |
| 127 | + std::to_string(4100) + "," + std::to_string(band) + "," |
| 128 | + std::to_string(0) + "," + std::to_string(power) + "," |
| 129 | + std::to_string(0); |
| 130 | } else if (0 == rat.compare(RfDesenseTxTest::mRatName[1])) { //TDSCDMA |
| 131 | command = std::string("AT+ERFTX=0,0,") + std::to_string(band) + "," |
| 132 | + std::to_string(channel) + "," + std::to_string(power); |
| 133 | } else if (0 == rat.compare(RfDesenseTxTest::mRatName[2])) { //WCDMA |
| 134 | command = std::string("AT+ERFTX=0,0,") + std::to_string(band) + "," |
| 135 | + std::to_string(channel) + "," + std::to_string(power); |
| 136 | } else if (0 == rat.compare(RfDesenseTxTest::mRatName[3])) { //LTE(FDD) |
| 137 | command = std::string("AT+ERFTX=6,0,2,") + std::to_string(band) + "," |
| 138 | + std::to_string(RatCmdLteBw) + "," + std::to_string(channel) |
| 139 | + ",1,0,0,0," + std::to_string(RatCmdLteRb) + "," + "0," |
| 140 | + std::to_string(power); |
| 141 | } else if (0 == rat.compare(RfDesenseTxTest::mRatName[4])) { //LTE(TDD) |
| 142 | command = std::string("AT+ERFTX=6,0,2,") + std::to_string(band) + "," |
| 143 | + std::to_string(RatCmdLteBw) + "," + std::to_string(channel) |
| 144 | + ",0,0,0,0," + std::to_string(RatCmdLteRb) + "," + "0," |
| 145 | + std::to_string(power); |
| 146 | } else if (0 == rat.compare(RfDesenseTxTest::mRatName[5])) { //CDMA(EVDO) |
| 147 | command = std::string("AT+ERFTX=13,4,") + std::to_string(channel) + "," |
| 148 | + std::to_string(band) + "," + std::to_string(power); |
| 149 | } else if (0 == rat.compare(RfDesenseTxTest::mRatName[6])) { //CDMA(1x) |
| 150 | command = std::string("AT+ECRFTX=1,") + std::to_string(channel) + "," |
| 151 | + std::to_string(band) + "," + std::to_string(power) + ",0"; |
| 152 | } |
| 153 | RatCmdStart = command; |
| 154 | } |
| 155 | |
| 156 | void RfDesenseRatInfo::setRatPowerRead(std::string mRatCmdPowerRead) { |
| 157 | RatCmdPowerRead = mRatCmdPowerRead; |
| 158 | } |
| 159 | |
| 160 | std::string RfDesenseRatInfo::getRatband() { |
| 161 | return Ratband; |
| 162 | } |
| 163 | |
| 164 | void RfDesenseRatInfo::setRatband(std::string ratband) { |
| 165 | Ratband = ratband; |
| 166 | } |
| 167 | |
| 168 | std::string RfDesenseRatInfo::getRatPowerSet() { |
| 169 | return RatPowerSet; |
| 170 | } |
| 171 | |
| 172 | void RfDesenseRatInfo::setRatPowerSet(std::string ratPowerSet) { |
| 173 | RatPowerSet = ratPowerSet; |
| 174 | } |
| 175 | |
| 176 | int RfDesenseRatInfo::getRatTxtimes() { |
| 177 | return RatTxtimes; |
| 178 | } |
| 179 | |
| 180 | void RfDesenseRatInfo::setRatTxtimes(int ratTxtimes) { |
| 181 | RatTxtimes = ratTxtimes; |
| 182 | } |