support library for C027 helper functions for Buffer Pipes, Buffered Serial Port (rtos capable) and GPS parsing. It includes modem APIs for USSD, SMS and Sockets.

Dependents:   HTTPClient_Cellular_HelloWorld Cellular_HelloMQTT MbedSmartRestMain Car_Bon_car_module ... more

This library is intended to be used with u-blox products such as the C027 or a shield with u-blox cellular and GPS modules like the cellular and positioning shield from Embedded Artist.

For 2G/GSM and 3G/UMTS you need to:

  • have a SIM card and know its PIN number
  • need to know you network operators APN setting These setting should be passed to the connect or init and join functions. You can also extend the APN database in MDMAPN.h.

For CDMA products you need to make sure that you have provisioned and activated the modem with either Sprint or Verizon.

Revision:
15:5eda64e5b9d1
Parent:
14:69c3e57ef0f5
Child:
16:4a7ba1887e81
--- a/SerialPipe.cpp	Tue Nov 19 09:02:35 2013 +0000
+++ b/SerialPipe.cpp	Fri Nov 22 08:23:30 2013 +0000
@@ -2,8 +2,8 @@
 
 #include "SerialPipe.h"
 
-SerialPipe::SerialPipe(PinName tx, PinName rx, int rxSize, int txSize, const char* name) 
-    : Serial(tx,rx,name), _pipeRx(rxSize), _pipeTx(txSize)
+SerialPipe::SerialPipe(PinName tx, PinName rx, int rxSize, int txSize) 
+    : _SerialPipeBase(tx,rx), _pipeRx(rxSize), _pipeTx(txSize)
 {
     attach(this, &SerialPipe::rxIrqBuf, RxIrq);
     attach(this, &SerialPipe::txIrqBuf, TxIrq);
@@ -23,36 +23,35 @@
 
 int SerialPipe::putc(int c)    
 {
-    return _putc(c);
+    c = _pipeTx.putc(c);
+    txStart();
+    return c;
 }
 
 int SerialPipe::put(const void* buffer, int length, bool blocking)    
 { 
     int count = length;
     const char* ptr = (const char*)buffer;
-    while (count && blocking)
+    if (count)
     {
-        int written = _pipeTx.put(ptr, count, false);
-        ptr += written;
-        count -= written;
-        txStart();
+        do
+        {
+            int written = _pipeTx.put(ptr, count, false);
+            ptr += written;
+            count -= written;
+            txStart();
+        }
+        while (count && blocking);
     }
     return (length - count);
 }
 
-int SerialPipe::_putc(int c)    
-{
-    c = _pipeTx.putc(c);
-    txStart();
-    return c;
-}
-
 void SerialPipe::txIrqBuf(void)
 {
-    while (Serial::writeable() && _pipeTx.readable())
+    while (_SerialPipeBase::writeable() && _pipeTx.readable())
     {
         char c = _pipeTx.getc();
-        Serial::_putc(c);
+        _SerialPipeBase::_base_putc(c);
     }
 }
 
@@ -71,7 +70,9 @@
 
 int SerialPipe::getc(void)                          
 { 
-    return _getc(); 
+    if (!_pipeRx.readable())
+        return EOF;
+    return _pipeRx.getc(); 
 } 
 
 int SerialPipe::get(void* buffer, int length, bool blocking) 
@@ -79,16 +80,11 @@
     return _pipeRx.get((char*)buffer,length,blocking); 
 }
 
-int SerialPipe::_getc(void)                          
-{ 
-    return _pipeRx.getc(); 
-} 
-
 void SerialPipe::rxIrqBuf(void)
 {
-    while (Serial::readable())
+    while (_SerialPipeBase::readable())
     {
-        char c = Serial::_getc();
+        char c = _SerialPipeBase::_base_getc();
         if (_pipeRx.writeable())
             _pipeRx.putc(c);
         else 
@@ -98,8 +94,8 @@
 
 // -----------------------------------------------------------------------
 
-SerialPipeEx::SerialPipeEx(PinName tx, PinName rx, int rxSize, int txSize, const char* name) 
-    : SerialPipe(tx,rx,rxSize,txSize,name)
+SerialPipeEx::SerialPipeEx(PinName tx, PinName rx, int rxSize, int txSize) 
+    : SerialPipe(tx,rx,rxSize,txSize)
 {}
 
 int SerialPipeEx::getLine(char* buffer, int length)