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.
Dependencies: Socket lwip-sys lwip
Fork of AbitUSBModem by
Diff: AbitUSBModem.cpp
- Revision:
- 97:7d9cc95e2ea7
- Parent:
- 96:b50f5f795684
- Child:
- 99:514e67a69ad6
--- a/AbitUSBModem.cpp Wed Feb 18 09:40:07 2015 +0000
+++ b/AbitUSBModem.cpp Wed Feb 18 14:11:24 2015 +0000
@@ -1,5 +1,6 @@
-/* AbitUSBModem.cpp
- * modifyed by Suga
+/* AbitUSBModem.cpp */
+/* Modified by 2015 phsfan
+ * for ABIT SMA-01
*/
/* VodafoneUSBModem.cpp */
/* Copyright (C) 2012 mbed.org, MIT License
@@ -36,9 +37,11 @@
m_dongle(), // Construct WANDongle: USB interface with two serial channels to the modem (USBSerialStream objects)
m_pppStream((IUSBHostSerial&)m_dongle), // PPP connections are managed via another serial channel.
m_at(&m_pppStream), // Construct ATCommandsInterface with the AT serial channel
+ m_sms(&m_at), // Construct SMSInterface with the ATCommandsInterface
m_ppp(&m_pppStream, &m_pppStream, &m_at, false), // Construct PPPIPInterface with the PPP serial channel
m_dongleConnected(false), // Dongle is initially not ready for anything
m_ipInit(false), // PPIPInterface connection is initially down
+ m_smsInit(false), // SMSInterface starts un-initialised
m_atOpen(false) // ATCommandsInterface starts in a closed state
{
}
@@ -151,6 +154,61 @@
return OK;
}
+
+int AbitUSBModem::sendSM(const char* number, const char* message)
+{
+ int ret = init();
+ if(ret)
+ {
+ return ret;
+ }
+
+ if(!m_smsInit)
+ {
+ ret = m_sms.init();
+ if(ret)
+ {
+ return ret;
+ }
+ m_smsInit = true;
+ }
+
+ ret = m_sms.send(number, message);
+ if(ret)
+ {
+ return ret;
+ }
+
+ return OK;
+}
+
+int AbitUSBModem::getSM(char* number, char* message, size_t maxLength)
+{
+ int ret = init();
+ if(ret)
+ {
+ return ret;
+ }
+
+ if(!m_smsInit)
+ {
+ ret = m_sms.init();
+ if(ret)
+ {
+ return ret;
+ }
+ m_smsInit = true;
+ }
+
+ ret = m_sms.get(number, message, maxLength);
+ if(ret)
+ {
+ return ret;
+ }
+
+ return OK;
+}
+
char* AbitUSBModem::getIPAddress()
{
return m_ppp.getIPAddress();
