This class provides SMS, USSD and modem file system support for u-blox modules on the C027 and C030 boards (excepting the C030 N2xx flavour) from mbed 5.5 onwards.

Dependents:   example-ublox-at-cellular-interface-ext example-ublox-cellular-driver-gen HelloMQTT ublox_new_driver_test ... more

Embed: (wiki syntax)

« Back to documentation index

UbloxCellularDriverGen Class Reference

UbloxCellularDriverGen Class Reference

UbloxCellularDriverGen class This interface provide SMS, USSD and module File System functionality. More...

#include <UbloxCellularDriverGen.h>

Public Member Functions

 UbloxCellularDriverGen (PinName tx=MDMTXD, PinName rx=MDMRXD, int baud=MBED_CONF_UBLOX_CELL_BAUD_RATE, bool debugOn=false)
 Constructor.
int smsList (const char *stat="ALL", int *index=NULL, int num=0)
 Count the number of messages in the device and optionally return a list with indexes from the storage locations in the device.
bool smsRead (int index, char *num, char *buf, int len)
 Read a message from a storage position.
bool smsDelete (int index)
 Delete a message.
bool smsSend (const char *num, const char *buf)
 Send a message to a recipient.
bool ussdCommand (const char *cmd, char *buf, int len)
 Make a USSD query.
bool delFile (const char *filename)
 Delete a file from the module's local file system.
int writeFile (const char *filename, const char *buf, int len)
 Write some data to a file in the module's local file system.
int readFile (const char *filename, char *buf, int len)
 Read a file from the module's local file system.
int fileSize (const char *filename)
 Retrieve the file size from the module's local file system.

Protected Member Functions

void CMGL_URC ()
 URC for Short Message listing.
void CMTI_URC ()
 URC for new SMS messages.
void CUSD_URC ()
 URC for USSD.
void CCWA_URC ()
 URC for call waiting.
void CCFC_URC ()
 URC for call forwarding.
void CLIR_URC ()
 URC for calling lined ID restriction.
void CLIP_URC ()
 URC for calling lined ID presentation.
void COLR_URC ()
 URC for connected lined ID restriction.
void COLP_URC ()
 URC for connected lined ID presentation.

Protected Attributes

int * _userSmsIndex
 Place to store the index of an SMS message.
int _userSmsNum
 The number of SMS message being returned to the user.
int _smsCount
 The number of SMS messages stored in the module.
char _smsBuf [SMS_BUFFER_SIZE]
 Temporary storage for an SMS message.
char * _ssUrcBuf
 A buffer for the string assembled from the URC.

Detailed Description

UbloxCellularDriverGen class This interface provide SMS, USSD and module File System functionality.

Definition at line 25 of file UbloxCellularDriverGen.h.


Constructor & Destructor Documentation

UbloxCellularDriverGen ( PinName  tx = MDMTXD,
PinName  rx = MDMRXD,
int  baud = MBED_CONF_UBLOX_CELL_BAUD_RATE,
bool  debugOn = false 
)

Constructor.

Parameters:
txthe UART TX data pin to which the modem is attached.
rxthe UART RX data pin to which the modem is attached.
baudthe UART baud rate.
debugOntrue to switch AT interface debug on, otherwise false.

Definition at line 399 of file UbloxCellularDriverGen.cpp.


Member Function Documentation

void CCFC_URC (  ) [protected]

URC for call forwarding.

Definition at line 138 of file UbloxCellularDriverGen.cpp.

void CCWA_URC (  ) [protected]

URC for call waiting.

Definition at line 81 of file UbloxCellularDriverGen.cpp.

void CLIP_URC (  ) [protected]

URC for calling lined ID presentation.

Definition at line 263 of file UbloxCellularDriverGen.cpp.

void CLIR_URC (  ) [protected]

URC for calling lined ID restriction.

Definition at line 206 of file UbloxCellularDriverGen.cpp.

void CMGL_URC (  ) [protected]

URC for Short Message listing.

Definition at line 33 of file UbloxCellularDriverGen.cpp.

void CMTI_URC (  ) [protected]

URC for new SMS messages.

Definition at line 63 of file UbloxCellularDriverGen.cpp.

void COLP_URC (  ) [protected]

URC for connected lined ID presentation.

Definition at line 311 of file UbloxCellularDriverGen.cpp.

void COLR_URC (  ) [protected]

URC for connected lined ID restriction.

Definition at line 359 of file UbloxCellularDriverGen.cpp.

void CUSD_URC (  ) [protected]

URC for USSD.

bool delFile ( const char *  filename )

