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

Embed: (wiki syntax)

« Back to documentation index

MDMSerial Class Reference

modem class which uses a serial port as physical interface. More...

#include <MDM.h>

Inherits SerialPipe, and MDMParser.

Public Types

enum  Dev
 

MT Device Types.

More...
enum  Sim
 

SIM Status.

More...
enum  Lpm
 

SIM Status.

More...
enum  CopsMode
 

COPS status.

More...
enum  Reg
 

Registration Status.

More...
enum  AcT
 

Access Technology.

More...
enum  IpProtocol
 

Type of IP protocol.

More...
enum  HttpOpCode
 

Type of HTTP Operational Codes (reference to HTTP control +UHTTP)

More...
enum  HttpCmd
 

Type of HTTP Commands (reference to HTTP command +UHTTPC)

More...
typedef uint32_t IP
 An IP v4 address.
typedef int(* _DPRINT )(void *param, char const *format,...)
 helper type for DPRINT
typedef int(* _CALLBACKPTR )(int type, const char *buf, int len, void *param)
 callback function for waitFinalResp with void* as argument

Public Member Functions

 MDMSerial (PinName tx MDM_IF(=MDMTXD,=D1), PinName rx MDM_IF(=MDMRXD,=D0), int baudrate MDM_IF(=MDMBAUD,=115200),#if DEVICE_SERIAL_FC PinName rts MDM_IF(=MDMRTS,=NC), PinName cts MDM_IF(=MDMCTS,=NC),#endif int rxSize=256, int txSize=128)
 Constructor.
virtual ~MDMSerial (void)
 Destructor.
virtual int getLine (char *buffer, int length)
 Get a line from the physical interface.
int writeable (void)
 check if writable return the number of free bytes
int putc (int c)
 send a character (blocking)
int put (const void *buffer, int length, bool blocking)
 send a buffer
int readable (void)
 check if readable
int getc (void)
 receive one character from the serial port (blocking)
int get (void *buffer, int length, bool blocking)
 read a buffer from the serial port
bool connect (const char *simpin=NULL, const char *apn=NULL, const char *username=NULL, const char *password=NULL, Auth auth=AUTH_DETECT, PinName pn MDM_IF(=MDMPWRON,=D4))
 Combined Init, checkNetStatus, join suitable for simple applications.
virtual bool init (const char *simpin=NULL, DevStatus *status=NULL, PinName pn MDM_IF(=MDMPWRON,=D4))
 register (Attach) the MT to the GPRS service.
void getDevStatus (MDMParser::DevStatus *dev)
 get the current device status
bool registerNet (NetStatus *status=NULL, int timeout_ms=180000)
 register to the network
bool checkNetStatus (NetStatus *status=NULL)
 check if the network is available
bool powerOff (void)
 Power off the MT, This function has to be called prior to switching off the supply.
MDMParser::IP join (const char *apn=NULL, const char *username=NULL, const char *password=NULL, Auth auth=AUTH_DETECT)
 register (Attach) the MT to the GPRS service.
bool disconnect (void)
 deregister (detach) the MT from the GPRS service.
MDMParser::IP gethostbyname (const char *host)
 Translates a domain name to an IP address.
MDMParser::IP getIpAddress (void)
 get the current assigned IP address
int socketSocket (IpProtocol ipproto, int port=-1)
 Create a socket for a ip protocol (and optionaly bind)
bool socketConnect (int socket, const char *host, int port)
 make a socket connection
bool socketIsConnected (int socket)
 make a socket connection
bool socketSetBlocking (int socket, int timeout_ms)
 Get the number of bytes pending for reading for this socket.
int socketSend (int socket, const char *buf, int len)
 Write socket data.
int socketSendTo (int socket, IP ip, int port, const char *buf, int len)
 Write socket data to a IP.
int socketReadable (int socket)
 Get the number of bytes pending for reading for this socket.
int socketRecv (int socket, char *buf, int len)
 Read this socket.
int socketRecvFrom (int socket, IP *ip, int *port, char *buf, int len)
 Read from this socket.
bool socketClose (int socket)
 Close a connectied socket (that was connected with socketConnect)
bool socketFree (int socket)
 Free the socket (that was allocated before by socketSocket)
int httpFindProfile ()
 find HTTP profile
bool httpSetBlocking (int profile, int timeout_ms)
 get the number of bytes pending for reading for this HTTP profile
bool httpSetProfileForCmdMng (int profile)
 set the HTTP profile for commands management
bool httpFreeProfile (int profile)
 free the HTTP profile
bool httpResetProfile (int httpProfile)
 reset HTTP profile
bool httpSetPar (int httpProfile, HttpOpCode httpOpCode, const char *httpInPar)
 set HTTP parameters
bool httpCommand (int httpProfile, HttpCmd httpCmdCode, const char *httpPath,\const char *httpOut, const char *httpIn, int httpContentType,\const char *httpCustomPar, char *buf, int len)
 HTTP commands management.
const char * getHTTPcmd (int httpCmdCode)
 get HTTP commands
int smsList (const char *stat="ALL", int *ix=NULL, int num=0)
 count the number of sms in the device and optionally return a list with indexes from the storage locations in the device.
bool smsRead (int ix, char *num, char *buf, int len)
 Read a Message from a storage position.
bool smsDelete (int ix)
 Send a message to a recipient.
bool smsSend (const char *num, const char *buf)
 Send a message to a recipient.
bool ussdCommand (const char *cmd, char *buf)
 Read a Message from a storage position.
bool delFile (const char *filename)
 Delete a file in the local file system.
int writeFile (const char *filename, const char *buf, int len)
 Write some data to a file in the local file system.
int readFile (const char *filename, char *buf, int len)
 Read a file from the local file system.
int readFileNew (const char *filename, char *buf, int len)
 Read a file from the local file system (the file size is greater than MAX_SIZE bytes)
int infoFile (const char *filename)
 Retrieve information about the dimension of a file from the local FFS.
int cellLocSrvTcp (const char *token, const char *server_1="cell-live1.services.u-blox.com",\const char *server_2="cell-live2.services.u-blox.com", int days=14, int period=4, int resolution=1)
 Configures CellLocate Tcp Aiding server Host name of the primary MGA server Host name of the secondary MGA server Authentication Token for MGA server access The number of days into the future the Offline data for the u-blox 7 The number of weeks into the future the Offline data for u-blox M8 Resolution of offline data for u-blox M8: 1 everyday, 0 every other day.
int cellLocSrvUdp (const char *server_1="cell-live1.services.u-blox.com", int port=46434, int latency=1000, int mode=0)
 Configures CellLocate Udp Aiding server Host name of the primary MGA server Server port Expected network latency in seconds from 0 to 10000ms Assist now management, mode of operation: 0 data downloaded at GNSS power up, 1 automatically kept alive, manual download.
int cellLocUnsol (int mode)
 Configures CellLocate URCs in the case of +ULOC operations Urc configuration: 0 disabled, 1 enabled.
int cellLocConfig (int scanMode)
 Configures CellLocate location sensor Network scan mode: 0 normal, 1 deep scan.
int cellLocRequest (CellSensType sensor, int timeout, int accuracy, CellRespType type=CELL_DETAILED, int hypotesis=1)
 Request CellLocate This function is not blocking, the result has to be retrived using cellLocGet Sensor selection: Timeout period in seconds (1 - 999) Target accuracy in meters (1 - 999999) Maximum desired number of responses from CellLocate® (up to 16)
int cellLocGetData (CellLocData *data, int index=0)
 Get a position record pointer to a CellLocData struct where the location will be copied in of the position to retrive.
int cellLocGetRes ()
 Get number of position records received.
int cellLocGetExpRes ()
 Get expected number of position to be received.
bool setDebug (int level)
 _DUMP_TEMPLATE (dumpDevStatus, MDMParser::DevStatus *, status) _DUMP_TEMPLATE(dumpNetStatus
 dump the device status to stdout using printf
MDMParser::NetStatus status _DUMP_TEMPLATE (dumpIp, MDMParser::IP, ip) enum
 dump the ip address to stdout using printf
virtual int send (const char *buf, int len)
 Write data to the device.
int sendFormated (const char *format,...)
 Write formated date to the physical interface (printf style)
int waitFinalResp (_CALLBACKPTR cb=NULL, void *param=NULL, int timeout_ms=10000)
 Wait for a final respons.
template<class T >
int waitFinalResp (int(*cb)(int type, const char *buf, int len, T *param), T *param, int timeout_ms=10000)
 template version of waitFinalResp when using callbacks, This template will allow the compiler to do type cheking but internally symply casts the arguments and call the (void*) version of waitFinalResp.

Static Public Member Functions

static MDMParsergetInstance ()
 get static instance

Data Fields

int _locRcvPos
 Received positions.
int _locExpPos
 Expected positions.

Protected Member Functions

virtual int _send (const void *buf, int len)
 Write bytes to the physical interface.
void rxIrqBuf (void)
 receive interrupt routine
void txIrqBuf (void)
 transmit interrupt woutine
void txStart (void)
 start transmission helper
void txCopy (void)
 move bytes to hardware
virtual void wait_ms (int ms)
 override in a rtos system, you us the wait function of a Thread
virtual void lock (void)
 override the lock in a rtos system
virtual void unlock (void)
 override the unlock in a rtos system

Static Protected Member Functions

static int _getLine (Pipe< char > *pipe, char *buffer, int length)
 Helper: Parse a line from the receiving buffered pipe.
static int _parseMatch (Pipe< char > *pipe, int len, const char *sta, const char *end)
 Helper: Parse a match from the pipe.
static int _parseFormated (Pipe< char > *pipe, int len, const char *fmt)
 Helper: Parse a match from the pipe.

Protected Attributes

Pipe< char > _pipeRx
 receive pipe
Pipe< char > _pipeTx
 transmit pipe
DevStatus _dev
 collected device information
NetStatus _net
 collected network information
IP _ip
 assigned ip address
CellLocData _loc [CELL_MAX_HYP]
 CellLocate data.

Detailed Description

modem class which uses a serial port as physical interface.

Definition at line 775 of file MDM.h.


Member Typedef Documentation

typedef int(* _CALLBACKPTR)(int type, const char *buf, int len, void *param) [inherited]

callback function for waitFinalResp with void* as argument

Parameters:
typethe getLine response
bufthe parsed line
lenthe size of the parsed line
paramthe optional argument passed to waitFinalResp
Returns:
WAIT if processing should continue, any other value aborts waitFinalResp and this retunr value retuned

Definition at line 626 of file MDM.h.

typedef int(* _DPRINT)(void *param, char const *format,...) [inherited]

helper type for DPRINT

Definition at line 517 of file MDM.h.

typedef uint32_t IP [inherited]

An IP v4 address.

Definition at line 95 of file MDM.h.


Member Enumeration Documentation

enum AcT [inherited]

Access Technology.

Definition at line 60 of file MDM.h.

enum CopsMode [inherited]

COPS status.

Definition at line 43 of file MDM.h.

enum Dev [inherited]

MT Device Types.

Definition at line 35 of file MDM.h.

enum HttpCmd [inherited]

Type of HTTP Commands (reference to HTTP command +UHTTPC)

Definition at line 291 of file MDM.h.

enum HttpOpCode [inherited]

Type of HTTP Operational Codes (reference to HTTP control +UHTTP)

Definition at line 287 of file MDM.h.

enum IpProtocol [inherited]

Type of IP protocol.

Definition at line 195 of file MDM.h.

enum Lpm [inherited]

SIM Status.

Definition at line 41 of file MDM.h.

enum Reg [inherited]

Registration Status.

Definition at line 58 of file MDM.h.

enum Sim [inherited]

SIM Status.

Definition at line 39 of file MDM.h.


Constructor & Destructor Documentation

MDMSerial ( PinName tx   MDM_IF=MDMTXD,=D1,
PinName rx   MDM_IF=MDMRXD,=D0,
int baudrate   MDM_IF=MDMBAUD,=115200,
#if DEVICE_SERIAL_FC PinName rts   MDM_IF=MDMRTS,=NC,
PinName cts   MDM_IF=MDMCTS,=NC,
#endif int  rxSize = 256,
int  txSize = 128 
)

Constructor.

Parameters:
txis the serial ports transmit pin (modem to CPU)
rxis the serial ports receive pin (CPU to modem)
baudratethe baudrate of the modem use 115200
rtsis the serial ports ready to send pin (CPU to modem) this pin is optional
ctsis the serial ports clear to send pin (modem to CPU) this pin is optional, but required for power saving to be enabled
rxSizethe size of the serial rx buffer
txSizethe size of the serial tx buffer
~MDMSerial ( void   ) [virtual]

Destructor.

Definition at line 2302 of file MDM.cpp.


Member Function Documentation

_DUMP_TEMPLATE ( dumpDevStatus  ,
MDMParser::DevStatus ,
status   
) [inherited]

dump the device status to stdout using printf

Parameters:
statusthe status to convert to textual form, unavailable fields are ommited (not printed)
dprinta function pointer
paramthe irst argument passed to dprint dump the network status to stdout using printf
statusthe status to convert to textual form, unavailable fields are ommited (not printed)
dprinta function pointer
paramthe irst argument passed to dprint
MDMParser::NetStatus status _DUMP_TEMPLATE ( dumpIp  ,
MDMParser::IP  ,
ip   
) [inherited]

dump the ip address to stdout using printf

Parameters:
ipthe ip to convert to textual form, unavailable fields are ommited (not printed)
dprinta function pointer
paramthe irst argument passed to dprint

Definition at line 551 of file MDM.h.

int _getLine ( Pipe< char > *  pipe,
char *  buffer,
int  length 
) [static, protected, inherited]

Helper: Parse a line from the receiving buffered pipe.

Parameters:
pipethe receiving buffer pipe
bufthe parsed line
lenthe size of the parsed line
Returns:
type and length if something was found, WAIT if not enough data is available NOT_FOUND if nothing was found

Definition at line 2184 of file MDM.cpp.

int _parseFormated ( Pipe< char > *  pipe,
int  len,
const char *  fmt 
) [static, protected, inherited]

Helper: Parse a match from the pipe.

Parameters:
pipethe buffered pipe
numberof bytes to parse at maximum,
fmtthe formating string (d any number, c any char of last d len)
Returns:
size of parsed match

Definition at line 2141 of file MDM.cpp.

int _parseMatch ( Pipe< char > *  pipe,
int  len,
const char *  sta,
const char *  end 
) [static, protected, inherited]

Helper: Parse a match from the pipe.

Parameters:
pipethe buffered pipe
numberof bytes to parse at maximum,
stathe starting string, NULL if none
endthe terminating string, NULL if none
Returns:
size of parsed match

Definition at line 2115 of file MDM.cpp.

int _send ( const void *  buf,
int  len 
) [protected, virtual]

Write bytes to the physical interface.

Parameters:
bufthe buffer to write
bufsize of the buffer to write
Returns:
bytes written

Implements MDMParser.

Definition at line 2311 of file MDM.cpp.

int cellLocConfig ( int  scanMode ) [inherited]

Configures CellLocate location sensor Network scan mode: 0 normal, 1 deep scan.

Definition at line 1972 of file MDM.cpp.

int cellLocGetData ( CellLocData data,
int  index = 0 
) [inherited]

Get a position record pointer to a CellLocData struct where the location will be copied in of the position to retrive.

Returns:
1 if data has been retrived and copied, 0 otherwise

Definition at line 2028 of file MDM.cpp.

int cellLocGetExpRes (  ) [inherited]

Get expected number of position to be received.

Returns:
number of expected position to be received

Definition at line 2017 of file MDM.cpp.

int cellLocGetRes (  ) [inherited]

Get number of position records received.

Returns:
number of position received

Definition at line 2013 of file MDM.cpp.

int cellLocRequest ( CellSensType  sensor,
int  timeout,
int  accuracy,
CellRespType  type = CELL_DETAILED,
int  hypotesis = 1 
) [inherited]

Request CellLocate This function is not blocking, the result has to be retrived using cellLocGet Sensor selection: Timeout period in seconds (1 - 999) Target accuracy in meters (1 - 999999) Maximum desired number of responses from CellLocate® (up to 16)

Definition at line 1985 of file MDM.cpp.

int cellLocSrvTcp ( const char *  token,
const char *  server_1 = "cell-live1.services.u-blox.com",
\const char *  server_2 = "cell-live2.services.u-blox.com",
int  days = 14,
int  period = 4,
int  resolution = 1 
) [inherited]

Configures CellLocate Tcp Aiding server Host name of the primary MGA server Host name of the secondary MGA server Authentication Token for MGA server access The number of days into the future the Offline data for the u-blox 7 The number of weeks into the future the Offline data for u-blox M8 Resolution of offline data for u-blox M8: 1 everyday, 0 every other day.

int cellLocSrvUdp ( const char *  server_1 = "cell-live1.services.u-blox.com",
int  port = 46434,
int  latency = 1000,
int  mode = 0 
) [inherited]

Configures CellLocate Udp Aiding server Host name of the primary MGA server Server port Expected network latency in seconds from 0 to 10000ms Assist now management, mode of operation: 0 data downloaded at GNSS power up, 1 automatically kept alive, manual download.

int cellLocUnsol ( int  mode ) [inherited]

Configures CellLocate URCs in the case of +ULOC operations Urc configuration: 0 disabled, 1 enabled.

Definition at line 1959 of file MDM.cpp.

bool checkNetStatus ( NetStatus status = NULL ) [inherited]

check if the network is available

Parameters:
statusan optional structure to with network information
Returns:
true if successful and connected to network, false otherwise

Definition at line 621 of file MDM.cpp.

bool connect ( const char *  simpin = NULL,
const char *  apn = NULL,
const char *  username = NULL,
const char *  password = NULL,
Auth  auth = AUTH_DETECT,
PinName pn   MDM_IF=MDMPWRON,=D4 
) [inherited]

Combined Init, checkNetStatus, join suitable for simple applications.

Parameters:
simpina optional pin of the SIM card
apnthe of the network provider e.g. "internet" or "apn.provider.com"
usernameis the user name text string for the authentication phase
passwordis the password text string for the authentication phase
authis the authentication mode (CHAP,PAP,NONE or DETECT)
Returns:
true if successful, false otherwise
bool delFile ( const char *  filename ) [inherited]

Delete a file in the local file system.

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

Definition at line 1774 of file MDM.cpp.

bool disconnect ( void   ) [inherited]

deregister (detach) the MT from the GPRS service.

Returns:
true if successful, false otherwise

Definition at line 997 of file MDM.cpp.

int get ( void *  buffer,
int  length,
bool  blocking 
) [inherited]

read a buffer from the serial port

Parameters:
pointerto the buffer to read.
lengthnumber of bytes to read
blockingtrue if all bytes shall be read. false if only the available bytes.
Returns:
the number of bytes read.

Definition at line 94 of file SerialPipe.cpp.

int getc ( void   ) [inherited]

receive one character from the serial port (blocking)

Parameters:
thecharacter received

Definition at line 87 of file SerialPipe.cpp.

void getDevStatus ( MDMParser::DevStatus dev ) [inherited]

get the current device status

Parameters:
stroctureholding the device information.

Definition at line 139 of file MDM.h.

MDMParser::IP gethostbyname ( const char *  host ) [inherited]

Translates a domain name to an IP address.

Parameters:
hostthe domain name to translate e.g. "u-blox.com"
Returns:
the IP if successful, 0 otherwise

Definition at line 1019 of file MDM.cpp.

const char * getHTTPcmd ( int  httpCmdCode ) [inherited]

get HTTP commands

Parameters:
httpCmdCodethe HTTP command code (reference also the enum format)
Returns:
HTTP command in string format

Definition at line 1637 of file MDM.cpp.

static MDMParser* getInstance (  ) [static, inherited]

get static instance

Definition at line 29 of file MDM.h.

MDMParser::IP getIpAddress ( void   ) [inherited]

get the current assigned IP address

Returns:
the ip that is assigned

Definition at line 188 of file MDM.h.

int getLine ( char *  buffer,
int  length 
) [virtual]

Get a line from the physical interface.

Parameters:
bufthe buffer to store it
bufsize of the buffer
Returns:
type and length if something was found, WAIT if not enough data is available NOT_FOUND if nothing was found

Implements MDMParser.

Definition at line 2316 of file MDM.cpp.

bool httpCommand ( int  httpProfile,
HttpCmd  httpCmdCode,
const char *  httpPath,
\const char *  httpOut,
const char *  httpIn,
int  httpContentType,
\const char *  httpCustomPar,
char *  buf,
int  len 
) [inherited]

HTTP commands management.

Parameters:
httpProfilethe HTTP profile identifier
httpCmdCodethe HTTP command code
httpPaththe path of HTTP server resource
httpOutthe filename where the HTTP server response will be stored
httpInthe input data (filename or string) to be sent to the HTTP server with the command request
httpContentTypethe HTTP Content-Type identifier
httpCustomParthe parameter for an user defined HTTP Content-Type
bufthe buffer to read into
lenthe size of the buffer to read into
Returns:
true if successfully, false otherwise
int httpFindProfile (  ) [inherited]

find HTTP profile

Returns:
true if successfully, false otherwise

Definition at line 1366 of file MDM.cpp.

bool httpFreeProfile ( int  profile ) [inherited]

free the HTTP profile

Parameters:
profilethe HTTP profile handle
Returns:
true if successfully, false otherwise

Definition at line 1419 of file MDM.cpp.

bool httpResetProfile ( int  httpProfile ) [inherited]

reset HTTP profile

Parameters:
httpProfilethe HTTP profile to be reset
Returns:
true if successfully, false otherwise

Definition at line 1436 of file MDM.cpp.

bool httpSetBlocking ( int  profile,
int  timeout_ms 
) [inherited]

get the number of bytes pending for reading for this HTTP profile

Parameters:
profilethe HTTP profile handle
timeout_ms-1 blocking, else non blocking timeout in ms
Returns:
0 if successful or SOCKET_ERROR on failure

Definition at line 1392 of file MDM.cpp.

bool httpSetPar ( int  httpProfile,
HttpOpCode  httpOpCode,
const char *  httpInPar 
) [inherited]

set HTTP parameters

Parameters:
httpProfilethe HTTP profile identifier
httpOpCodethe HTTP operation code
httpInParthe HTTP input parameter
Returns:
true if successfully, false otherwise

Definition at line 1450 of file MDM.cpp.

bool httpSetProfileForCmdMng ( int  profile ) [inherited]

set the HTTP profile for commands management

Parameters:
profilethe HTTP profile handle
Returns:
true if successfully, false otherwise

Definition at line 1405 of file MDM.cpp.

int infoFile ( const char *  filename ) [inherited]

Retrieve information about the dimension of a file from the local FFS.

Parameters:
filenamethe name of the file
Returns:
the file dimension in number of bytes

Definition at line 1906 of file MDM.cpp.

virtual bool init ( const char *  simpin = NULL,
DevStatus status = NULL,
PinName pn   MDM_IF=MDMPWRON,=D4 
) [virtual, inherited]

register (Attach) the MT to the GPRS service.

Parameters:
simpina optional pin of the SIM card
statusan optional struture to with device information
Returns:
true if successful, false otherwise
MDMParser::IP join ( const char *  apn = NULL,
const char *  username = NULL,
const char *  password = NULL,
Auth  auth = AUTH_DETECT 
) [inherited]

register (Attach) the MT to the GPRS service.

Parameters:
apnthe of the network provider e.g. "internet" or "apn.provider.com"
usernameis the user name text string for the authentication phase
passwordis the password text string for the authentication phase
authis the authentication mode (CHAP,PAP,NONE or DETECT)
Returns:
the ip that is assigned

Definition at line 867 of file MDM.cpp.

virtual void lock ( void   ) [protected, virtual, inherited]

override the lock in a rtos system

Definition at line 695 of file MDM.h.

bool powerOff ( void   ) [inherited]

Power off the MT, This function has to be called prior to switching off the supply.

Returns:
true if successfully, false otherwise

Definition at line 553 of file MDM.cpp.

int put ( const void *  buffer,
int  length,
bool  blocking 
) [inherited]

send a buffer

Parameters:
bufferthe buffer to send
lengththe size of the buffer to send
blocking,iftrue this function will block until all bytes placed in the buffer.
Returns:
the number of bytes written

Definition at line 31 of file SerialPipe.cpp.

int putc ( int  c ) [inherited]

send a character (blocking)

Parameters:
cthe character to send
Returns:
c

Definition at line 24 of file SerialPipe.cpp.

int readable ( void   ) [inherited]

check if readable

Returns:
the size available in the buffer.

Definition at line 82 of file SerialPipe.cpp.

int readFile ( const char *  filename,
char *  buf,
int  len 
) [inherited]

Read a file from the local file system.

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 1797 of file MDM.cpp.

int readFileNew ( const char *  filename,
char *  buf,
int  len 
) [inherited]

Read a file from the local file system (the file size is greater than MAX_SIZE bytes)

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 1828 of file MDM.cpp.

bool registerNet ( NetStatus status = NULL,
int  timeout_ms = 180000 
) [inherited]

register to the network

Parameters:
statusan optional structure to with network information
timeout_ms-1 blocking, else non blocking timeout in ms
Returns:
true if successful and connected to network, false otherwise

Definition at line 608 of file MDM.cpp.

void rxIrqBuf ( void   ) [protected, inherited]

receive interrupt routine

Definition at line 99 of file SerialPipe.cpp.

int send ( const char *  buf,
int  len 
) [virtual, inherited]

Write data to the device.

Parameters:
bufthe buffer to write
bufsize of the buffer to write
Returns:
bytes written

Definition at line 119 of file MDM.cpp.

int sendFormated ( const char *  format,
  ... 
) [inherited]

Write formated date to the physical interface (printf style)

Parameters:
fmtthe format string
..variable arguments to be formated
Returns:
bytes written

Definition at line 130 of file MDM.cpp.

bool setDebug ( int  level ) [inherited]

Set the debug level

Parameters:
level-1 = OFF, 0 = ERROR, 1 = INFO(default), 2 = TRACE, 3 = ATCMD,TEST
Returns:
true if successful, false not possible

Definition at line 2039 of file MDM.cpp.

bool smsDelete ( int  ix ) [inherited]

Send a message to a recipient.

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

Definition at line 1702 of file MDM.cpp.

int smsList ( const char *  stat = "ALL",
int *  ix = NULL,
int  num = 0 
) [inherited]

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

Parameters:
statwhat type of messages you can use use "REC UNREAD", "REC READ", "STO UNSENT", "STO SENT", "ALL"
ixlist where to save the storage positions
numnumber of elements in the list
Returns:
the number of messages, this can be bigger than num, -1 on failure

Definition at line 1674 of file MDM.cpp.

bool smsRead ( int  ix,
char *  num,
char *  buf,
int  len 
) [inherited]

Read a Message from a storage position.

Parameters:
ixthe storage position to read
numthe originator address (~16 chars)
bufa buffer where to save the sm
lenthe length of the sm
Returns:
true if successful, false otherwise

Definition at line 1726 of file MDM.cpp.

bool smsSend ( const char *  num,
const char *  buf 
) [inherited]

Send a message to a recipient.

Parameters:
numthe phone number of the recipient
bufthe content of the message to sent
Returns:
true if successful, false otherwise

Definition at line 1687 of file MDM.cpp.

bool socketClose ( int  socket ) [inherited]

Close a connectied socket (that was connected with socketConnect)

Parameters:
socketthe socket handle
Returns:
true if successfully, false otherwise

Definition at line 1123 of file MDM.cpp.

bool socketConnect ( int  socket,
const char *  host,
int  port 
) [inherited]

make a socket connection

Parameters:
socketthe socket handle
hostthe domain name to connect e.g. "u-blox.com"
portthe port to connect
Returns:
true if successfully, false otherwise

Definition at line 1082 of file MDM.cpp.

bool socketFree ( int  socket ) [inherited]

Free the socket (that was allocated before by socketSocket)

Parameters:
socketthe socket handle
Returns:
true if successfully, false otherwise

Definition at line 1139 of file MDM.cpp.

bool socketIsConnected ( int  socket ) [inherited]

make a socket connection

Parameters:
socketthe socket handle
Returns:
true if connected, false otherwise

Definition at line 1100 of file MDM.cpp.

int socketReadable ( int  socket ) [inherited]

Get the number of bytes pending for reading for this socket.

Parameters:
socketthe socket handle
Returns:
the number of bytes pending or SOCKET_ERROR on failure

Definition at line 1215 of file MDM.cpp.

int socketRecv ( int  socket,
char *  buf,
int  len 
) [inherited]

Read this socket.

Parameters:
socketthe socket handle
bufthe buffer to read into
lenthe size of the buffer to read into
Returns:
the number of bytes read or SOCKET_ERROR on failure

Definition at line 1242 of file MDM.cpp.

int socketRecvFrom ( int  socket,
IP ip,
int *  port,
char *  buf,
int  len 
) [inherited]

Read from this socket.

Parameters:
socketthe socket handle
ipthe ip of host where the data originates from
portthe port where the data originates from
bufthe buffer to read into
lenthe size of the buffer to read into
Returns:
the number of bytes read or SOCKET_ERROR on failure

Definition at line 1305 of file MDM.cpp.

int socketSend ( int  socket,
const char *  buf,
int  len 
) [inherited]

Write socket data.

Parameters:
socketthe socket handle
bufthe buffer to write
lenthe size of the buffer to write
Returns:
the size written or SOCKET_ERROR on failure

Definition at line 1159 of file MDM.cpp.

int socketSendTo ( int  socket,
IP  ip,
int  port,
const char *  buf,
int  len 
) [inherited]

Write socket data to a IP.

Parameters:
socketthe socket handle
ipthe ip to send to
portthe port to send to
bufthe buffer to write
lenthe size of the buffer to write
Returns:
the size written or SOCKET_ERROR on failure

Definition at line 1187 of file MDM.cpp.

bool socketSetBlocking ( int  socket,
int  timeout_ms 
) [inherited]

Get the number of bytes pending for reading for this socket.

Parameters:
socketthe socket handle
timeout_ms-1 blocking, else non blocking timeout in ms
Returns:
0 if successful or SOCKET_ERROR on failure

Definition at line 1110 of file MDM.cpp.

int socketSocket ( IpProtocol  ipproto,
int  port = -1 
) [inherited]

Create a socket for a ip protocol (and optionaly bind)

Parameters:
ipprotothe protocol (UDP or TCP)
portin case of UDP, this optional port where it is bind
Returns:
the socket handle if successful or SOCKET_ERROR on failure

Definition at line 1048 of file MDM.cpp.

void txCopy ( void   ) [protected, inherited]

move bytes to hardware

Definition at line 54 of file SerialPipe.cpp.

void txIrqBuf ( void   ) [protected, inherited]

transmit interrupt woutine

Definition at line 63 of file SerialPipe.cpp.

void txStart ( void   ) [protected, inherited]

start transmission helper

Definition at line 71 of file SerialPipe.cpp.

virtual void unlock ( void   ) [protected, virtual, inherited]

override the unlock in a rtos system

Definition at line 697 of file MDM.h.

bool ussdCommand ( const char *  cmd,
char *  buf 
) [inherited]

Read a Message from a storage position.

Parameters:
cmdthe ussd command to send e.g "*#06#"
bufa buffer where to save the reply
Returns:
true if successful, false otherwise

Definition at line 1752 of file MDM.cpp.

virtual void wait_ms ( int  ms ) [protected, virtual, inherited]

override in a rtos system, you us the wait function of a Thread

Parameters:
msthe number of milliseconds to wait

Definition at line 693 of file MDM.h.

int waitFinalResp ( _CALLBACKPTR  cb = NULL,
void *  param = NULL,
int  timeout_ms = 10000 
) [inherited]

Wait for a final respons.

Parameters:
cbthe optional callback function
paramthe optional callback function parameter
timeout_msthe timeout to wait (See Estimated command response time of AT manual)

Definition at line 139 of file MDM.cpp.

int waitFinalResp ( int(*)(int type, const char *buf, int len, T *param)  cb,
T *  param,
int  timeout_ms = 10000 
) [inherited]

template version of waitFinalResp when using callbacks, This template will allow the compiler to do type cheking but internally symply casts the arguments and call the (void*) version of waitFinalResp.

See also:
waitFinalResp

Definition at line 645 of file MDM.h.

int writeable ( void   ) [inherited]

check if writable return the number of free bytes

Definition at line 19 of file SerialPipe.cpp.

int writeFile ( const char *  filename,
const char *  buf,
int  len 
) [inherited]

Write some data to a file in the local file system.

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 1784 of file MDM.cpp.


Field Documentation

DevStatus _dev [protected, inherited]

collected device information

Definition at line 738 of file MDM.h.

IP _ip [protected, inherited]

assigned ip address

Definition at line 740 of file MDM.h.

CellLocData _loc[CELL_MAX_HYP] [protected, inherited]

CellLocate data.

Definition at line 741 of file MDM.h.

int _locExpPos [inherited]

Expected positions.

Definition at line 79 of file MDM.h.

int _locRcvPos [inherited]

Received positions.

Definition at line 78 of file MDM.h.

NetStatus _net [protected, inherited]

collected network information

Definition at line 739 of file MDM.h.

Pipe<char> _pipeRx [protected, inherited]

receive pipe

Definition at line 79 of file SerialPipe.h.

Pipe<char> _pipeTx [protected, inherited]

transmit pipe

Definition at line 80 of file SerialPipe.h.