summaryrefslogtreecommitdiff
path: root/src/MTS_IO_CdmaRadio.cpp
blob: 4ff5d639d9953d83aa9850b5b35d91e8ed22ea1f (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
/*
 * 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.cpp
 \brief A brief description 
 \date Nov 19, 2014
 \author sgodinez

 A more elaborate description
*/

#include <mts/MTS_IO_CdmaRadio.h>
#include <mts/MTS_Text.h>
#include <mts/MTS_Logger.h>
#include <mts/MTS_Thread.h>

using namespace MTS::IO;

CdmaRadio::CdmaRadio(const std::string& sName, const std::string& sPort)
: TelitRadio(sName, sPort)
{

}

CdmaRadio::~CdmaRadio() {

}

CdmaRadio::CODE CdmaRadio::getImei(std::string& sImei) {
    printTrace("%s| Get IMEI", getName().c_str());
    return getMeid(sImei);
}

CdmaRadio::CODE CdmaRadio::getMeid(std::string& sMeid) {
    printTrace("%s| Get MEID", getName().c_str());
    sMeid = VALUE_NOT_SUPPORTED;
    std::string sCmd("AT#MEIDESN?");
    std::string sResult = sendCommand(sCmd);
    size_t pos = sResult.find(RSP_OK);
    if (pos == std::string::npos) {
        printWarning("%s| Unable to get MEID from radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    size_t start = sResult.find("#MEIDESN:") + sizeof("#MEIDESN:");
    size_t stop = sResult.find(",");

    if(stop != std::string::npos && stop > start) {
        sMeid = sResult.substr(start, stop - start);
    } else {
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::getMsid(std::string& sMsid) {
    printTrace("%s| Get MSID", getName().c_str());
    sMsid = VALUE_NOT_SUPPORTED;
    std::string sCmd("AT$MSID?");
    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to get MSID from radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    size_t start = sResult.find("$MSID:") + sizeof("$MSID:");
    sMsid =  MTS::Text::trim(sResult.substr(start, end-start));
    if(sMsid.size() == 0) {
        printWarning("%s| MSID is empty", getName().c_str());
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::getCarrier(std::string& sCarrier) {
    if(m_sCarrier != "") {
        sCarrier = m_sCarrier;
        return SUCCESS;
    }

    std::string sFirmware;
    CODE code = getFirmware(sFirmware);
    if(code != SUCCESS) {
        return code;
    }

    if(!getCarrierFromFirmware(sFirmware, sCarrier)) {
        return FAILURE;
    }

    m_sCarrier = sCarrier;

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::getNetwork(std::string& sNetwork) {
    return getCarrier(sNetwork);
}

CdmaRadio::CODE CdmaRadio::getSimStatus(std::string& sSimStatus) {
    printTrace("%s| Get SIM Status", getName().c_str());
    sSimStatus = VALUE_NOT_SUPPORTED;
    return NOT_APPLICABLE;
}

CdmaRadio::CODE CdmaRadio::getIccid(std::string& sIccid) {
    printTrace("%s| Get ICCID", getName().c_str());
    sIccid = VALUE_NOT_SUPPORTED;
    return NOT_APPLICABLE;
}

CdmaRadio::CODE CdmaRadio::getLac(std::string& sLac) {
    printTrace("%s| Get LAC", getName().c_str());
    sLac = VALUE_NOT_SUPPORTED;
    return NOT_APPLICABLE;
}

CdmaRadio::CODE CdmaRadio::getService(std::string& sService) {
    printTrace("%s| Get Service", getName().c_str());
    sService = VALUE_NOT_SUPPORTED;
    std::string sCmd("AT+SERVICE?");
    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(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;
    }

    size_t start = sResult.find("+SERVICE:");
    if(start != std::string::npos) {
        start += sizeof("+SERVICE:");
        std::string sPsnt = MTS::Text::trim(sResult.substr(start, end-start));
        int32_t iService;
        sscanf(sPsnt.c_str(), "%d", &iService);

        switch(iService) {
            case 0: sService = "No Service"; break;
            case 1: sService = "1xRTT"; break;
            case 2: sService = "EVDO"; break; //Release 0
            case 3: sService = "EVDO"; break; //Release A
            case 4: sService = "GPRS"; break;
            default: sService = VALUE_UNKNOWN; break;
        }

        printDebug("%s| Service ID: [%d][%s]", getName().c_str(), iService, sService.c_str());
    }
    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::getHardware(std::string& sHardware) {
    printTrace("%s| Get Hardware", getName().c_str());
    sHardware = VALUE_NOT_SUPPORTED;
    std::string sCmd("AT#HWREV");
    std::string sResult = sendCommand(sCmd);
    size_t pos = sResult.find(RSP_OK);
    if (pos == std::string::npos) {
        printWarning("%s| Unable to get hardware from radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    sHardware = MTS::Text::trim(sResult.substr(0, pos));
    if(sHardware.size() == 0) {
        printWarning("%s| Unable to get hardware from radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::getMdn(std::string& sMdn) {
    printTrace("%s| Get MDN", getName().c_str());
    sMdn = VALUE_NOT_SUPPORTED;
    std::string sCmd("AT+CNUM");
    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to get MDN from radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    size_t start = sResult.find("CNUM:");
    std::vector<std::string> vParts = MTS::Text::split(sResult.substr(start + sizeof("CNUM:"), end), ",");
    if(vParts.size() == 3) {
        sMdn = vParts[1];
        if(sMdn.size() == 0) {
            printWarning("%s| MDN is empty.  Device may need to be activated", getName().c_str(), sCmd.c_str());
        }
    } else {
        printWarning("%s| Unable to parse MDN from radio using command [%s][%s]", getName().c_str(), sCmd.c_str(), sResult.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::validateMsl(const Json::Value& jArgs) {
    printTrace("%s| Validate MSL", getName().c_str());

    if(!jArgs["msl"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCarrier;
    getCarrier(sCarrier);

    if(sCarrier != "Aeris" && sCarrier != "Sprint") {
        return NOT_APPLICABLE;
    }

    std::string sMdn;
    if(getMdn(sMdn) != SUCCESS) {
        return FAILURE;
    }

    Json::Value jMdn(Json::objectValue);
    jMdn["mdn"] = sMdn;
    jMdn["msl"] = jArgs["msl"];

    return setMdn(jMdn);
}

CdmaRadio::CODE CdmaRadio::setMdn(const Json::Value& jArgs) {
    printTrace("%s| Set MDN", getName().c_str());

    if(!jArgs["mdn"].isString()) {
        printError("%s| Arguments missing \"mdn\"", getName().c_str());
        return INVALID_ARGS;
    }

    std::string sCarrier;
    getCarrier(sCarrier);

    std::string sCmd("AT$MDN=");
    if(sCarrier == "Sprint") {

        if(!jArgs["msl"].isString()) {
            printError("%s| Arguments missing \"msl\"", getName().c_str());
            return INVALID_ARGS;
        }
        sCmd += jArgs["msl"].asString() + ",";
    } else if(sCarrier == "Aeris") {
        //AT$MDN=<Last Six Digits of HEX MEID>,<MDN>
        sCmd += getMeidLastSix() + ",";
    }

    //Strip spaces and hyphens
    std::string sMdn = jArgs["mdn"].asString();
    sMdn = MTS::Text::strip(sMdn, '-');
    sMdn = MTS::Text::strip(sMdn, '(');
    sMdn = MTS::Text::strip(sMdn, ')');
    sMdn = MTS::Text::strip(sMdn, ' ');


    sCmd += sMdn;

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set MDN for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMsid(const Json::Value& jArgs) {
    printTrace("%s| Set MSID", getName().c_str());
    if(!jArgs["msid"].isString()) {
        printError("%s| Arguments missing \"msid\"", getName().c_str());
        return INVALID_ARGS;
    }

    std::string sCarrier;
    getCarrier(sCarrier);

    std::string sCmd("AT$MSID=");
    if(sCarrier == "Sprint") {
        if(!jArgs["msl"].isString()) {
            printError("%s| Arguments missing \"msl\"", getName().c_str());
            return INVALID_ARGS;
        }
        sCmd += jArgs["msl"].asString() + ",";
    } else if(sCarrier == "Aeris") {
        //AT$MSID=<Last Six Digits of HEX MEID>,<MSID>
        sCmd += getMeidLastSix() + ",";
    }


    sCmd += jArgs["msid"].asString();

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set MSID for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::getMipProfile(Json::Value& jMipProfile) {
    printTrace("%s| Get MIP Active Profile", getName().c_str());

    initMipProfile(jMipProfile);

    std::string sCarrier;
    getCarrier(sCarrier);

    if(sCarrier == "Aeris" || sCarrier == "Sprint") {
        std::string sCmd("AT$QCMIPGETP");
        std::string sResult = MTS::Text::trim(sendCommand(sCmd));
        if (sResult.find(RSP_OK) == std::string::npos) {
            printWarning("%s| Unable to get active MIP profile for radio using command [%s]", getName().c_str(), sCmd.c_str());
            return FAILURE;
        }

        std::vector<std::string> vLine = MTS::Text::split(sResult, "\r\n");

        //ACTIVE MIP PROFILE
        std::string sLine = vLine[0];
        std::vector<std::string> vParts = MTS::Text::split(sLine, ':', 2);
        if(vParts.size() == 2 && vParts[0] == "Profile") {
            if(vParts[1].find("Enabled") != std::string::npos) {
                jMipProfile[KEY_MIP_ENABLED] = true;
            } else {
                jMipProfile[KEY_MIP_ENABLED] = false;
            }
            int32_t id;
            sscanf(vParts[1].c_str(), "%d", &id);
            jMipProfile[KEY_MIP_ID] = id;

        } else {
            printWarning("%s| Unable to parse active MIP profile from line [%s]", getName().c_str(), sLine.c_str());
        }


        splitAndAssign(vLine[1], "NAI", jMipProfile, KEY_MIP_NAI);
        splitAndAssign(vLine[2], "Home Addr", jMipProfile, KEY_MIP_HOMEADDRESS);
        splitAndAssign(vLine[3], "Primary HA", jMipProfile, KEY_MIP_PRIMARYHA);
        splitAndAssign(vLine[4], "Secondary HA", jMipProfile, KEY_MIP_SECONDARYHA);
        splitAndAssign(vLine[5], "MN-AAA SPI", jMipProfile, KEY_MIP_MNAAASPI);
        splitAndAssign(vLine[6], "MN-HA SPI", jMipProfile, KEY_MIP_MNHASPI);

        //Reverse Tunneling
        sLine = vLine[7];
        vParts = MTS::Text::split(sLine, ':', 2);
        if(vParts.size() == 2 && vParts[0] == "Rev Tun") {
            if(vParts[1] == "1") {
                jMipProfile[KEY_MIP_REVTUN] = true;
            } else {
                jMipProfile[KEY_MIP_REVTUN] = false;
            }
        } else {
            printWarning("%s| Unable to parse Reverse Tunneling from line [%s]", getName().c_str(), sLine.c_str());
        }

        //MN-AAA SS
        sLine = vLine[8];
        vParts = MTS::Text::split(sLine, ':', 2);
        if(vParts.size() == 2 && vParts[0] == "MN-AAA SS") {
            if(vParts[1] == "Set") {
                jMipProfile[KEY_MIP_MNAAASS] = true;
            } else {
                jMipProfile[KEY_MIP_MNAAASS] = false;
            }
        } else {
            printWarning("%s| Unable to parse MN-AAA SS from line [%s]", getName().c_str(), sLine.c_str());
        }

        //MN-HA SS
        sLine = vLine[9];
        vParts = MTS::Text::split(sLine, ':', 2);
        if(vParts.size() == 2 && vParts[0] == "MN-HA SS") {
            if(vParts[1] == "Set") {
                jMipProfile[KEY_MIP_MNHASS] = true;
            } else {
                jMipProfile[KEY_MIP_MNHASS] = false;
            }
        } else {
            printWarning("%s| Unable to parse MN-HA SS from line [%s]", getName().c_str(), sLine.c_str());
        }
    }


    return SUCCESS;
}


CdmaRadio::CODE CdmaRadio::setMipActiveProfile(const Json::Value& jArgs) {
    printTrace("%s| Set MIP Active Profile", getName().c_str());

    if(!jArgs["activeProfile"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPP=");
    sCmd += jArgs["activeProfile"].asString();

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set Active profile for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMipNai(const Json::Value& jArgs) {
    printTrace("%s| Set MIP NAI", getName().c_str());

    if(!jArgs["nai"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPNAI=");
    sCmd += jArgs["nai"].asString() + ",1";

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set NAI for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMipHomeIp(const Json::Value& jArgs) {
    printTrace("%s| Set MIP Home IP", getName().c_str());

    if(!jArgs["homeIp"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPHA=");
    sCmd += jArgs["homeIp"].asString() + ",1";

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set Home IP profile for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMipPrimaryHa(const Json::Value& jArgs) {
    printTrace("%s| Set MIP Primary HA", getName().c_str());

    if(!jArgs["primaryHa"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPPHA=");
    sCmd += jArgs["primaryHa"].asString() + ",1";

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set Primary HA for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMipSecondaryHa(const Json::Value& jArgs) {
    printTrace("%s| Set MIP Secondary HA", getName().c_str());

    if(!jArgs["secondaryHa"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPSHA=");
    sCmd += jArgs["secondaryHa"].asString() + ",1";

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set Secondary HA for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMipMnAaaSpi(const Json::Value& jArgs) {
    printTrace("%s| Set MIP MN-AAA SPI", getName().c_str());

    if(!jArgs["mnAaaSpi"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPMASPI=");
    sCmd += jArgs["mnAaaSpi"].asString() + ",1";

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set MN-AAA SPI for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMipMnHaSpi(const Json::Value& jArgs) {
    printTrace("%s| Set MIP MN-HA SPI", getName().c_str());

    if(!jArgs["mnHaSpi"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPMHSPI=");
    sCmd += jArgs["mnHaSpi"].asString() + ",1";

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set MN-HA SPI for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMipRevTun(const Json::Value& jArgs) {
    printTrace("%s| Set MIP Rev Tun", getName().c_str());

    if(!jArgs["revTun"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPRT=");
    sCmd += jArgs["revTun"].asString() + ",1";

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set Rev Tun for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMipMnAaaSs(const Json::Value& jArgs) {
    printTrace("%s| Set MIP MN-AAA SS", getName().c_str());

    if(!jArgs["mnAaaSs"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPMASS=");
    sCmd += jArgs["mnAaaSs"].asString() + ",1";

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set MN-AAA SS for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::setMipMnHaSs(const Json::Value& jArgs) {
    printTrace("%s| Set MIP MN-HA SS", getName().c_str());

    if(!jArgs["mnHaSs"].isString()) {
        return INVALID_ARGS;
    }

    std::string sCmd("AT$QCMIPMHSS=");
    sCmd += jArgs["mnHaSs"].asString() + ",1";

    std::string sResult = sendCommand(sCmd);
    size_t end = sResult.find(RSP_OK);
    if (end == std::string::npos) {
        printWarning("%s| Unable to set MN-HA SS for radio using command [%s]", getName().c_str(), sCmd.c_str());
        return FAILURE;
    }

    return SUCCESS;
}

CdmaRadio::CODE CdmaRadio::updateDc(const Json::Value& jArgs, UpdateCb& stepCb) {
    printTrace("%s| Update Device Configuration", getName().c_str());

    std::string sCarrier;
    getCarrier(sCarrier);

    if(sCarrier != "Sprint") {
        return NOT_APPLICABLE;
    }

    CODE result = FAILURE;
    std::size_t pos = 0;
    std::size_t end = 0;

    IsNeedMoreData isNeedMoreData = [&stepCb, &result, &pos, &end,  this](const std::string& iterationData, const std::string& allData)->bool {

        if(iterationData.empty()) {
            //No new data
            return true;
        }

        end = allData.find(NL, pos);
        printTrace("%s| Update DC Callback Started", this->getName().c_str());

        while(end != std::string::npos) {
            size_t next;
            std::string sLine = MTS::Text::getLine(allData, pos, next);

            printTrace("%s| Line: [%s]", this->getName().c_str(), sLine.c_str());

            if(sLine == "#906") {
                // DC DM session started
                if(stepCb) {
                    stepCb(Json::Value("DC Info: DM session started"));
                }
            } else if(sLine == "#918") {
                // DC Done, success
                result = SUCCESS;
                if(stepCb) {
                    stepCb(Json::Value("DC Done: success"));
                }
                return false;
            } else if(sLine == "#924") {
                // DC Done, no profile
                result = SUCCESS;
                if(stepCb) {
                    stepCb(Json::Value("DC Done: no profile"));
                }
                return false;
            } else if(sLine == "#911") {
                // DC Error: credential error
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("DC Error: credential error"));
                }
                return false;
            } else if(sLine == "#912") {
                // DC Error: unreachable server
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("DC Error: unreachable server"));
                }
                return false;
            } else if(sLine == "#913") {
                // DC Error: network error
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("DC Error: network error"));
                }
                return false;
            } else if(sLine == "#915") {
                // DC Error: update fails with other reasons
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("DC Error: update fails with other reasons"));
                }
                return false;
            }else if(sLine == RSP_ERROR) {
                result = ERROR;
                return false;
            }

            //Set cursors for next iteration
            if(next != std::string::npos) {
                pos = next;
            }
            end = allData.find(NL, pos);
        }

        printTrace("%s| Update DC Callback Finished", this->getName().c_str());
        return true;
    };

    sendCommand("AT+OMADM=2", isNeedMoreData, 5 * 60000);
    return result;
}

CdmaRadio::CODE CdmaRadio::updatePrl(const Json::Value& jArgs, UpdateCb& stepCb) {
    printTrace("%s| Update Preferred Roaming List", getName().c_str());

    std::string sCarrier;
    getCarrier(sCarrier);

    if(sCarrier != "Sprint") {
        return NOT_APPLICABLE;
    }

    CODE result = FAILURE;
    std::size_t pos = 0;
    std::size_t end = 0;

    IsNeedMoreData isNeedMoreData = [&stepCb, &result, &pos, &end,  this](const std::string& iterationData, const std::string& allData)->bool {

        if(iterationData.empty()) {
            //No new data
            return true;
        }

        end = allData.find(NL, pos);
        printTrace("%s| Update PRL Callback Started", this->getName().c_str());

        while(end != std::string::npos) {
            size_t next;
            std::string sLine = MTS::Text::getLine(allData, pos, next);

            printTrace("%s| Line: [%s]", this->getName().c_str(), sLine.c_str());

            if(sLine == "#905") {
                // PRL DM session started
                if(stepCb) {
                    stepCb(Json::Value("PRL Info: DM session started"));
                }
            } else if(sLine == "#909") {
                // PRL Done, success
                result = SUCCESS;
                if(stepCb) {
                    stepCb(Json::Value("PRL Done: success"));
                }
                return false;
            } else if(sLine == "#910") {
                // PRL Done, no PRL update
                result = SUCCESS;
                if(stepCb) {
                    stepCb(Json::Value("PRL Done: no PRL update"));
                }
                return false;
            } else if(sLine == "#911") {
                // PRL Error: credential error
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("PRL Error: credential error"));
                }
                return false;
            } else if(sLine == "#912") {
                // PRL Error: unreachable server
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("PRL Error: unreachable server"));
                }
                return false;
            } else if(sLine == "#913") {
                // PRL Error: network error
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("PRL Error: network error"));
                }
                return false;
            } else if(sLine == "#915") {
                // PRL Error: update fails with other reasons
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("PRL Error: update fails with other reasons"));
                }
                return false;
            } else if(sLine == RSP_ERROR) {
                result = ERROR;
                return false;
            }

            //Set cursors for next iteration
            if(next != std::string::npos) {
                pos = next;
            }
            end = allData.find(NL, pos);
        }

        printTrace("%s| Update PRL Callback Finished", this->getName().c_str());
        return true;
    };

    sendCommand("AT+PRL=2", isNeedMoreData, 5 * 60000);
    return result;
}

CdmaRadio::CODE CdmaRadio::updateFumo(const Json::Value& jArgs, UpdateCb& stepCb) {
    printTrace("%s| Update Firmware Update Management Object", getName().c_str());

    std::string sCarrier;
    getCarrier(sCarrier);

    if(sCarrier != "Sprint") {
        return NOT_APPLICABLE;
    }

    CODE result = FAILURE;
    std::size_t pos = 0;
    std::size_t end = 0;

    IsNeedMoreData isNeedMoreData = [&stepCb, &result, &pos, &end,  this](const std::string& iterationData, const std::string& allData)->bool {

        if(iterationData.empty()) {
            //No new data
            return true;
        }

        end = allData.find(NL, pos);
        printTrace("%s| Update FUMO Callback Started", this->getName().c_str());

        while(end != std::string::npos) {
            size_t next;
            std::string sLine = MTS::Text::getLine(allData, pos, next);

            printTrace("%s| Line: [%s]", this->getName().c_str(), sLine.c_str());

            if(sLine == "#907") {
                // FUMO DM session started
                if(stepCb) {
                    stepCb(Json::Value("FUMO Info: DM session started"));
                }
            } else if(sLine == "#916") {
                // FUMO Done, no firmware update
                result = SUCCESS;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Done: no firmware update"));
                }
                return false;
            } else if(sLine == "#911") {
                // FUMO Error: credential error
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Error: credential error"));
                }
                return false;
            } else if(sLine == "#912") {
                // FUMO Error: unreachable server
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Error: unreachable server"));
                }
                return false;
            } else if(sLine == "#913") {
                // FUMO Error: network error
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Error: network error"));
                }
                return false;
            } else if(sLine == "#915") {
                // FUMO Error: update fails with other reasons
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Error: update fails with other reasons"));
                }
                return false;
            } else if(sLine == "#919") {
                // FUMO Firmware downloaded successfully
                if(stepCb) {
                    stepCb(Json::Value("FUMO Info: firmware downloaded successfully"));
                }
            } else if(sLine == "#920:") {
                // FUMO Firmware download progress (percent)
                if(stepCb) {
                    stepCb(Json::Value(std::string("FUMO Info: firmware download progress ") + allData.substr(pos + 5, end + 5 - pos)));
                }
            } else if(sLine == "#921:") {
                // FUMO Firmware size get from the OMA-DM server (byte)
                if(stepCb) {
                    stepCb(Json::Value(std::string("FUMO Info: firmware size get from the OMA-DM server ") + allData.substr(pos + 5, end + 5 - pos) + " byte"));
                }
            } else if(sLine == "#921") { /// Info: check after check "#921:"
                // FUMO Firmware download start
                if(stepCb) {
                    stepCb(Json::Value("FUMO Info: firmware downloaded successfully"));
                }
            } else if(sLine == "#929: 200") {
                // FUMO Done, success
                result = SUCCESS;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Done: update success"));
                }
                return false;
            } else if(sLine == "#929: 402") {
                // FUMO Error, firmware corrupted, CRC error
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Error: firmware corrupted, CRC error"));
                }
                return false;
            } else if(sLine == "#929: 403") {
                // FUMO Error, firmware package mismatch
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Error: firmware package mismatch"));
                }
                return false;
            } else if(sLine == "#929: 404") {
                // FUMO Error, firmware signature failed
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Error: firmware signature failed"));
                }
                return false;
            } else if(sLine == "#929: 406") {
                // FUMO Error, firmware update authentication failed
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Error: firmware update authentication failed"));
                }
                return false;
            } else if(sLine == "#929: 410") {
                // FUMO Error, firmware update general error
                result = ERROR;
                if(stepCb) {
                    stepCb(Json::Value("FUMO Error: firmware update general error"));
                }
                return false;
            } else if(sLine == "#930") {
                // FUMO Reporting of Firmware Update result to server
                if(stepCb) {
                    stepCb(Json::Value("FUMO Info: reporting of firmware update result to server"));
                }
            } else if(sLine == RSP_ERROR) {
                result = ERROR;
                return false;
            }

            //Set cursors for next iteration
            if(next != std::string::npos) {
                pos = next;
            }
            end = allData.find(NL, pos);
        }

        printTrace("%s| Update FUMO Callback Finished", this->getName().c_str());
        return true;
    };

    sendCommand("AT+FUMO=2", isNeedMoreData, 30 * 60000);
    return result;
}

CdmaRadio::CODE CdmaRadio::resetHfa(const Json::Value& jArgs, UpdateCb& stepCb) {
    printTrace("%s| HFA Reset (after device reboot HFA will occur)", getName().c_str());

    std::string sCarrier;
    getCarrier(sCarrier);

    if(sCarrier != "Sprint") {
        return NOT_APPLICABLE;
    }

    if(!jArgs["msl"].isString()) {
        return INVALID_ARGS;
    }

    CODE result = FAILURE;
    std::size_t pos = 0;
    std::size_t end = 0;

    IsNeedMoreData isNeedMoreData = [&stepCb, &result, &pos, &end,  this](const std::string& iterationData, const std::string& allData)->bool {
        /* Expected Events:
        *  #900 - DM Client ready
        *  #904 - HFA Started
        *  #914 - HFA Done - HFA Success
        *  #905 - PRL - Session started
        *  #909 - PRL - Done - PRL success
        *  #907 - FUMO - Firmware DM session started or started again until no more updates are available
        *  #916 - FUMO - Firmware Done, No firmware update
        */


        if(iterationData.empty()) {
            //No new data
            return true;
        }

        end = allData.find(NL, pos);
        printTrace("%s| HFA Reset Callback Started", this->getName().c_str());

        while(end != std::string::npos) {
            size_t next;
            std::string sLine = MTS::Text::getLine(allData, pos, next);

            printTrace("%s| Line: [%s]", this->getName().c_str(), sLine.c_str());

            if(sLine == "#900") {
                if(stepCb) {
                    stepCb(Json::Value("RTN Info: DM Client Ready"));
                }
            } else if(sLine == "#904") {
                if(stepCb) {
                    stepCb(Json::Value("RTN Info: HFA - Session Started"));
                }
            } else if(sLine == "#914") {
                if(stepCb) {
                    stepCb(Json::Value("RTN Info: HFA - Session Completed Successfully"));
                }
            } else if(sLine == "#905") {
                if(stepCb) {
                    stepCb(Json::Value("RTN Info: PRL - Session Started"));
                }
            } else if(sLine == "#909") {
                if(stepCb) {
                    stepCb(Json::Value("RTN Info: PRL - Session Completed Successfully"));
                }
            } else if(sLine == "#907") {
                if(stepCb) {
                    stepCb(Json::Value("RTN Info: Firmware DM - Session Started"));
                }
            } else if(sLine == "#916") {
                // RTN Done, success
                result = SUCCESS;
                if(stepCb) {
                    stepCb(Json::Value("RTN Done: Firmware DM - Session Completed Successfully"));
                }
                return false;
            } else if(sLine == RSP_ERROR) {
                result = ERROR;
                return false;
            } else if(sLine == RSP_OK) {
                //The Device will reboot now, so reset the connection
                if(stepCb) {
                    stepCb(Json::Value("RTN Info: Resetting Radio"));
                }

                //TODO: Investigate a better way of to handle
                //      recapturing the radio port after reset

                //Sleep for a few seconds while resetting
                MTS::Thread::sleep(5000);

                //Try to reconnect to radio
                if(!this->resetConnection(10000)) {
                    printError("%s| Unable to obtain radio after reset", this->getName().c_str());
                    if(stepCb) {
                        stepCb(Json::Value("RTN Error: Unable to obtain radio after reset"));
                    }
                    result = ERROR;
                    return false;
                }
            }

            //Set cursors for next iteration
            if(next != std::string::npos) {
                pos = next;
            }
            end = allData.find(NL, pos);
        }

        printTrace("%s| HFA Reset Callback Finished", this->getName().c_str());
        return true;
    };

    std::string sCmd("AT#SPRTN=\"");
    sCmd += jArgs["msl"].asString() + "\"";
    sendCommand(sCmd, isNeedMoreData, 5 * 60000);
    return result;
}

CdmaRadio::CODE CdmaRadio::activate(const Json::Value& jArgs, UpdateCb& stepCb) {
    printTrace("%s| Activation", getName().c_str());

    std::string sActivationCmd;
    std::string sCarrier;
    getCarrier(sCarrier);

    if(sCarrier == VALUE_CARRIER_AERIS) {

        if(!jArgs["msid"].isString()) {
            printError("%s| Arguments missing \"msid\"", getName().c_str());
            return INVALID_ARGS;
        }

        if(!jArgs["mdn"].isString()) {
            printError("%s| Arguments missing \"mdn\"", getName().c_str());
            return INVALID_ARGS;
        }

        std::string sMsid = jArgs["msid"].asString();
        std::string sMdn = jArgs["mdn"].asString();
        if(sMdn.size() != 10) {
            printError("%s| MDN not valid.  Expected length of 10: [%s][%d]", getName().c_str(), sMdn.c_str(), sMdn.size());
            return INVALID_ARGS;
        }

        if(sMsid.size() != 10) {
            printError("%s| MIN not valid.  Expected length of 10: [%s][%d]", getName().c_str(), sMsid.c_str(), sMsid.size());
            return INVALID_ARGS;
        }

        //Set MDN & MSID
        CODE code;
        code = setMdn(jArgs);
        if(code != SUCCESS) {
            return code;
        }

        code = setMsid(jArgs);
        if(code != SUCCESS) {
            return code;
        }

        resetRadio(10000);

        return SUCCESS;

    } else if(sCarrier == VALUE_CARRIER_VERIZON) {
        sActivationCmd = "AT+CDV*22899\r";
    } else if(sCarrier == VALUE_CARRIER_USCELLULAR) {
        sActivationCmd = "AT+CDV*228\r";
    } else {
        return NOT_APPLICABLE;
    }

    CODE result = FAILURE;
    std::size_t pos = 0;
    std::size_t end = 0;

    IsNeedMoreData isNeedMoreData = [&stepCb, &result, &pos, &end,  this](const std::string& iterationData, const std::string& allData)->bool {
        //Verizon Activation
        /* Expected Events:
        *  OK
        *  #OTASP: 0   //Start OTASP
        *  #OTASP: 1   //Start OTASP Commit
        *  #OTASP: 2   //End OTASP
        *
        *  ERRORS:
        *  NO CARRIER  //Account Plan Not Active
        *  #OTASP: 5   //Activation Failed
        */


        if(iterationData.empty()) {
            //No new data
            return true;
        }

        end = allData.find(NL, pos);
        printTrace("%s| Activation Reset Callback Started", this->getName().c_str());

        while(end != std::string::npos) {
            size_t next;
            std::string sLine = MTS::Text::getLine(allData, pos, next);

            printTrace("%s| Line: [%s]", this->getName().c_str(), sLine.c_str());

            if(sLine == RSP_OK) {
                if(stepCb) {
                    stepCb(Json::Value("Activation Info: Over-the-Air Programming in Process"));
                }
            } else if(sLine == "#OTASP: 0") {
                if(stepCb) {
                    stepCb(Json::Value("Activation Info: Saving Radio Configurations"));
                }
            } else if(sLine == "#OTASP: 1") {
                if(stepCb) {
                    stepCb(Json::Value("Activation Info: Restarting Radio"));
                }
            } else if(sLine == "#OTASP: 2") {
                if(stepCb) {
                    stepCb(Json::Value("Activation Info: Activation Completed Successfully"));
                }
                //Sleep for a few seconds while radio resets
                MTS::Thread::sleep(5000);
                this->resetConnection(10000);
                result = SUCCESS;
                return false;
            } else if(sLine == "#OTASP: 5") {
                if(stepCb) {
                    stepCb(Json::Value("Activation Error: Activation Failed"));
                }
                return false;
            } else if(sLine == "NO CARRIER") {
                if(stepCb) {
                    stepCb(Json::Value("Activation Error: Account Plan May Not Be Active"));
                }
                result = ERROR;
                return false;
            } else if(sLine == RSP_ERROR) {
                result = ERROR;
                return false;
            }

            //Set cursors for next iteration
            if(next != std::string::npos) {
                pos = next;
            }
            end = allData.find(NL, pos);
        }

        printTrace("%s| Activation Callback Finished", this->getName().c_str());
        return true;
    };

    sendCommand(sActivationCmd, isNeedMoreData, 5 * 60000);
    return result;
}

CdmaRadio::CODE CdmaRadio::getNetworkStatus(Json::Value& jData) {
    printTrace("%s| Get Network Status", getName().c_str());

    getCommonNetworkStats(jData);

    std::string sCarrier;
    getCarrier(sCarrier);

    if(sCarrier == VALUE_CARRIER_SPRINT) {
        Json::Value& jDebug = jData["debug"];
        std::string sCmd("AT$DEBUG?");
        std::string sResult = MTS::Text::trim(sendCommand(sCmd));
        if (sResult.find(RSP_OK) != std::string::npos) {
            std::vector<std::string> vCategories = MTS::Text::split(sResult, "\r\n\r\n");
            for(size_t i = 0 ; i < vCategories.size(); i++) {
                std::vector<std::string> vLine = MTS::Text::split(vCategories[i], "\r\n");
                if(vLine[0] == "1x Engineering") {
                    Json::Value& j1x = jDebug["1xrtt"];
                    splitAndAssign(vLine[1], "State", j1x, "state");
                    splitAndAssign(vLine[3], "Channel", j1x, "channel");
                    splitAndAssign(vLine[4], "Band Class", j1x, "bandClass");
                    splitAndAssign(vLine[5], "SID", j1x, "sid");
                    splitAndAssign(vLine[6], "NID", j1x, "nid");
                    splitAndAssign(vLine[7], "Base ID", j1x, "baseId");
                    splitAndAssign(vLine[8], "PN", j1x, "pn");
                    splitAndAssign(vLine[9], "P_rev", j1x, "pRev");
                    splitAndAssign(vLine[10], "Lat", j1x, "lat");
                    splitAndAssign(vLine[11], "Lon", j1x, "lon");
                    splitAndAssign(vLine[12], "Rx Pwr", j1x, "rxPwr");
                    splitAndAssign(vLine[13], "Rx Ec/Io", j1x, "rxEcIo");
                    splitAndAssign(vLine[14], "Rx FER", j1x, "rxFer");
                    splitAndAssign(vLine[15], "Tx Pwr", j1x, "txPwr");
                    splitAndAssign(vLine[16], "Active Set", j1x, "activeSet");
                    splitAndAssign(vLine[17], "Neighbor Set", j1x, "neighborSet");
                } else if(vLine[0] == "EVDO Engineering") {
                    Json::Value& jEvdo = jDebug["evdo"];
                    splitAndAssign(vLine[1], "State", jEvdo, "state");
                    splitAndAssign(vLine[2], "Mac Index", jEvdo, "macIndex");
                    splitAndAssign(vLine[3], "Channel", jEvdo, "channel");
                    splitAndAssign(vLine[4], "Color Code", jEvdo, "colorCode");
                    splitAndAssign(vLine[5], "Sector ID", jEvdo, "sectorId");
                    splitAndAssign(vLine[6], "PN", jEvdo, "pn");
                    splitAndAssign(vLine[7], "Rx Pwr", jEvdo, "rxPwr");
                    splitAndAssign(vLine[8], "Rx PER", jEvdo, "rxPer");
                    splitAndAssign(vLine[9], "Pilot Energy", jEvdo, "pilotEnergy");
                    splitAndAssign(vLine[10], "DRC", jEvdo, "drc");
                    splitAndAssign(vLine[11], "SINR", jEvdo, "sinr");
                    splitAndAssign(vLine[12], "AN-AAA", jEvdo, "anAaa");
                    splitAndAssign(vLine[13], "IP Address", jEvdo, "ipAddress");
                } else if(vLine[0] == "Configuration") {
                    Json::Value& jConf = jDebug["configuration"];
                    splitAndAssign(vLine[1], "Technology", jConf, "technology");
                    splitAndAssign(vLine[2], "1x Diversity", jConf, "1xDiversity");
                    splitAndAssign(vLine[3], "EVDO Diversity", jConf, "evdoDiversity");
                    splitAndAssign(vLine[4], "QLIC", jConf, "qlic");
                    splitAndAssign(vLine[5], "PRL", jConf, "prl");
                    splitAndAssign(vLine[6], "Chipset", jConf, "chipset");
                    splitAndAssign(vLine[7], "AMSS version", jConf, "amssVersion");
                    splitAndAssign(vLine[8], "Device version", jConf, "deviceVersion");
                    splitAndAssign(vLine[9], "Hardware version", jConf, "hardwareVersion");
                    splitAndAssign(vLine[10], "Browser", jConf, "browser");
                    splitAndAssign(vLine[11], "Multimedia Version", jConf, "multimediaVersion");
                }
            }

        } else {
            printDebug("%s| SPRINT Network Status command returned unexpected response: [%s][%s]", getName().c_str(), sCmd.c_str(), sResult.c_str());
        }
    }


    printTrace("%s| Network Status:\n%s\n", getName().c_str(), jData.toStyledString().c_str());

    return SUCCESS;
}

std::string CdmaRadio::getMeidLastSix() {
    std::string sMeid;
    if(getMeid(sMeid) != SUCCESS || sMeid.size() != 14) {
        return "";
    }
    return sMeid.substr(8);
}