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.

Committer:
mazgch
Date:
Thu Apr 20 08:44:47 2017 +0000
Revision:
139:fd9fe498f142
Parent:
93:2b5478693c20
update for additional baud rate parameter in new mbed 5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mazgch 0:cb2d45baaca3 1 #pragma once
mazgch 0:cb2d45baaca3 2
mazgch 2:b6012cd91657 3 #include "mbed.h"
mazgch 0:cb2d45baaca3 4 #include "Pipe.h"
mazgch 0:cb2d45baaca3 5
mazgch 42:6786401ba18c 6 #define _SerialPipeBase SerialBase //!< base class used by this class
mazgch 15:5eda64e5b9d1 7
mazgch 42:6786401ba18c 8 /** Buffered serial interface (rtos capable/interrupt driven)
mazgch 42:6786401ba18c 9 */
mazgch 15:5eda64e5b9d1 10 class SerialPipe : public _SerialPipeBase
mazgch 0:cb2d45baaca3 11 {
mazgch 9:e7a5959ffae1 12 public:
mazgch 42:6786401ba18c 13 /** Constructor
mazgch 42:6786401ba18c 14 \param tx the trasmitting pin
mazgch 42:6786401ba18c 15 \param rx the receiving pin
mazgch 139:fd9fe498f142 16 \param baud the initial baudrate
mazgch 42:6786401ba18c 17 \param rxSize the size of the receiving buffer
mazgch 42:6786401ba18c 18 \param txSize the size of the transmitting buffer
mazgch 42:6786401ba18c 19 */
mazgch 139:fd9fe498f142 20 SerialPipe(PinName tx, PinName rx, int baudrate, int rxSize = 128, int txSize = 128);
mazgch 42:6786401ba18c 21
mazgch 42:6786401ba18c 22 /** Destructor
mazgch 42:6786401ba18c 23 */
mazgch 93:2b5478693c20 24 virtual ~SerialPipe(void);
mazgch 42:6786401ba18c 25
mazgch 9:e7a5959ffae1 26 // tx channel
mazgch 42:6786401ba18c 27 //----------------------------------------------------
mazgch 42:6786401ba18c 28
mazgch 42:6786401ba18c 29 /** check if writable
mazgch 42:6786401ba18c 30 return the number of free bytes
mazgch 42:6786401ba18c 31 */
mazgch 13:e2446fcdc246 32 int writeable(void);
mazgch 42:6786401ba18c 33
mazgch 42:6786401ba18c 34 /** send a character (blocking)
mazgch 42:6786401ba18c 35 \param c the character to send
mazgch 42:6786401ba18c 36 \return c
mazgch 42:6786401ba18c 37 */
mazgch 42:6786401ba18c 38 int putc(int c);
mazgch 42:6786401ba18c 39
mazgch 42:6786401ba18c 40 /** send a buffer
mazgch 42:6786401ba18c 41 \param buffer the buffer to send
mazgch 42:6786401ba18c 42 \param length the size of the buffer to send
mazgch 42:6786401ba18c 43 \param blocking, if true this function will block
mazgch 42:6786401ba18c 44 until all bytes placed in the buffer.
mazgch 42:6786401ba18c 45 \return the number of bytes written
mazgch 42:6786401ba18c 46 */
mazgch 15:5eda64e5b9d1 47 int put(const void* buffer, int length, bool blocking);
mazgch 42:6786401ba18c 48
mazgch 9:e7a5959ffae1 49 // rx channel
mazgch 42:6786401ba18c 50 //----------------------------------------------------
mazgch 42:6786401ba18c 51
mazgch 42:6786401ba18c 52 /** check if readable
mazgch 42:6786401ba18c 53 \return the size available in the buffer.
mazgch 42:6786401ba18c 54 */
mazgch 9:e7a5959ffae1 55 int readable(void);
mazgch 42:6786401ba18c 56
mazgch 42:6786401ba18c 57 /** receive one character from the serial port (blocking)
mazgch 42:6786401ba18c 58 \param the character received
mazgch 42:6786401ba18c 59 */
mazgch 42:6786401ba18c 60 int getc(void);
mazgch 42:6786401ba18c 61
mazgch 42:6786401ba18c 62 /** read a buffer from the serial port
mazgch 42:6786401ba18c 63 \param pointer to the buffer to read.
mazgch 42:6786401ba18c 64 \param length number of bytes to read
mazgch 42:6786401ba18c 65 \param blocking true if all bytes shall be read. false if only the available bytes.
mazgch 42:6786401ba18c 66 \return the number of bytes read.
mazgch 42:6786401ba18c 67 */
mazgch 15:5eda64e5b9d1 68 int get(void* buffer, int length, bool blocking);
mazgch 42:6786401ba18c 69
mazgch 13:e2446fcdc246 70 protected:
mazgch 42:6786401ba18c 71 //! receive interrupt routine
mazgch 9:e7a5959ffae1 72 void rxIrqBuf(void);
mazgch 42:6786401ba18c 73 //! transmit interrupt woutine
mazgch 9:e7a5959ffae1 74 void txIrqBuf(void);
mazgch 42:6786401ba18c 75 //! start transmission helper
mazgch 13:e2446fcdc246 76 void txStart(void);
mazgch 70:0a87d256cd24 77 //! move bytes to hardware
mazgch 70:0a87d256cd24 78 void txCopy(void);
mazgch 42:6786401ba18c 79 Pipe<char> _pipeRx; //!< receive pipe
mazgch 42:6786401ba18c 80 Pipe<char> _pipeTx; //!< transmit pipe
mazgch 9:e7a5959ffae1 81 };