Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MTS-Cellular by
Diff: Cellular/Cellular.cpp
- Revision:
- 63:f46ef5823ab5
- Parent:
- 59:5535f14e3cc4
- Child:
- 64:6b6ccf11fb4c
--- a/Cellular/Cellular.cpp Wed Aug 13 21:50:43 2014 +0000
+++ b/Cellular/Cellular.cpp Mon Aug 18 17:16:27 2014 +0000
@@ -400,6 +400,25 @@
return io->readable();
}
+std::string Cellular::getEquipmentIdentifier()
+{
+ string num = "0123456789"; //string containing numerics to parse for
+ string equipmentIdentifier = sendCommand("AT+CGSN", 2000);
+
+ if (equipmentIdentifier.find("OK") != string::npos) {
+ size_t posStart = equipmentIdentifier.find_first_of(num);
+ size_t posEnd = equipmentIdentifier.find_last_of(num);
+
+ //Remove all except IMEI or MEID number
+ equipmentIdentifier = equipmentIdentifier.substr(posStart, posEnd - posStart);
+ } else {
+ //Empty string signifies failure to find Identifier
+ equipmentIdentifier.clear();
+ }
+
+ return equipmentIdentifier;
+}
+
unsigned int Cellular::writeable()
{
if(io == NULL) {
