Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems

Dependents:   mtsas mtsas mtsas mtsas

Files at this revision

API Documentation at this revision

Comitter:
Vanger
Date:
Mon Aug 18 19:42:44 2014 +0000
Parent:
64:6b6ccf11fb4c
Child:
66:8c55e2bf7270
Commit message:
Changed method of parsing for radio identifier number in getEquipmentIdentifier() under Cellular.cpp

Changed in this revision

Cellular/Cellular.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Cellular/Cellular.cpp	Mon Aug 18 18:42:24 2014 +0000
+++ b/Cellular/Cellular.cpp	Mon Aug 18 19:42:44 2014 +0000
@@ -402,15 +402,11 @@
 
 std::string Cellular::getEquipmentIdentifier()
 {
-    string command = "AT+CGSN";
-    string equipmentIdentifier = sendCommand(command, 2000);
+    string equipmentIdentifier = sendCommand("AT+CGSN", 2000);
+    std::vector<std::string> lines = Text::split(equipmentIdentifier, "\r\n");
     
     if (equipmentIdentifier.find("OK") != string::npos) {                
-        size_t cursor; //Dummy var
-        
-        //Need +3 due to /r from echo, and /r/n from radio 
-        //between command echo and equipment identifier number.
-        equipmentIdentifier = Text::getLine(equipmentIdentifier, command.size() + 3, cursor);
+        equipmentIdentifier = lines[1];
     } else {
         //Empty string signifies failure
         equipmentIdentifier.clear();