Delete a file from the module's local file system.

An attempt to delete a non-existent file will fail.

Note: init() should be called before this method can be used.

Parameters:
filenamethe name of the file.
Returns:
true if successful, false otherwise.

Definition at line 605 of file UbloxCellularDriverGen.cpp.

int fileSize ( const char *  filename )

Retrieve the file size from the module's local file system.

Note: init() should be called before this method can be used.

Parameters:
filenamethe name of the file.
Returns:
the file size in bytes.

Definition at line 719 of file UbloxCellularDriverGen.cpp.

int readFile ( const char *  filename,
char *  buf,
int  len 
)

Read a file from the module's local file system.

Note: init() should be called before this method can be used.

Parameters:
filenamethe name of the file
bufa buffer to hold the data
lenthe size to read
Returns:
the number of bytes read

Definition at line 636 of file UbloxCellularDriverGen.cpp.

bool smsDelete ( int  index )

Delete a message.

Note: init() should be called before this method can be used.

Parameters:
indexthe storage position to delete.
Returns:
true if successful, false otherwise.

Definition at line 483 of file UbloxCellularDriverGen.cpp.

int smsList ( const char *  stat = "ALL",
int *  index = NULL,
int  num = 0 
)

Count the number of messages in the device and optionally return a list with indexes from the storage locations in the device.

Note: init() should be called before this method can be used.

Parameters:
statwhat type of messages you can use: "REC UNREAD", "REC READ", "STO UNSENT", "STO SENT", "ALL".
indexlist where to save the storage positions (pointer to an array of ints).
numnumber of elements that can be stored in the list.
Returns:
the number of messages, this can be bigger than num, -1 on failure.

Definition at line 435 of file UbloxCellularDriverGen.cpp.

bool smsRead ( int  index,
char *  num,
char *  buf,
int  len 
)

Read a message from a storage position.

Note: init() should be called before this method can be used.

Parameters:
indexthe storage position to read.
numthe originator address (16 chars including terminator).
bufa buffer where to save the short message.
lenthe length of buf.
Returns:
true if successful, false otherwise.

Definition at line 494 of file UbloxCellularDriverGen.cpp.

bool smsSend ( const char *  num,
const char *  buf 
)

Send a message to a recipient.

Note: init() and nwk_registration() should be called before this method can be used.

Parameters:
numthe phone number of the recipient as a null terminated string. Note: no spaces are allowed in this string.
bufthe content of the message to sent, null terminated.
Returns:
true if successful, false otherwise.

Definition at line 462 of file UbloxCellularDriverGen.cpp.

bool ussdCommand ( const char *  cmd,
char *  buf,
int  len 
)

Make a USSD query.

Note: init() should be called before using this method can be used and, in many cases, nwk_registration() is also required as the USSD may need network access.

Note: some USSD commands relate to call waiting, call forwarding, etc., which can result in multiple responses. This function returns only the first response. Instantiate this class with debugOn set to true to get a better view of what is really going on. If such responses are important to you, you should subclass this class and parse for them specifically and, probably, use specific AT commands rather than USSD.

Parameters:
cmdthe USSD string to send e.g "*#100#".
bufa buffer where to save the reply, which will always be returned zero terminated.
lenthe length of buf, set to USSD_STRING_LENGTH + 1 to obtain the maximum length response plus terminator.
Returns:
true if successful, false otherwise.

Definition at line 532 of file UbloxCellularDriverGen.cpp.

int writeFile ( const char *  filename,
const char *  buf,
int  len 
)

Write some data to a file in the module's local file system.

Note: init() should be called before this method can be used.

Parameters:
filenamethe name of the file.
bufthe data to write.
lenthe size of the data to write.
Returns:
the number of bytes written.

Definition at line 617 of file UbloxCellularDriverGen.cpp.


Field Documentation

char _smsBuf[SMS_BUFFER_SIZE] [protected]

Temporary storage for an SMS message.

Definition at line 208 of file UbloxCellularDriverGen.h.

int _smsCount [protected]

The number of SMS messages stored in the module.

Definition at line 204 of file UbloxCellularDriverGen.h.

char* _ssUrcBuf [protected]

A buffer for the string assembled from the URC.

Definition at line 224 of file UbloxCellularDriverGen.h.

int* _userSmsIndex [protected]

Place to store the index of an SMS message.

Definition at line 196 of file UbloxCellularDriverGen.h.

int _userSmsNum [protected]

The number of SMS message being returned to the user.

Definition at line 200 of file UbloxCellularDriverGen.h.