Base class for the ublox-xxx-cellular-xxx classes. Cannot be used standalone, only inherited by classes that do properly useful stuff. Or, to put it another way, if you are using any of the ublox-xxx-cellular-xxx classes, you will need this class also.
Dependents: example-ublox-cellular-interface example-ublox-cellular-driver-gen HelloMQTT example-ublox-cellular-interface_r410M ... more
Diff: UbloxCellularBase.cpp
- Revision:
- 11:57f64bc518c0
- Parent:
- 10:c4281fa79b8f
- Child:
- 12:aa3cbc3f88c5
diff -r c4281fa79b8f -r 57f64bc518c0 UbloxCellularBase.cpp
--- a/UbloxCellularBase.cpp Tue Jan 02 05:45:24 2018 +0000
+++ b/UbloxCellularBase.cpp Tue Jan 02 12:38:56 2018 +0500
@@ -209,6 +209,32 @@
return success;
}
+/** Get the IMEI.
+ *
+ * @return true if successful, otherwise false.
+ */
+bool UbloxCellularBase::get_imei(char *imei_to_send,int size)
+{
+ bool success;
+ LOCK();
+
+ MBED_ASSERT(_at != NULL);
+
+ // International mobile equipment identifier
+ // AT Command Manual UBX-13002752, section 4.7
+ success = _at->send("AT+CGSN") && _at->recv("%15[^\n]\nOK\n", _dev_info.imei);
+ tr_info("DevInfo: IMEI=%s", _dev_info.imei);
+
+ if(success)
+ {
+ memcpy(imei_to_send,_dev_info.imei,size);
+ imei_to_send[size-1] = '\0';
+ }
+
+ UNLOCK();
+ return success;
+}
+
bool UbloxCellularBase::get_meid()
{
bool success;
u-blox